Instructions to use timothywong731/tim-360m-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use timothywong731/tim-360m-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="timothywong731/tim-360m-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("timothywong731/tim-360m-instruct") model = AutoModelForCausalLM.from_pretrained("timothywong731/tim-360m-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 timothywong731/tim-360m-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "timothywong731/tim-360m-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": "timothywong731/tim-360m-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/timothywong731/tim-360m-instruct
- SGLang
How to use timothywong731/tim-360m-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 "timothywong731/tim-360m-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": "timothywong731/tim-360m-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 "timothywong731/tim-360m-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": "timothywong731/tim-360m-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use timothywong731/tim-360m-instruct with Docker Model Runner:
docker model run hf.co/timothywong731/tim-360m-instruct
TIM-360M-instruct
The instruction-tuned variant of TIM-360M-base — a 361.8M-parameter decoder-only transformer trained from scratch on 2× RTX 4090. Post-trained with SFT → DPO, no TRL.
Exported as Qwen3ForCausalLM — loads with transformers and no trust_remote_code.
Chat format
ChatML. Turns are wrapped <|im_start|>{role}\n{content}<|im_end|>; the assistant turn ends on <|im_end|> (token id 2), which is the model's generation stop token. Use the tokenizer's chat template — don't hand-format.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
tok = AutoTokenizer.from_pretrained("timothywong731/tim-360m-instruct")
m = AutoModelForCausalLM.from_pretrained("timothywong731/tim-360m-instruct", torch_dtype=torch.bfloat16)
msgs = [{"role": "user", "content": "Explain what a transformer is in two sentences."}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt")
out = m.generate(ids, max_new_tokens=200, do_sample=True, temperature=0.7, top_p=0.9)
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True))
Architecture
Identical to the base model: SmolLM2-360M skeleton, pre-LN RMSNorm, RoPE (θ=100000), SwiGLU, grouped-query attention (15 query / 5 KV heads) with per-head QK-norm, tied embeddings, no biases. 32 layers, hidden 960, head_dim 64, FFN 2560, vocab 49,152. Context: max_position_embeddings 4096, trained at seq_len 2048.
Post-training
- SFT on smol-smoltalk — multi-turn instruction following, loss on assistant turns only.
- DPO on ultrafeedback_binarized — a frozen reference policy, sigmoid preference loss (β=0.1, lr 5e-7), scored over the final assistant turn.
Evaluation
lm-evaluation-harness (0.4.12), 0-shot, acc_norm where applicable:
| HellaSwag | ARC-Easy | ARC-Challenge | PIQA | WinoGrande | OpenBookQA | SciQ | SocialIQA | CommonsenseQA | WikiText (bpb ↓) |
|---|---|---|---|---|---|---|---|---|---|
| 0.395 | 0.501 | 0.262 | 0.652 | 0.524 | 0.302 | 0.714 | 0.408 | 0.203 | 1.130 |
Post-training preserved base capability — most tasks move within noise of the base model, with a real gain on SocialIQA (+3.0) and small gains on HellaSwag / OpenBookQA. WikiText bits-per-byte rises (1.06 → 1.13), as expected: a chat-tuned model is no longer a pure next-token predictor of raw web text.
Limitations
Small (360M) and lightly trained (~30B pretraining tokens, then light post-training). Instruction-following is basic — expect short, sometimes shallow answers, weak arithmetic and multi-step reasoning, and confident hallucination. English-only. DPO is not safety alignment — this model has no dedicated safety tuning; filter before exposing to end users.
Provenance & license
Apache-2.0. Pretraining data (all named, public): FineWeb-Edu (ODC-BY), DCLM-Baseline (CC-BY-4.0), Stack-Edu, FineMath (ODC-BY). Post-training data: smol-smoltalk and ultrafeedback_binarized (see their dataset cards for licenses). No gated or scraped-private data.
- Downloads last month
- 434
Model tree for timothywong731/tim-360m-instruct
Datasets used to train timothywong731/tim-360m-instruct
HuggingFaceTB/smol-smoltalk
Evaluation results
- acc_norm on HellaSwag (0-shot)self-reported0.395
- acc_norm on ARC-Easy (0-shot)self-reported0.501
- acc_norm on ARC-Challenge (0-shot)self-reported0.262
- acc_norm on PIQA (0-shot)self-reported0.652
- acc on WinoGrande (0-shot)self-reported0.524
- acc_norm on OpenBookQA (0-shot)self-reported0.302
- acc on SocialIQA (0-shot)self-reported0.408
- acc_norm on SciQ (0-shot)self-reported0.714