syvb commited on
Commit
02d0371
·
verified ·
1 Parent(s): 90e6e60

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +75 -0
README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - coconut
5
+ - activation-oracle
6
+ - interpretability
7
+ - chain-of-thought
8
+ - latent-reasoning
9
+ - gpt2
10
+ datasets:
11
+ - synthetic
12
+ language:
13
+ - en
14
+ base_model:
15
+ - openai-community/gpt2-large
16
+ pipeline_tag: text-generation
17
+ ---
18
+
19
+ # Cocoracle: Activation Oracles for Coconut Latent Reasoning
20
+
21
+ Checkpoints from the [Cocoracle](https://github.com/syvb/cocoracle) experiment -- interpreting what a model "thinks" during latent reasoning.
22
+
23
+ Combines [Coconut](https://arxiv.org/abs/2412.06769) (Chain of Continuous Thought) with [Activation Oracles](https://arxiv.org/abs/2512.15674) to train models that answer natural-language questions about their own latent chain-of-thought hidden states.
24
+
25
+ ## Models
26
+
27
+ ### GPT-2-large Coconut (all-latent)
28
+
29
+ **`stage3_alllatent.pt`** -- GPT-2-large (774M) fine-tuned with the Coconut curriculum to perform multi-digit addition using entirely latent reasoning.
30
+
31
+ - **Task**: Multi-digit addition (2-4 digits) with carry propagation
32
+ - **Accuracy**: 45.4% (teacher-forced) on all-latent reasoning
33
+ - **Architecture**: GPT-2-large + 4 special tokens (`<bot>`, `<sep>`, `<eot>`, `<act>`)
34
+
35
+ ### GPT-2-large Self-Oracle (all-latent)
36
+
37
+ **`self_oracle_alllatent.pt`** -- The Coconut model further fine-tuned to interpret its own latent reasoning activations via norm-matched injection at layer 17.
38
+
39
+ - **CoT exact match**: 6.9%
40
+ - **CoT token F1**: 34.2%
41
+ - **Random baseline**: 0%
42
+
43
+ ## Usage
44
+
45
+ ```python
46
+ import torch
47
+ from transformers import GPT2LMHeadModel, GPT2Tokenizer
48
+
49
+ tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
50
+ tokenizer.pad_token = tokenizer.eos_token
51
+ tokenizer.add_special_tokens({
52
+ "additional_special_tokens": ["<bot>", "<sep>", "<eot>", "<act>"]
53
+ })
54
+
55
+ model = GPT2LMHeadModel.from_pretrained("gpt2-large")
56
+ model.resize_token_embeddings(len(tokenizer))
57
+ state = torch.load("stage3_alllatent.pt", map_location="cpu")
58
+ model.load_state_dict(state)
59
+ ```
60
+
61
+ See the [GitHub repo](https://github.com/syvb/cocoracle) for full code and an interactive demo (`scripts/interactive.py`).
62
+
63
+ ## Results
64
+
65
+ | Configuration | CoT Exact Match | CoT Token F1 | AO Val Loss |
66
+ |--------------|----------------|--------------|-------------|
67
+ | Separate AO (GPT-2-small + LoRA) | 0% | 26.4% | 2.92 |
68
+ | Self-oracle, GPT-2-small | 0% | 32.5% | 1.98 |
69
+ | Self-oracle, GPT-2-large, stage 1 | 0% | 25.6% | 1.10 |
70
+ | **Self-oracle, GPT-2-large, all-latent** | **6.9%** | **34.2%** | **0.55** |
71
+
72
+ ## References
73
+
74
+ - Hao et al., [arXiv:2412.06769](https://arxiv.org/abs/2412.06769)
75
+ - Karvonen et al., [arXiv:2512.15674](https://arxiv.org/abs/2512.15674)