Run this model with HF Jobs
Run pvlabs/Hlupak-2-10M-Instruct on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/pvlabs/Hlupak-2-10M-Instruct. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/pvlabs/Hlupak-2-10M-Instruct on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/pvlabs/Hlupak-2-10M-Instruct. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/pvlabs/Hlupak-2-10M-Instruct. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use pvlabs/Hlupak-2-10M-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pvlabs/Hlupak-2-10M-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pvlabs/Hlupak-2-10M-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("pvlabs/Hlupak-2-10M-Instruct") model = AutoModelForCausalLM.from_pretrained("pvlabs/Hlupak-2-10M-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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use pvlabs/Hlupak-2-10M-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pvlabs/Hlupak-2-10M-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": "pvlabs/Hlupak-2-10M-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/pvlabs/Hlupak-2-10M-Instruct
- SGLang
How to use pvlabs/Hlupak-2-10M-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 "pvlabs/Hlupak-2-10M-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": "pvlabs/Hlupak-2-10M-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 "pvlabs/Hlupak-2-10M-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": "pvlabs/Hlupak-2-10M-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use pvlabs/Hlupak-2-10M-Instruct with Docker Model Runner:
docker model run hf.co/pvlabs/Hlupak-2-10M-Instruct
Hlupak-2-10M-Instruct
A tiny chat model trained from scratch that thinks before it answers and uses two tools: Wikipedia search and a calculator. It looks facts up instead of guessing, sends harder math to the calculator, and handles short follow-ups like "and of 64?" or "no, I meant 36". It's still a very small model: without search it gets facts wrong, and explanations, lists and poems are weak.
The smaller sibling of Hlupak-2-13M-Instruct: under 10M parameters and only 1 hour of pretraining. It matches the 13M model on our test chats, and beats the older Hlupak-14M-Instruct there (~16/20 vs ~10.5/20), but it knows fewer facts on its own. Pick it when download size or speed matters; otherwise use the 13M.
It runs in a web browser. An int8 ONNX export is included in onnx/.
Built by PingVortex Labs.
Model Details
- Parameters: 10M (9,985,792 with tied embeddings, 7.9M without)
- Architecture: Qwen3, 12 layers, hidden size 256, 4 attention heads, 1 KV head, head dim 64, SwiGLU MLP 640
- Vocabulary: 8,256 tokens (custom BPE, with tool and thinking tokens)
- Context length: 8192 tokens
- Language: English only
- Format: custom chat tags (
<|user|>,<|assistant|>,<|end|>), thoughts in<|think|>, tools via<|tool_call|>/<|tool_result|> - Base model: Hlupak-2-10M-Base
- License: Apache 2.0
Training
- Pretraining: 0.56B tokens on one RTX 5060 Ti in 1 hour: 0.54B at 1k context, then 0.02B at 8k. A knowledge-first mix: mostly educational web text and encyclopedia articles, plus reading comprehension (documents followed by a question answered from them), textbook-style text, chat, synthetic thinking and search transcripts, and a little math.
- Fine-tuning: the same data and settings as Hlupak-2-13M-Instruct: ~125M tokens, 1 epoch. Chats where every reply starts with a short plan in
<|think|>, search chats, calculator chats, follow-ups and corrections ("and of 64", "no I meant ...", "so what's the answer?"), and a "tools off" mode.
Usage
import re
import math
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_path = "pvlabs/Hlupak-2-10M-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path, dtype=torch.float16)
model.eval()
END = [tokenizer.convert_tokens_to_ids("<|end|>"), tokenizer.convert_tokens_to_ids("<|end_of_text|>")]
def calc(expr):
# numbers, + - * / ^ ( ) and sqrt() only
if not re.fullmatch(r"(sqrt|[\d.+\-*/^() ])+", expr):
return "Error: bad expression."
v = eval(expr.replace("^", "**").replace("sqrt", "math.sqrt"), {"__builtins__": {}, "math": math})
return str(int(v)) if v == int(v) else f"{v:.6f}".rstrip("0")
def search(query):
# plug in a real search here; the model expects up to 3 numbered results
return "[1] Paris: Paris is the capital and largest city of France."
def reply(chat):
"""chat: the conversation so far as one string, ending with <|assistant|>"""
for _ in range(3): # at most 2 tool calls per reply
inputs = tokenizer(chat, return_tensors="pt", add_special_tokens=False)
with torch.no_grad():
out = model.generate(**inputs, max_new_tokens=200, do_sample=True, temperature=0.5, top_k=40, top_p=0.9,
eos_token_id=END, pad_token_id=tokenizer.pad_token_id)
text = tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False)
text = text.replace("<|end_of_text|>", "<|end|>")
chat += text if text.endswith("<|end|>") else text + "<|end|>"
call = re.search(r'<\|tool_call\|>(search|calc)\("(.*?)"\)', text)
if not call:
return chat
result = calc(call[2]) if call[1] == "calc" else search(call[2])
chat += f"<|tool_result|>{result}<|end|><|assistant|>"
return chat
chat = reply("<|user|>whats the square root of 16<|end|><|assistant|>")
chat = reply(chat + "<|user|>and of 64<|end|><|assistant|>")
print(chat)
Output:
<|user|>whats the square root of 16<|end|><|assistant|><|think|>Math: a square root. This needs exact math, so I will use the calculator.<|/think|><|tool_call|>calc("sqrt(16)")<|end|><|tool_result|>4<|end|><|assistant|>The square root of 16 is 4.<|end|><|user|>and of 64<|end|><|assistant|><|think|>Follow-up: the same kind of math, now the square root of 64. I will use the calculator. The expression is sqrt(64).<|/think|><|tool_call|>calc("sqrt(64)")<|end|><|tool_result|>8<|end|><|assistant|>The square root of 64 is 8.<|end|>
Avoid repetition penalties. They also penalise repeated digits, which breaks arithmetic.
Prompt Format
Each turn is wrapped in a role tag and closed with <|end|>, with no newlines between turns:
<|user|>Your message here<|end|><|assistant|>
- Thinking: every reply starts with a short plan,
<|think|>...<|/think|>, then the answer. - Tools: the model writes
<|tool_call|>search("query")or<|tool_call|>calc("expression")and ends the turn with<|end|>. Append<|tool_result|>result<|end|><|assistant|>and generate again; the model then answers from the result. - Search results: up to 3 lines like
[1] Title: first sentences of the article. The model picks the result that matches and answers from it. - Calculator: expressions use numbers,
+ - * / ^ ( )andsqrt(). - Tools off: start the chat with
<|system|>Tools are off.<|end|>. The model then answers from memory and does math in its thoughts.
The bundled chat template builds plain user and assistant turns: tokenizer.apply_chat_template(messages, add_generation_prompt=True).
Evaluation
Our own tests, all with the same scripts. Test chats are graded by hand. Benchmarks are accuracy in %, with no tools.
| Model | Params | Test chats (20) | Follow-up turns (14) | Fact quiz | Holdout quiz | ARC-Easy | ARC-Challenge | HellaSwag |
|---|---|---|---|---|---|---|---|---|
| Hlupak-2-10M-Instruct | 10.0M | ~16 | 11.5 | 69.9 | 55.7 | 42.1 | 20.4 | 25.9 |
| Hlupak-2-13M-Instruct | 13.1M | ~16 | 12.5 | 69.9 | 63.2 | 45.3 | 20.4 | 26.3 |
| Hlupak-14M-Instruct | 15.7M | ~10.5 | not tested | 77.2 | 61.3 | 43.3 | 20.4 | 26.0 |
- Test chats: 20 scripted chats with real tools (greetings, its name, facts, sums, square roots, percentages, corrections, feelings, remembering your name, a poem, a list, explanations).
- Follow-up turns: 10 chats with short follow-ups and corrections, like "and of 64" or "and isaac newton?".
- Holdout quiz: never used to pick training data, so it's the fairest knowledge test. The fact quiz was used to pick data for older Hlupak models.
- ARC-Challenge and HellaSwag are at chance (25%) for every model this small.
ONNX
onnx/model_int8.onnx (dynamic int8, 17 MB) runs in a web browser with onnxruntime-web and takes an explicit KV cache:
- Inputs:
input_idsint64[1, T],past_kandpast_vfloat32[12, 1, 1, P, 64](useP = 0for the first call) - Outputs:
logitsfor the last position[1, 8256],present_kandpresent_v[12, 1, 1, P+T, 64]
It picks the same next token as the PyTorch model in our check, but its longer answers can drift from the original. For full precision, use the bf16 safetensors.
Limitations
- Knows fewer facts than the 13M model (holdout quiz 55.7 vs 63.2). Without search it often invents facts, names and dates. It can also mix up details from the search results it reads.
- Sometimes answers from memory when it should search (it did on "whats the eiffel tower" in our tests).
- Explanations ("why is the sky blue?"), lists and poems are weak and may repeat themselves.
- Follow-ups to answers it gave from memory ("and of Germany?" after the capital of France) don't trigger a new search.
- English only. Not suited to code or anything safety-critical.
Made by PingVortex.
- Downloads last month
- 129