Instructions to use Ace-2504/slm-125m-e2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ace-2504/slm-125m-e2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ace-2504/slm-125m-e2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Ace-2504/slm-125m-e2") model = AutoModelForCausalLM.from_pretrained("Ace-2504/slm-125m-e2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Ace-2504/slm-125m-e2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ace-2504/slm-125m-e2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ace-2504/slm-125m-e2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Ace-2504/slm-125m-e2
- SGLang
How to use Ace-2504/slm-125m-e2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Ace-2504/slm-125m-e2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ace-2504/slm-125m-e2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Ace-2504/slm-125m-e2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ace-2504/slm-125m-e2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Ace-2504/slm-125m-e2 with Docker Model Runner:
docker model run hf.co/Ace-2504/slm-125m-e2
SLM-125M-e2 β a 125M legal/financial language model (2-epoch continued pretraining)
A 125.8M-parameter LLaMA-architecture base language model for US legal and SEC-filing
text, and the strongest checkpoint in the slm-125m line. It is
Ace-2504/slm-125m-extended continued for 2 epochs over a rebuilt, cleaner 2.50B-token
corpus.
- Validation perplexity: 9.86 (down from 11.72 for
slm-125m-extended) - Not instruction-tuned β this is a base model that continues text, it does not answer questions.
What changed vs. the earlier checkpoints
This model exists to answer a research question: is the catastrophic forgetting seen in
one-shot continued pretraining reversible? The slm-125m-extended run had trained on
515M tokens containing no SEC filings, and SEC ability degraded +8.1% as a result.
This run trained on a corpus that is ~35% SEC. Every domain improved, and the earlier forgetting reversed β measured on the base model's own held-out validation set (a fair within-family comparison, identical tokenizer, neither model trained on it):
| Domain | slm-125m-extended β e2 (perplexity) | change |
|---|---|---|
| SEC filings | 7.41 β 5.74 | β12.8% (was +8.1% before) |
| US case law | 11.51 β 9.80 | β6.6% |
| Educational web | 27.65 β 23.52 | β4.9% |
Conclusion: continued-pretraining forgetting is a function of data composition, not an inevitable cost β reintroduce a domain and the model recovers it. SEC, the model's strongest register, is now better than in any previous checkpoint.
Model
| Architecture | LlamaForCausalLM, 125.8M params |
| Layers / hidden / heads | 12 / 768 / 12 (head dim 64) |
| Context length | 1,024 |
| Vocabulary | 16,384 (byte-level BPE, trained on the domain corpus) |
| Positional / norm / MLP | RoPE (ΞΈ=10,000) Β· RMSNorm Β· SwiGLU Β· tied embeddings |
| Precision | bf16 |
Training
| Initialised from | Ace-2504/slm-125m-extended (weights only; optimizer reset) |
| Corpus | 2.500B tokens β SEC 869M / US case law 855M / FineWeb-Edu 776M |
| Epochs / steps | 2 epochs Β· 9,440 steps Β· 4.95B tokens processed |
| Schedule | 100-step warmup β peak LR 3e-4 β cosine decay β 3e-5 floor |
| Batch | 524,288 tokens/step (micro-batch 32 Γ grad-accum 16) |
| Optimizer | AdamW (Ξ² 0.9/0.95, wd 0.1), grad-clip 1.0 |
| Hardware | 1Γ A100 (SXM4), ~12.5 h |
Model lineage
| Checkpoint | cumulative tokens seen | val perplexity |
|---|---|---|
slm-125m-base (from scratch, 1 epoch) |
2.04B | ~11.3 |
slm-125m-extended (+515M) |
2.55B | 11.72 |
slm-125m-e2 (this model, +4.95B / 2 epochs) |
~7.5B | 9.86 |
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
tok = AutoTokenizer.from_pretrained("Ace-2504/slm-125m-e2")
model = AutoModelForCausalLM.from_pretrained("Ace-2504/slm-125m-e2", torch_dtype=torch.float32).eval()
prompt = "Pursuant to Section 10(b) of the Securities Exchange Act,"
ids = tok(prompt, return_tensors="pt").input_ids
out = model.generate(ids, max_new_tokens=60, do_sample=True, temperature=0.8, top_p=0.95, top_k=50)
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
Intended use & limitations
- Base model, not a chatbot. It completes text in a legal/financial register; it does not follow instructions or answer questions. For that, fine-tune it.
- Specialist, not general. It is strongest on SEC-filing / contract text (where it beats similarly-sized general models such as GPT-2 and Pythia-160M on bits-per-byte) and weaker on general web and educational text.
- No world knowledge guarantees. At 125M parameters with a 1,024-token context it holds little factual knowledge; anything factual should come from retrieval (RAG), not the weights.
- Trained on public US case law, SEC filings, and educational web text; it inherits their biases and coverage gaps.
Related models
Ace-2504/slm-125m-baseβ the original from-scratch model.Ace-2504/slm-125m-extendedβ the 1-epoch +515M checkpoint this one continues from.
- Downloads last month
- 40
docker model run hf.co/Ace-2504/slm-125m-e2