Skip to content

fix: honor standalone feature-density evaluation - #762

Merged
chanind merged 1 commit into
decoderesearch:mainfrom
AaravMehta-07:codex/evals-feature-density-only
Oct 14, 2026
Merged

chanind merged 1 commit into
decoderesearch:mainfrom
AaravMehta-07:codex/evals-feature-density-only

Conversation

@AaravMehta-07

@AaravMehta-07 AaravMehta-07 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

run_evals silently skips feature-density evaluation when compute_featurewise_density_statistics=True is the only activation-based metric selected. Its dispatch condition only checks L2, sparsity and variance flags, even though EvalConfig exposes feature density as a separate option. The result has no feature_density or consistent_activation_heuristic values, and invalid zero/negative batch counts also bypass the existing validation.

Include the feature-density flag in that dispatch condition and validation message. Validate batch counts before temporarily disabling hook_z reshaping, so invalid configurations do not mutate the SAE's mode. No formulas, scalar metric selection or training behavior change.

The regression fixture uses a real, randomly initialized CPU HookedTransformer, StandardSAE, pretokenized in-memory Hugging Face Dataset, and ActivationsStore; it downloads no model or dataset and replaces no domain logic. Fixed encoder parameters make active/inactive feature counts deterministic. Tests cover both included/excluded special tokens and zero/negative batch counts.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Additional code comments: not needed for the existing dispatch condition.
  • Documentation changes: not needed; this restores an existing option.
  • No new warnings: the local run includes existing TransformerLens deprecation and activation-store tensor-copy warnings.
  • Added regression tests; all eight fail on the original implementation and pass after correction, including resid_pre and hook_z mode-preservation controls.
  • Existing offline evaluation controls and new regressions pass: 42 passed, 43 deselected.
  • Existing interface assertions have not been rewritten.

Formatting, Typing and Tests

  • Pinned changed-file pre-commit checks pass.
  • Scoped Pyright 1.1.365 on source and test files: zero errors/warnings.
  • Full repository Ruff 0.7.4 lint/format checks pass; full repository Pyright 1.1.365 passes after installing actual optional development packages in an isolated local environment.
  • Full make check-ci was not run. A full affected-file offline attempt passed the eight new cases, then stopped at the first existing pretrained-model fixture because its files are absent from the local cache (LocalEntryNotFoundError). The 42-test run is an offline subset, not a full-suite claim; model-download-dependent tests remain unvalidated locally.

The local latest Datasets/dill combination initially failed during Arrow fingerprint construction before evaluation. The tests were rerun using an isolated supported dependency overlay (Datasets 4.3.0, dill 0.4.0, PyArrow 22.0.0). This PR changes no dependency pins.

Performance

No training-performance or model-quality claim. This enables only the computation explicitly requested by the existing configuration.

Duplicate checks found no matching feature-density-only dispatch fix. #755 optimizes a temporary masked activation allocation inside the evaluation helper; this change concerns dispatch in run_evals and does not reproduce that optimization.

AI disclosure: investigated, implemented and tested with OpenAI Codex, with an independent GPT-6 Luna review followed by root corrections and test reruns; no claim of human-authored code or personal human test execution.

@AaravMehta-07

Copy link
Copy Markdown
Contributor Author

CI follow-up: the source build reached the full test run, which finished with 1,798 passed and 7 skipped. Its one failure is the existing gpt2-tokenized ActivationsStore fixture receiving HTTP 429 from the HF dataset revision endpoint (run 38345025413), not an assertion in the new tests. The separate Claude review action fails before review because it cannot obtain an OIDC token. Local affected offline tests and repository formatting/types pass as described above. A maintainer rerun after the rate limit clears would help validate the full hosted suite; no workflow permission changes are included in this PR.

@chanind chanind left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks for finding this!

@chanind
chanind merged commit d0f8fc1 into decoderesearch:main Oct 14, 2026
3 of 5 checks passed
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