Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix(local models): tell the catalog this machine's bandwidth and compute

bitcoinbuilderb150ff165dbc
diff --git a/cli/src/lib/localModels.spec.ts b/cli/src/lib/localModels.spec.ts
index 9918d13d2..59e96c648 100644
--- a/cli/src/lib/localModels.spec.ts
+++ b/cli/src/lib/localModels.spec.ts
@@ -802,6 +802,26 @@ describe('local model discovery and lifecycle', () => {
expect(snapshot.freeDiskBytes).toBeGreaterThan(0)
})
+ it("tells the catalog the machine's measured bandwidth and compute, which its speed estimates rest on", async () => {
+ const original = run.getMockImplementation()!
+ run.mockImplementation(async (args, output) => args[0] === 'device-info'
+ ? ok({ device_class: 'apple-silicon', backend: 'metal', usable_bytes: 54 * 1024 ** 3, memory: { total_gb: 64 },
+ mem_bandwidth_gbps: 400, compute_gflops: 15600 })
+ : original(args, output))
+ await service.list('home')
+ const sent = request.mock.calls.find(([url]) => String(url).includes('/catalog'))!
+ expect(JSON.parse(String(sent[1]?.body)).device).toEqual({ device_class: 'apple-silicon', usable_bytes: 54 * 1024 ** 3,
+ backend: 'metal', mem_bandwidth_gbps: 400, compute_gflops: 15600 })
+ })
+
+ it('leaves out a measurement the machine did not report, so the catalog falls back to its own', async () => {
+ await service.list('home')
+ const sent = request.mock.calls.find(([url]) => String(url).includes('/catalog'))!
+ const device = JSON.parse(String(sent[1]?.body)).device
+ expect(device).not.toHaveProperty('mem_bandwidth_gbps')
+ expect(device).not.toHaveProperty('compute_gflops')
+ })
+
it('names one model the same whatever its quantization', () => {
for (const name of ['Qwen3.6-35B-A3B', 'unsloth/Qwen3.6-35B-A3B-GGUF', 'Qwen3.6-35B-A3B-UD-Q5_K_XL.gguf', 'Qwen3.6-35B-A3B-Q4_K_M',
'qwen3.6-35b-a3b-bf16', 'Qwen3.6-35B-A3B-IQ4_XS', 'Qwen3.6-35B-A3B-MXFP4_MOE']) {
diff --git a/cli/src/lib/localModels.ts b/cli/src/lib/localModels.ts
index 2ae57ea46..3ac54b03e 100644
--- a/cli/src/lib/localModels.ts
+++ b/cli/src/lib/localModels.ts
@@ -281,10 +281,16 @@ export class LocalModels {
// Match `grid catalog`/`list` (cli/models.py `_fetch_pullable`): browse the
// catalog service's first page of ranked "popular" models for this device,
// not every compatible row across all pages — the picker shows one page.
+ // ⚠️ The machine's measured memory bandwidth and compute go too: the service estimates speed
+ // from them (grid_cli/catalog/ranking.py) and, without them, assumes 150 GB/s and 4 TFLOPS for
+ // any Mac — an M1 Max's 400 GB/s read as 2.7x slower than it is, and the models whose prompt it
+ // then judged too slow to process were not offered at all.
+ const bandwidth = num(device.mem_bandwidth_gbps), compute = num(device.compute_gflops)
const response = await this.request(url, {
method: 'POST', headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },
body: JSON.stringify({ browse: true, page: 1, page_size: 50, device: {
device_class: device.device_class, usable_bytes: device.usable_bytes, backend: device.backend,
+ ...(bandwidth ? { mem_bandwidth_gbps: bandwidth } : {}), ...(compute ? { compute_gflops: compute } : {}),
} }), signal: AbortSignal.timeout(20_000), redirect: 'error',
})
if (!response.ok) throw new Error('Compatible models are unavailable. Try again.')