Industry & Use Cases

Best LLM for Legal Work (2026): Open-Weight Models for Contracts, Research and Drafting You Can Run Locally

Which open-weight language models suit legal documents, legal research and drafting in October 2026, checked against Hugging Face model cards, the Vals AI LegalBench leaderboard and the serving lists of vLLM, llama.cpp and Ollama, with the memory a 128K-token contract needs and what ABA Formal Opinion 512 asks of lawyers.

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.

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.

SituationPickWhy
One 32 GB workstation GPUQwen3.8-27B82.43% on LegalBench, 262K native context, Apache 2.0
One 24 GB GPU, many concurrent usersGemma 4 26B A4BMixture-of-experts with 256K context and a small KV cache
Long bundles on a 32 GB cardQwen3.6-35B-A3B2.7 GB of cache for a 128K-token prompt
One 80 GB server GPUgpt-oss-120b75.94% on LegalBench; OpenAI says it fits a single H100
Multi-GPU server, highest open score that fits a rack slotGLM-5.3-Flash83.93% on LegalBench, MIT licence, 1M-token context
Research answers tied to sourcesCommand A+Built-in citation spans that point at the supporting passage
French, German or Italian mattersMistral Small 4 or Gemma 4 31BMistral lists dozens of languages; Gemma 4 supports 35+ out of the box

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)SizeLicenceNative contextLegalBench (Vals)Worth knowing
Qwen3.8-27B (Qwen)27.8B dense, vision includedApache 2.0262K, extendable to 1M82.43%Published August 2026; reads page images as well as text
Qwen3.6-35B-A3B (Qwen)36B MoE, about 3B activeApache 2.0262KNot listedFast on modest GPUs
Gemma 4 31B and 26B A4B (Google)31.3B dense; 25.8B MoEApache 2.0256KNot listedHybrid sliding-window attention keeps the cache small
gpt-oss-120b and gpt-oss-20b (OpenAI)117B and 21B MoEApache 2.0 plus usage policy128K75.94% and 70.85%MXFP4 weights fit one 80 GB or 16 GB device
Mistral Small 4 (Mistral)119B MoE, 6.5B activeApache 2.0256KNot listedLists French, German, Italian, Spanish, Dutch and Portuguese
GLM-5.3-Flash (Z.ai)320B MoE, 18B activeMIT1M83.93%Needs about four H200-class GPUs at FP8
Command A+ (Cohere)218B MoE, 25B activeApache 2.0128K61.42%Citation spans; trained on 48 languages
Granite 4.2 8B (IBM)8.8B denseApache 2.0128K, extension to 512KNot listedReleased 25 August 2026; small enough for laptops
Llama 3.3 70B (Meta)70.6B denseLlama 3.3 Community License128K77.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.

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.

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:

  1. 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.
  2. 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.
  3. 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.

Model4-bit weightsKV cache at 128KTotal before runtime overheadFits on
Gemma 4 26B A4B15.8 GB2.9 GB18.7 GBOne 24 GB GPU
gpt-oss-20b12.1 GB3.2 GB15.3 GBOne 24 GB GPU
Qwen3.6-35B-A3B22.0 GB2.7 GB24.7 GBOne 32 GB GPU
Qwen3.8-27B17.0 GB8.6 GB25.6 GBOne 32 GB GPU; 24 GB with an 8-bit cache
Granite 4.2 8B5.4 GB21.5 GB26.9 GBOne 32 GB GPU
Gemma 4 31B19.1 GB11.6 GB30.7 GBOne 48 GB GPU
gpt-oss-120b63.4 GB4.8 GB68.2 GBOne 80 GB GPU
Mistral Small 473.0 GB3.0 GB76.0 GBOne 96 GB GPU
Llama 3.3 70B43.1 GB42.9 GB86.0 GBTwo 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.

ModelvLLMllama.cppOllama library
Qwen3.8-27BYes, Qwen3.5 architectureCommunity GGUFs (Unsloth)Yes, qwen3.8:27b, 18 GB, 256K
Qwen3.6-35B-A3BYesCommunity GGUFs (Unsloth)Yes, qwen3.6:35b
Gemma 4YesMaintainer GGUFs (ggml-org)Yes, gemma4 from E2B to 31B
gpt-ossYesMaintainer MXFP4 GGUFs (ggml-org)Yes, gpt-oss
Mistral Small 4Yes, Mistral3 architectureCommunity GGUFsNot in the library
GLM-5.3-FlashvLLM recipe; not yet in the supported-model listUpstream since 30 September 2026Cloud tags only
Command A+YesCommunity GGUFsNot in the library; command-a is the older 111B model
Granite 4.2 8BGranite architecture listedIBM publishes a GGUFYes, 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.

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.

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.

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.

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.

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.


Keeping matter files on your own servers? See the legal services solution or book a demo.

Frequently asked questions

Which local LLM is best for legal documents?

For one workstation GPU, Qwen3.8-27B is the strongest open-weight choice we found. It scored 82.43% on the Vals AI LegalBench leaderboard in October 2026, carries an Apache 2.0 licence and reads 262K tokens natively, enough for a long agreement with its schedules. At 4-bit it needs about 17 GB for weights, so a 32 GB card holds a full 128K-token contract. With an 80 GB server GPU, gpt-oss-120b is the usual alternative. Test any pick on your own clause library first.

Is there a good open-source legal LLM?

Not one we would deploy as the main model today. Equall's SaulLM family is MIT-licensed and was trained on legal text, but its 7B, 54B and 141B checkpoints date from 2024, sit on Mistral and Mixtral bases with 32K context, and have not been updated since July 2024. Lawma 8B beats GPT-4 on 260 court-database classification tasks, yet its authors say to use it only for those tasks. Current general models score far higher on LegalBench, so most firms adapt them with retrieval instead.

Which LLM is best for legal research with citations?

The model matters less than the retrieval and checking around it. Stanford researchers found commercial legal research assistants built on retrieval still hallucinated between 17% and 33% of the time in 2024. Pair a strong long-context model such as Qwen3.8-27B or gpt-oss-120b with retrieval over sources you trust, require a pinpoint citation for each proposition, and verify every authority in a citator before anything is filed. Command A+ can tag which retrieved passage supports each sentence, which speeds up that review.

Can lawyers use a local LLM without breaching confidentiality?

A model on servers the firm controls removes the outside provider from the picture, which is the disclosure risk ABA Formal Opinion 512 asks lawyers to weigh under Model Rule 1.6. It does not end the analysis. Lawyers still need competence with the tool under Rule 1.1, must review its output, and should keep matter-level access controls so one client's documents cannot surface in another team's answers. If a tool learns from inputs, the opinion calls for the client's informed consent first.

How much GPU memory does a long contract need?

Count the weights and the KV cache for the context you plan to use. A 128K-token prompt, very roughly 200 pages of dense contract text, costs 2.7 GB of cache on Qwen3.6-35B-A3B but 8.6 GB on Qwen3.8-27B and 42.9 GB on Llama 3.3 70B, all at 16 bits. Add 17 to 22 GB of 4-bit weights for the first two models. A 24 GB card suits Gemma 4 26B A4B at full 128K context; a 32 GB card covers the Qwen picks.

Filed under
local LLMopen-weight modelslaw firm AIlegal privilege AIon-premises AIdata sovereignty
On-Prem AI

Plan your on-prem AI deployment

Book an architecture call and we will scope a private, on-prem AI deployment for your environment — integrations, hardware, and governance included.

Keep reading