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 everyday questions and small talk Gemma 4 E2B
instructions write, summarise, rewrite, translate, plan Llama 3.2 3B
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

90.9% correct on 3,200 held-out questions it never saw in training (version 2; version 1 scored 89.2%). Examples:

Message Label
hello, how are you? chat
Why is the sky blue? chat
Solve 3x + 5 = 20. maths
Write a Python function to reverse a string. code
Write a short poem about the monsoon. instructions
Translate good morning into Hindi. instructions

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', 'instructions', 'maths', 'code'][int(logits.argmax())])

Training

Fine-tuned on Kaggle (two T4 GPUs, two settings trained at once, the better one kept: learning rate 7e-5, 5 epochs) on 8,000 balanced examples per label, split 80 / 10 / 10:

Label Examples from
chat Dolly 15k open and general questions (CC BY-SA 3.0), Google Synthetic-Persona-Chat (CC BY 4.0), Jigyasa Simple, Medium and Big (Apache 2.0)
instructions Dolly 15k writing, brainstorming, summarising and extraction tasks (CC BY-SA 3.0)
maths GSM8K, MetaMathQA and MATH (MIT), NuminaMath (Apache 2.0)
code CodeAlpaca-20k (only clearly code-related requests) and MBPP (CC BY 4.0)

Limitations

  • Short proofs and calculus questions are its weakest spot: some go to instructions or 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-NC 4.0 © 2026 Vrishvardhan Sharma.

Downloads last month
27
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