Skip to content
R

RouteMesh

Know which model a prompt deserves

Created on 26th October 2026

•

R

RouteMesh

Know which model a prompt deserves

The problem RouteMesh solves

Most LLM apps send every prompt to the same model. A one-line question like "how do I undo the last git commit" gets the same heavyweight treatment as "design a rate limiter that scales to 10k req/s", which wastes compute and time on easy requests.

RouteMesh is a prompt router that decides how much model power a request actually needs, then answers it with a local LLM through Ollama (no API costs, runs on your own machine).

For each prompt it decides two things:

  • Task: generate, debug, refactor, explain, shell, docs, or design
  • Tier: cheap (qwen2.5:1.5b) for short, well-defined, low-risk requests, or expensive (qwen2.5:3b) for long, multi-step, or high-stakes ones

The classifier is a Logistic Regression on MiniLM sentence embeddings plus 10 hand-built features (word count, code fences, stack-trace words, version numbers, design words, etc.). A set of safety rules overrides it for obvious cases, e.g. a real multi-line stack trace always goes to the expensive model.

The web UI shows the routing result and why that route was chosen, so the decision is transparent instead of a black box.

Challenges we ran into

1. What counts as "cheap" vs "expensive"?
There's no ground-truth label for this. We built the training set from code datasets (MBPP, CodeAlpaca, Magicoder, SQL) plus templates, and the tier labels are partly based on prompt length and template type, not measured model performance. That means a short prompt can still be hard. We documented this limitation openly and made the UI explain each routing decision so mistakes are easy to spot.

2. The classifier alone wasn't reliable on obvious cases.
A statistical model can misroute things like pasted stack traces. We added a rules layer (apply_rules) that overrides the classifier: a real stack trace forces debug, and a multi-line one forces expensive. Combining ML with hard rules fixed the high-stakes failures.

3. Template-based training data.
Many debug/design/docs/shell examples were generated from templates, so the router did best on prompts that look like the templates and worse on unusual phrasing. We mixed in real code datasets alongside the templates to improve coverage.

4. Environment and dependency issues.
Python 3.15 was too new for torch and scikit-learn, and router.joblib only loads with the same scikit-learn version it was trained with. We pinned to Python 3.12/3.13 and matched versions, and wrote setup steps and a troubleshooting table in the README so others can run it.

5. Local model limits.
Both models are small and from the same family, answers are capped at 300 tokens, and the first request is slow while Ollama loads the model. The docs task also can't fetch live info. We scoped these as known limitations and planned fixes: a search/RAG path, confidence-based escalation, and more tiers.

Technologies used

Discussion

Builders also viewed

See more projects on Devfolio