The best LLM for legal work that you can run on your own hardware in October 2026 is Qwen3.8-27B: it scores 82.43% on the Vals AI LegalBench leaderboard, holds a full long agreement in context on one 32 GB GPU, and uses Apache 2.0. On an 80 GB server GPU, gpt-oss-120b is the common alternative. Legal-specific open models such as SaulLM date from 2024 and now trail current general models.
Quick picks for legal teams
Legal work rewards three things in a model: a long context window that actually holds a contract and its schedules, careful reading of defined terms, and output you can check. The picks below come from Hugging Face model cards, the Vals AI LegalBench leaderboard (updated 13 October 2026) and the serving lists of vLLM, llama.cpp and Ollama, all checked on 22 October 2026.
| Situation | Pick | Why |
|---|---|---|
| One 32 GB workstation GPU | Qwen3.8-27B | 82.43% on LegalBench, 262K native context, Apache 2.0 |
| One 24 GB GPU, many concurrent users | Gemma 4 26B A4B | Mixture-of-experts with 256K context and a small KV cache |
| Long bundles on a 32 GB card | Qwen3.6-35B-A3B | 2.7 GB of cache for a 128K-token prompt |
| One 80 GB server GPU | gpt-oss-120b | 75.94% on LegalBench; OpenAI says it fits a single H100 |
| Multi-GPU server, highest open score that fits a rack slot | GLM-5.3-Flash | 83.93% on LegalBench, MIT licence, 1M-token context |
| Research answers tied to sources | Command A+ | Built-in citation spans that point at the supporting passage |
| French, German or Italian matters | Mistral Small 4 or Gemma 4 31B | Mistral lists dozens of languages; Gemma 4 supports 35+ out of the box |
The open-weight shortlist for legal documents
Every model here publishes its weights on Hugging Face under a licence that permits commercial use. LegalBench scores are from Vals AI’s independent run; “not listed” means Vals has not scored that open checkpoint.
| Model (vendor) | Size | Licence | Native context | LegalBench (Vals) | Worth knowing |
|---|---|---|---|---|---|
| Qwen3.8-27B (Qwen) | 27.8B dense, vision included | Apache 2.0 | 262K, extendable to 1M | 82.43% | Published August 2026; reads page images as well as text |
| Qwen3.6-35B-A3B (Qwen) | 36B MoE, about 3B active | Apache 2.0 | 262K | Not listed | Fast on modest GPUs |
| Gemma 4 31B and 26B A4B (Google) | 31.3B dense; 25.8B MoE | Apache 2.0 | 256K | Not listed | Hybrid sliding-window attention keeps the cache small |
| gpt-oss-120b and gpt-oss-20b (OpenAI) | 117B and 21B MoE | Apache 2.0 plus usage policy | 128K | 75.94% and 70.85% | MXFP4 weights fit one 80 GB or 16 GB device |
| Mistral Small 4 (Mistral) | 119B MoE, 6.5B active | Apache 2.0 | 256K | Not listed | Lists French, German, Italian, Spanish, Dutch and Portuguese |
| GLM-5.3-Flash (Z.ai) | 320B MoE, 18B active | MIT | 1M | 83.93% | Needs about four H200-class GPUs at FP8 |
| Command A+ (Cohere) | 218B MoE, 25B active | Apache 2.0 | 128K | 61.42% | Citation spans; trained on 48 languages |
| Granite 4.2 8B (IBM) | 8.8B dense | Apache 2.0 | 128K, extension to 512K | Not listed | Released 25 August 2026; small enough for laptops |
| Llama 3.3 70B (Meta) | 70.6B dense | Llama 3.3 Community License | 128K | 77.18% | Older, with a large KV cache |
Higher open-weight scores come from far larger models: GLM-5.3 reaches 84.84% with 744 billion parameters, and Kimi K3 86.21% with about 2.8 trillion. For context, the top closed model on the same leaderboard scores 88.56%, so Qwen3.8-27B sits about six points below the frontier on a single card.
Legal LLMs on Hugging Face: SaulLM, Lawma and the fine-tune question
Searches for a “legal LLM” usually lead to three projects. Here is their state in October 2026:
- SaulLM (Equall). Saul-7B was built by continued pretraining of Mistral-7B, and SaulLM-54B and SaulLM-141B on Mixtral bases, all with English-language legal corpora from US and European sources. All three are MIT-licensed with 32,768-token context. The last commits are from July 2024, and the 54B card calls itself a research artifact.
- Lawma. Lawma 8B and 70B fine-tune Llama 3 on 260 classification tasks drawn from the US Supreme Court and Songer Courts of Appeals databases. On those tasks Lawma 8B scores 80.3% against 62.9% for GPT-4. Its card is explicit that the model outputs only multiple-choice labels and should be used for nothing else.
- Community fine-tunes. Hugging Face lists hundreds of small legal chatbots and jurisdiction-specific adapters uploaded in 2026, from Indonesian and Thai law to Italian legal QA. Few publish evaluations, and most sit on 1.5B to 8B bases.
The lesson from Lawma is the useful one. A narrow fine-tune can beat a general model by a wide margin on a fixed, labelled task such as tagging the disposition of an appeal. For open-ended work, the base model’s reasoning dominates: Vals scores the Mistral 7B and Mixtral 8x7B bases under SaulLM at 53.77% and 55.84%, against 82.43% for Qwen3.8-27B. Most firms now start from a current general model and add retrieval over their own precedents.
Reading LegalBench and other legal scores with care
LegalBench, published by Neel Guha and colleagues in 2023, has 162 tasks written with legal professionals and grouped into six kinds of reasoning: issue spotting, rule recall, rule application, rule conclusion, interpretation and rhetorical understanding. Vals AI runs it as a public leaderboard.
Three cautions apply before you rank models on it:
- Short prompts. Most tasks are a paragraph or a clause with a short answer. They say little about a model’s grip on a 90-page facility agreement.
- Format sensitivity. Command A+ scores 61.42%, below the much smaller gpt-oss-20b. A score like that can reflect how a model formats short answers as much as how it reasons about law.
- Hosted precision. Vals reaches open models through API providers. Your 4-bit build can score lower than the hosted one.
Use leaderboards to pick two or three candidates, then test them on 50 to 100 tasks from your own files with known answers: clauses to extract, deviations to flag, questions a partner has already answered.
Memory for long contracts: weights plus a 128K-token cache
A model needs memory for its weights and for the KV cache that holds the prompt. Long documents make the cache the deciding factor. One token is roughly three quarters of an English word, so 128K tokens is very roughly 200 pages of dense contract text at about 650 tokens a page.
The table counts keys and values at 16 bits for 131,072 tokens, from each model’s config.json. Gemma’s sliding-window layers hold only 1,024 tokens, and Qwen’s linear-attention layers keep a small fixed state, so only their full-attention layers grow with the prompt. Weights are 4-bit Q4_K_M sizes at 4.89 bits per weight, or the MXFP4 GGUF file for gpt-oss.
| Model | 4-bit weights | KV cache at 128K | Total before runtime overhead | Fits on |
|---|---|---|---|---|
| Gemma 4 26B A4B | 15.8 GB | 2.9 GB | 18.7 GB | One 24 GB GPU |
| gpt-oss-20b | 12.1 GB | 3.2 GB | 15.3 GB | One 24 GB GPU |
| Qwen3.6-35B-A3B | 22.0 GB | 2.7 GB | 24.7 GB | One 32 GB GPU |
| Qwen3.8-27B | 17.0 GB | 8.6 GB | 25.6 GB | One 32 GB GPU; 24 GB with an 8-bit cache |
| Granite 4.2 8B | 5.4 GB | 21.5 GB | 26.9 GB | One 32 GB GPU |
| Gemma 4 31B | 19.1 GB | 11.6 GB | 30.7 GB | One 48 GB GPU |
| gpt-oss-120b | 63.4 GB | 4.8 GB | 68.2 GB | One 80 GB GPU |
| Mistral Small 4 | 73.0 GB | 3.0 GB | 76.0 GB | One 96 GB GPU |
| Llama 3.3 70B | 43.1 GB | 42.9 GB | 86.0 GB | Two 48 GB GPUs |
Two results stand out. Granite 4.2 8B has the smallest weights but a cache four times larger than its weights at full context, because all 40 layers attend over the whole prompt. Llama 3.3 70B needs as much memory for one long contract as for the model itself. Multiply the cache by the number of documents your team reviews at once, and check the arithmetic in our VRAM calculator.
Serving support in vLLM, llama.cpp and Ollama
Checked against vLLM’s supported-model list, GGUF builds on Hugging Face and Ollama’s library on 22 October 2026.
| Model | vLLM | llama.cpp | Ollama library |
|---|---|---|---|
| Qwen3.8-27B | Yes, Qwen3.5 architecture | Community GGUFs (Unsloth) | Yes, qwen3.8:27b, 18 GB, 256K |
| Qwen3.6-35B-A3B | Yes | Community GGUFs (Unsloth) | Yes, qwen3.6:35b |
| Gemma 4 | Yes | Maintainer GGUFs (ggml-org) | Yes, gemma4 from E2B to 31B |
| gpt-oss | Yes | Maintainer MXFP4 GGUFs (ggml-org) | Yes, gpt-oss |
| Mistral Small 4 | Yes, Mistral3 architecture | Community GGUFs | Not in the library |
| GLM-5.3-Flash | vLLM recipe; not yet in the supported-model list | Upstream since 30 September 2026 | Cloud tags only |
| Command A+ | Yes | Community GGUFs | Not in the library; command-a is the older 111B model |
| Granite 4.2 8B | Granite architecture listed | IBM publishes a GGUF | Yes, granite4.2, 128K |
One trap matters for privileged material: Ollama’s cloud tags, such as gemma4:cloud and the GLM-5.3 entries, run on Ollama’s servers. Pull a local tag, or block cloud tags at the proxy.
Matching the model to the legal task
Clause extraction and contract review
Extraction is the most forgiving task for small models. Give the model a schema (governing law, term, termination triggers, liability cap, assignment, change of control) and ask for the clause text and its section number with each value. Gemma 4 26B A4B and Qwen3.6-35B-A3B handle this at volume on one GPU. Validate every field against the source text in code, and send mismatches to a reviewer. The contract analysis use case shows that workflow with playbook deviations.
Contract comparison and redlines
Comparing a counterparty draft with your standard terms needs both documents in context at once, plus the playbook. That is where 128K tokens gets used up and where the cache table above decides the hardware. Let a diff tool find the changed text, then ask the model to classify each change against the playbook: acceptable, needs a fallback position, or escalate. Qwen3.8-27B is the better reasoner here; keep the final markup a lawyer’s job.
Deposition and transcript summaries
A multi-day deposition record can outgrow a single 128K window. Summarise by session with page and line references, then merge the summaries. Ask for contradictions with exhibits and earlier testimony as a separate pass, each with its page-and-line cite. Long-context MoE models keep this affordable because the summary passes are cheap.
Legal research with citations
Research is where models fail most visibly. Do not ask a model what the law is; ask it to answer from retrieved authorities you supplied, cite each proposition to a passage, and say when the sources do not answer the question. Command A+ can return citation spans that link each sentence to the supporting document, and the AI legal research agent fixes jurisdiction and date before it searches. Every case still goes through a citator before filing; the legal research use case shows where those checks sit.
Legal drafting
For first drafts of clauses, letters and memos, a model works best from your firm’s templates and precedent bank rather than from its training data. Keep prompts tied to a precedent, generate alternatives, and have the supervising lawyer choose. Drafting rarely needs the largest model; tone and consistency with house style matter more, and small models can be tested quickly.
Hallucinated citations: from Mata v. Avianca to 2026
On 22 June 2023, Judge P. Kevin Castel of the Southern District of New York sanctioned two lawyers and their firm in Mata v. Avianca for filing non-existent opinions with fake quotes generated by ChatGPT, and for standing by them after the court questioned their existence. The penalty was $5,000, plus letters to the plaintiff and to each judge falsely named as an author.
The problem has grown since. On 6 June 2025, the Divisional Court of England and Wales held in Ayinde v London Borough of Haringey that freely available generative AI tools cannot conduct reliable legal research, and told heads of chambers and managing partners to put practical measures in place. In June 2026, Senior Judge Sharion Aycock of the Northern District of Mississippi sanctioned all four lawyers on both sides of Withers v. City of Aberdeen, fining each and barring two from practising in the district for two years, according to Bloomberg Law. Damien Charlotin’s public database listed 2,202 court decisions involving hallucinated content on 19 October 2026, 1,501 of them in the United States.
Retrieval reduces the risk without removing it. A preregistered Stanford study published in 2024 found that Lexis+ AI and Thomson Reuters’ AI research tools each hallucinated between 17% and 33% of the time, less than a general chatbot but far from zero. A local model inherits the same failure mode, so verification belongs in the workflow, not in a policy memo.
Confidentiality, privilege and ABA Formal Opinion 512
The American Bar Association’s Standing Committee on Ethics and Professional Responsibility issued Formal Opinion 512 on 29 July 2024, its first on generative AI. It points to the Model Rules on competence (1.1), confidentiality (1.6), communication (1.4) and fees (1.5), along with candour toward the tribunal and supervision duties.
- Rule 1.6. Before client information goes into a tool, the lawyer weighs the risk that it is disclosed to or accessed by others, inside or outside the firm. For tools that learn from what they are given, the opinion calls for the client’s informed consent, and a boilerplate clause in an engagement letter does not supply it.
- Rule 1.1. Lawyers need a reasonable understanding of the tool’s benefits and risks, and must review what it produces before relying on it.
- Rule 1.5. A lawyer may bill the time spent prompting a tool and reviewing its draft, but in most cases may not charge the client for learning how to use it.
ABA opinions guide rather than bind; state bars and courts apply their own versions of the rules. Outside the US, the Law Society and the courts of England and Wales point the same way. This article is general information, not legal advice.
Why firms keep legal models on their own servers
A model running on hardware the firm controls changes the confidentiality analysis in concrete ways. No outside provider receives the prompt, so there is no vendor retention policy to read and no subprocessor list to track. Nothing the firm sends trains a model that other customers query. Ethical walls can be enforced where the documents already live, through the same access controls that govern the document management system.
It also makes cost predictable. Long-context legal work uses many tokens: two long agreements and a playbook in one prompt can approach the 128K window. On owned GPUs, a heavy diligence month costs the same as a quiet one.
The trade-off is that the firm takes on model selection, patching and evaluation. That is manageable with a small shortlist like the one above and a fixed test set. For the wider buying decision, our guide for law firm IT and risk teams and the legal services solution page cover architecture, privilege and procurement.
How VDF AI fits legal model deployments
VDF AI is software that a firm or legal department installs on its own servers, in a private cloud or in an air-gapped network. VDF AI Router registers the models from this guide, served through vLLM, Ollama or another local endpoint, and its air-gap mode keeps every request on those local models. A Qwen3.8-27B endpoint for research and a Gemma 4 endpoint for bulk extraction can sit behind the same routing policy.
The workflows above map to governed agents. The legal agents catalogue includes a general legal assistant and a research agent that cites each proposition. Retrieval respects the permissions of the person asking, so matter teams see only their matters. High-risk steps, such as sending a markup to a counterparty, can require human approval, and every agent run leaves an audit trail of prompts, retrieved documents and approvals inside the firm’s environment. The on-premises contract review playbook walks through a deployment step by step. A firm can begin with a three-month trial of the platform on its own hardware.
Sources
Verified 22 October 2026.
- Qwen3.8-27B model card and Qwen3.6-35B-A3B model card
- Gemma 4 31B model card and Gemma 4 26B A4B
- gpt-oss-120b model card and ggml-org gpt-oss GGUF builds
- Mistral Small 4 model card
- GLM-5.3-Flash model card
- Command A+ model card
- Granite 4.2 8B model card
- Llama 3.3 70B Instruct model card
- SaulLM-54B-Instruct and Saul-7B-Instruct model cards
- Lawma 8B model card
- Vals AI LegalBench leaderboard, updated 13 October 2026
- LegalBench paper, Guha et al., arXiv:2308.11462
- Hallucination-Free? Assessing the Reliability of Leading AI Legal Research Tools, arXiv:2405.20362
- Mata v. Avianca, Opinion and Order on Sanctions, S.D.N.Y. 22-cv-1461, 22 June 2023
- Ayinde v London Borough of Haringey, [2025] EWHC 1383 (Admin)
- Bloomberg Law: lawyers on both sides of a Mississippi case punished for AI errors
- AI Hallucination Cases database, Damien Charlotin
- ABA news release on Formal Opinion 512, 29 July 2024
- vLLM supported models and Ollama model library
Keeping matter files on your own servers? See the legal services solution or book a demo.