Dike
Model ReportModel Engineering
EGSAAEGCC

Dike Model: Legal Document Typing That Knows When to Ask a Human

A compact 278M-parameter model that types legal documents across five jurisdictions in real time, matches a model roughly 100 times its size where it answers, and sends everything else to review.

Dike Research Team
September 2026
7 min read
Dike Model: Legal Document Typing That Knows When to Ask a Human
Key Metrics
Measured on held-out documents
278M
Model parameters

A 1.1 GB file that runs on ordinary hardware

845/s
Documents per second

On one GPU; 30 per second on a CPU alone

99.24%
Agreement on answered

Domain labels on the 62.4% it answers on its own

0 of 2,704
Wrong types auto-accepted

Document type on unseen documents

Executive Findings & Empirical Takeaways
  • 1The Dike model reproduces the domain labels of a reference model roughly 100 times its size, with 99.24% agreement on the 62.4% of held-out documents it chooses to answer (1,480 documents, confidence bar 0.975). The rest go to a ranked review queue instead of getting a guess.
  • 2Document type is close to solved for known sources: a source prefix in the document ID determines the type for all but a handful of documents. The model is the safety net for new sources: on 2,704 unseen documents it was right 99.8% of the time, auto-accepted 97.3% of them, and made zero errors among the ones it auto-accepted.
  • 3It is fast enough to sit in the ingestion path: 845 documents per second on one GPU, 30 per second on a CPU alone, with identical answers on both. That is roughly 170 times faster than the large reference model that labeled our training data.
  • 4Every number here is agreement with a large reference model, not accuracy against lawyers. No human-labeled reference set exists yet, so we built the model to make its uncertainty visible and its abstentions cheap, and every response carries a provisional warning until that changes.

1. Metadata decides whether legal AI can be trusted

A legal search API is only as good as its metadata. Whether a record is a statute, a regulation, a court ruling or a treaty, and which area of law it belongs to, decides what a query retrieves and what an AI agent is allowed to cite. Across our corpus that metadata was uneven: some sources were clean, others had never been typed, and the corpus keeps growing. A large language model can type documents well, but it is slow and expensive at this scale. We wanted its judgment at the cost of a small model, in a shape a product can depend on: fast, typed, calibrated, and willing to say "I am not sure".

2. Big-model judgment at small-model speed

The Dike model gives two typed answers instead of free text: a domain (12 labels, from financial to criminal) and a document type (6 labels). To build it, a large open model, Qwen3.8-27B, first labeled tens of thousands of documents. Each document was asked several ways, so that the order of the answer choices could not sway the result, and answers that did not hold up were re-checked and given less weight. We then trained a compact 278M-parameter multilingual encoder, XLM-RoBERTa base, to reproduce those judgments. Nearly half of the labeling effort went to the documents the model found hardest, not to easy ones. The result keeps most of the large model's judgment at a fraction of its cost.

Cleaning the labels paid off

Where the large model wavered on a document (14,050 of them), we asked it again in six different ways and weighted each label by how many of those answers agreed. Together with 12,116 more labels on hard cases, this raised the share of documents the Dike model can answer automatically by 1.4 points, at the same agreement on the ones it answers.

3. Four guardrails that make it safe to automate

Accuracy alone does not make a classifier safe to automate. What matters is what happens on the documents it gets wrong, so much of the engineering went into the guardrails around the model rather than the model itself.

The model's answer is never the last word on a conflict

If the model is at least 90% sure a document is a different type than its source says, the answer is not overwritten. It is flagged for review with the reason attached. That is how we found real treaties and founding deeds stored as legislation.

GuardrailWhat it doesWhy it matters
Calibrated confidenceConfidence is fitted on held-out data (expected calibration error 0.020)Thresholds mean something, and drift is measurable
Three actionsEvery answer is accept, review or escalateOnly confident answers are ever automatic
ID rule cross-checkA source prefix fixes the document type; the model can only disagree loudlyMisfiled treaties and fatwas go to a person, not the index
"Unclear" is never auto-acceptedA dedicated label for documents that fit nothingThe model cannot hide a bad guess behind a category

4. What it does on documents it never saw

The model rows below use held-out documents that were excluded from training; the ID-rule row covers the whole corpus. Agreement is measured on the documents the model answers on its own, and coverage is the share it chose to answer.

What abstaining buys you

Across the full corpus the model auto-accepts about 60% of domain answers and sends the rest to a review queue ranked by how uncertain it is. A reviewer's time goes to the documents where a wrong label is most likely, not to the ones the model is sure about.

AnswerDocumentsAnswered automaticallyAgreement on answered
Domain (bar 0.975)1,480 held out62.4%99.24% with the reference model
Document type, model alone2,704 held out97.3%99.8% overall, 0 wrong among accepted
Document type, ID ruleWhole corpusAll but a handfulBy construction, from the source

5. What an answer looks like

The API returns the same shape a language-model call would, so it slots into agent code without special handling. For each question it returns a choice, a calibrated confidence, the full probability distribution and an action. It also names the model, counts tokens, and, while the calibration is provisional, says so in a warning on every response.

FieldExampleMeaning
choicefinancialThe most probable label
confidence0.991Calibrated against the reference model
actionacceptaccept, review or escalate
sourceid_rule / modelWhich mechanism produced a document type
warningsprovisionalPresent until refitted on human labels

6. Small, fast and boring to run

The Dike model is a 1.1 GB file. It answers 845 documents per second on one GPU and 30 per second on a CPU, with the same answer on both. One document takes under 10 ms on a GPU and about 30 ms on a CPU. In our parity test, 100 of 100 documents got the same answer on both. We ran the real HTTP service through a 20-check release test on 500 documents it had never seen, and it passed all 20: malformed input gets a clean error instead of a crash, the same request always returns the same answer, results do not change with batch size, and the server log never contains document text. Under 16 parallel clients, while the GPU was also busy with a training job, it held 71 requests per second at a 95th percentile of 248 ms.

7. What this unlocks for Dike users

Typed metadata turns search from "find text like this" into "find this kind of authority". It lets queries filter by document type and legal domain across every jurisdiction on one shared taxonomy, and lets agents cite only answers marked accept while treating review and escalate as suggestions. New sources are onboarded by checking a small verified sample first, so the model is never trusted alone on something it has not seen. Because the model runs on ordinary hardware and answers in milliseconds, it is built to type documents as they are ingested rather than in a nightly batch, which keeps metadata current as the corpus grows. We are rolling it out in shadow mode first: it logs its answers without writing them anywhere.

8. Where the next gains come from

More labels stopped helping. Agreement with the reference model plateaued around 92%, and the large model itself gave the same answer across differently ordered questions only about 89% of the time. A model cannot be more certain than the labels it learns from, so the next gains come from better labels: human review of the documents where the large model wavers, not a bigger model. Extra pretraining on hundreds of thousands of our own documents added 0.6 points of agreement and 1.0 point of coverage. We measured it and kept it as an option rather than adopting it.

9. Limitations and what comes next

Every domain number is agreement with a large reference model. No lawyer has labeled a reference set yet, so we cannot state the model's accuracy against people, and we do not. The stated confidence is calibrated against the reference model and is marked provisional in every response until it is refitted on human labels. The model is weaker than an earlier version at spotting a treaty or a fatwa filed under legislation, which is why the ID cross-check and the review queue stay in place. Kuwait, Qatar and the UAE have less training data than Egypt and Saudi Arabia. The next step is a human-labeled reference set: it replaces the large model as the yardstick, refits the confidence and removes the provisional warning.