Skip to content

fix: count interpreted features, not scored examples, in the run summary - #202

Open
Borislo83 wants to merge 2 commits into
EleutherAI:mainfrom
Borislo83:fix/interpreted-feature-count
Open

Borislo83 wants to merge 2 commits into
EleutherAI:mainfrom
Borislo83:fix/interpreted-feature-count

Conversation

@Borislo83

Copy link
Copy Markdown

The run summary printed by log_results reports the number of scored examples as the number of interpreted features:

print(f"Number of interpreted live features: {len(latent_df)}")

latent_df has one row per scored example (and per scorer), so the count is inflated by the number of examples per latent times the number of scorers. With two latents scored on three examples each, the summary says Number of interpreted live features: 6. In a default run with 50 test examples and 50 non-activating examples per latent and two scorers, it is about 200 times too large.

This counts distinct (module, latent_idx) pairs instead. Nothing else in the summary changes.

I found this while reading result_analysis.py and did not find an existing issue or PR for it.

Tests

  • Added test_logging_counts_interpreted_features_not_examples: two latents with three examples each must be reported as 2. It fails on main with 6.
  • pytest tests/test_log/test_result_analysis.py: 8 passed. ruff check . and black --check are clean.
  • I did not run the full test suite locally (I did not install vLLM and the other heavy dependencies), so I am relying on CI for the rest.

This touches a different part of the file from #201 and merges cleanly with it.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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