Skip to content

Add reference low-bit quantizers and physical-cost model (CAP3-01, SLM-90)#338

Merged
Tyler-R-Kendrick merged 1 commit into
mainfrom
slm-90-cap3-01-quantization
Jul 18, 2026
Merged

Add reference low-bit quantizers and physical-cost model (CAP3-01, SLM-90)#338
Tyler-R-Kendrick merged 1 commit into
mainfrom
slm-90-cap3-01-quantization

Conversation

@Tyler-R-Kendrick

@Tyler-R-Kendrick Tyler-R-Kendrick commented Jul 18, 2026

Copy link
Copy Markdown
Owner

CAP3-01 (SLM-90): reference low-bit quantizers and physical-cost model

An architecture-agnostic reference quantization package + physical-cost ledger, registered into TwoTower behind a disabled-by-default quant_format config.

What's here (14 files, additive, on current main)

  • models/quantization/formats.py (low-bit formats, torch-free), fake_quant.py, observers.py, convert.py (walks named_modules() for nn.Linear — no TwoTower coupling), diagnostics.py, cost.py (physical-cost model), __init__.py.
  • twotower.py / model_build/{config,factory}.py — additive default-off quant_format field + apply_quant_format (lazy-imports the package, matching main's lazy-torch pattern); old configs/checkpoints load unchanged.
  • scripts/inspect_quantization.py + tests/test_models/test_quantization.py (torch-gated, importorskip) + design doc + results JSON.

Dropped the branch's arity re-implementation and misc clobbers; the retired arity stub is not reintroduced.

Verification

  • No-new-breakage vs a clean-main baseline: tests/test_harnesses/model_build failing/error IDs byte-identical (the 14 are pre-existing torch-env collection issues); +1 correct skip (test_quantization gating on torch).
  • Torch-free gates: ruff / repo_policy / compileall / git diff --check clean. The quantization modules + test_quantization run in CI (torch installed).

Honesty

Additive/default-off registration; no ship gate or test weakened. Mechanism increment (reference quantizers + physical-cost ledger) — no model trained, no ship/speedup/quality claim.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jul 18, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
slm-training Ready Ready Preview, Comment Jul 18, 2026 9:40am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Tyler-R-Kendrick, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c030fdb5-b8da-46f4-b5a5-203084841e71

📥 Commits

Reviewing files that changed from the base of the PR and between bce6d65 and 82b0ecd.

📒 Files selected for processing (14)
  • docs/design/iter-cap3-01-quantization-20260717.md
  • docs/design/quantization-results.json
  • scripts/inspect_quantization.py
  • src/slm_training/harnesses/model_build/config.py
  • src/slm_training/harnesses/model_build/factory.py
  • src/slm_training/models/quantization/__init__.py
  • src/slm_training/models/quantization/convert.py
  • src/slm_training/models/quantization/cost.py
  • src/slm_training/models/quantization/diagnostics.py
  • src/slm_training/models/quantization/fake_quant.py
  • src/slm_training/models/quantization/formats.py
  • src/slm_training/models/quantization/observers.py
  • src/slm_training/models/twotower.py
  • tests/test_models/test_quantization.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch slm-90-cap3-01-quantization

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Tyler-R-Kendrick
Tyler-R-Kendrick force-pushed the slm-80-cap0-04-certificates branch from 9197057 to fef03b1 Compare July 18, 2026 09:17
Base automatically changed from slm-80-cap0-04-certificates to main July 18, 2026 09:23
…M-90)

An architecture-agnostic reference quantization package (operates on generic
nn.Linear via named_modules) plus a physical-cost ledger, registered into
TwoTower behind a disabled-by-default quant_format config.

- models/quantization/{formats,fake_quant,observers,convert,diagnostics,
  cost,__init__}.py: low-bit formats, fake-quant + observers, converter,
  diagnostics, and a physical-cost model.
- twotower.py / model_build/{config,factory}.py: additive default-off
  quant_format field + apply_quant_format (lazy-imports the package); old
  configs/checkpoints load unchanged.
- scripts/inspect_quantization.py + torch-gated tests (importorskip) + design
  doc + results.

No-new-breakage verified against a clean-main baseline (identical failure
sets). Mechanism increment — no model trained, no ship/speedup/quality claim.
Torch tests run in CI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017NWyjZwGMUPHXZhtqQVzUJ
@Tyler-R-Kendrick
Tyler-R-Kendrick force-pushed the slm-90-cap3-01-quantization branch from 6623512 to 82b0ecd Compare July 18, 2026 09:40
@Tyler-R-Kendrick Tyler-R-Kendrick changed the title CAP3-01: reference low-bit quantizers and physical-cost ledger Add reference low-bit quantizers and physical-cost model (CAP3-01, SLM-90) Jul 18, 2026
@Tyler-R-Kendrick
Tyler-R-Kendrick merged commit 1e72877 into main Jul 18, 2026
4 checks passed
@Tyler-R-Kendrick
Tyler-R-Kendrick deleted the slm-90-cap3-01-quantization branch July 18, 2026 09:46
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.

2 participants