Skip to content

SAE: wire up MiniLM Stage-J 49K (Matryoshka) end to end - #157

Merged
enjalot merged 2 commits into
mainfrom
sae-minilm-stagej
Jul 11, 2026
Merged

SAE: wire up MiniLM Stage-J 49K (Matryoshka) end to end#157
enjalot merged 2 commits into
mainfrom
sae-minilm-stagej

Conversation

@enjalot

@enjalot enjalot commented Jul 11, 2026

Copy link
Copy Markdown
Owner

What

Makes the newly published enjalot/sae-all-MiniLM-L6-v2-stagej-49K (Matryoshka, nested 512/2048/8192/49152, k=64) usable in latent-scope for any dataset embedded with all-MiniLM-L6-v2, and fixes two latent bugs found along the way.

Changes

  • web/src/lib/SAE.js — live registry entry for the MiniLM Stage-J SAE (64_128, label parquet served by the latent-taxonomy site, same pattern as nomic).
  • web/src/contexts/ScopeContext.jsx — Explore previously looked up SAEs by exact saeAvailable[model_id] while Setup used the prefix-tolerant getSaeForModel(). A transformers-/huggingface--prefixed embedding id could pass Setup and then silently load no features in Explore. Both paths now use getSaeForModel(). Also exposes the matched saeEntry in context.
  • web/src/components/Explore/FeatureModal.jsx — the latent-taxonomy deep link was hardcoded to NOMIC_FWEDU_25k; it now uses the scope's SAE registry label (falls back to nomic).
  • pyproject.tomllatentsae>=0.2.0,<1; 0.1.3 cannot load Matryoshka checkpoints (cfg.json carries matryoshka_* fields).
  • latentscope/scripts/sae.py — stale default repo id …-10BT…-100BT (matches the registry and the actually-published repo).
  • Test mocks for ../lib/SAE updated to export getSaeForModel.

Testing

  • npm test: 103/103 pass (the two context suites failed before the mock update, all green after).
  • npm run production: builds clean; npm run lint: 0 errors (49 pre-existing warnings, none introduced).
  • Python path verified against the public HF repo with latentsae 0.2.0 (installed from git): Sae.load_from_hub('enjalot/sae-all-MiniLM-L6-v2-stagej-49K', '64_128', 'cpu')num_latents=49152, encode() returns [batch, 64] top_acts/top_indices — exactly the calls ls-sae makes. The ColBERT token repo (32_512) also loads and encodes with the same package version (L0 ≈ 32).

Notes

  • The label parquet URL (…/models/MINILM_STAGEJ_49K/features.parquet) goes live when the latent-taxonomy multi-model site deploys; until then Explore fetches 404 for MiniLM scopes (nomic unaffected). The parquet's column order matches the positional parsing in apiService.getFeatures (verified: identical schema to the nomic file).
  • web/src/components/FilterDataTable.jsx (root, not Explore/) contains a stale copy of FeatureModal with the same hardcoded link but appears to be imported nowhere; left untouched.
  • Per-token SAEs (the ColBERT model) are deliberately not wired up here — the SAE pipeline is one-vector-per-row end to end and token-level features are a separate design effort.

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a45c221e7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml
"outlines>=0.1,<1",
"nltk>=3.8,<4",
"latentsae>=0.1.3,<1",
"latentsae>=0.2.0,<1",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Update uv.lock with the latentsae floor

This raises the runtime requirement to latentsae>=0.2.0 for the new Matryoshka SAE path, but the committed uv.lock was not regenerated: it still pins the latentsae package to 0.1.3 and still records the project dependency as >=0.1.3,<1 (uv.lock lines 2947-2973 and 3048). Any environment installed from the committed lock will miss the Matryoshka support that this commit relies on, so ls-sae for the new MiniLM entry can fail despite pyproject.toml advertising the newer dependency.

Useful? React with 👍 / 👎.

Comment thread web/src/lib/SAE.js
enjalot and others added 2 commits July 11, 2026 18:28
- register enjalot/sae-all-MiniLM-L6-v2-stagej-49K (64_128) in the SAE map
- fix Explore's exact-key SAE lookup: ScopeContext now uses the same
  prefix-tolerant getSaeForModel() as Setup, so transformers-/huggingface-
  prefixed embedding ids resolve (previously features silently never loaded)
- parameterize the latent-taxonomy feature deep-link (was hardcoded to
  NOMIC_FWEDU_25k) via the new saeEntry exposed by ScopeContext
- bump latentsae to >=0.2.0 (0.1.3 cannot load Matryoshka checkpoints)
- fix stale ls-sae default repo id (10BT -> 100BT, matching the registry)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Setup/Sae.jsx no longer blindly attaches saes[0]: runs are filtered by
  embedding_id AND SAE model_id, so a nomic run can't get attached to a
  MiniLM scope (and vice versa) now that the registry has two entries
- uv.lock regenerated for latentsae 0.2.0 (now on PyPI)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@enjalot
enjalot force-pushed the sae-minilm-stagej branch from 3a45c22 to dd56595 Compare July 11, 2026 18:32
@enjalot

enjalot commented Jul 11, 2026

Copy link
Copy Markdown
Owner Author

Updates:

  • Rebased onto current main (the UI revamp + Amber Console restyle merged after this branch was cut). All changes carried over cleanly — the restyled FeatureModal keeps the parameterized taxonomy link, and apiService.getFeatures still parses the label parquet positionally, so the registry URL assumption holds post-revamp.
  • Both review comments addressed:
    • uv.lock regenerated — latentsae 0.2.0 is now on PyPI (https://pypi.org/project/latentsae/0.2.0/), so the lock resolves the new floor.
    • Setup/Sae.jsx no longer blindly attaches saes[0]: existing runs are filtered by embedding_id and SAE model_id before selection, in both the initial fetch and the post-job refresh, so a nomic run can't be attached to a MiniLM scope now that the registry has two entries.
  • Heads-up: vite build is broken on main itself (MembersTooltip.module.scss was never committed; vitest doesn't catch it because CSS modules are mocked). Fix in Fix build: add missing MembersTooltip.module.scss #161 — with that commit applied on top, this branch builds clean. Tests: 103/103, lint: 0 errors.

@enjalot
enjalot merged commit 60d1180 into main Jul 11, 2026
5 checks passed
enjalot added a commit that referenced this pull request Jul 11, 2026
…ken-maps

Both sides had wired MiniLM labels and fixed the taxonomy deep-link
independently; resolved to main's getSaeForModel registry style with the
token-scope additions on top (scope-declared SAEs resolve links/labels by the
SAE's own model repo via saeLabels). FeatureModal keeps the
activation-ranking fix alongside main's saeEntry link.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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