Fine-tuning Falcon for judicial headnotes
Preliminary results from training 7B and 40B open-weight models on Supreme Court headnotes
On September 5, the Madhya Pradesh High Court asked, through AWS, whether AI could draft headnotes—the structured summaries of statutes, issues, and holdings printed above reported judgments. Because court data and inference often have to stay on-premises, we built a 4,678-pair dataset from 25,151 Supreme Court pages and fine-tuned Falcon 7B and 40B with QLoRA against five-shot GPT-3.5. First commit September 13; three runs across three GPU tiers September 18; capabilities report delivered September 21.
At 4% of GPT-3’s size, Falcon 7B learned Indian law-reporter form in under a day with no examples in its prompt. Falcon 40B passed two full epochs of 7B before finishing one. Five-shot GPT-3.5 still stays closer to the record.
The 2023 context budget
GPT-3.5 Turbo reads 4,096 tokens at a time, and its 16k variant, released in June, reads 16,384. Falcon reads 2,048. A reported judgment routinely runs past all of these, so no model available today reads one whole.
Few-shot prompting tightens this further. Our GPT-3.5 baseline runs on the 16k model with five example pairs, each a judgment summary and its published headnote. Even with the shortest examples chosen, they take up more than half of the window on every call, before the judgment in hand is added. Fine-tuning moves the examples into the weights and leaves the window to the case.
A judgment of 12,597 tokens, the 46 sentences the summarizer keeps, and what fits in a 2023 window.
Mohd. Ahmed Khan v. Shah Bano Begum (1985), sentence by sentence. Each bar is one sentence, as wide as its token count.
Point at a sentence to read it.
Semantic compression by rhetorical role
Both systems took their input from jhana’s existing corpus, and nothing in the extraction pipeline was built for this experiment. Every judgment in the corpus already carries reconstructed formatting, separated footnotes, extracted tables, fourteen classes of named entity, and an extractive summary from the models that OpenNyAI released1 for Indian judgments.
Those models work in two steps. A classifier trained on the corpus2 of Kalamkar et al., 354 judgments and 40,305 labeled sentences, assigns each sentence one of twelve rhetorical roles: preamble, facts, ruling by the lower court, issues, arguments of the petitioner and the respondent, analysis, statute, precedent relied on and not relied on, ratio, and ruling by the present court. A summarizer in the BERTSUM3 family then takes those labels and returns five sections: facts, arguments, issues, analysis, and decision. Issue and decision sentences are copied whole, and the rest are ranked within a length budget. We prepend the case title, citations, and bench, and drop the preamble.
Every sentence in this semantic summary appears in the judgment. In the figure above, the colored bars are the summary of one judgment: 46 of its 358 sentences, and 1,693 of its 12,597 tokens.
Dataset and training
We scraped 25,151 Supreme Court pages from LIIofIndia4, splitting each into its citator line, acts, and headnote. We normalized party names and joined the pages to our corpus, first by exact title and then by fuzzy match at a token-sort ratio of 90 or above. That gave 4,678 pairs of summary and headnote from the Supreme Court Reports, about 3,200 of them in the reporter’s formal “HELD” form, mostly from the 1960s through the 1980s.
Each pair was written as an instruction (“Write headnotes for the judgment below”), the summary, and the reporter’s block: citator line, “Acts and Questions,” and headnote. Sequences are truncated at Falcon’s 2,048 tokens, which covers the summary and the opening of the block.
We follow5 the QLoRA recipe (4-bit NF4 weights, a paged AdamW optimizer, a learning rate of 2 × 10−4 with 3% warmup, gradient clipping at 0.3, and batches grouped by length) with rank-8 adapters and a cosine schedule. We kept the same learning rate for the 40B model, where the paper halves it, and sized batches to what each card could hold. At retail prices, the cloud cost of GPU rental for training alone is more than INR 40,000.
| Model | Hardware | Batch | Pairs seen | Epochs | GPU-hours | Loss, start → end |
|---|---|---|---|---|---|---|
| Falcon 7B | 4× V100 16GB | 1 | 3,050 | 0.65 | 27 | 1.93 → 1.65 |
| Falcon 7B | 2× A100 40GB | 4 | 9,360 | 2.0 | 34 | 1.99 → 1.63 |
| Falcon 40B | 1× A100 80GB | 8 | 2,880 | 0.62 | 24 | 1.72 → 1.50 |
The 7B model trains in about 8GB per card on V100s from 2017. The 40B model fits on a single 80GB A100.
Training loss
Falcon 40B reaches a loss of 1.50 before one epoch; Falcon 7B settles at 1.63 after two.
Training loss against steps for the three runs, as exported from Weights & Biases.
The runs use batches of 1, 4, and 8, so a step is a different number of pairs in each. Both 7B runs follow the same curve across hardware and batch sizes, falling from about 1.95 to 1.65 within the first epoch and reaching 1.63 after two. Falcon 40B starts lower and falls faster. After 360 steps, 2,880 pairs, it is at 1.50, below where the 7B model ends after more than three times as much data, and it was still falling when the run stopped. In perplexity, that is about 4.5 against 5.1.
| Run | Run ID | Started (UTC) | GPU | Steps logged | History |
|---|---|---|---|---|---|
| 1epoch-headnotes-falcon-7b | aa5f2yet | Sep 18, 2023, 09:44 | 4× V100 16GB | 3,050 | Download |
| 2epoch-headnotes-falcon-7b | 2n3tyxhy | Sep 18, 2023, 12:11 | 2× A100 40GB | 2,340 | Download |
| 1epoch-headnotes-falcon-40b | cqn18saj | Sep 18, 2023, 12:19 | 1× A100 80GB | 360 | Download |
Please email for download access sharing.
Falcon 7B against GPT-3.5 few-shot
We gave both systems the semantic summary of the same Supreme Court judgment, on section 15 of the Rajasthan Imposition of Ceiling on Agricultural Holdings Act, 1973, and set each output beside the reported headnote.
With no examples in its prompt, the fine-tuned 7B model reproduced the reporter’s whole block. It opened with the acts and the question, turned on “Dismissing the appeal, it was, HELD:”, marked its propositions with page references such as “[247B-C; 248A]”, and reached the right holding.
GPT-3.5 with five examples stayed closer to the record. It named section 15, the protection of Article 31A(1)(a), the Constitution Bench decision in Bansidhar v. State of Rajasthan, and the dismissal of the appeals. The Falcon model, alongside the right holding, added facts that the judgment does not contain: a farmer, 20 acres, and a civil judge in Jodhpur.
The fine-tuned models also fail to stop. Across runs the output does not terminate: it writes on to the token limit and loops, restating a holding it has already given, as the sample above does before it is cut off. The cause is in our data. Training sequences were cut at 2,048 tokens and carried no end-of-sequence token, so the model was never shown where a headnote ends. Nontermination and looping are the key error of these runs.
Deployment
For use today, GPT-3.5 few-shot is the stronger system on fidelity to the judgment, and it is the one we would deploy first. The Falcon runs are a proof of concept for the other route. A 7B open model, trained in under a day on hardware a court can own, learned the reporter’s form from 4,678 pairs and gave the prompt window back to the judgment. In-house weights give the court complete control over training and inference, and its own IP can be extended later to more sensitive uses.
The report
The capabilities report of September 20, 2023, prepared in partnership with AWS.
Download the report (PDF, 12 slides). The contact slide is left out.
Notes
- OpenNyAI, opennyai: named entity recognition, rhetorical roles, and extractive summarization for Indian court judgments. Kalamkar et al., “Named Entity Recognition in Indian Court Judgments,” NLLP 2022. ↩
- Kalamkar et al., “Corpus for Automatic Structuring of Legal Documents,” LREC 2022, 4420–4429. ↩
- Liu and Lapata, “Text Summarization with Pretrained Encoders,” EMNLP 2019. ↩
- Legal Information Institute of India (LIIofIndia), Supreme Court of India. ↩
- Dettmers et al., “QLoRA: Efficient Finetuning of Quantized LLMs,” 2023. ↩
- Technology Innovation Institute, Falcon-7B and Falcon-40B, 2023.
Retrospective, 2026: getting bitter-lessoned
This sprint predates Suit, and it changed how we built Suit.
Compressing a judgment through an extractive summarizer and fine-tuning a small model to save prompt tokens was a rational answer to windows of 2,048 and 4,096 tokens. Within a year those windows had grown by orders of magnitude, and frontier models were improving faster than any fine-tune of ours could follow. We stopped competing on base-model weights for a single task and built a harness that runs on whichever model is strongest.
The experiment also tried to learn the wrong thing. We trained on finished headnotes, so the model was asked to learn correctness and taste at once, from the output alone, regardless of agency or process. Nothing in the training asked what it had read. The 7B model learned to sound like a Supreme Court reporter and, in the same output, made up a farmer, 20 acres, and a civil judge in Jodhpur. Our scrape was noisy too, but a cleaner one would have taught the same thing.
Core, not Penumbra is the pivot that came, in part, out of this. We stopped trying to learn taste, on which reasonable experts disagree, and decoupled it from reading. Suit certifies whether the minimum evidence was considered. A verifier over real legal work gives agents, and open-weight models, a signal that can be hill-climbed: reinforcement learning with verifiable rewards, where this experiment had only imitation.
The headnotes work continued at the Madras High Court, where human experts preferred jhana’s headnotes to GPT-4o’s 73.1% of the time and to SCC’s 58.2% of the time. The requirement that a court’s weights and files stay in its own infrastructure carried into our work with the High Courts of Sikkim and Gujarat.