From-Scratch Small Language Models for Legal and Financial Text: A Staged Pretraining Recipe and an Honest Account of Their Limits

We build two decoder-only language models from scratch — 125.8M and 528.5M parameters — pretrained on US case law, SEC filings, and educational web text, then fine-tuned for legal and financial question answering. We report three findings we believe are broadly useful beyond this specific project. First, naively mixing five heterogeneous pretraining sources at their natural size proportions measurably hurts held-out quality on the original, smaller sources (fineweb-edu perplexity worsens from 20.73 to 22.82 despite more total training data); a staged Warmup-Stable-Decay schedule, adapted from MiniCPM and SmolLM2, recovers this and improves perplexity on every shared domain over the smaller model. Second, a subtle supervised fine-tuning failure mode — two datasets sharing clause-category names under different task framings (extraction vs. classification) — causes the model to collapse to bare label output regardless of what is asked; we document the bug, its 100% reproduction rate, and the fix. Third, and most centrally, we run both models through five externally accepted benchmark categories via lm-evaluation-harness and find a sharp, consistent split: open-book contract-clause tasks are a real, usable capability, while closed-book legal knowledge and reasoning sit at or below random chance for both model sizes. We further report a methodological case study on legal-domain contamination checking: a naive n-gram overlap check flags an implausible 8,712 lines as "contaminated," which on inspection are uniformly generic legal boilerplate rather than evidence of benchmark leakage; a stricter 40-word contiguous-run threshold combined with per-hit provenance attribution narrows this to 5 of 1,853 documents (0.27%), each independently explainable and none affecting the reported results. We release both models, the fine-tuning data recipe, an in-browser ONNX deployment, and all evaluation code. Code, model weights, and the full evaluation codebase: https://github.com/DeependraVerma/legal-slm-125M. Model cards: https://huggingface.co/DeependraVerma.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-07-23
DOI
https://doi.org/10.5281/zenodo.21508660
Primary Topic
Artificial Intelligence in Law
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
preprint

From-Scratch Small Language Models for Legal and Financial Text: A Staged Pretraining Recipe and an Honest Account of Their Limits

D Verma
Zenodo (CERN European Organization for Nuclear Research)
Artificial Intelligence in Law
preprint

From-Scratch Small Language Models for Legal and Financial Text: A Staged Pretraining Recipe and an Honest Account of Their Limits

D Verma
preprint en

Abstract

We build two decoder-only language models from scratch — 125.8M and 528.5M parameters — pretrained on US case law, SEC filings, and educational web text, then fine-tuned for legal and financial question answering. We report three findings we believe are broadly useful beyond this specific project. First, naively mixing five heterogeneous pretraining sources at their natural size proportions measurably hurts held-out quality on the original, smaller sources (fineweb-edu perplexity worsens from 20.73 to 22.82 despite more total training data); a staged Warmup-Stable-Decay schedule, adapted from MiniCPM and SmolLM2, recovers this and improves perplexity on every shared domain over the smaller model. Second, a subtle supervised fine-tuning failure mode — two datasets sharing clause-category names under different task framings (extraction vs. classification) — causes the model to collapse to bare label output regardless of what is asked; we document the bug, its 100% reproduction rate, and the fix. Third, and most centrally, we run both models through five externally accepted benchmark categories via lm-evaluation-harness and find a sharp, consistent split: open-book contract-clause tasks are a real, usable capability, while closed-book legal knowledge and reasoning sit at or below random chance for both model sizes. We further report a methodological case study on legal-domain contamination checking: a naive n-gram overlap check flags an implausible 8,712 lines as "contaminated," which on inspection are uniformly generic legal boilerplate rather than evidence of benchmark leakage; a stricter 40-word contiguous-run threshold combined with per-hit provenance attribution narrows this to 5 of 1,853 documents (0.27%), each independently explainable and none affecting the reported results. We release both models, the fine-tuning data recipe, an in-browser ONNX deployment, and all evaluation code. Code, model weights, and the full evaluation codebase: https://github.com/DeependraVerma/legal-slm-125M. Model cards: https://huggingface.co/DeependraVerma.

Zenodo (CERN European Organization for Nuclear Research)
Peace, Justice and strong institutions
Artificial Intelligence in Law
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

From-Scratch Small Language Models for Legal and Financial Text: A Staged Pretraining Recipe and an Honest Account of Their Limits — D Verma · Zenodo (CERN European Organization for Nuclear Research) (2026) | TGRS Research Map | TGRS