Text Generation
Transformers
Safetensors
PyTorch
English
qwen3
qwen
qwen3-1.7b
qwen3-8b
quintus
quintus-1.7b
causal-lm
language-model
chat
assistant
compact-llm
small-language-model
knowledge-distillation
online-kd
full-vocabulary-kd
supervised-fine-tuning
sft
reasoning
code-generation
english
vllm
conversational
text-generation-inference
Instructions to use iamrahulreddy/Quintus with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use iamrahulreddy/Quintus with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="iamrahulreddy/Quintus") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("iamrahulreddy/Quintus") model = AutoModelForCausalLM.from_pretrained("iamrahulreddy/Quintus") 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 iamrahulreddy/Quintus with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "iamrahulreddy/Quintus" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "iamrahulreddy/Quintus", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/iamrahulreddy/Quintus
- SGLang
How to use iamrahulreddy/Quintus 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 "iamrahulreddy/Quintus" \ --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": "iamrahulreddy/Quintus", "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 "iamrahulreddy/Quintus" \ --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": "iamrahulreddy/Quintus", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use iamrahulreddy/Quintus with Docker Model Runner:
docker model run hf.co/iamrahulreddy/Quintus
| # Architecture | |
| Quintus is built as a two-stage model development pipeline: | |
| 1. Online full-vocabulary knowledge distillation from a larger Qwen3 teacher into a Qwen3-1.7B base student. | |
| 2. Targeted SFT to improve instruction-following behavior, persona consistency, and generation stability. | |
|  | |
| ## Core Training Path | |
| The main training entry point is `src/train.py`. It supports three phases: | |
| - `sft`: Cross-entropy training on assistant response tokens. | |
| - `kd`: Offline top-k teacher-logit distillation, retained for compatibility and provenance checks. | |
| - `online_kd`: The final preferred path. Teacher logits are produced live during the student forward pass. | |
| The final KD objective is implemented in `src/losses.py`: | |
| $$ | |
| \mathcal{L}_{\text{total}} | |
| = \alpha \mathcal{L}_{\text{CE}} | |
| + (1 - \alpha)\mathcal{L}_{\text{KD}} | |
| $$ | |
| For the final run, $\alpha = 0.3$ and $T = 2.0$. In this codebase, $\alpha$ is the cross-entropy weight. The complementary weight is assigned to the KD term. | |
| ## Data Flow | |
| `src/download.py` prepares the training data. It handles both pre-tokenized rows and raw instruction data. For raw rows, it normalizes common conversation schemas, applies the tokenizer chat template, and builds an assistant-only `loss_mask`. | |
| Important details: | |
| - Prompt and formatting tokens are masked out. | |
| - Assistant response tokens receive loss. | |
| - Samples longer than `max_seq_len` are rejected rather than silently truncated. | |
| - The tokenizer contract is later validated to avoid teacher/student vocabulary mismatches. | |
| ## Sequence Packing | |
| `src/sequence_packing.py` implements deterministic first-fit decreasing packing. It places multiple shorter samples into fixed-length bins, separated by EOS tokens. | |
| Packing properties: | |
| - Training split is packed; validation can remain unpacked for interpretability. | |
| - Bins are fixed at `pack_length = 4096` in the final profile. | |
| - EOS separators have `loss_mask = 0`. | |
| - The first token after a separator is optionally masked to avoid cross-sample target leakage. | |
| - Attention masks are built from the true packed length, not by comparing token IDs against `pad_token_id`. | |
| The attention-mask detail is important because Qwen tokenizers can reuse EOS-like IDs in ways that make token-identity-derived padding masks unsafe. | |
| ## Online KD Memory Strategy | |
| Full-vocabulary KD is expensive because both student and teacher produce logits shaped as: | |
| $$ | |
| \text{student\_logits},\ \text{teacher\_logits} | |
| \in \mathbb{R}^{B \times S \times |V|} | |
| $$ | |
| The implementation keeps this feasible by chunking along the token dimension with: | |
| $$ | |
| C_{\text{KD}} = 2048 | |
| $$ | |
| Each chunk computes the teacher softmax, student log-softmax, and masked KL contribution, then accumulates the result. This preserves the dense teacher distribution while avoiding a single large KL workspace. | |
| ## Validation, Provenance, And Safety Checks | |
| Several modules exist to prevent silent training corruption: | |
| - `src/provenance.py`: Validates tokenizer contracts, vocab sizes, revisions, and teacher-logit metadata. | |
| - `src/kd_contracts.py`: Builds deterministic tokenizer fingerprints. | |
| - `src/training_schedule.py`: Aligns train/validation splits with batch and gradient-accumulation constraints. | |
| - `src/checkpoints.py`: Saves model, tokenizer, scheduler, trainer state, and packing metadata; validates resume compatibility. | |
| - `src/transformers_compat.py`: Resolves attention backend and formats model-loading errors. | |
| ## SFT Layer | |
| The `sft/` directory contains the post-KD alignment layer: | |
| - `sft/train_sft.py`: SFT training with optional sequence packing, LoRA/QLoRA paths, and built-in spot evaluations. | |
| - `sft/evaluate.py`: EvalPlus and lm-evaluation-harness orchestration. | |
| - `sft/chat.py`: Local interactive chat wrapper using the tokenizer chat template. | |
| This stage is intentionally separate from KD. KD transfers the teacher's probability structure; SFT teaches the model how to expose that capability in the intended assistant format. | |