oracle-lens-data / README.md
agu18dec's picture
README: cross-link data <-> AR <-> AO repos, refresh counts
c260146 verified
|
Raw
History Blame Contribute Delete
6.86 kB
---
license: other
license_name: research-only
license_link: LICENSE
---
# oracle-lens-data — Inverted OLens (AR + AO)
All **data** for the Inverted OLens program: fully fresh on-policy rollouts from
`Qwen/Qwen3.6-27B`, the whiteners fit on them, and the AO pool. Checkpoints live in
[`agu18dec/oracle-lens-ar-checkpoints`](https://huggingface.co/agu18dec/oracle-lens-ar-checkpoints) (AR)
and [`agu18dec/oracle-lens-ao-checkpoints`](https://huggingface.co/agu18dec/oracle-lens-ao-checkpoints) (AO).
**Activations (AR training pairs) are deliberately NOT stored here** — they are ~174 KB each
(17 layers x 5120 x bf16) and are *deterministically re-derivable* from the rollouts below.
See [Regenerating activations](#regenerating-activations).
## Layout
| path | contents |
|---|---|
| `rollouts/chat/` | on-policy **assistant** rollouts — 1,485,997 convs / **798,403,679** output tokens (12 shards + `reports/`) |
| `rollouts/pt/` | on-policy **pretraining-text** rollouts — 991,520 convs / **680,133,035** output tokens (13 shards + `reports/`) |
| `whiteners/chat/`, `whiteners/pt/` | per-layer mean+cov (fp64-accumulated), 17 layers per cell, >=1.04M rows each |
| `ao/pool/` | AO crop pools, fingerprinted: `pool_iolens` (527,160 crops) + `eval_pool_iolens` (13,137), and the exclusion-deduped extension `pool_iolens_ext1` (939,113) + `eval_pool_iolens_ext1` |
| `ao/arout/<ar-run>/<rung>/` | AR reconstructions the AO trains on — k=4 seeded layers/crop, layers ≥ 20, self-describing metadata (`ao_layers`, pick seeds) |
| `ao/runs/` | frozen injection scale (`scale_iolens_chat_final.json`: alpha 16000 / scale 64.559), arout gate + sweep records |
| `meta/` | splits, seed reports, exact datagen counts, gate reports (`prelaunch_*.json`), per-shard capture manifests |
### Rollout shard schema (safetensors)
| tensor | dtype | meaning |
|---|---|---|
| `ids` | int32 `[total]` | prompt then output tokens, per conversation, concatenated |
| `offsets` | int64 `[n+1]` | conversation `i` = `ids[offsets[i]:offsets[i+1]]` |
| `prompt_len` | int32 `[n]` | first `prompt_len[i]` tokens are the prompt; the rest is the model's own generation |
| `seed_hash` | int64 `[n]` | blake2b-8 of the seed key (freshness ledger) |
| `split_id` | int8 `[n]` | 0 `ar_train` / 1 `ao_train` / 2 `ao_val` / 3 `eval` — assigned from seed content hash **before** generation |
| `out_logprob` | fp16 `[total_out]` | engine logprob of each sampled output token (ragged, conversation order) |
Shard metadata (`meta` key) carries model id, mode, engine + version, tokenizer sha, sampling
params and exact token counts.
## How the data was made
- **chat**: WildChat-1M user turns -> `apply_chat_template(..., enable_thinking=False)` -> SGLang
sampling at **temp 1.0, top_p 1.0, max_new 1536**.
- **pt**: FineWeb-Edu documents -> first **256 tokens** as a raw prefix (NO chat template) ->
base-style continuation, **temp 1.0, top_p 1.0, max_new 1024**.
- Splits are a pure function of seed content hash, assigned before generation and
conversation-cohesive (all turns of a conversation land on one side).
- Degenerate outputs (empty/EOS-only, or an immediately repeating 20-gram) were dropped and
counted per shard. Verified gates: tokenizer identity, byte-exact prompt renders (1000/1000
per cell), engine-vs-HF teacher-forced logprob parity, per-shard length/degeneracy, seed
freshness. Reports in `meta/`.
## Regenerating activations
Activations are captured by a single teacher-forced forward over each stored conversation, with
spans carved **only inside the generated region**. Everything is seeded, so the output is
bit-identical to what the program trained on.
```bash
git clone https://github.com/camilablank/global-workspace && cd global-workspace
bash bootstrap_runpod.sh --all # env + torch pin + serving envs
source scripts/cluster/env.sh
hf download agu18dec/oracle-lens-data --repo-type dataset \
--include 'rollouts/chat/*' --local-dir $OLA_ROOT/rollouts_dl
# one GPU, one rollout shard -> multilayer_v1 pair shards
CUDA_VISIBLE_DEVICES=0 uv run --no-sync python scripts/ola/iolens_capture_pairs.py \
--mode chat --rollout-shard 0 \
--rollouts-dir rollouts_dl/rollouts/chat \
--out-dir ml_pairs_chat --train-frac 0.14 # slice of ar_train; skip-cursor for waves
```
What that produces, per pair:
- **input** = a span of `N ~ uniform{1..32}` tokens taken at a sampled position inside the
assistant/continuation region. Spans within a conversation are **mutually disjoint** (no span
is a prefix or subset of another, no activation is shared between pairs), ~35 spans/conv.
- **target** = the residual stream at `prev_pos = span_start - 1` — the state the model was in
*just before* emitting that span — at layers `(0, 4, 8, ..., 60, 63)`, stored `[17, 5120]` bf16.
- Conversations whose output re-emits a `<think>` block (chat, ~8%) or loops are skipped;
mojibake is kept (it is inherited from source documents and is faithful on-policy text).
Useful flags: `--carve-mode octave` (legacy long-span cascade, for >32-token crop-source
experiments), `--train-frac-skip` (disjoint later waves), `--batch-tokens/--batch-rows`
(capture throughput).
Fit whiteners on the pairs you just captured (needed for the AR loss and every FVE number):
```bash
CUDA_VISIBLE_DEVICES=0 uv run --no-sync python scripts/ola/iolens_fit_whitener.py \
--pairs-dir ml_pairs_chat --out-prefix whitening_chat --n-shards-use 12
```
...or just use the published `whiteners/{chat,pt}/` (fit on >=1.04M rows/layer; null-predictor
FVE ~ 1/5120, i.e. random vectors score exactly chance in this basis).
## Which data goes to which trainer
| consumer | source | why |
|---|---|---|
| **AR (assistant cell)** | `rollouts/chat` split `ar_train` -> pairs | learns to invert assistant text |
| **AR (PT cell)** | `rollouts/pt` split `ar_train` -> pairs | learns to invert document continuations |
| **AR eval (both)** | split `eval` -> pairs (true activations) | held-out FVE / retrieval |
| **AO (all runs)** | `rollouts/chat` split `ao_train` -> `ao/pool` | the AO always reads **assistant** text, whichever AR produced its activations — that is what makes chat-AR vs PT-AR a controlled comparison |
| **AO val** | conversation-level split of the same pool (seed 1234) | no window/prefix overlap with AO train |
Hygiene that is enforced, not assumed: AR and AO conversations are disjoint by pre-generation
split; every AO crop is additionally checked against a hash of every AR span prefix (31,889
crops dropped, 0 collisions remain); AO windows are non-overlapping with one crop length each;
`audit_diversity` refuses any configuration where a text would be a target more than 2.5x/epoch by default (the k=4 program overrides to 4.0 with `--max-repeat`, watching val CE for a memorization inflection).