63 lines
2.0 KiB
Markdown
63 lines
2.0 KiB
Markdown
|
|
---
|
||
|
|
library_name: transformers
|
||
|
|
pipeline_tag: text-generation
|
||
|
|
tags:
|
||
|
|
- text-generation
|
||
|
|
- causal-lm
|
||
|
|
- llama
|
||
|
|
- legal
|
||
|
|
- finance
|
||
|
|
- modal
|
||
|
|
---
|
||
|
|
|
||
|
|
# tirumalaseti/slm-125m-base
|
||
|
|
|
||
|
|
This is a **125M-parameter base completion model** trained from scratch on a legal/financial-heavy corpus. It is **not a chatbot**: it was optimized for next-token prediction and works best when prompted with the opening of a sentence or paragraph to continue.
|
||
|
|
|
||
|
|
## Model summary
|
||
|
|
|
||
|
|
- **Trainable parameters:** 125,847,552 (~125.848M)
|
||
|
|
- **Architecture:** 12-layer Llama-style decoder, 768 hidden size, 12 attention heads
|
||
|
|
- **Context length:** 1,024 tokens
|
||
|
|
- **Tokenizer:** 16,384-token byte-level BPE
|
||
|
|
- **Training tokens seen:** 2,500,329,472
|
||
|
|
- **Optimizer steps:** 4,769
|
||
|
|
- **Completed epochs over the packed train set:** 1.23
|
||
|
|
- **Final validation loss:** 2.3035
|
||
|
|
- **Final validation perplexity:** 10.01
|
||
|
|
- **Reported spend:** $0.00
|
||
|
|
|
||
|
|
## Training corpus
|
||
|
|
|
||
|
|
The packed corpus used for pretraining contains 2,059,674,624 total tokens:
|
||
|
|
|
||
|
|
- **Train:** 2,039,072,768
|
||
|
|
- **Validation:** 20,601,856
|
||
|
|
|
||
|
|
Realized source mix:
|
||
|
|
|
||
|
|
- **US case law:** 722,081,792 tokens (35.1%)
|
||
|
|
- **SEC filings:** 868,714,496 tokens (42.2%)
|
||
|
|
- **Educational web text:** 468,878,336 tokens (22.8%)
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
```python
|
||
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||
|
|
|
||
|
|
model_id = "tirumalaseti/slm-125m-base"
|
||
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
||
|
|
model = AutoModelForCausalLM.from_pretrained(model_id)
|
||
|
|
|
||
|
|
prompt = "The plaintiff respectfully moves this Court to"
|
||
|
|
inputs = tokenizer(prompt, return_tensors="pt")
|
||
|
|
outputs = model.generate(**inputs, max_new_tokens=96, temperature=0.8, top_p=0.95)
|
||
|
|
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
||
|
|
```
|
||
|
|
|
||
|
|
## Notes
|
||
|
|
|
||
|
|
- This is a **base model**, not an instruction-tuned assistant.
|
||
|
|
- It is strongest at continuing legal/financial prose in-register.
|
||
|
|
- The spend figure comes from the latest visible Modal billing report; Modal billing report may lag; this value reflects the latest locally visible report..
|