Instructions to use nitin1pawar/slm125m-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nitin1pawar/slm125m-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nitin1pawar/slm125m-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nitin1pawar/slm125m-instruct") model = AutoModelForCausalLM.from_pretrained("nitin1pawar/slm125m-instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nitin1pawar/slm125m-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nitin1pawar/slm125m-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nitin1pawar/slm125m-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nitin1pawar/slm125m-instruct
- SGLang
How to use nitin1pawar/slm125m-instruct 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 "nitin1pawar/slm125m-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nitin1pawar/slm125m-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "nitin1pawar/slm125m-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nitin1pawar/slm125m-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use nitin1pawar/slm125m-instruct with Docker Model Runner:
docker model run hf.co/nitin1pawar/slm125m-instruct
slm125m-instruct
A 126M-parameter legal/financial Q&A model, supervised
fine-tuned from nitin1pawar/slm125m-base โ a base model
that was itself pretrained from scratch (corpus, tokenizer and weights) for $31.76.
Trained in RAFT style: each example pairs a question with retrieved passages, and a quarter of the training set contains passages that do not answer the question, so the model learns to say so instead of inventing an answer.
Prompt format
<|bos|><|system|>{system}<|user|>{user}<|assistant|>{answer}<|eos|>
tokenizer.apply_chat_template is configured, so:
messages = [
{"role": "system", "content": "You are a legal and financial assistant. ..."},
{"role": "user", "content": "Passage 1:\n...\n\nQuestion: ..."},
]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
When the passages do not contain the answer the model replies:
The passage does not provide enough information to answer this question.
Training data
10,000 synthetic Q&A pairs generated with gpt-5-mini from the model's own
pretraining corpus (US case law + SEC filings + educational web text), then graded by an
LLM judge on groundedness, correctness, answerability and form. Judge pass rate
88.4%. Questions were deduplicated by exact hash and by 5-gram
Jaccard overlap.
Passages were drawn from the deduplicated and decontaminated corpus, so CaseHOLD and
LexGLUE case_hold remain genuinely held out.
| slice | share |
|---|---|
| closed_book | 1,584 |
| instruction | 787 |
| negative | 2,511 |
| positive | 5,118 |
Training
148 steps over 1 epochs (9.7M tokens, 62s on 1รH100), full-parameter (no LoRA), AdamW, peak LR 8e-05 cosine to 0, bf16. Loss is computed on answer tokens only โ question and context tokens are masked out.
Results
| metric | value |
|---|---|
| Val answer-token loss | 1.6840 (ppl 5.39) |
| Refusal recall (no answer in context โ refuses) | 91.0% |
| False refusal rate (answer present โ wrongly refuses) | 15.3% |
| Base-corpus perplexity after SFT | 10.56 (was 8.11 before) |
Limitations
125M parameters. It produces fluent but frequently incorrect legal and financial text, its knowledge is bounded by a 2.07B-token corpus, and the training answers were written by another language model rather than by lawyers. Context is capped at 1,024 tokens. Not legal or financial advice.
- Downloads last month
- 235
Model tree for nitin1pawar/slm125m-instruct
Base model
nitin1pawar/slm125m-base
docker model run hf.co/nitin1pawar/slm125m-instruct