A 125-million-parameter base language model

Legal & financial language, learned from nothing.

Trained from a random initialization on 2.04 billion tokens of US case law, SEC filings and educational web text, then asked to keep writing.

Built end-to-end by Deependra Verma Generative AI Researcher, AI Engineer, and AI Team Lead

Try it live ↓Chat with the fine-tuned model →
125.8M
parameters
7.76
held-out perplexity
2.04B
unique tokens
16,384
BPE vocabulary
01
Playground

Complete the passage

Give it the opening of a brief, a filing, or an opinion, then watch the model continue it, one token at a time. These are the real 125M model weights, generating live.

Playground

runs entirely in your browser

Starters
Length96 tokens
Creativity0.80
The completion will appear here, streamed token by token as the model writes it.

This is a base model: it continues text, it does not answer questions. It will confidently invent case names, citations and figures. Never rely on its output as legal, financial or factual advice.

02
Chat

Now ask it a question

Fine-tuned on 5,846 grounded legal & financial Q&A pairs, the same 125M model stops rambling and starts answering. It is a separate model, legal-slm-125m-sft ↗, that streams its reply as you watch.

Base
slm-125m-base
our own pretrained base
Fine-tuned on
5,846 Q&A
Gemini-distilled + judged
SFT val loss
2.06
from 4.27
Fine-tune
1×L4 · ~80s
full fine-tune
Ask the assistant

runs entirely in your browser

Ask a legal or financial question. Pick a starter below or type your own.

A 125M fine-tuned model. It answers one question at a time and will confidently invent case names and figures. Not legal or financial advice.

03
The numbers

Small model, honest accounting

Trainable parameters
125,848,320
tied embeddings
Unique training tokens
2.04 billion
after dedup + decontam
Tokens seen
4.08 billion
2 epochs
Held-out perplexity
7.76
full 20.6M-token val set
Final validation loss
2.049
cross-entropy
04
Training

Perplexity, falling

Held-out perplexity measured on a 20.6-million-token validation set the model never trained on. Two epochs, 38,890 steps, from a random start to 7.76.

79111315177.761k20k38.9kOPTIMIZER STEP →
05
Architecture

A Llama, in miniature

Architecture
Llama-style decoder
Layers · dim · heads
12 · 768 · 12
Head dimension
64 (multi-head)
Context length
1,024 tokens
Positional
RoPE (θ = 10,000)
Normalization
RMSNorm (1e-5)
Activation
SwiGLU (silu)
Vocabulary
16,384 byte-level BPE
Embeddings
tied input / output
Precision
bfloat16
tokens → 16,384 BPE embedding
01
02
03
04
05
06
07
08
09
10
11
12
RMSNorm → tied LM head → logits
12 decoder blocks · RoPE · SwiGLU

Pretrained on 8 × B200 GPUs (on-prem) · bfloat16 compute

06
The corpus

Two billion tokens, hand-cleaned

Streamed from public datasets, then run through a deterministic pipeline: rule-based cleaning, an OCR-garble gate, MinHash-LSH near-duplicate removal, and 13-gram decontamination against the CaseHOLD and LexGLUE benchmarks.

2.04BTOKENS
  • 35%US case lawHFforLegal/case-law
  • 42%SEC filingsPleIAs/SEC
  • 23%Educational webfineweb-edu
07
Caveats

What this is, and is not

§

It is a base (pretrained) model, a next-token predictor. It has never been instruction-tuned, aligned, or shown a single question-answer pair.

§

It will fabricate case names, docket numbers, statutes and financial figures with total confidence. Everything it writes is fiction shaped like law.

§

English only, 1,024-token context, 125M parameters. It is a study in doing a lot with very little. It is not a product, and never legal or financial advice.

08
About

Who built this, and why

Deependra Verma — a Generative AI Researcher, AI Engineer, and AI Team Lead— designed and built legal-slm-125M end to end: the data pipeline, the byte-level tokenizer, pretraining from a random initialization, honest held-out evaluation, this live demo, and the supervised fine-tuning that turned it into a Q&A assistant.

It exists as a hands-on study in language-model engineering — proof of being able to take a model from nothing to a working, evaluated, deployed system, with every number on this page coming from a real training or evaluation run, not a projection.

GitHub ↗Hugging Face ↗
09
FAQ

Questions worth answering honestly

Who built legal-slm-125M?

It was designed and built end-to-end by Deependra Verma — a Generative AI Researcher, AI Engineer, and AI Team Lead — covering the full pipeline from data cleaning and tokenizer training through pretraining, evaluation, and fine-tuning.

What is legal-slm-125M?

A 125.8-million-parameter Llama-style decoder language model trained from a random initialization on 2.04 billion unique tokens of US case law, SEC filings, and educational web text, reaching a held-out perplexity of 7.76 after two epochs of pretraining (38,890 steps).

What's the difference between the base model and the fine-tuned (chat) model?

The base model (slm-125m-base) only continues text — it was never shown a question-answer pair and cannot answer questions. The fine-tuned model (legal-slm-125m-sft) was further trained via supervised fine-tuning on a teacher-LLM-distilled, judge-filtered legal/financial Q&A dataset, so it can actually answer questions, though both models still fabricate specifics on unfamiliar prompts.

Is the fine-tuned model production-ready or safe to rely on for legal or financial advice?

No. It answers reasonably on prompts similar to its training distribution, but like any 125-million-parameter model fine-tuned on a few thousand examples, it confidently invents case names, citations, and figures on out-of-distribution or adversarial questions. This is a research and portfolio project, not a source of legal, financial, or factual advice.

How was the model trained, and what did it cost?

Pretraining ran for two epochs on a from-scratch cleaned and deduplicated corpus, and the fine-tuning stage distilled a Q&A dataset from a teacher LLM, filtered by an LLM-as-judge. The compute-heavy phases (pretraining, evaluation, fine-tuning) ran on the author's own on-prem GPUs rather than rented cloud instances, and the fine-tuning dataset was built entirely on free-tier APIs — real out-of-pocket cost for this build was $0.