router-34M

Which model should answer this? router-34M reads a message and sorts it into one of four buckets, so an assistant can hand it to the right model. It is Viveka-34M fine-tuned as a classifier, small enough to decide in about 40 milliseconds on an ordinary laptop CPU.

Label Meaning In Vrishvardhan's offline assistant it goes to
chat small talk, everyday questions, and writing tasks (write, summarise, translate, plan) Gemma 4 E2B
science physics, chemistry, biology, space and technology questions the general chat model, until his science model is ready
maths equations, word problems, proofs Qwen2.5 Math 7B
code writing, explaining or fixing code Qwen2.5 Coder 3B

It runs next to thinker-34M, which decides whether a question needs careful thinking.

Results

98.1% correct on 1,999 held-out questions it never saw in training (version 4, November 2026). Version 4 has new labels (science replaced instructions), so this is not the same test as before: version 3 scored 94.1%, version 2 90.9% and version 1 89.2% with the old labels.

It is also tested on 33 tricky messages (very short greetings, plain sums, proofs, science questions, MicroPython questions...), none of them used in training: version 4 gets 31 of 33 right. Examples:

Message Label
hi chat
Write a poem about rain chat
Why is the sky blue? science
A ball is dropped from 45 m. How long does it take to hit the ground? science
Solve 3x + 5 = 20. maths
Prove that the square root of 2 is irrational. maths
micropython 1.28.0 code

Use

from transformers import pipeline
clf = pipeline('text-classification', model='vrishv/router-34M')
print(clf('Solve 3x + 5 = 20.'))

An ONNX copy (model.onnx) is included for CPUs without PyTorch, e.g. with onnxruntime and tokenizers:

import numpy as np, onnxruntime as ort
from tokenizers import Tokenizer
from huggingface_hub import hf_hub_download
tok = Tokenizer.from_file(hf_hub_download('vrishv/router-34M', 'tokenizer.json'))
sess = ort.InferenceSession(hf_hub_download('vrishv/router-34M', 'model.onnx'))
ids = tok.encode('Solve 3x + 5 = 20.').ids[:128]
logits = sess.run(None, {'input_ids': np.array([ids]), 'attention_mask': np.ones((1, len(ids)), dtype=np.int64)})[0]
print(['chat', 'science', 'maths', 'code'][int(logits.argmax())])

Training

Version 4 is built on the IAM-free Viveka-34M (v3) and was fine-tuned on a Kaggle T4 GPU, split 90 / 5 / 5:

Label Examples from
chat Dolly 15k questions and writing, brainstorming, summarising and extraction tasks (CC BY-SA 3.0), Tulu 3 persona instruction-following prompts (ODC-BY), Google Synthetic-Persona-Chat (CC BY 4.0), SQuAD questions (CC BY-SA 4.0), the geography questions of Jigyasa. Questions that are clearly science were left out of chat.
science Jigyasa Simple, Medium and Big (Apache 2.0, all topics except geography), AI2 ARC (CC BY-SA 4.0), OpenBookQA (Apache 2.0), 12 science subjects of MMLU (MIT), plus science-topic questions and physics / chemistry problems with numbers and units made by a script
maths GSM8K, MetaMathQA and MATH (MIT), NuminaMath (Apache 2.0), maths theory questions from StackMathQA (CC BY 4.0), plus calculations and named-theorem questions generated by a script
code CodeAlpaca-20k (only clearly code-related requests) and MBPP (CC BY 4.0), TACO easy and medium problems (Apache 2.0)

Limitations

  • Its weakest spot (from the tricky test): short maths THEORY questions that sound like science, such as "What is the derivative of x squared?" and "what is the Euler line", were not labelled maths. More maths theory data is planned for the next version.
  • Version 4 changed the labels: code written for version 3 that expects instructions must be updated (writing tasks are now chat).
  • When it is unsure (top score below about 0.4), it is better to fall back to a general chat model.
  • English only. Long messages are read up to 128 tokens.

About the maker

router-34M was built by Vrishvardhan Sharma (vrishv), a 9-year-old self-taught builder from India. His other work:

  • GitaVardhan: a free, offline Bhagavad Gita app in 13 Indian languages, and a pocket-sized voice-controlled Gita device he designed, wired and coded himself.
  • Sanskrit Vardhan: an app for learning Sanskrit through the Bhagavad Gita, with word-by-word meanings and step-by-step Pāṇinian derivations. Launched on 20 October 2026 by Prof. Shrinivasa Varakhedi, Vice-Chancellor of Central Sanskrit University.
  • Kannada, Tamil and Telugu Vardhan: apps that teach everyday spoken Kannada, Tamil and Telugu.
  • Hindi Vardhan (hindivardhan.in): a dictionary of pure, Sanskrit-rooted Hindi. Over 6,000 borrowed words in everyday Hindi, each with native alternatives checked against five classical Sanskrit dictionaries.
  • AksharaVardhan: a handwriting reader that runs on an ordinary computer.
  • graphics-studio: a free Space that makes and edits images, videos, music and narration.
  • Viveka-34M: his small language model, trained from scratch, that this model is built on.
  • Shodhana-34M: Viveka trained further to correct lines misread by a handwriting reader.
  • Jigyasa Simple: 473 everyday science questions with short, plain-text answers.
  • Jigyasa Medium and Jigyasa Big: 969 and 970 deeper science questions, built from his own questions, with answers of up to 7 and 10 sentences.
  • thinker-34M: decides whether a question needs careful thinking; used next to this router.

He has memorised the Bhagavad Gita and Pāṇini's Aṣṭādhyāyī, won national Sanskrit recitation competitions, and speaks six languages. More at vrishvardhan.in.

CC BY-SA 4.0 © 2026 Vrishvardhan Sharma.

Downloads last month
89
Safetensors
Model size
33.9M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for vrishv/router-34M

Quantized
(2)
this model

Datasets used to train vrishv/router-34M