Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

- Enable native MiMo standing wired residency by default. Without a standing residency set every command buffer must make the ~161 GiB weight payload resident again; on a 256 GiB M3 Ultra the driver kept unwiring it and single-stream decode measured ~0.4 tok/s (the request failed at 234 s), versus 37.8 tok/s with residency, identical requests and weights. The existing bounded ceiling still leaves max(16 GiB, 10%) of physical memory unwired and never grants load admission. `DARKBLOOM_MIMO_PERSISTENT_WIRED_RESIDENCY=0` (or `false`/`no`/`off`) restores the previous behavior and is now forwarded to the launchd provider job; the former opt-in value `1` remains valid.

## Unreleased — first-content exploration backoff

- Back evidence exploration off per provider identity after explorations fail: a first-content timeout, deadline refusal or genuine fault doubles a per-model suppression interval (5 minutes to 2 hours) and a delivered request halves it. Also stop exploring a provider whose remembered decode rate, corroborated over at least 5 observations and kept across evidence resets and reconnects, is below 0.25× the fleet median. Health breakers, reputation and the feasible-first fallback are unchanged.

## Unreleased — first-content evidence exploration

- Let an idle, loaded provider compete beside feasible peers after the 5-minute measurement-age threshold, using connection age when measurements are undated. This breaks the evidence-first exclusion of newly connected and long-idle providers without guaranteeing selection or measurement recovery. Hedge and fresh-feasible requests still require feasible evidence.
Expand Down
19 changes: 19 additions & 0 deletions coordinator/api/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ func (s *Server) cancelDispatchForFirstContentTimeout(
pr.Profile.Mark(registry.StampCancelSent)
s.sendRecordedCancel(provider, pr.RequestID, pr.Model, cancelCauseFirstChunkTimeout)
s.refundProviderExtra(pr)
// A timed-out exploration produced no evidence: back exploration off for
// this identity (registry/first_content_exploration_gate.go). No breaker
// sees first-content timeouts; that stays as it is.
if pr.FirstContentExplored() {
s.registry.RecordFirstContentExplorationOutcome(provider.ID, pr.Model, false)
}
return true
}

Expand Down Expand Up @@ -383,6 +389,12 @@ func (s *Server) noteInferenceError(providerID string, pr *registry.PendingReque
if providerID == "" || pr == nil {
return
}
// A deadline refusal stays health-neutral for every breaker below, but an
// exploration that ends in one produced no evidence, so it counts against
// exploration eligibility (registry/first_content_exploration_gate.go).
if pr.FirstContentExplored() && isDeadlineUnreachableErrorReason(errReason) {
s.registry.RecordFirstContentExplorationOutcome(providerID, pr.Model, false)
}
// Structured health-neutral outcomes (isProviderHealthNeutralErrorReason:
// jinja_* template-render failures, tool_noncompliance, and the
// request-clock-specific deadline_unreachable refusal) never feed provider
Expand Down Expand Up @@ -449,6 +461,10 @@ func (s *Server) noteInferenceError(providerID string, pr *registry.PendingReque
// fault-503ing ~all of its requests gets quarantined fleet-wide. errStr lets
// the breaker tell a capacity-503 (ignored) from a fault-503 (counted). Both
// breakers coexist.
// Only genuine faults count against exploration; capacity sheds do not.
if pr.FirstContentExplored() && registry.ProviderOutcomeIsFault(statusCode, errStr) {
s.registry.RecordFirstContentExplorationOutcome(providerID, pr.Model, false)
}
if opened, _ := s.registry.RecordProviderOutcome(providerID, false, statusCode, errStr, causes...); opened {
s.ddIncr("routing.provider_breaker_open", []string{"model:" + pr.Model})
}
Expand Down Expand Up @@ -574,6 +590,9 @@ func (s *Server) noteInferenceSuccess(pr *registry.PendingRequest) {
return
}
s.registry.RecordInferenceSuccess(pr.ProviderID, pr.Model, pr.Traits.CooldownShape())
if pr.FirstContentExplored() {
s.registry.RecordFirstContentExplorationOutcome(pr.ProviderID, pr.Model, true)
}
// A clean completion is an ACCEPT for the capacity-reject cooldown: clear
// the pair's reject streak, any active capacity cooldown, and the re-trip
// backoff. Belt-and-braces with the commit-time accept (commitFirstContent)
Expand Down
128 changes: 128 additions & 0 deletions coordinator/api/first_content_exploration_outcome_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
package api

// Exploration outcome hooks (registry/first_content_exploration_gate.go): an
// attempt selected through evidence exploration feeds its result back so a
// provider whose explorations fail is not explored again at once. These pin
// which terminals count, through the real noteInferenceError glue, and that
// a non-explored attempt never touches the exploration state.

import (
"fmt"
"testing"

"github.com/eigeninference/d-inference/coordinator/protocol"
"github.com/eigeninference/d-inference/coordinator/registry"
)

func deliverExploredError(t *testing.T, srv *Server, provider *registry.Provider, model, requestID string, explored bool, msg protocol.InferenceErrorMessage) {
t.Helper()
pr := &registry.PendingRequest{
RequestID: requestID,
ProviderID: provider.ID,
Model: model,
ChunkCh: make(chan registry.ProviderChunk, 1),
CompleteCh: make(chan protocol.UsageInfo, 1),
ErrorCh: make(chan protocol.InferenceErrorMessage, 1),
}
pr.SetFirstContentExplored(explored)
provider.AddPending(pr)
msg.Type = protocol.TypeInferenceError
msg.RequestID = requestID
srv.handleInferenceError(provider.ID, provider, &msg)
em, ok := <-pr.ErrorCh
if !ok {
t.Fatalf("ErrorCh closed without a terminal for %s", requestID)
}
srv.noteInferenceError(pr.ProviderID, pr, em.StatusCode, em.Error, em.ErrorReason, em.TerminalCause, em.CoordinatorCause)
}

func TestFirstContentExplorationOutcomeClassification(t *testing.T) {
cases := []struct {
name string
explored bool
msg protocol.InferenceErrorMessage
wantSuppressed bool
}{
{"deadline_refusal_explored", true, protocol.InferenceErrorMessage{
Error: "deadline unreachable", StatusCode: 503, ErrorReason: errorReasonDeadlineUnreachable,
FailureCode: protocol.FailureCodeCapacity}, true},
{"deadline_refusal_not_explored", false, protocol.InferenceErrorMessage{
Error: "deadline unreachable", StatusCode: 503, ErrorReason: errorReasonDeadlineUnreachable,
FailureCode: protocol.FailureCodeCapacity}, false},
{"genuine_fault_explored", true, protocol.InferenceErrorMessage{
Error: "engine failure: generation aborted", StatusCode: 500,
FailureCode: protocol.FailureCodeGenerationFailure}, true},
{"neutral_terminal_explored", true, protocol.InferenceErrorMessage{
Error: "deadline", StatusCode: 504, TerminalCause: terminalCauseSafetyDeadline,
FailureCode: protocol.FailureCodeGenerationFailure}, false},
// A capacity shed never ran the request: neutral for exploration as
// it is for the node-health breaker.
{"capacity_shed_explored", true, protocol.InferenceErrorMessage{
Error: "token budget exceeded", StatusCode: 503, FailureCode: protocol.FailureCodeCapacity}, false},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
srv, reg, provider, _ := newBreakerExemptionHarness(t, "explore-"+tc.name)
deliverExploredError(t, srv, provider, "test-model", fmt.Sprintf("req-%s", tc.name), tc.explored, tc.msg)
if got := reg.FirstContentExplorationSuppressed(provider.ID, "test-model"); got != tc.wantSuppressed {
t.Fatalf("exploration suppressed=%v, want %v", got, tc.wantSuppressed)
}
})
}
}

// A deadline refusal on an explored attempt backs exploration off without
// striking any health breaker: the maintainers' health-neutral rule stands.
func TestFirstContentExplorationDeadlineRefusalStaysHealthNeutral(t *testing.T) {
srv, reg, provider, _ := newBreakerExemptionHarness(t, "explore-neutral")
for i := range breakerStrikeRounds {
deliverExploredError(t, srv, provider, "test-model", fmt.Sprintf("req-neutral-%d", i), true,
protocol.InferenceErrorMessage{Error: "deadline unreachable", StatusCode: 503,
ErrorReason: errorReasonDeadlineUnreachable, FailureCode: protocol.FailureCodeCapacity})
}
if !reg.FirstContentExplorationSuppressed(provider.ID, "test-model") {
t.Fatal("explored deadline refusals did not back exploration off")
}
if reg.ProviderBreakerOpen(provider.ID) {
t.Fatal("deadline refusals opened the node-health breaker")
}
}

// The dominant failure of the provider that motivated this: explored
// attempts cancelled for a first-content timeout, which no breaker sees.
func TestFirstContentExplorationFirstContentTimeoutBacksOff(t *testing.T) {
for _, explored := range []bool{false, true} {
t.Run(fmt.Sprintf("explored_%v", explored), func(t *testing.T) {
srv, reg, provider, _ := newBreakerExemptionHarness(t, fmt.Sprintf("explore-timeout-%v", explored))
pr := &registry.PendingRequest{RequestID: "req-timeout", ProviderID: provider.ID, Model: "test-model",
ChunkCh: make(chan registry.ProviderChunk, 1), CompleteCh: make(chan protocol.UsageInfo, 1),
ErrorCh: make(chan protocol.InferenceErrorMessage, 1)}
pr.SetFirstContentExplored(explored)
provider.AddPending(pr)
if !srv.cancelDispatchForFirstContentTimeout(provider, pr) {
t.Fatal("setup: the timeout did not own the cancellation")
}
if got := reg.FirstContentExplorationSuppressed(provider.ID, "test-model"); got != explored {
t.Fatalf("exploration suppressed=%v, want %v", got, explored)
}
if reg.ProviderBreakerOpen(provider.ID) {
t.Fatal("a first-content timeout opened the node-health breaker")
}
})
}
}

// A delivered exploration halves the backoff; after one failure that clears it.
func TestFirstContentExplorationSuccessRecovers(t *testing.T) {
srv, reg, provider, _ := newBreakerExemptionHarness(t, "explore-success")
reg.RecordFirstContentExplorationOutcome(provider.ID, "test-model", false)
if !reg.FirstContentExplorationSuppressed(provider.ID, "test-model") {
t.Fatal("setup: failure did not suppress exploration")
}
pr := &registry.PendingRequest{RequestID: "req-ok", ProviderID: provider.ID, Model: "test-model"}
pr.SetFirstContentExplored(true)
srv.noteInferenceSuccess(pr)
if reg.FirstContentExplorationSuppressed(provider.ID, "test-model") {
t.Fatal("a delivered exploration did not lift a one-failure backoff")
}
}
3 changes: 2 additions & 1 deletion coordinator/registry/first_content_exploration.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ func firstContentEvidenceExplorable(c *routingCandidate) bool {
s := &c.snapshot
return s.modelLoaded && s.wholeMacWorkKnown && !s.wholeMacBusy && s.partialPrefillRows == 0 &&
s.totalPending == 0 && s.evidenceGapAgeMs >= 0 &&
time.Duration(s.evidenceGapAgeMs)*time.Millisecond >= firstContentEvidenceExplorationAfter
time.Duration(s.evidenceGapAgeMs)*time.Millisecond >= firstContentEvidenceExplorationAfter &&
!s.exploration.suppressed && !firstContentExplorationRememberedSlow(s)
}
Loading
Loading