Instructions to use eulogik/fugusashi-router with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use eulogik/fugusashi-router with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("eulogik/fugusashi-router") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Fugusashi Router β CMA-ES Evolved Model Routing Weights
What is This?
CMA-ES evolved routing weights for the Fugusashi intelligent model router β an open-source alternative to Sakana AI's Fugu model router.
A 385-dimensional weight vector (384 embedding weights + 1 bias) that maps prompt embeddings to model selection, learned via Covariance Matrix Adaptation Evolution Strategy (CMA-ES) β the same evolutionary optimization approach used in Sakana AI's TRINITY paper.
This is the evolved router brain β the weights that tell the Fugusashi router which model to pick for each prompt.
Quick Start
import numpy as np
import json
from sentence_transformers import SentenceTransformer
from huggingface_hub import hf_hub_download
# Download weights from HuggingFace
weights_path = hf_hub_download(repo_id="eulogik/fugusashi-router", filename="cmaes_weights.json")
with open(weights_path) as f:
data = json.load(f)
weights = np.array(data["mean"])
bias = weights[-1]
# Embed prompt and route
embedder = SentenceTransformer("all-MiniLM-L6-v2")
embedding = embedder.encode(["Write a Python function to sort a list"], normalize_embeddings=True)[0]
logits = embedding @ weights[:384] + bias
models = ["gpt-oss-120b", "nemotron-3-ultra", "nemotron-3-super", "hermes-3-405b", "lfm-2.5-1.2b"]
chosen = models[np.argmax(logits)]
print(f"Route to: {chosen}")
Or Install the Full Router
pip install fugusashi
from fugusashi.coordinator import CMAESRouter
from fugusashi.config import load_config
config = load_config("config.yaml")
router = CMAESRouter(config=config)
result = router.route("Write a Python sorting function")
print(f"Model: {result.model}, Latency: {result.latency_ms:.1f}ms")
Training Details
| Field | Value |
|---|---|
| Algorithm | CMA-ES (Covariance Matrix Adaptation Evolution Strategy) |
| Dimensions | 385 (384 embedding weights + 1 bias) |
| Population | 16 |
| Generations | 30 |
| Training tasks | 20 preference samples |
| Best fitness | ~0.24 |
| Embedding model | all-MiniLM-L6-v2 |
| Mean latency | 4.0ms |
| P95 latency | 4.4ms |
| P99 latency | 7.9ms |
Performance
- 4ms mean routing latency β 25x faster than LLM-based routing
- 85% accuracy with training data, 70% cold-start
- CMA-ES evolution β weights improve continuously from outcomes
- Federated learning β privacy-preserving collaborative routing
- Natural language explanations β every decision explained
Model Pool
| Model | Role | Provider |
|---|---|---|
| gpt-oss-120b | Heavy reasoning | OpenRouter (free) |
| nemotron-3-ultra | General | OpenRouter (free) |
| nemotron-3-super | Light general | OpenRouter (free) |
| hermes-3-405b | Code/creative | OpenRouter (free) |
| lfm-2.5-1.2b | Ultra-fast | OpenRouter (free) |
How It Works
Prompt β Embed (384d) β Dot Product (weights[:384]) + bias β argmax β Model
The 385-dimensional weight vector is evolved via CMA-ES across 30 generations with a population of 16. Each generation evaluates routing accuracy on a training set of preference samples.
Project Links
| Resource | Link |
|---|---|
| Source Code | github.com/eulogik/fugusashi |
| PyPI Package | pypi.org/project/fugusashi |
| Live Demo | huggingface.co/spaces/eulogik/fugusashi |
| Dataset | huggingface.co/datasets/eulogik/fugusashi-preferences |
| Website | eulogik.github.io/fugusashi |
| eulogik | eulogik.com |
Citation
@software{fugusashi2026,
title={Fugusashi: Open-Source Intelligent Model Router},
author={{eulogik}},
year={2026},
url={https://github.com/eulogik/fugusashi},
doi={10.5281/zenodo.XXXXXXX}
}
License
MIT β use it however you want.
Built with β€οΈ by eulogik
Fugu Sashi. Served Free.