Instructions to use mstrasser/jeff-adapter-legal-clauses with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use mstrasser/jeff-adapter-legal-clauses with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Configuration Parsing Warning:In adapter_config.json: "peft.task_type" must be a string
jeff-adapter-legal-clauses
Contract clause types. Labels a single contract provision with its clause type, such as governing law, notices or confidentiality.
A LoRA adapter for jeff-base v1.3, a small open decision model
(a fine-tune of Qwen3.5-0.8B). You send a situation (the state) and questions with named options; Jeff returns a
calibrated probability for every option from one forward pass, with no generated text to parse. One Jeff server loads
the base once and any number of adapters beside it; each request picks an adapter by name ("model": "legal-clauses").
Adapter page, with the full data card: jeffhub.ai/adapters/legal-clauses.
Results
On this adapter's held-out test sets, never trained on, scored three ways on the same rows: the untrained model Jeff is built from, the Jeff v1.3 base alone, and the base with this adapter. Every question has 100 options. As of 2026-10-05. All adapters
| Test set | Test rows | Qwen3.5-0.8B untrained | Jeff base v1.3 alone | Jeff base v1.3 + adapter |
|---|---|---|---|---|
test |
9,895 | 12.5% · 0.094 | 7.4% · 0.039 | 83.6% · 0.011 |
test-novel |
7,357 | 12.1% · 0.090 | 7.1% · 0.044 | 81.4% · 0.015 |
Each cell: accuracy · calibration error (ECE; lower is better, 0 is perfect).
test.jsonl in this repository is the test set; test-novel is not included.
With llama.cpp (GGUF)
The same test, through llama.cpp: the base GGUF (mstrasser/jeff-base-gguf) plus this adapter's LoRA GGUF (mstrasser/jeff-adapter-legal-clauses-gguf), with the temperature refitted for each format. Running Jeff with llama.cpp
| Test set | Full precision | Q8_0 | Q4_K_M |
|---|---|---|---|
test |
83.6% · 0.011 | 83.8% · 0.011 | 83.4% · 0.010 |
test-novel |
81.4% · 0.015 | 81.6% · 0.015 | 81.2% · 0.015 |
Not measured yet for v1.3: calibration charts, the commonest confusions and accuracy per answer.
Source of these numbers: results/sources/v1.3/retrained-adapters.table.json in the JeffHub repository, also collected in jeffhub-v1.3.json.
When to use it
- You have a contract split into provisions and want each one labelled with a clause type.
- Your contracts are commercial or employment agreements written in English, like those filed with the US SEC.
- You can use the 100 LEDGAR clause types, or a subset of them, as your options.
When not to use it
- Your contracts are not in English, or follow a legal system very different from the US. All training text comes from US SEC filings.
- You need legal advice or a judgement on whether a clause is fair or enforceable. The adapter only names the clause type.
- You pass a whole contract at once. It was trained on one provision at a time.
- You need your own clause types. Training used the LEDGAR labels only.
How to use it
The adapter runs with Jeff's server, on the main branch of firelex/jeff, on the
jeff-base v1.3 base.
git clone https://github.com/firelex/jeff && cd jeff
uv sync --no-default-groups --extra lora # add --extra cuda on NVIDIA GPUs, --extra mac on Apple silicon
uv run --no-default-groups hf download mstrasser/jeff-base --revision v1.3 --local-dir checkpoints/jeff-base
uv run --no-default-groups hf download mstrasser/jeff-adapter-legal-clauses --revision v1.3 --local-dir adapters/legal-clauses
JEFF_CHECKPOINT=checkpoints/jeff-base JEFF_ADAPTERS=adapters/ PORT=8765 \
uv run --no-default-groups jeff-serve # on a Mac, add JEFF_BACKEND=mlx
Every folder in adapters/ is served under its folder name; add or replace adapters while the server runs with
curl -X POST http://localhost:8765/v1/adapters/reload. Each adapter records the exact base it was trained on, and
the server refuses an adapter trained on a different one, so this adapter loads only on jeff-base v1.3 (a v1.2 adapter
does not load on v1.3). For llama.cpp, use mstrasser/jeff-adapter-legal-clauses-gguf.
Request format
State (the situation), in this order:
| Key | Changes per request | What it holds |
|---|---|---|
document |
no | One sentence about the document the provision comes from. In training this was always "A commercial contract filed with the U.S. Securities and Exchange Commission (SEC)". |
provision |
yes | The text of one contract provision. |
Questions:
clause_type(choice): Which type of clause the provision is, judged by its main topic. Options: 100 LEDGAR clause types, each with a snake_case key such as governing_laws and a one-line description. The full list is LEDGAR in descriptions.py in the source.
Rules:
- Use the option keys and descriptions from descriptions.py; the adapter was trained on them.
- Several clause types are close in meaning (for example assignments and assigns). Expect probability to be shared between them.
- Use the instructions below word for word; the adapter was trained mostly on them.
General rules for every request: the request format guide.
Example
The request below is also in this repository as example.json.
{
"model": "legal-clauses",
"state": {
"document": "A commercial contract filed with the U.S. Securities and Exchange Commission (SEC)",
"provision": "This Agreement shall be governed by and construed in accordance with the laws of the State of Delaware, without regard to its conflict of laws principles."
},
"questions": {
"clause_type": {
"type": "choice",
"instructions": "Which type of clause is this contract provision? Choose the clause type that best matches the main topic of the provision.",
"criteria": {
"governing_laws": "Governing law: which state's or country's law governs the contract.",
"notices": "Notices: how formal notices must be given, and to which addresses.",
"confidentiality": "Confidentiality: keeping information secret and limits on using or disclosing it.",
"terminations": "Termination: how and when the contract or employment can be ended, and what follows.",
"assignments": "Assignments: whether and how a party may transfer its rights or duties under the contract to someone else.",
"severability": "Severability: if one provision is invalid, the rest of the contract remains in force.",
"entire_agreements": "Entire agreement: the contract is the whole agreement and replaces all earlier agreements on the subject.",
"indemnifications": "Indemnification: one party must compensate and defend the other against losses and claims.",
"counterparts": "Counterparts: the contract may be signed in separate copies, including electronic signatures, which together form one agreement.",
"waiver_of_jury_trials": "Waiver of jury trial: the parties give up the right to a jury trial in disputes.",
"amendments": "Amendments: how the contract can be amended, usually only in writing signed by the parties."
}
}
}
}
curl -s localhost:8765/v1/systemone -H 'content-type: application/json' -d @adapters/legal-clauses/example.json
The answer holds a probability for each option of each question. A recorded response from the v1.3 adapter is not published yet.
Files
adapter_model.safetensors,adapter_config.json: the LoRA weights (PEFT format);readout.safetensors: the adapter's own readout over the answer codes;decision_config.json: answer codes, temperature, prompt layout and the checksum of the base it was trained on;test.jsonl: the held-out test set the results below were measured on;calibration.jsonl: the calibration rows the adapter's temperature was fitted on;example.json: the example request above.
adapter_config.json and decision_config.json name the base as mstrasser/jeff-base, revision v1.3; the server
checks the base by the checksum of its weights.
Training
| Base | mstrasser/jeff-base, revision v1.3 (a fine-tune of Qwen3.5-0.8B) |
| Prompt layout | live-last: the fixed part of the request first, the changing state field last |
| Training code | The git_commit recorded in decision_config.json is the training machine's copy and was not published. It builds exactly the same prompt as main of firelex/jeff (from commit 6d0d7da) for a text state and for an object with at least one field; the format is in docs/v1.3-request-format.md |
| Run | 0.8b-legal-clauses-20261003-0149, final checkpoint |
| Adapter files | 41.5 MB (adapter_model.safetensors and readout.safetensors) |
| LoRA GGUF for llama.cpp | mstrasser/jeff-adapter-legal-clauses-gguf |
- 1.3.0 (2026-10-03): Trained on Jeff v1.3 with the live-last prompt layout (LoRA rank 16, one epoch, about 10% of the base model's own training data mixed in).
Data card
Report attached. The shortcut report and data card are included and pass the JeffHub checks; the numbers are the maintainers’ own. What the levels mean
- Test set: included in this repository as
test.jsonl, so anyone can check the numbers - Calibration rows: included in this repository as
calibration.jsonl, the rows its threshold is chosen on - QA report, sanitised: the data-quality checks run before training
How the test set was held out. The official LEDGAR test split, as distributed in LexGLUE; never trained on.
Training data. Built from public data sets, listed under Data and licence.
The attached QA report was written for the data of the previous release; the v1.3 data fixes the notes it left open. The QA report re-run on the v1.3 data is still to be attached.
The source data sets are public (listed under Data and licence). A script to rebuild our rows from them will follow.
Near-duplicate provisions (standard boilerplate) appear at most three times in training, which leaves 61,848 training rows.
Training mixed in a replay sample of the Jeff base model's own training data: 6,185 rows, about 10% on top of the adapter's 61,848 (inherited from the v1.2 recipe as a precaution; its effect has not been measured).
Data and licence
Adapter licence: Apache-2.0.
Qwen3.5-0.8B notice: these weights were modified from Qwen3.5-0.8B by the Jeff project: jeff-base is a fine-tune of Qwen3.5-0.8B, and this adapter was trained on top of it. Qwen3.5-0.8B is Copyright 2026 Alibaba Cloud and licensed under the Apache License, Version 2.0; a copy of that licence is in LICENSE.
It was trained on:
LEDGAR (LexGLUE ledgar configuration). Licence: CC-BY-4.0 (open licence)
Provisions are from public SEC EDGAR filings (Tuggener et al. 2020). Option descriptions were written by hand from the label names.
Limitations
- Tied to jeff-base v1.3. It will not load on any other base or version; the server checks the base weights' checksum.
- Jeff chooses between the options you give it. It does not write text or reason in several steps.
- Calibration was fitted on this adapter's own calibration rows. On very different data, check it again.
- Everything listed under When not to use it above.
Links
- Adapter page: jeffhub.ai/adapters/legal-clauses
- Base model: mstrasser/jeff-base (revision v1.3)
- LoRA GGUF for llama.cpp: mstrasser/jeff-adapter-legal-clauses-gguf
- What changed in v1.3: release notes
- Code and server: github.com/firelex/jeff
Jeff is an independent project. It uses the same request format as Jev but is not affiliated with or endorsed by TypeSafe, the makers of Jev.
- Downloads last month
- 31