Combines two of the project's most useful encoder shifts in one model:
Multilingual base — encoder is
sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 (117M
params, 50+ languages), so French / Spanish / German queries route
into the same 18 671-tool English catalog as the default.
Next-tool fine-tune — the multilingual encoder has been
fine-tuned on 8 386 next-tool prediction triplets with a
contrastive (task, gold_description, hard_negative) objective. Hard
negatives come from the previous hybrid encoder's top-50 retrieval,
so each gradient step pushes past its own retrieval mistakes.
Encoder lives at
dalek-ai/multilingual-next-v1,
loaded lazily on the first route() call. ~33 MB of TF-IDF + encoder
centroids on disk in this repo.
Quick start
Install the SDK directly from GitHub (PyPI publish pending):
1from agent_tool_router import Router
2r = Router.from_pretrained("baseline-v1-desc-hybrid-multilingual-next-v1")3r.route("annule ma commande en attente et rembourse le crédit", k=3)4r.route(5"I want to add a checked bag to my reservation",6 k=3,7 history=["update_reservation_flights"],8)
The L12 base beats the L6 base on recall@50 and Markov top-3 K=50,
at the cost of ~2pp on recall@200 (the L6 fine-tune still wins the
top-200 rerank). Reproduce:
python -m router.eval.eval_next_tool_widen --cache-dir data/cache/next_tool_multilingual_v1 --model dalek-ai/baseline-v1-desc-hybrid-multilingual-next-v1.
The fine-tune Pareto-dominates the plain multilingual base on every
held-out source (Hermes +7.3pp, ToolACE +4.3pp, tau-bench +33.9pp).
Compared to the English-only minilm-next-v1 fine-tune, it gives up
~3pp on Hermes / ToolACE in exchange for an extra +4.7pp on tau-bench
and the multilingual coverage.
History bigram rerank (Markov-2, ≥ 0.4.0)
Passing a 2-step history triggers stupid backoff to the bigram table
shipped in this repo (markov2_counts.npz + markov2_keys.npy, ~25 KB),
falling back to Markov-1 when the (prev2, prev1) pair is unseen in train.
Same held-out 2 094 triplets, K=200, best alpha per system:
system
top-1
top-3
top-5
Markov-1 only (≥ 0.3.0)
51.7%
73.7%
80.1%
Markov-2 backoff (≥ 0.4.0)
56.9%
76.2%
80.5%
delta
+5.2pp
+2.5pp
+0.4pp
Largest single-position gain: tau-bench t=2 reaches 100% top-3 with
Markov-2 (was 97.4% with Markov-1). tau-bench t≥3 climbs to 92.9% top-3
(+8.1pp). On the 775 test rows whose (prev2, prev1) bigram is seen in
train, top-1 jumps +14.0pp (62.5% → 76.5%). Reproduce:
python -m router.eval.eval_next_tool_markov2 --cache-dir data/cache/next_tool_multilingual_v1 --model dalek-ai/baseline-v1-desc-hybrid-multilingual-next-v1.
FR/EN qualitative probe (n=50 parallel queries)
model
EN top-3
FR top-3
EN top-5
FR top-5
baseline-v1-desc-hybrid (default MiniLM-L6)
82%
26%
90%
30%
baseline-v1-desc-hybrid-multilingual
82%
54%
90%
62%
baseline-v1-desc-hybrid-next-v1
86%
28%
94%
28%
baseline-v1-desc-hybrid-multilingual-next-v1
84%
54%
90%
60%
No French drift from the EN-only fine-tune triples (54% top-3 FR
identical to the plain multilingual). +2pp EN top-3 over the plain
multilingual. Reproduce: python -m router.eval.eval_fr_pretrained.