How p0rt/platos-key-small-models works
This repository runs a CPU-based experiment that tests whether hidden-state keys can be transplanted between frozen language models. The workflow prepares CounterFact facts, extracts recall status and layer keys for each model, fits and evaluates donor-to-recipient transfers, then aggregates pair results. The swap stage also compares self-swaps, controls, ridge fits, and mutual-nearest-neighbor layer choices. Edges reflect the README workflow and shown imports/calls; the pair runner and some swap internals were not fully sampled.
Main entry points: swap.py Fit and evaluate swaps · extract.py Extract model keys · common.py Model and patch utilities · prepare_facts.py Prepare facts
Components 12
Fact preparation
- Prepare facts
src/prepare_facts.py - Fact list
Model representations
- Extract model keys
src/extract.py - Model and patch utilities
src/common.py - Per-model key archives
Transfer experiments
- Fit and evaluate swaps
src/swap.py - Pair results
results
Results reporting
- Summarize pairs
src/summarize.py - Aggregate results
results
Other components
- Experimenter
- CounterFact dataset
- Pretrained models
Connections 17
- Experimenter → Prepare facts: runs workflow
README.md - CounterFact dataset → Prepare facts: provides facts
README.md - Prepare facts → Fact list: writes list
README.md - Experimenter → Extract model keys: runs per model
README.md - Fact list → Extract model keys: supplies facts
README.md - Extract model keys → Model and patch utilities: calls utilities
src/extract.py - Model and patch utilities → Pretrained models: loads checkpoints
src/common.py - Extract model keys → Per-model key archives: writes archives
README.md - Experimenter → Fit and evaluate swaps: runs model pairs
README.md - Fact list → Fit and evaluate swaps: supplies facts
README.md - Per-model key archives → Fit and evaluate swaps: provides layer keys
README.md - Fit and evaluate swaps → Model and patch utilities: calls utilities
src/swap.py - Model and patch utilities → Pretrained models: loads checkpoints
src/common.py - Fit and evaluate swaps → Pair results: writes pair metrics
README.md - Experimenter → Summarize pairs: runs summary
README.md - Pair results → Summarize pairs: reads pair files
README.md - Summarize pairs → Aggregate results: writes aggregate
src/summarize.py