A 125M-parameter decoder-only transformer trained from scratch on a curated legal and financial corpus. Built on the LLaMA architecture with a custom 16K byte-level BPE tokenizer.
Evaluation was conducted on a held-out 1% split (20.6M tokens) of the training corpus.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model = AutoModelForCausalLM.from_pretrained("Saliltrehan7/slm-125m-base")
4tokenizer = AutoTokenizer.from_pretrained("Saliltrehan7/slm-125m-base")
5
6prompt = "The court held that the defendant"
7inputs = tokenizer(prompt, return_tensors="pt")
8outputs = model.generate(**inputs, max_new_tokens=100, temperature=0.7)
9print(tokenizer.decode(outputs[0], skip_special_tokens=True))
The entire pipeline — data processing, tokenizer training, model pretraining, and deployment — ran on
Modal's serverless GPU platform. Total compute cost:
$12.36.
1@misc{slm125m2026,
2 title={SLM-125M-Base: A Legal/Financial Small Language Model},
3 author={Salil Trehan},
4 year={2026},
5 url={https://huggingface.co/Saliltrehan7/slm-125m-base}
6}