Text Generation
Transformers
Safetensors
English
French
Estonian
llama4_text
legal
law
multilingual
english
french
estonian
legal-reasoning
lora
instruction-tuning
llama-3
adaption-labs
conversational
4-bit precision
bitsandbytes
Instructions to use RayNene/Trilex with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RayNene/Trilex with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RayNene/Trilex") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RayNene/Trilex") model = AutoModelForCausalLM.from_pretrained("RayNene/Trilex", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RayNene/Trilex with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RayNene/Trilex" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RayNene/Trilex", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RayNene/Trilex
- SGLang
How to use RayNene/Trilex with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "RayNene/Trilex" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RayNene/Trilex", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "RayNene/Trilex" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RayNene/Trilex", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RayNene/Trilex with Docker Model Runner:
docker model run hf.co/RayNene/Trilex
File size: 7,424 Bytes
09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 09740de 0d18cc4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | ---
license: llama3.3
base_model: meta-llama/Llama-3.3-70B-Instruct
language:
- en
- fr
- et
library_name: transformers
pipeline_tag: text-generation
tags:
- legal
- law
- multilingual
- english
- french
- estonian
- legal-reasoning
- lora
- instruction-tuning
- llama-3
- adaption-labs
datasets:
- RayNene/Trilex
---
# TriLex
> **Understanding law across borders, languages, and legal traditions.**
*A multilingual legal reasoning model adapted from Llama 3.3 70B Instruct for English, French, and Estonian legal understanding.*
---
# Why TriLex?
Law has never been more global.
A company incorporated in London may negotiate contracts governed by French law. An AI researcher may compare judicial systems across Europe. Citizens increasingly seek legal information online before consulting legal professionals. Governments themselves frequently study how other jurisdictions address similar policy challenges.
Yet most legal language models remain confined to a single legal system or language.
TriLex was built to move beyond that limitation.
Instead of specializing in only one jurisdiction, TriLex has been adapted to understand three distinct legal traditions:
- 🇬🇧 **England** — Common Law built through judicial precedent
- 🇫🇷 **France** — Civil Law founded on comprehensive legal codification
- 🇪🇪 **Estonia** — A digitally enabled legal system recognized for modern public administration
By exposing the model to multiple legal frameworks, TriLex aims to produce responses that recognize not only legal terminology, but also the institutional reasoning and policy objectives behind different legal systems.
---
# The Problem
Legal information is often difficult to access.
For many people, legislation is written in technical language, court structures differ from one country to another, and understanding how laws interact across jurisdictions requires years of formal education.
Meanwhile, AI is rapidly becoming one of the first places people turn when trying to understand legal concepts.
That creates an important responsibility.
Rather than generating generic legal responses, TriLex was adapted to produce explanations that are clearer, more contextual, and more sensitive to differences between legal systems.
The goal is **not** to replace lawyers.
The goal is to make legal knowledge easier to understand.
---
# Model Overview
**Base Model**
> Meta Llama 3.3 70B Instruct
**Adaptation Method**
- LoRA fine-tuning
- Adaptive Data pipeline by **Adaption Labs**
**Languages**
- English
- French
- Estonian
---
# Areas of Expertise
TriLex has been adapted for legal reasoning tasks including:
- Comparative law
- Constitutional law
- Administrative law
- Civil law
- Public policy
- Government structures
- Judicial systems
- Legal interpretation
- Legal education
- Legal question answering
- Cross-jurisdiction legal comparisons
---
# Training Dataset
TriLex was adapted using a multilingual legal instruction dataset containing examples across three legal systems.
The dataset includes:
- English legal reasoning
- French legal reasoning
- Estonian legal reasoning
- Comparative legal analysis
- Enhanced instruction-response pairs
- Semantically enriched legal examples
By training on multiple jurisdictions simultaneously, the model learns to distinguish differences in legal traditions while preserving legal context.
---
# How to Use
This repository contains **LoRA adapter weights**.
Load the base model first, then apply the adapter.
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
BASE_MODEL = "meta-llama/Llama-3.3-70B-Instruct"
ADAPTER = "RayNene/TriLex"
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
device_map="auto"
)
model = PeftModel.from_pretrained(
base_model,
ADAPTER
)
```
---
# Prompting Tips
TriLex performs best when legal questions include jurisdictional context.
### Examples
```
Explain the differences between English common law and the French civil law system.
```
```
How does Estonia's digital identity framework support its legal and public administration systems?
```
```
Compare how administrative disputes are handled in France and England.
```
```
Why does England rely heavily on judicial precedent while France relies on codified legislation?
```
```
How do tribunal systems improve judicial efficiency in England?
```
---
# Intended Applications
TriLex is designed for:
- Legal education
- Comparative law research
- Government policy analysis
- Legal assistants
- Academic research
- Multilingual legal retrieval
- Domain-adapted language model research
---
# Limitations
TriLex is intended for research and educational purposes.
It does **not** provide legal advice and should never replace consultation with qualified legal professionals. Laws change over time, judicial interpretations evolve, and legal outcomes depend heavily on jurisdiction and individual circumstances.
---
# Built with Adaption Labs
TriLex was developed as part of the **Adaption Labs AutoScientist Challenge**.
The project leveraged **Adaptive Data** to enhance and refine multilingual legal instruction data before model adaptation. Adaptive Data made it possible to improve instruction quality, enrich legal reasoning examples, and generate a stronger foundation for domain-specific fine-tuning.
Special thanks to **Adaption Labs** for making advanced domain adaptation workflows more accessible to the open-source AI community.
---
# Vision
The future of legal AI should not stop at answering questions—it should help people understand *why* legal systems differ.
Every legal system reflects the history, institutions, and values of the society it serves. By bringing together English common law, French civil law, and Estonia's digital-first governance model, TriLex aims to encourage more transparent, multilingual, and internationally aware legal AI.
By releasing both the dataset and model openly, this project hopes to contribute to research, education, and the broader effort to make legal knowledge more accessible worldwide.
---
## Citation
If you use TriLex in research or downstream applications, please cite this repository and the accompanying dataset.
If you use **TriLex** in your research, applications, or derivative work, please cite this repository.
### BibTeX
```bibtex
@misc{Ray Munene,
title = {TriLex: A Multilingual Legal Reasoning Model for English, French, and Estonian Law},
author = {Munene, Ray},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/RayNene/TriLex}},
note = {LoRA adaptation of Meta Llama 3.3 70B Instruct developed as part of the Adaption Labs AutoScientist Challenge}
}
```
### APA
Munene, R. (2026). *TriLex: A Multilingual Legal Reasoning Model for English, French, and Estonian Law* [Computer software]. Hugging Face. https://huggingface.co/RayNene/TriLex
### Dataset
The accompanying multilingual legal dataset is available at:
https://huggingface.co/datasets/RayNene/TriLex
If you use the training data, please cite both the dataset and the model.
---
## Contact
Questions, suggestions, or contributions are welcome.
- 🤗 Hugging Face: https://huggingface.co/RayNene
- GitHub: https://github.com/RayMune |