Skip to content

Add CPU correctness gates + CI + Apache-2.0 license - #1

Merged
KoushikVGitHub merged 1 commit into
mainfrom
ci/tests-and-license
Jul 28, 2026
Merged

Add CPU correctness gates + CI + Apache-2.0 license#1
KoushikVGitHub merged 1 commit into
mainfrom
ci/tests-and-license

Conversation

@KoushikVGitHub

Copy link
Copy Markdown
Owner

Turns the repo's verified-by-hand claims into gates that run on every push, and makes the code legally reusable.

What's here

tests/ — 41 tests, CPU-only, ~11s, torch is the only dependency. No transformers, no video codecs, no CAMELS download, so it stays runnable on a bare runner.

File Gate
test_distributed_sigreg.py world=2 × batch-B ≡ world=1 × batch-2B over gloo on CPU — the twin of src/sigreg.py --verify (NCCL, 2 GPUs), which CI can't run. Plus a process-group-free check of the shard-additivity algebra the collective depends on.
test_anticollapse.py The collapse_resolution.md finding as an executable claim: on a rank-2-of-64 batch whose per-dim std is a healthy 1.00, ‖∇sigreg‖ = 2.3e-4 vs ‖∇cov‖ = 0.25 (~1000×). Also pins the participation-ratio detector against known-rank inputs.
test_conv_stem.py Pytest port of scripts/test_conv_stem.py (kept as the standalone demo): token-grid match, bit-identical linear path, legacy checkpoint keys, circular equivariance to 8e-7.
test_sigreg.py ~0 for N(0,I), large under collapse, penalizes mis-scaling, bit-reproducible under a seeded generator.
test_masking.py Context/target partition disjoint + exhaustive, blocks contiguous, context never empty at the trained default.
test_jepa.py Per-mode wiring: EMA teacher built only where needed, teacher frozen, stop_grad really severs the target, detectors in range.

CIubuntu-latest × py3.10/3.12 against the CPU torch wheel. The distributed gate is its own step because it's the load-bearing correctness claim.

LICENSE — Apache-2.0 (explicit patent grant). The repo is meant to be read and reused; without a license it was legally unusable.

Why these tests

Each targets a failure that does not raise. A broken all-reduce still trains. A non-circular pad still converges. A regularizer blind to dimensional collapse still logs a healthy loss — that one already cost a run, and eff_rank is the reason it was caught.

Note

One test skips on Windows (gloo cannot create a device there); it runs on the Linux matrix.

The engine's load-bearing claims all fail silently: a broken all-reduce still
trains, a non-circular pad still converges, a regularizer blind to dimensional
collapse still logs a healthy loss. Until now they were verified by hand on a
pod and written up in prose. Gate them instead.

tests/ (41 tests, CPU-only, ~11s, torch is the only dependency):
  - test_distributed_sigreg: world=2 x batch-B == world=1 x batch-2B over gloo,
    the CPU twin of `src/sigreg.py --verify` (NCCL, 2 GPUs), plus a
    process-group-free check of the shard-additivity algebra it relies on.
  - test_anticollapse: the collapse_resolution finding as an executable claim --
    on a rank-2-of-64 batch with per-dim std 1.00, |grad sigreg| = 2.3e-4 vs
    |grad cov| = 0.25 (~1000x). Also pins the participation-ratio detector.
  - test_conv_stem: pytest port of scripts/test_conv_stem.py (kept as the
    standalone demo) -- token-grid match, bit-identical linear path, legacy
    checkpoint keys, circular equivariance.
  - test_sigreg / test_masking / test_jepa: objective properties, mask
    partition structure, and per-mode teacher/stop-grad wiring.

CI runs the suite on ubuntu-latest x py3.10/3.12 against the CPU torch wheel,
with the distributed gate called out as its own step.

LICENSE: Apache-2.0. The repo is meant to be read and reused; without a license
it was legally unusable.

One test skips on Windows, where gloo cannot create a device.
@KoushikVGitHub
KoushikVGitHub merged commit 57995a0 into main Jul 28, 2026
2 checks passed
@KoushikVGitHub
KoushikVGitHub deleted the ci/tests-and-license branch July 28, 2026 13:25
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