tune(moa): tighten first_answer_grace from 6s to 3s - #626
Closed
michaelneale wants to merge 2 commits into
Closed
Conversation
Empirical default tuning based on public-mesh lab data. Setup: 3-node + public-mesh client, MoA fans out to 4-5 workers, including studio MiniMax (~1s), mini Qwen3.5 (~700ms), and assorted public-mesh peers. Before (6s grace, PR #624 diverse-answer landed): median mesh_chat ~6.0s (5/5 runs hit grace ceiling) After (3s grace): median mesh_chat ~2.0s (lab data: 10/10 turns sub-2.1s) Quality: across factual / arithmetic / subjective / creative-short prompts in the lab, all 10 turns returned correct or reasonable answers. The 1 turn that was technically loose ("write a 5-word sentence about rain" returned a 6-word sentence) is consistent with MoA's general short-creative-constraint behavior, not a new failure mode introduced by tighter grace. Trade-off being made: a worker that takes 3-6s to land is now excluded from consensus. On the public mesh post-PR #624 we found consensus rarely fires anyway (textually-identical short answers are rare); we fall through to grace's highest-confidence picker. So the 3s ceiling is effectively the floor for chat latency, not the midpoint of a consensus distribution. Other change: zero. Backwards compatible \u2014 callers that explicitly build a (tests, custom integrations) keep their configured value.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the MoA gateway’s chat-mode timeout tuning by reducing the first_answer_grace default, aiming to improve perceived chat latency by allowing earlier exit when grace conditions are met.
Changes:
- Reduced
first_answer_gracedefault from 6s to 3s in the MoA gateway config. - Added a lab TODO note capturing post-#624 measurement takeaways / next steps.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| MIC_LAB_TODO.md | Adds a short lab strategy/todo note related to grace behavior and streaming ideas. |
| crates/mesh-llm-host-runtime/src/network/openai/moa_gateway.rs | Lowers the default first_answer_grace duration and expands the rationale comment. |
Comments suppressed due to low confidence (1)
crates/mesh-llm-host-runtime/src/network/openai/moa_gateway.rs:307
- PR description and this comment block assume the “diverse fast answers” grace behavior from PR #624, but that logic does not appear to be present in this branch (no matching grace tests, and
gather_workers_incrementalstill requiresanswers.len() == 1). With the current sole-answer grace, tightening this timer may not address the stated chat latency floor. Either include the prerequisite #624 behavioral change in this PR/stack, or adjust the PR description + rationale comments accordingly.
// 3 seconds: empirically good across the public mesh. Long
// enough that slow-but-good workers (e.g. studio MiniMax
// landing at ~1s, mini Qwen3.5 at ~700ms) finish before the
// timer; short enough that the chat UI feels responsive
// instead of sitting on the 6s ceiling. Lab data: median
// mesh_chat dropped from ~6s to ~2s after this change with no
// measurable quality regression on factual, arithmetic, and
// short-creative prompts.
first_answer_grace: std::time::Duration::from_secs(3),
| hedge_delay: std::time::Duration::from_secs(5), | ||
| // Chat-only sole-answer grace. Tool turns ignore this. | ||
| first_answer_grace: std::time::Duration::from_secs(6), | ||
| // Chat-only grace: after this long since dispatch, if at least |
Comment on lines
+4
to
+6
| * **Chat path is now grace-bounded.** `mesh_chat` p50 floor on the public | ||
| mesh is ~6s = the `first_answer_grace` config. To make chat feel | ||
| faster, lower the grace (1.5-2s), trade off: more likely to take a |
Collaborator
Author
|
Rolled into #624 \u2014 the eligibility relaxation and the tighter default are the same user-journey change and only meaningful together. Easier to review as one PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Lowers the chat-mode
first_answer_gracedefault from 6 seconds to 3 seconds. This is a one-line tuning change. Built on top of #624 (which makes grace fire on diverse fast answers \u2014 needed for the chat case where workers don't textually agree).Why now
On the public mesh today (5 workers including studio MiniMax, mini Qwen3.5, etc.):
With #624 landed and the timer being the dominant chat path, 3s gives 2\u00d7 better p50 with no measurable quality regression on short chat prompts.
Lab data, public mesh, 10 varied turns
Latency distribution:
Trade-off
A worker that takes 3\u20136s to land is now excluded from consensus. On the public mesh post-#624 we found textual consensus rarely fires for chat anyway, so this isn't losing a path that was actually firing.
For agentic / tool turns (
has_tools=true), grace is bypassed entirely and consensus continues to work as before. The 3s number is chat-only.Compat
GatewayConfigkeep their configured value.Tests
cargo test -p mesh-llm-host-runtime --lib: 1463 pass.
cargo clippy --all-targets -- -D warnings: clean.
cargo fmt --all -- --check: clean.
The grace eligibility logic itself (which determines when the timer arms) is covered by PR #624's tests. This PR is strictly a config tuning, no behavior-shape change.
Open question
3s is empirical. A more conservative tuning would be 4-5s. A more aggressive one would be 2s (tested in lab, all 10 turns sub-2.5s but tight enough that any worker with 2s+ network latency is excluded). Happy to land at any number you prefer.