Repository navigation
feat(desktop): recommend models from Macs with the same chip - #1610
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Threat model review — advisoryReviewed head 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. |
"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.
ce22d28 to
9386504
Compare
…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>
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/statsmodel_earnings[].by_chip. Before, it ranked by the seven-daynetwork 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. Head651d44f4c(signed,GitHub Verified). Commits:
283050549(feature) and651d44f4c(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_earningsnon-null, a totals ranking puts Gemma first on everyMac 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):
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)"] endAfter
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)"] endchipEarnings(network, chip)parsesby_chipstrictly. It needs a fresh 7-day block(
as_of≤ 5 min old) andby_chip_window: "24h"; it returnsnullon a non-array, anon-integer amount,
machines < 1or 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 thisMac can serve. The ranking and the copy therefore always fall back together.
recommendedModels(models, totals, perChip)ranks eligible models by this chip's median, thenmean, keeping models whose mean is above zero, top three. Without per-chip figures, the
network-total ranking is unchanged.
Fallback paths (verified)
by_chip/by_chip_window(production today)modelsChipRecommendations"falls back … absent, stale or malformed"; the existingmodelsRecommendationssuites are unchangedby_chip_window: "24h", no class for this chipApple M2 Pro→null)as_ofolder than 5 min, malformed amount,machines: 0, non-string chipby_chipbeside rows with it (partial data)by_chip: nullmodel_earnings: null(no network data)Chip detection matches the coordinator's classes exactly
Machine.chipisloaded.hardware?.chipName ?? "Unknown hardware"(
DesktopSnapshot.swift). The hardware comes fromHardwareDetector.detect():system_profiler SPDisplaysDataTypesppci_model, falling back tomachdep.cpu.brand_string.HardwareInfo.chipNameashardware.chip_name.Hardware.ChipNameverbatim, with no normalization. AppAttest's hardware policy also requires the attested status chip to equal it.
/v1/stats, 2026-10-26 05:54Z, 1,151connections) reports 18 distinct values, all of the form
Apple M<n>[ Pro| Max| Ultra]. A Macwhose detection failed reads "Unknown hardware", which matches no class, so it ranks by totals.
Dependency and stacking
feat/hardware-aware-model-recommendations),which is stacked on feat(provider): default-on n-gram loop detection for Gemma-4 requests #488 (
fix/earnings-public-model-earnings).current behavior. Merge order relative to the platform PRs is therefore free.
model_earningsunchanged(
DesktopResources.swift:"model_earnings": value.field("model_earnings")), so no runtimebuild or release is needed.
Privacy
The app reads only public aggregates already relayed from
/v1/statsand sends nothing new. Whatthe coordinator publishes, and its privacy floor, is reviewed in platform #499.
Test plan
npm test→ 102 files, 671 tests passed (G's 669 plus 2 new), at651d44f4con a clean tree, Node 24.22.1 (CI uses Node 22).tests/modelsChipRecommendations.test.tsandtests/modelsChipRecommendationsView.test.tsx(G's 4 tests) fail on
master(chipEarnings is not a function, assertion) and pass.283050549(chipRanking is not a function;Unable to find … role "region" and name "Recommended for your Mac") and pass on651d44f4c.by_chip, and the onboarding screen (StartServing); desktopnpm test103 files, 680 tests at548a04b16c. Each fails against the reviewer's matching mutant (M2, M3, M4, M5, M10, M13).npx tsc --noEmitclean;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-previewshows this fragment.console-ui/, so it passed without work.make docs-checkreports 3 broken links into thelibs/mlx-swift-lmgitlink(
docs/architecture/inference.md,kv-cache-quantization.md,docs/developer/build.md). Thegitlink 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 onmaster.Components touched
desktop-app/src/renderer/…,desktop-app/src/shared/contracts.ts)docs/developer/desktop-app.md,docs/reference/desktop-control.md)Protocol / interface changes
/v1/statsresponse (
model_earnings.models[].by_chip,model_earnings.by_chip_window), andNetworkDatagains the matching optional types.Documentation impact
docs/developer/desktop-app.md(Autopilot recommendations,including the
chipRankingfallback) anddocs/reference/desktop-control.md(
/control/v1/networkrelaysby_chip).changelog.d/desktop-recommendations-by-chip.md.Refactor pass: independent behavior-preserving review (2026-10-26), one commit,
651d44f4c.Mac can serve with earnings. The Models screen then read "No earning recommendations yet" and
onboarding hid its recommendations, although totals were available.
chipRankingnow falls backto the totals, together with the totals copy. Two tests fail before and pass after.
amountis nowisAmount.current behavior.
Need help on this PR? Tag
@codesmith-botwith what you need.