RouteWeaver-4B

The routing policy from RouteWeaver: Weaving Mode Selection and Execution into Unified LLM Routing.

Existing LLM routers fix the execution paradigm in advance — single-round, multi-round or agentic — so they adapt which models to call but not how the calls are organized. RouteWeaver makes the paradigm itself a routing decision: this model selects an execution mode, then routes frozen worker models inside the mode it chose.

What this model does

It is not a chat model and it does not answer questions. It writes routing actions, and the surrounding agent loop executes them against a worker pool:

<mode>agentic</mode>
<route model="worker_3" role="planner" refs="">Split the problem into sub-tasks: ...</route>
<observation id="n1" role="planner">...</observation>
<route model="worker_3" role="executor" refs="n1">Compute ...</route>
<observation id="n2" role="executor">...</observation>
<answer>9</answer>

Three modes share one action grammar:

mode execution
single exactly one worker call
multi two to four sequential calls, each seeing the previous observation
agentic up to eight calls over role-structured layers (planner / executor / verifier / summarizer) with explicit references between them

Workers are addressed only by anonymous ids (worker_1 … worker_6) that the prompt pairs with capability descriptions; the router never sees model names or prices. The ids are positional: they mean what the prompt says they mean, so the model must be served with the same pool definition it was trained with (configs/route_channels.yaml in the code repository).

Usage

The model only behaves as a router inside the agent loop that parses its actions and calls the workers. Use the code repository:

git clone https://github.com/LaughKing/RouteWeaver && cd RouteWeaver
bash setup_env.sh && conda activate routeweaver

CKPT=$(python -c "from huggingface_hub import snapshot_download as d; print(d('e2rea1/RouteWeaver-4B'))")
TAG=routeweaver GPU=0 bash scripts/eval.sh paper

Loading the weights on their own works as usual, and is useful for inspecting what it emits:

from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("e2rea1/RouteWeaver-4B", dtype="bfloat16")
tok = AutoTokenizer.from_pretrained("e2rea1/RouteWeaver-4B")

This model is trained with α = 0 — task reward only. Three cost-aware operating points of the same method are in RouteWeaver-4B-cost: α = 0.1 cuts worker cost 23% for 1.0 point of accuracy, α = 0.3 cuts it 61% for 3.1 points.

Decoding used for every reported number: greedy at evaluation time (temperature 0.8 / top-p 0.95 during training), prompts capped at 6,144 tokens, the multi-turn response budget at 16,384, each observation at 2,048.

Worker pool

The six frozen workers the router was trained against. Serving a different pool changes what the ids mean, and the policy's choices stop being meaningful.

id model
worker_1 Qwen3-8B
worker_2 Llama-3.1-8B-Instruct
worker_3 Qwen3-30B-A3B-Instruct-2507
worker_4 Gemma-3-27B-IT
worker_5 Llama-3.3-70B-Instruct
worker_6 Gemini-2.5-Flash-Lite

Limitations

  • Pool-specific. The policy learned which anonymous id is good at what. It does not transfer to a different worker pool without retraining.
  • Not a standalone model. Without the agent loop it emits actions nobody executes.
  • It inherits the limitations of the workers it calls: a wrong worker answer propagates, and the router cannot verify facts itself.
  • Trained on Math / Code / Knowledge / Reason / Recall questions in English.

Citation

@article{routeweaver2026,
  title   = {RouteWeaver: Weaving Mode Selection and Execution into Unified LLM Routing},
  author  = {Wang, Xiaohan and Zhang, Haozhen and Liu, Qingyuan and Feng, Tao and Wang, Wenya},
  journal = {arXiv preprint},
  year    = {2026}
}

Built on verl and vLLM; the base model is Qwen3-4B-Instruct-2507.

Downloads last month
66
Safetensors
Model size
4B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for e2rea1/RouteWeaver-4B

Finetuned
(2380)
this model
Quantizations
1 model

Collection including e2rea1/RouteWeaver-4B