Instructions to use nagbhaskar55/slm125mlive-bhaskar-finetune with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nagbhaskar55/slm125mlive-bhaskar-finetune with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nagbhaskar55/slm125mlive-bhaskar-finetune") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nagbhaskar55/slm125mlive-bhaskar-finetune") model = AutoModelForCausalLM.from_pretrained("nagbhaskar55/slm125mlive-bhaskar-finetune", 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 nagbhaskar55/slm125mlive-bhaskar-finetune with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nagbhaskar55/slm125mlive-bhaskar-finetune" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nagbhaskar55/slm125mlive-bhaskar-finetune", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nagbhaskar55/slm125mlive-bhaskar-finetune
- SGLang
How to use nagbhaskar55/slm125mlive-bhaskar-finetune 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 "nagbhaskar55/slm125mlive-bhaskar-finetune" \ --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": "nagbhaskar55/slm125mlive-bhaskar-finetune", "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 "nagbhaskar55/slm125mlive-bhaskar-finetune" \ --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": "nagbhaskar55/slm125mlive-bhaskar-finetune", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use nagbhaskar55/slm125mlive-bhaskar-finetune with Docker Model Runner:
docker model run hf.co/nagbhaskar55/slm125mlive-bhaskar-finetune
slm125mlive-bhaskar-finetune
Instruction-tuned from nagbhaskar55/slm125mlive-base, a 125M-parameter Llama-architecture model pretrained from scratch on US case law, SEC filings and educational web text.
What changed
| base | this model | |
|---|---|---|
| SFT val loss (assistant tokens) | 3.1862 | 1.5278 |
| perplexity | 24.2 | 4.608 |
Trained 3 epochs on H100x1; best checkpoint was epoch 0 of 3.
Training data
7,960 synthetic instruction pairs generated from the same corpus the base
model was pretrained on, with gemini-3.6-flash as teacher and gemini-3.1-flash-lite
as an LLM judge. Every answer is grounded in a passage supplied in the prompt.
- Tasks: {'summarization': 1600, 'extraction': 1600, 'grounded_qa': 3200, 'rewriting': 1560}
- Sources: {'sec': 3186, 'case-law': 3158, 'fineweb-edu': 1616}
- Difficulty: {'medium': 2755, 'hard': 1134, 'easy': 4071}
- Refusals: 423 items answer exactly
"Not stated in the context."when the passage does not contain the answer - Lengths: mean 629.5 tokens, p90 798, max 1019 (limit 1024)
Curation: LLM judge on grounding / correctness / instruction-following (each >= 4 of 5), exact + 8-gram + embedding near-duplicate removal, and 13-gram decontamination against CaseHOLD. 10,958 raw pairs were reduced to 7,960.
Prompt format
Loss was applied to assistant tokens only. The chat template ships in
tokenizer_config.json:
<|bos|><|system|>{system}<|eos|><|user|>{user}<|eos|><|assistant|>{answer}<|eos|>
System prompt used in training:
You are a legal and financial assistant. Use only the provided context.
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("nagbhaskar55/slm125mlive-bhaskar-finetune")
model = AutoModelForCausalLM.from_pretrained("nagbhaskar55/slm125mlive-bhaskar-finetune")
messages = [
{"role": "system", "content": "You are a legal and financial assistant. Use only the provided context."},
{"role": "user", "content": "<passage>\n\n<your question>"},
]
ids = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
print(tok.decode(model.generate(ids, max_new_tokens=200)[0][ids.shape[1]:],
skip_special_tokens=True))
Intended use and limits
This model reads a passage you supply and answers from it. It is not a knowledge base: at 125M parameters, closed-book answers are unreliable, and the training data deliberately teaches grounded reading rather than recall.
It was tuned on synthetic data from a single teacher model, so it inherits that teacher's biases and error modes. Do not use it for legal or financial advice. CaseHOLD was held out of both pretraining and fine-tuning; the base model scored below chance zero-shot there, and this checkpoint has not been re-evaluated on it.
- Downloads last month
- 300
Model tree for nagbhaskar55/slm125mlive-bhaskar-finetune
Base model
nagbhaskar55/slm125mlive-base