Skip to content

feat(desktop): recommend models from Macs with the same chip - #1610

Merged
jonathan308 merged 4 commits into
devfrom
feat/hardware-aware-model-recommendations
Nov 12, 2026
Merged

jonathan308 merged 4 commits into
devfrom
feat/hardware-aware-model-recommendations

Conversation

@jonathan308

@jonathan308 jonathan308 commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Status for 0.10.12 (2026-11-09, after the independent review): ready for review. Inert until darkbloom-platform#499 deploys its
by_chip data, so the merge order is free.

  • Review: approve (~/build/merge/mainnet/earnings/review-1449-1562-1610.md, 2026-11-09). Its H1 (three fixture cases) is done in 2c89d79303 and head 548a04b16c (signed; tests only, no source change):
    • the median ranks before the mean: "ranks by the typical Mac of this chip before the average one". Qwen 3.5 9B ($0.05 a day typical, $0.06 average) ranks above GPT-OSS 20B ($0.04, $0.20).
    • partial data: "ranks the models with per-chip rows when another model has none, unless a row is malformed". A model row without by_chip is skipped and the others still rank per chip; by_chip: null falls back to the totals.
    • onboarding: "recommended models in onboarding" renders StartServing with chipNetwork() and checks its copy, order and amounts.
    • Each fails when its logic is broken: the reviewer's mutants M2 and M3 (ranking by the mean), M4 and M5 (partial and null by_chip), M10 and M13 (onboarding ignores the ranking or its copy) now fail the suite, confirmed by two runs each; all six passed it before. 13 of the 17 mutants now fail it (was 7); M1, M6, M14 and M16 (the tiebreaks, fractional machines, the cap of three) still pass, as before.
  • CI (dev) run 42707869183 on 548a04b16c: success (no Swift job: desktop tests only). Desktop App (frontend) 42707868850: success.
  • Local on 548a04b16c: desktop npm test 103 files, 680 tests; tsc --noEmit and prettier clean. Merges cleanly into dev 0f11fbe01a (no dev merge needed).
  • Refactor pass (an independent review-only subagent, as AGENTS.md requires): one cleanup, 548a04b16c (the null-by_chip case builds its network with the fixture's mapModels); every assertion kept. The fixture's claim that the coordinator omits an empty by_chip matches platform provider: ContinuousBatchingV2 bridge behind DARKBLOOM_ENGINE_V2 (Gemma 4 + GPT-OSS 20B) #499 (json:"by_chip,omitempty").
  • The review's product notes are unchanged by design: all-or-nothing parsing (H2) and short lists for rare chips (H3).
  • "→ master" and head 651d44f4c below are history: the branch now targets dev.

Summary

"Recommended for your Mac" (onboarding and the Models screen) now ranks models by what Macs with
this Mac's chip earned per day from each model over the last 24 hours. It ranks by the median,
then the mean, from /v1/stats model_earnings[].by_chip. Before, it ranked by the seven-day
network totals. It falls back to those totals whenever per-chip figures are missing, stale or
malformed, or recommend no model this Mac can serve. The Swift runtime is unchanged.

Branch: feat/hardware-aware-model-recommendations → master. Head 651d44f4c (signed,
GitHub Verified). Commits: 283050549 (feature) and 651d44f4c (refactor pass).

Why

  • The totals steer every Mac to Gemma. Gemma QAT served 3.29M of the network's 4.19M
    jobs in the 24 h to 2026-10-26 03:00Z, about $239 of $483/day at list (earnings workstream §7).
    Once platform feat(provider): default-on n-gram loop detection for Gemma-4 requests #488 makes model_earnings non-null, a totals ranking puts Gemma first on every
    Mac that can run it.

  • Gemma pays most Macs almost nothing. Under speed-first routing, per machine per day (earnings
    workstream §4.3, public counter deltas, 2026-10-25/26):

    Hardware Gemma QAT $/day Better choice on this hardware
    M5 Ultra 96 GB 4.1–6.2 Gemma
    M5 Max 64–128 GB 0.56–2.61 Gemma, Qwen3.6-35B (M5 Max 128 GB: $3.40)
    M3 Ultra 256 GB 0.06–0.13 broad set or GLM/MiMo (the income plan's §3.4)
    M1/M2/M4 Max/Pro 64–128 GB 0.001–0.11 Qwen3.5-9B (M4 Max 64 GB: $0.25–0.57), gpt-oss-20b ($0.05–0.69)
  • Operators reported exactly this (2026-10-25/26): machines running Gemma out-earning their
    Nemotron ones ("I don't really understand that"); a 64 GB operator, "even switching to Gemma I
    barely get jobs now. Am I banned somehow?"; and an M3 Ultra 256 GB operator who "can't manage
    to hit $2/day".

Before

flowchart LR
  subgraph Behavior
    A1[GET /control/v1/network] --> B1[model_earnings: 7-day network totals]
    B1 --> C1[rank compatible models by network total]
    C1 --> D1["Top earning compatible models · network · 7 days → Gemma first on every Mac"]
  end
  subgraph Code
    S1[StartServing / AutopilotModels] --> R1["recommendedModels(models, networkEarnings)"]
    R1 --> V1["RecommendedModels(earnings)"]
  end
Loading

After

flowchart LR
  subgraph Behavior
    A2[GET /control/v1/network] --> B2{"fresh by_chip rows for this Mac's chip<br/>that recommend a model this Mac can serve?"}
    B2 -->|yes| C2["rank by median, then mean per machine-day; drop mean = 0"]
    C2 --> D2["Top earning on Apple M4 Max Macs · network · 24 hours<br/>$X a day typical · $Y average"]
    B2 -->|"no: old coordinator, no class, stale, malformed,<br/>or no servable model with earnings"| E2["rank by 7-day network totals, as before"]
    E2 --> F2["Top earning compatible models · network · 7 days"]
  end
  subgraph Code
    S2[StartServing / AutopilotModels] --> P2["chipRanking(models, chipEarnings(network, machine.chip))"]
    S2 --> R2["recommendedModels(models, networkEarnings, perChip)"]
    P2 --> R2
    R2 --> V2["RecommendedModels(earnings, perChip)"]
  end
Loading
  • chipEarnings(network, chip) parses by_chip strictly. It needs a fresh 7-day block
    (as_of ≤ 5 min old) and by_chip_window: "24h"; it returns null on a non-array, a
    non-integer amount, machines < 1 or a non-string chip, or when no row matches this chip.
  • chipRanking(models, perChip) keeps the per-chip figures only when they recommend a model this
    Mac can serve. The ranking and the copy therefore always fall back together.
  • recommendedModels(models, totals, perChip) ranks eligible models by this chip's median, then
    mean, keeping models whose mean is above zero, top three. Without per-chip figures, the
    network-total ranking is unchanged.

Fallback paths (verified)

Case Result Test
Coordinator without by_chip / by_chip_window (production today) 7-day totals, as before modelsChipRecommendations "falls back … absent, stale or malformed"; the existing modelsRecommendations suites are unchanged
by_chip_window: "24h", no class for this chip totals "reads what Macs with this chip earned …" (Apple M2 Pro → null)
Rows for this chip, but only for models this Mac can't serve or that paid nothing totals and the totals copy (fixed in the refactor pass; before, the list was empty: "No earning recommendations yet" on the Models screen and no recommendations in onboarding) "falls back to network totals when this chip earned from no model this Mac can serve"; view: "falls back to network totals and says so …"
as_of older than 5 min, malformed amount, machines: 0, non-string chip totals "falls back … absent, stale or malformed"
A model row without by_chip beside rows with it (partial data) per-chip for the others "ranks the models with per-chip rows when another model has none, unless a row is malformed"
by_chip: null totals the same test
model_earnings: null (no network data) existing single-model start unchanged

Chip detection matches the coordinator's classes exactly

  • Desktop. Machine.chip is loaded.hardware?.chipName ?? "Unknown hardware"
    (DesktopSnapshot.swift). The hardware comes from HardwareDetector.detect(): system_profiler SPDisplaysDataType sppci_model, falling back to machdep.cpu.brand_string.
  • Provider. It registers that same HardwareInfo.chipName as hardware.chip_name.
  • Coordinator. It keys classes by Hardware.ChipName verbatim, with no normalization. App
    Attest's hardware policy also requires the attested status chip to equal it.
  • Matching is exact string equality. The public fleet (/v1/stats, 2026-10-26 05:54Z, 1,151
    connections) reports 18 distinct values, all of the form Apple M<n>[ Pro| Max| Ultra]. A Mac
    whose detection failed reads "Unknown hardware", which matches no class, so it ranks by totals.

Dependency and stacking

Privacy

The app reads only public aggregates already relayed from /v1/stats and sends nothing new. What
the coordinator publishes, and its privacy floor, is reviewed in platform #499.

Test plan

  • Full desktop suite: npm test → 102 files, 671 tests passed (G's 669 plus 2 new), at
    651d44f4c on a clean tree, Node 24.22.1 (CI uses Node 22).
  • Fail-before / pass-after:
    • tests/modelsChipRecommendations.test.ts and tests/modelsChipRecommendationsView.test.tsx
      (G's 4 tests) fail on master (chipEarnings is not a function, assertion) and pass.
    • The refactor pass's 2 new tests fail on 283050549 (chipRanking is not a function;
      Unable to find … role "region" and name "Recommended for your Mac") and pass on 651d44f4c.
  • After the independent review (2026-11-09): three tests pin the ranking by the median before the mean, partial and null by_chip, and the onboarding screen (StartServing); desktop npm test 103 files, 680 tests at 548a04b16c. Each fails against the reviewer's matching mutant (M2, M3, M4, M5, M10, M13).
  • npx tsc --noEmit clean; npm run lint (prettier) clean.
  • make docs-impact-check BASE=origin/master: 11 changed files, coverage OK.
  • make changelog-check: 2 valid fragments; make changelog-preview shows this fragment.
  • Pre-push hook ran enabled; it checks only console-ui/, so it passed without work.
  • Mermaid: both diagrams render with mermaid-cli 11.17.
  • make docs-check reports 3 broken links into the libs/mlx-swift-lm gitlink
    (docs/architecture/inference.md, kv-cache-quantization.md, docs/developer/build.md). The
    gitlink is not initialized in the review worktree, and both targets exist at the pinned commit
    aee6ebb6. No file this PR touches is involved, and the result is identical on master.

Components touched

  • desktop app (Electron renderer: desktop-app/src/renderer/…, desktop-app/src/shared/contracts.ts)
  • docs (docs/developer/desktop-app.md, docs/reference/desktop-control.md)
  • provider-swift (Swift CLI): no change

Protocol / interface changes

  • No provider protocol changes. The desktop reads an optional field from the public /v1/stats
    response (model_earnings.models[].by_chip, model_earnings.by_chip_window), and
    NetworkData gains the matching optional types.

Documentation impact

  • Canonical documentation updated: docs/developer/desktop-app.md (Autopilot recommendations,
    including the chipRanking fallback) and docs/reference/desktop-control.md
    (/control/v1/network relays by_chip).
  • changelog.d/desktop-recommendations-by-chip.md.

Refactor pass: independent behavior-preserving review (2026-10-26), one commit, 651d44f4c.

  • Fallback fix. G's ranking returned no model when this chip had rows but none for a model this
    Mac can serve with earnings. The Models screen then read "No earning recommendations yet" and
    onboarding hid its recommendations, although totals were available. chipRanking now falls back
    to the totals, together with the totals copy. Two tests fail before and pass after.
  • Rename. The parser's predicate amount is now isAmount.
  • Kept. All of G's tests and assertions.
  • Checked. The chip mapping is exact end to end (above), and the old-coordinator path matches
    current behavior.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Error Error Nov 9, 2026 10:02pm UTC
d-inference-console-ui-dev Error Error Nov 9, 2026 10:02pm UTC
d-inference-landing Ready Ready Preview Nov 9, 2026 10:02pm UTC
darkbloom-status Ready Ready Preview Nov 9, 2026 10:02pm UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 9, 2026 10:02pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head ce22d28ffd14 against base 84ddfdba6bb7.

Reviewers: anthropic/claude-sonnet-5.5: first pass completed; anthropic/claude-opus-5.5: not needed by escalation policy; openai/gpt-6.1-sol: not needed by escalation policy

No actionable findings in the reviewed text. This is not a security approval.

Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging.

Scan completed.

Coverage: 42/42 source units; cross-file integration complete. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned.

Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 0 reused batch(es), 0 provider cache-hit tokens.

Saved findings and earlier report · Historical findings are not confirmed resolved.

Bedrock: 5 request(s), 232949 uncached + 0 cache-read + 0 cache-write input / 3510 output tokens; 0 request(s) with unknown usage. OpenRouter backup used 0 time(s). Dollar amounts above cover OpenRouter only; AWS billing is reconciled separately.
Workload allowance: 6 native request(s), including one shared response repair; 500 emergency ceiling. Selected depth and integration rounds are admitted as their scope becomes known.

"Recommended for your Mac" ranked models by seven-day network earnings,
which favors models that many fast Macs serve: an M3 Ultra or M4 Max was
steered to Gemma, which pays those Macs almost nothing under speed-first
routing.

When the coordinator publishes /v1/stats model_earnings[].by_chip (what one
Mac of a chip earned per day from each model over 24 hours), rank by this
Mac's chip: the median, then the mean, keeping models whose mean is above
zero. The card shows "$X a day typical · $Y average" and names the chip.
Without per-chip rows, or with stale or malformed data, the ranking falls
back to network totals as before. The Swift runtime already relays
model_earnings unchanged, so no runtime change is needed.

Tests: modelsChipRecommendations.test.ts (parsing, ranking, fallbacks) and
modelsChipRecommendationsView.test.tsx (Models screen copy and order) fail
on master and pass here; the full desktop suite passes (102 files, 669
tests); tsc and prettier are clean.
…nothing here

Refactor pass over "recommend models from Macs with the same chip".

When /v1/stats carries by_chip rows for this Mac's chip, but none for a model
this Mac can serve with a mean above zero (for example only a model too large
for it, or models that paid nothing), recommendedModels returned no model: the
Models screen said "No earning recommendations yet" and onboarding hid the
recommendations, although network totals were available. chipRanking now keeps
the per-chip earnings only when they recommend a model this Mac can serve;
otherwise the ranking and its copy fall back to the seven-day network totals
together. The parser's amount predicate is renamed isAmount.

Tests: modelsChipRecommendations ("falls back to network totals when this chip
earned from no model this Mac can serve") and modelsChipRecommendationsView
("falls back to network totals and says so ...") fail on 2830505 and pass.
…arding

Three cases the independent review asked for, so the tests hold what this
change is about (tests only; no source change):

- ranks by the typical Mac of this chip before the average one: Qwen 3.5 9B
  ($0.05 typical, $0.06 average) ranks above GPT-OSS 20B ($0.04, $0.20);
  the existing fixture sorted the same by either figure.
- ranks the models with per-chip rows when another model has none, unless a
  row is malformed: a row without by_chip (how the coordinator omits a model
  with no published class) leaves the others ranked per chip, while
  by_chip: null voids the per-chip view, so the totals rank.
- recommended models in onboarding: StartServing with chipNetwork() shows
  the per-chip header, order and amounts; nothing rendered it before.

Each fails against the reviewer's matching mutant, confirmed by two full
runs: M2 and M3 (ranking by the mean), M4 and M5 (partial and null
by_chip), M10 and M13 (onboarding ignores the ranking or its copy); all six
passed the suite before. 13 of the 17 mutants now fail it (was 7).

The fixture's network rewrites share one mapModels helper, and the view tests
one firstUse snapshot and cardNames reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The malformed-row case wrote out by hand the network rewrite that
mapModels already does; it now uses the exported helper. Same assertions;
M4 and M5 still fail the test, and the suite passes (103 files, 680 tests).

From the refactor pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonathan308
jonathan308 merged commit 0272f02 into dev Nov 12, 2026
21 checks passed

This branch had an error being deployed

2 failed (outdated) and 3 active deployments
Preview – eigen-homepages-darkbloom — 548a04b1 Deployed Nov 9, 2026 by vercel[bot]
Preview – d-inference-landing — 548a04b1 Deployed Nov 9, 2026 by vercel[bot]
Preview – darkbloom-status — 548a04b1 Deployed Nov 9, 2026 by vercel[bot]
Preview – d-inference — 93865043 Deployed Nov 8, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — 93865043 Deployed Nov 8, 2026 by vercel[bot]
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