Skip to content

lanes: a learned row cost may fall below the table, and learning rounds reach the width they measure - #2777

Merged
ashhart merged 2 commits into
mainfrom
lead/row-cost-both
Nov 11, 2026
Merged

ashhart merged 2 commits into
mainfrom
lead/row-cost-both

Conversation

@ashhart

@ashhart ashhart commented Nov 10, 2026

Copy link
Copy Markdown
Owner

What this changes

Where a family learns its shared rows' cost (learn_row_costs), a fit showing rows cost less than shared_costs says now lowers their price instead of counting as nothing. Before, a table timed on a slower build kept its slope forever and kept out drafts that would pay. The fall must clear the same two-sided noise test as a rise, and a round never prices below its streams' plain width (allocate.rowTerm). While a stream count has no fit, its rounds now reach the width they measure (HeadCost.least_rows, the likeliest drafts first) instead of only being capped there, so a table that prices every draft out still gets its wider widths measured.

Checks on this head

  • Head commit: 41cd6bae42a8b52f0cfc55cb9e91419ce4c00cb8
  • Lean checker: 386 problems on main, 386 on this head, 0 new.
  • Tests: zig test -lc --dep sys -Mroot=zig/src/core/lanes/lanes.zig -lc -Msys=zig/src/platform/sys.zig: 353 passed, 1 skipped, 0 failed. Five tests are new or changed, and each fails on main:
    • allocate: the floor, and the bound at the plain width.
    • row_cost: a falling fit lowers the price; a stale table is corrected down and capped; a learning round reaches each measured width, then nothing is forced.
  • zig build test-lane-api-host passes (584 tests).
  • zig fmt --check zig/src/core/lanes/ clean. depth.zig is 598 lines.
  • CI: pending.
  • Not run: a served A/B. See the receipt.

Receipt

  • Main against branch:
    • Not run. On main only GLM sets learn_row_costs, and only on Macs without tensor units.
    • Our M3 Ultra has 131 GB free against the 182 GB TensorFold/GLM-5.3-Flash-MLX-4bit-MTP, and the M5 Ultra has tensor units, so it doesn't learn row costs.
    • Anyone with GLM on an M1-M4 Mac: tools/bench_concurrent.py at 1, 4 and 8 streams, greedy and sampled, main against this head, would settle it.
  • Boxes it reaches: GLM on Metal without tensor units. Every other family's decisions are unchanged:
    • With nothing learned, extraMs and leastRows are 0.
    • rowTerm returns the old product for a row price at or above 0.
    • The allocator with least_rows 0 is the old loop.
  • New switch? No.
  • Exactness: only how many drafts a round verifies changes. Acceptance never reads the price, so replies are unchanged. The engine tests' shared-equals-solo and drafted-equals-plain cases pass.
  • Prompt speed: n/a, the change doesn't reach prompt processing.
  • Licence: n/a.

Seen first on the community DeepSeek-V4.1 recipe on four DGX Sparks: a fork of our lane core whose row table was timed before its wide-MoE kernels. At 16 streams it kept every prose draft out (about one row a stream, ~16 tokens a ~83 ms round). The same fix for that fork is with its maintainer for a ring A/B.

Checklist

  • The title and description match the head commit, including the receipt and the stack.

  • New tests fail before the change, pass after it, and skip cleanly without their dependency.

  • Comments and docstrings are one line. No measurements or history in the source.

  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.

  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.

  • No precision traded for speed. No bits change.

  • Decode and prompt processing are no slower than main: unmeasured on the one configuration it reaches (above).

  • Synthena (Ash's Agent)

…ds reach the width they measure

Where a family learns shared rows' cost (learn_row_costs), a fit that clears the
noise test now lowers the row price as well as raising it, bounded so a round
never prices below its streams' plain width. While a stream count has no fit,
its rounds reach the measured width (the likeliest drafts first), so a table
that prices every draft out still gets its wider widths measured. Only how many
drafts a round verifies changes; families that do not learn row costs are
unchanged.
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.

lanes: a learned row cost never falls below the table, so a table timed on a slower build keeps paying drafts out

1 participant