Instructions to use FahrenheitResearch/FR-Lex-1.7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use FahrenheitResearch/FR-Lex-1.7B with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("FahrenheitResearch/FR-Lex-1.7B") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use FahrenheitResearch/FR-Lex-1.7B with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "FahrenheitResearch/FR-Lex-1.7B"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "FahrenheitResearch/FR-Lex-1.7B" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use FahrenheitResearch/FR-Lex-1.7B with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "FahrenheitResearch/FR-Lex-1.7B"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default FahrenheitResearch/FR-Lex-1.7B
Run Hermes
hermes
- OpenClaw new
How to use FahrenheitResearch/FR-Lex-1.7B with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "FahrenheitResearch/FR-Lex-1.7B"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "FahrenheitResearch/FR-Lex-1.7B" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MLX LM
How to use FahrenheitResearch/FR-Lex-1.7B with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "FahrenheitResearch/FR-Lex-1.7B"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "FahrenheitResearch/FR-Lex-1.7B" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FahrenheitResearch/FR-Lex-1.7B", "messages": [ {"role": "user", "content": "Hello"} ] }'
Upload folder using huggingface_hub
Browse files- README.md +3 -225
- model.safetensors +1 -1
README.md
CHANGED
|
@@ -1,231 +1,9 @@
|
|
| 1 |
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
license_link: https://www.apache.org/licenses/LICENSE-2.0
|
| 4 |
-
language:
|
| 5 |
-
- en
|
| 6 |
library_name: mlx
|
| 7 |
-
|
| 8 |
-
|
| 9 |
pipeline_tag: text-generation
|
|
|
|
| 10 |
tags:
|
| 11 |
- mlx
|
| 12 |
-
- qwen3
|
| 13 |
-
- legal
|
| 14 |
-
- law
|
| 15 |
-
- thin-language-model
|
| 16 |
-
- lens
|
| 17 |
-
- lora
|
| 18 |
-
- 4-bit
|
| 19 |
-
- apple-silicon
|
| 20 |
-
- text-generation
|
| 21 |
-
- conversational
|
| 22 |
-
widget:
|
| 23 |
-
- text: "Summarize the holding of the following case:\n\n<paste judgment text>"
|
| 24 |
-
---
|
| 25 |
-
|
| 26 |
-
<div align="center">
|
| 27 |
-
|
| 28 |
-
<img src="https://huggingface.co/FahrenheitResearch/FR-Lex-1.7B/resolve/main/assets/banner.jpeg" alt="Fahrenheit Research" width="100%">
|
| 29 |
-
|
| 30 |
-
# FR-Lex-1.7B
|
| 31 |
-
|
| 32 |
-
**A Thin Language Model for law. Grounded, jurisdiction-aware, and running on your laptop.**
|
| 33 |
-
|
| 34 |
-
`GROUNDED.` `JURISDICTIONAL.` `LOCAL.`
|
| 35 |
-
|
| 36 |
-
<p>
|
| 37 |
-
<a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank" style="margin:2px;"><img alt="License" src="https://img.shields.io/badge/License-Apache_2.0-D4F23C?style=flat-square&labelColor=0D0D0D" style="display:inline-block;vertical-align:middle;"></a>
|
| 38 |
-
<img alt="Base" src="https://img.shields.io/badge/Base-Qwen3--1.7B-1A1A1A?style=flat-square&labelColor=0D0D0D" style="display:inline-block;vertical-align:middle;">
|
| 39 |
-
<img alt="Format" src="https://img.shields.io/badge/MLX_·_4--bit-1A1A1A?style=flat-square&labelColor=0D0D0D&logo=apple&logoColor=D4F23C" style="display:inline-block;vertical-align:middle;">
|
| 40 |
-
<img alt="Domain" src="https://img.shields.io/badge/Domain-Legal-D4F23C?style=flat-square&labelColor=0D0D0D" style="display:inline-block;vertical-align:middle;">
|
| 41 |
-
<a href="https://f-r.co" target="_blank" style="margin:2px;"><img alt="Website" src="https://img.shields.io/badge/Website-f--r.co-D4F23C?style=flat-square&labelColor=0D0D0D" style="display:inline-block;vertical-align:middle;"></a>
|
| 42 |
-
<a href="https://github.com/fahrenheit-research" target="_blank" style="margin:2px;"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-fahrenheit--research-1A1A1A?style=flat-square&labelColor=0D0D0D&logo=github&logoColor=white" style="display:inline-block;vertical-align:middle;"></a>
|
| 43 |
-
<a href="https://huggingface.co/FahrenheitResearch/FR-Forge-1.7B" target="_blank" style="margin:2px;"><img alt="Sibling" src="https://img.shields.io/badge/Sibling-FR--Forge_1.7B-1A1A1A?style=flat-square&labelColor=0D0D0D" style="display:inline-block;vertical-align:middle;"></a>
|
| 44 |
-
</p>
|
| 45 |
-
|
| 46 |
-
</div>
|
| 47 |
-
|
| 48 |
-
---
|
| 49 |
-
|
| 50 |
-
## Contents
|
| 51 |
-
|
| 52 |
-
1. [Overview](#overview)
|
| 53 |
-
2. [How it works](#how-it-works)
|
| 54 |
-
3. [Specifications](#specifications)
|
| 55 |
-
4. [Quickstart](#quickstart)
|
| 56 |
-
5. [Intended use](#intended-use)
|
| 57 |
-
6. [Coverage](#coverage)
|
| 58 |
-
7. [Limitations](#limitations)
|
| 59 |
-
8. [Training](#training)
|
| 60 |
-
9. [Citation](#citation)
|
| 61 |
-
|
| 62 |
-
## Overview
|
| 63 |
-
|
| 64 |
-
FR-Lex-1.7B is a **Thin Language Model (TLM)** for law, by Fahrenheit Research. Sibling to [FR-Forge](https://huggingface.co/FahrenheitResearch/FR-Forge-1.7B) (manufacturing). It is a small, 4-bit, MLX model fine-tuned with LoRA adapters on a balanced, multi-jurisdiction legal corpus, designed to run locally on Apple Silicon.
|
| 65 |
-
|
| 66 |
-
It is built to **process legal text you give it**, not to recall case law from memory. Version 0.2 covers the United States and Australia as primary jurisdictions, with experimental German and Swedish support.
|
| 67 |
-
|
| 68 |
-
```text
|
| 69 |
-
Where a Thin Language Model fits
|
| 70 |
-
|
| 71 |
-
specialization
|
| 72 |
-
▲
|
| 73 |
-
│ ● FR-Lex 1.7B
|
| 74 |
-
│ narrow · local · cheap
|
| 75 |
-
│
|
| 76 |
-
│ ● Frontier LLM
|
| 77 |
-
│ broad · hosted · costly
|
| 78 |
-
└──────────────────────────────────────────────▶ generality
|
| 79 |
-
```
|
| 80 |
-
|
| 81 |
-
## How it works
|
| 82 |
-
|
| 83 |
-
FR-Lex runs **standalone** for narrow legal tasks, or as a **Lens** that sits in front of a larger general LLM, enriching a query before the expensive computation.
|
| 84 |
-
|
| 85 |
-
```text
|
| 86 |
-
Court document / legal query
|
| 87 |
-
│
|
| 88 |
-
▼
|
| 89 |
-
┌─────────────────────────────────────────────────────┐
|
| 90 |
-
│ FR-Lex 1.7B │
|
| 91 |
-
└─────────────────────────────────────────────────────┘
|
| 92 |
-
│
|
| 93 |
-
┌────────┴─────────┐
|
| 94 |
-
▼ ▼
|
| 95 |
-
STANDALONE LENS (enrich, then route)
|
| 96 |
-
│ │
|
| 97 |
-
├─ summarize ├─ detect jurisdiction
|
| 98 |
-
├─ extract holding ├─ extract citations
|
| 99 |
-
├─ spot issues └─▶ Frontier LLM (expensive reasoning)
|
| 100 |
-
└─ explain plainly
|
| 101 |
-
│
|
| 102 |
-
▼
|
| 103 |
-
Grounded, local answer (supply the source text for factual output)
|
| 104 |
-
```
|
| 105 |
-
|
| 106 |
-
It is an assistant, not a certified authority. It is not a substitute for a licensed attorney or the controlling law.
|
| 107 |
-
|
| 108 |
-
## Specifications
|
| 109 |
-
|
| 110 |
-
| | |
|
| 111 |
-
|---|---|
|
| 112 |
-
| **Base** | Qwen3-1.7B (4-bit, MLX) |
|
| 113 |
-
| **Parameters** | 1.7B · 4-bit |
|
| 114 |
-
| **Method** | LoRA adapters, fused |
|
| 115 |
-
| **Runtime** | MLX (Apple Silicon) |
|
| 116 |
-
| **Languages** | English (DE / SV experimental, answers in source language) |
|
| 117 |
-
| **Version** | 0.2 |
|
| 118 |
-
| **License** | Apache-2.0 |
|
| 119 |
-
|
| 120 |
-
## Quickstart
|
| 121 |
-
|
| 122 |
-
Runs locally with MLX on Apple Silicon. Supply the source text as context for factual output.
|
| 123 |
-
|
| 124 |
-
```bash
|
| 125 |
-
pip install -U mlx-lm
|
| 126 |
-
python3 -m mlx_lm generate \
|
| 127 |
-
--model FahrenheitResearch/FR-Lex-1.7B \
|
| 128 |
-
--max-tokens 400 \
|
| 129 |
-
--prompt "Summarize the holding of the following case:
|
| 130 |
-
|
| 131 |
-
<paste judgment text>"
|
| 132 |
-
```
|
| 133 |
-
|
| 134 |
-
```python
|
| 135 |
-
from mlx_lm import load, generate
|
| 136 |
-
|
| 137 |
-
model, tok = load("FahrenheitResearch/FR-Lex-1.7B")
|
| 138 |
-
prompt = "Summarize the holding of the following case:\n\n<paste judgment text>"
|
| 139 |
-
print(generate(model, tok, prompt=prompt, max_tokens=400))
|
| 140 |
-
```
|
| 141 |
-
|
| 142 |
-
Pin a specific release with `load("FahrenheitResearch/FR-Lex-1.7B", revision="v0.1")`.
|
| 143 |
-
|
| 144 |
-
## Intended use
|
| 145 |
-
|
| 146 |
-
Grounded legal-text processing over court documents:
|
| 147 |
-
|
| 148 |
-
```text
|
| 149 |
-
FR-Lex covers
|
| 150 |
-
├─ Grounded summarization condense judgments and filings
|
| 151 |
-
├─ Holding extraction isolate the operative ruling
|
| 152 |
-
├─ Issue spotting flag the legal questions at stake
|
| 153 |
-
├─ Plain-language explanation translate legalese for non-lawyers
|
| 154 |
-
└─ Citation extraction pull and normalize references
|
| 155 |
-
```
|
| 156 |
-
|
| 157 |
-
Best results come from supplying the source text as context.
|
| 158 |
-
|
| 159 |
-
## Coverage
|
| 160 |
-
|
| 161 |
-
```text
|
| 162 |
-
Jurisdiction maturity (qualitative tiers, not a benchmark)
|
| 163 |
-
|
| 164 |
-
United States ████████████████████ primary · strongest
|
| 165 |
-
Australia ████████████████████ primary · strongest
|
| 166 |
-
Germany ███████████░░░░░░░░░░ experimental
|
| 167 |
-
Sweden ███████░░░░░░░░░░░░░░ experimental · weakest
|
| 168 |
-
India ████░░░░░░░░░░░░░░░░░ pipeline only (not in weights)
|
| 169 |
-
UAE ████░░░░░░░░░░░░░░░░░ pipeline only (not in weights)
|
| 170 |
-
```
|
| 171 |
-
|
| 172 |
-
- **United States, Australia** — primary, strongest quality.
|
| 173 |
-
- **Germany, Sweden** — experimental; answers in the source language. German is more reliable than Swedish (whose open corpus mixes in EU translations).
|
| 174 |
-
- **India, UAE** — supported in the pipeline (citation and jurisdiction detection) but not yet in these trained weights.
|
| 175 |
-
|
| 176 |
-
## Limitations
|
| 177 |
-
|
| 178 |
-
> **Not legal advice.** Outputs are legal information for research and drafting assistance only. Consult a licensed attorney.
|
| 179 |
-
|
| 180 |
-
- **Experimental European coverage.** German and Swedish are early; German is more reliable than Swedish. India and the UAE are in the pipeline but not yet in these trained weights.
|
| 181 |
-
- **Not a knowledge base.** Ungrounded recall will confabulate; always supply the source text for factual output.
|
| 182 |
-
- **Small model.** For anything that must be exact (clause text, citation strings), verify against the controlling source.
|
| 183 |
-
|
| 184 |
-
## Training
|
| 185 |
-
|
| 186 |
-
```text
|
| 187 |
-
Multi-jurisdiction legal corpus ─┐
|
| 188 |
-
US caselaw (CAP / Common Pile) │
|
| 189 |
-
Open Australian Legal Corpus ├─▶ LoRA fine-tune (MLX) ─▶ fuse adapters ─▶ FR-Lex 1.7B
|
| 190 |
-
German court decisions (OLD) │ balanced across jurisdictions
|
| 191 |
-
Swedish SweLaw corpus ─┘
|
| 192 |
-
```
|
| 193 |
-
|
| 194 |
-
<details>
|
| 195 |
-
<summary>Base, method, data, and targets</summary>
|
| 196 |
-
|
| 197 |
-
- **Base model:** `mlx-community/Qwen3-1.7B-4bit` (Qwen3 architecture, 4-bit), fine-tuned with LoRA via MLX on Apple Silicon.
|
| 198 |
-
- **Data, by source license:**
|
| 199 |
-
- Public-domain US caselaw — Caselaw Access Project via the Common Pile.
|
| 200 |
-
- Open Australian Legal Corpus — CC BY 4.0.
|
| 201 |
-
- German court decisions — Open Legal Data, MIT.
|
| 202 |
-
- Swedish SweLaw corpus — CC0.
|
| 203 |
-
- Balanced across the four jurisdictions.
|
| 204 |
-
- **Targets:** teacher-distilled summaries, holdings, issues, and plain-language explanations; rule-based citation targets.
|
| 205 |
-
|
| 206 |
-
</details>
|
| 207 |
-
|
| 208 |
-
## Citation
|
| 209 |
-
|
| 210 |
-
Apache-2.0. Base model `mlx-community/Qwen3-1.7B-4bit` is Apache-2.0. Built on Qwen3 (Alibaba Cloud, Apache 2.0). Training data per source licenses; see the project repository for full attribution.
|
| 211 |
-
|
| 212 |
-
```
|
| 213 |
-
@software{fr_lex_2026,
|
| 214 |
-
title = {FR-Lex-1.7B: a thin language model for law},
|
| 215 |
-
author = {Fahrenheit Research},
|
| 216 |
-
year = {2026},
|
| 217 |
-
note = {Fine-tuned from Qwen3-1.7B (4-bit) with MLX/LoRA}
|
| 218 |
-
}
|
| 219 |
-
```
|
| 220 |
-
|
| 221 |
---
|
| 222 |
-
|
| 223 |
-
<div align="center">
|
| 224 |
-
|
| 225 |
-
**FAHRENHEIT RESEARCH**
|
| 226 |
-
|
| 227 |
-
Thin Language Models for specialized domains.
|
| 228 |
-
|
| 229 |
-
[Website](https://f-r.co) · [GitHub](https://github.com/fahrenheit-research) · [Sibling model: FR-Forge-1.7B](https://huggingface.co/FahrenheitResearch/FR-Forge-1.7B)
|
| 230 |
-
|
| 231 |
-
</div>
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
library_name: mlx
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
license_link: https://huggingface.co/Qwen/Qwen3-1.7B/blob/main/LICENSE
|
| 5 |
pipeline_tag: text-generation
|
| 6 |
+
base_model: mlx-community/Qwen3-1.7B-4bit
|
| 7 |
tags:
|
| 8 |
- mlx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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id sha256:a2140c66d0d44447beacc41eb74c1ce4056c9e62de637665cad11eb07201f366
|
| 3 |
size 968080210
|