107 lines
2.8 KiB
Markdown
107 lines
2.8 KiB
Markdown
|
|
---
|
||
|
|
license: apache-2.0
|
||
|
|
language:
|
||
|
|
- en
|
||
|
|
tags:
|
||
|
|
- legal
|
||
|
|
- contract-analysis
|
||
|
|
- legal-reasoning
|
||
|
|
- mistral
|
||
|
|
- olaverse
|
||
|
|
pipeline_tag: text-generation
|
||
|
|
library_name: transformers
|
||
|
|
base_model: unsloth/mistral-7b-v0.3-bnb-4bit
|
||
|
|
---
|
||
|
|
|
||
|
|
# Legal-Peace-7B-v1.0 🏛️⚖️
|
||
|
|
|
||
|
|
> ⚠️ **Beta Model**: This model is experimental and intended for research purposes. Outputs must always be reviewed by a qualified legal professional. Not recommended for production use.
|
||
|
|
|
||
|
|
**Legal-Peace-7B-v1.0** is a fine-tuned **Mistral-7B-v0.3** model designed for contract analysis and legal reasoning tasks.
|
||
|
|
|
||
|
|
Part of the [Olaverse Legal](https://github.com/Olaverse-Labs/olaverse)
|
||
|
|
|
||
|
|
## Quick Start
|
||
|
|
|
||
|
|
### Via the `olaverse` library (recommended)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
pip install olaverse[legal]
|
||
|
|
```
|
||
|
|
|
||
|
|
```python
|
||
|
|
from olaverse.llm import LegalPeace
|
||
|
|
|
||
|
|
model = LegalPeace() # defaults to "olaverse/legal-peace-v1.0"
|
||
|
|
model.load() # requires GPU + unsloth
|
||
|
|
|
||
|
|
prompt = "Analyze this clause: 'All disputes shall be resolved through binding arbitration in Delaware.' What are the key implications?"
|
||
|
|
response = model.generate(prompt, max_new_tokens=300, temperature=0.7)
|
||
|
|
print(response)
|
||
|
|
```
|
||
|
|
|
||
|
|
### Via Hugging Face directly
|
||
|
|
|
||
|
|
```python
|
||
|
|
from unsloth import FastLanguageModel
|
||
|
|
|
||
|
|
model, tokenizer = FastLanguageModel.from_pretrained(
|
||
|
|
model_name="olaverse/legal-peace-v1.0",
|
||
|
|
max_seq_length=2048,
|
||
|
|
dtype=None,
|
||
|
|
load_in_4bit=True,
|
||
|
|
)
|
||
|
|
|
||
|
|
FastLanguageModel.for_inference(model)
|
||
|
|
|
||
|
|
prompt = "Analyze this clause: 'All disputes shall be resolved through binding arbitration in Delaware.'"
|
||
|
|
|
||
|
|
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
||
|
|
outputs = model.generate(**inputs, max_new_tokens=300, temperature=0.7)
|
||
|
|
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
||
|
|
```
|
||
|
|
|
||
|
|
## Performance vs Base Mistral-7B
|
||
|
|
|
||
|
|
| Benchmark | Improvement |
|
||
|
|
|---|---|
|
||
|
|
| Inference Speed | ⚡ 10.3% faster (9.27s vs 10.33s) |
|
||
|
|
| Contract Analysis | 📋 32.6% faster |
|
||
|
|
| Case Predictions | ⚖️ 14.0% faster |
|
||
|
|
| Response Quality | 📝 More structured, professional legal responses |
|
||
|
|
|
||
|
|
## Model Details
|
||
|
|
|
||
|
|
| Property | Value |
|
||
|
|
|---|---|
|
||
|
|
| Base Model | Mistral-7B-v0.3 |
|
||
|
|
| Parameters | 7B |
|
||
|
|
| Quantization | 4-bit (unsloth BnB) |
|
||
|
|
| Training | SFT (4,800 cases) + DPO (419 legal reasoning examples) |
|
||
|
|
| License | Apache 2.0 |
|
||
|
|
|
||
|
|
## Use Cases
|
||
|
|
|
||
|
|
✅ Contract clause analysis and review
|
||
|
|
✅ Legal research assistance
|
||
|
|
✅ Evidence evaluation
|
||
|
|
✅ Case outcome prediction
|
||
|
|
✅ Legal Q&A
|
||
|
|
|
||
|
|
## Limitations
|
||
|
|
|
||
|
|
⚠️ **Beta model — not for production use**
|
||
|
|
⚠️ Not a replacement for legal professionals
|
||
|
|
⚠️ Always verify outputs with qualified attorneys
|
||
|
|
⚠️ Trained primarily on U.S. legal data
|
||
|
|
|
||
|
|
## Links
|
||
|
|
|
||
|
|
- [GitHub](https://github.com/Olaverse-Labs/olaverse)
|
||
|
|
- [Olaverse Library Docs](https://Olaverse-Labs.github.io/olaverse/)
|
||
|
|
- [Benchmarks](https://github.com/Olaverse-Labs/olaverse)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Made with ❤️ by Olaverse AI**
|