Skip to content

MoA: Mixture-of-Agents multi-model strategies - #9

Closed
michaelneale wants to merge 7 commits into
mainfrom
mom-experiment
Closed

michaelneale wants to merge 7 commits into
mainfrom
mom-experiment

Conversation

@michaelneale

@michaelneale michaelneale commented Mar 22, 2026

Copy link
Copy Markdown
Collaborator

What

Client-side Mixture-of-Agents (MoA) implementation — fan out requests to multiple models, aggregate responses.

Based on:

Strategies

  • moa — synthesize all responses into one (best for chat quality)
  • best-of-n — pick the best response verbatim (best for correctness)
  • moa-2 — two-layer: fan-out → all refine → aggregate (highest quality, 3x latency)

All three appear as virtual models in /v1/models when 2+ real models are available. Selectable by model name.

How it works

  • Client-side only — hosts are unaware. Client fans out via reqwest loopback to the local proxy, which routes via QUIC to mesh hosts
  • Tier filtering: only fans out to strong models (tier 3+) — weak models add latency without quality
  • Aggregator is always the highest-tier model (pick_aggregator())
  • Handles thinking models (captures reasoning_content fallback)

Eval results

Claude Sonnet 4 MiniMax-253B solo MoA
Agentic task (pi) 13s, 5/5 18s, 5/5 45s, 3/5
  • MiniMax-253B matches Claude on agentic coding tasks (confirmed 2 runs)
  • MoA is good for single-turn chat quality
  • MoA breaks tool-use — aggregation prompt confuses tool-call protocol

Known limitation: tool calls

MoA synthesis injects a prompt that breaks agent tool-use flows. Two strategies under consideration:

  1. MoA for reasoning → separate pass extracts tool calls
  2. Best-of-N for tool calls → pick best proposal verbatim (simpler)

Files

  • mesh-llm/src/moa.rs — strategies, fan-out, aggregation (~300 LOC)
  • mesh-llm/src/proxy.rs — MoA interception in handle_mesh_request
  • mesh-llm/src/main.rs — MoA interception in api_proxy
  • mom/ — experiment data, eval scripts, results

NSED experiment (also in this branch)

Implemented N-Way Self-Evaluating Deliberation from the MoM paper. Multi-round deliberation with cross-evaluation and quadratic voting. Findings:

  • Tool routing is the killer feature (ensemble reliably picks the model with best tool calls)
  • 3-10x latency overhead for marginal quality improvement on most tasks
  • Single-round is the sweet spot — led to Best-of-N strategy

3-model ensemble (MiniMax-253B, Qwen3-8B, Qwen3-30B-A3B) on Studio.
NSED protocol: parallel proposals, anonymous cross-evaluation with
diagonal mask, quadratic voting, up to 3 deliberation rounds.

Key findings:
- Tool use: ensemble correctly picks model with best tool coverage
- Reasoning: multi-round deliberation improves structure/rigor
- Math/code: no improvement when all models solve correctly
- Latency: 3-10x overhead, too much for interactive use
- Weak models (8B) become pure evaluators, never win proposals

Promising direction: single-round MoM as a mesh router strategy
for model=auto — try all models, vote on best answer.
Direct head-to-head: Claude Sonnet 4 vs Qwen3-8B (local) on finding
bugs in a statistics module.

Claude: 34s, found 10 issues, excellent quality, idiomatic Python
Qwen3-8B: 29s, found 7 issues, good quality, missed subtle edge cases

Claude meaningfully better but gap isn't enormous. MoM ensemble could
close it by combining diverse model perspectives.
Proper agentic comparison using pi -p harness (same as Open Model Gym).
Task: add display_name() to Rust User struct.

Claude Sonnet 4: 12s, read file, edited correctly, compiles. 5/5.
Qwen3-8B: 84s, hallucinated method already exists, no edit. 3/5.

The gap is massive for agentic work. Single-turn reasoning is
comparable, but tool use (read/edit/verify) is where small models
fall apart. Need to test MiniMax-253B and Qwen2.5-72B next.
New module moa.rs with three strategies, selected by model name:
- moa: Fan-out to all models → aggregator synthesizes (MoA paper)
- best-of-n: Fan-out → aggregator picks best response verbatim
- moa-2: Two-layer fan-out → all refine → aggregator synthesizes

All run client-side via reqwest loopback through local proxy.
Hosts are unaware. Virtual models appear in /v1/models when 2+ models.

Handles thinking models (reasoning_content fallback).
Tested end-to-end: 3 mesh models (MiniMax-253B, Qwen2.5-72B, Qwen3.5-9B).

98/98 tests pass.
Key findings:
- MiniMax-253B via mesh: 5/5, 24s — identical edit to Claude
- Claude Sonnet 4: 5/5, 15s — baseline ceiling
- Qwen3-8B: 3/5 — hallucinated, no edit (confirmed again)
- MoA: failed (0 output) — fan-out latency exceeds pi timeout

Local algo comparison (3 models):
- MoA synthesis amplifies hallucinations from weaker models
- Best-of-N better than synthesis for correctness
- All strategies 3.5x slower than solo on convergent tasks

Model scale is the answer for agentic work. MiniMax-253B (free)
matches Claude (paid) on the same task.
…l-use

- Filter MoA fan-out to tier 3+ models only (drops Qwen3.5-9B)
- Fan-out time: 80s → 3s
- Increase connect_timeout to 30s (QUIC tunnel setup needs time)

Eval results (confirmed across 2 runs):
- Claude Sonnet 4: 13-15s, 5/5
- MiniMax-253B solo: 18-24s, 5/5 — MATCHES CLAUDE
- MoA: 45s, 3/5 — aggregation prompt breaks tool-use protocol

MoA is good for chat quality, bad for agentic work.
Solo strong model is the right strategy for agents.
- Move superseded Python prototypes to mom/historical/
- Add REFERENCE.md (MoA/NSED/RouteMoA literature notes)
- .gitignore Mixture.pdf
- Document MoA tool-call strategy as key next step:
  option (a) MoA for reasoning → separate tool extraction pass
  option (b) Best-of-N for tool calls → pick best verbatim (simpler)
- Updated file index in PLAN.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant