Instructions to use jaweed123/TinyJLLM-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jaweed123/TinyJLLM-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jaweed123/TinyJLLM-Instruct")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("jaweed123/TinyJLLM-Instruct") model = AutoModelForCausalLM.from_pretrained("jaweed123/TinyJLLM-Instruct", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jaweed123/TinyJLLM-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jaweed123/TinyJLLM-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jaweed123/TinyJLLM-Instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/jaweed123/TinyJLLM-Instruct
- SGLang
How to use jaweed123/TinyJLLM-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 "jaweed123/TinyJLLM-Instruct" \ --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": "jaweed123/TinyJLLM-Instruct", "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 "jaweed123/TinyJLLM-Instruct" \ --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": "jaweed123/TinyJLLM-Instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use jaweed123/TinyJLLM-Instruct with Docker Model Runner:
docker model run hf.co/jaweed123/TinyJLLM-Instruct
TinyJLLM-Instruct — instruction-tuned 100M model
Supervised fine-tuning of TinyJLLM on 83,145 curated instruction examples from six public datasets. Trained from scratch in the TinyLLM repository with response-masked loss and attention: response positions attend only to the prompt, which prevents the model from learning a copy shortcut.
Published recipe: 1 epoch over the curated subset (Dolly-15k, CodeAlpaca, oasst1, MetaMathQA capped at 8K), validation loss 4.71 (perplexity 111). A 2-epoch run reached 4.29 but memorized more — the 1-epoch model produced better answers in side-by-side evaluation.
Model family
| Model | Stage | Link |
|---|---|---|
TinyJLLM |
Base | jaweed123/TinyJLLM |
TinyJLLM-Instruct |
SFT (this model) | jaweed123/TinyJLLM-Instruct |
TinyJLLM-Instruct-DPO |
DPO | jaweed123/TinyJLLM-Instruct-DPO |
Usage
The model uses a plain marker format (no chat template):
### Instruction:
What is the capital of France?
### Response:
Because of the response-masked training protocol, generation must use the
same masking (response tokens attend only to the prompt). Plain causal
model.generate() produces degenerate repetition. A self-contained
transformers loop:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "jaweed123/TinyJLLM-Instruct"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id).eval()
@torch.no_grad()
def respond(instruction, max_new_tokens=40):
prompt = f"### Instruction:\n{instruction}\n\n### Response:\n"
ids = tok(prompt)["input_ids"]
L = len(ids)
seq = ids + [tok.pad_token_id] # dummy keeps response positions aligned
for _ in range(max_new_tokens):
inp = torch.tensor([seq])
T = inp.shape[1]
mask = torch.tril(torch.ones(1, 1, T, T, dtype=torch.bool))
mask[:, :, L:, :] = False # response rows ...
mask[:, :, L:, :L] = True # ... see the prompt only
nxt = int(model(inp, attention_mask=mask).logits[0, -1].argmax())
if nxt == tok.eos_token_id:
break
seq.append(nxt)
return tok.decode(seq[L + 1:])
print(respond("What is the capital of France?"))
The project's own learnllm.inference.generate.generate(..., response_mask_start=...)
implements the same protocol with sampling and a repetition penalty.
Training details
| Base | TinyJLLM (102.5M, 32K vocab, 512 ctx) |
| Dataset | 83,145 examples, 6 sources (licenses in the repo manifest) |
| Subset used | Dolly-15k + CodeAlpaca + oasst1 + MetaMathQA (8K cap) |
| Epochs / LR | 1 / 2e-5, warmup + cosine |
| Loss | response-only (-100 on prompt tokens), labels[i] = input[i+1] |
| Attention | response-masked (response rows attend to prompt only) |
| Hardware | RTX 4060 8 GB |
Two bugs worth knowing about are documented in
SFT_TRAINING.md:
a label off-by-one that made training look converged while generations were
garbage, and the response-masking fix that removed the copy shortcut.
Limitations
At 100M parameters this model reproduces answer shapes more reliably than answer content: math and code are frequently wrong, multi-turn context is poorly tracked, and world knowledge is narrow. It is an educational artifact, not a production assistant.
Citation
@misc{tinyjllm,
title = {TinyJLLM: A 100M-Parameter Small Language Model Built From Scratch},
author = {Jaweed, Abdul},
year = {2026},
url = {https://github.com/Abdul-Jaweed/TinyLLM}
}
- Downloads last month
- 501