Skip to content

ci(interp): test the shared sae library, not just the recipes#1685

Draft
polinabinder1 wants to merge 1 commit into
mainfrom
ci/sae-lib-unit-tests
Draft

ci(interp): test the shared sae library, not just the recipes#1685
polinabinder1 wants to merge 1 commit into
mainfrom
ci/sae-lib-unit-tests

Conversation

@polinabinder1

@polinabinder1 polinabinder1 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

What

Adds CI coverage for the shared sae interpretability library's own unit tests (sae/tests/), which no workflow currently runs.

Why

The interp lane (unit-tests-interpretability-recipes.yaml) runs pytest tests/ from each recipe dir, so it only ever collects recipes/<recipe>/tests. The library's own suite — test_streaming, test_topk, test_kernels, and the seven test_tp_* tensor-parallel tests — is never collected. A change under sae/ only triggers the dependent recipes; it never runs the lib's own tests. Result: the library has zero direct CI coverage today.

How

Make the sae lib a first-class matrix entry, identical to how every recipe/model is tested in this repo — the house style is "a unit with its own .ci_build.sh that gets pytest tests/", not a bespoke standalone job:

  • New interpretability/sparse_autoencoders/sae/.ci_build.sh — a plain pip install -e ".[dev]". The lib is domain-agnostic (torch + triton, both already in the base image), so unlike the evo2 recipe there is no megatron venv to build.
  • One-line change to the changed-dirs glob ("$RROOT"/*/"$RROOT"/*/ "$SAE"/) so the lib is an eligible unit alongside the recipes.

It then reports as interp-unit-tests (sae) next to interp-unit-tests (evo2), on the same linux-amd64-gpu-l4-latest-1 runner — so test_kernels (Triton) runs on the GPU and the gloo-backed test_tp_* run on the box's CPUs. No new infra: the TP suite is CPU/gloo multiprocessing (0 CUDA refs), not multi-GPU.

When it runs

Inherited from the existing trigger logic, no new gate:

  • a change under sae/ → runs the lib's tests and the dependent recipes,
  • a change to this workflow → runs everything,
  • the nightly cron (9 AM UTC / 2 AM MST) → runs everything,
  • a recipe-only change → does not run the lib tests.

Validation

This PR touches both the workflow and (indirectly, via the new eligibility) the sae unit, so its own CI run exercises the new interp-unit-tests (sae) lane end-to-end. On main today the evo2 recipe has no .ci_build.sh yet (that lands with #1622), so this PR's run is scoped to exactly interp-unit-tests (sae).

Draft while the first interp-unit-tests (sae) run is validated.

🤖 Generated with Claude Code

The interpretability lane runs `pytest tests/` from each recipe dir, so it only
ever collected `recipes/<recipe>/tests`. The shared `sae` library's own suite
(`sae/tests`: streaming, topk, kernels, and the nine gloo/CPU `test_tp_*`
tensor-parallel tests) was never collected by any workflow — a change under
`sae/` only *triggered* the dependent recipes, it never ran the lib's own tests.
Net: the library had zero direct CI coverage.

Make the `sae` lib a first-class matrix entry, exactly like a recipe — the house
style here is "a unit with its own `.ci_build.sh` that gets `pytest tests/`", not
a bespoke standalone job:

  * add `sae/.ci_build.sh` — a plain `pip install -e ".[dev]"`. The lib is
    domain-agnostic (torch + triton, both in the pytorch base image), so unlike
    the evo2 recipe there is no megatron venv to build.
  * include `"$SAE"` in the changed-dirs glob so the lib is an eligible unit.

It then rides the same changed-dirs -> build -> `pytest tests/` rails and reports
as `interp-unit-tests (sae)` beside `interp-unit-tests (evo2)`, on the same L4
(so `test_kernels` runs on the GPU and the gloo `test_tp_*` run on its CPUs).

Triggers are inherited, no new gate: a change under `sae/` runs the lib's tests
AND the dependent recipes; a workflow change or the nightly cron runs everything;
a recipe-only change does not run the lib tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6b9fb77c-240c-4608-a5c7-5d33e751200f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/sae-lib-unit-tests

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

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