Downloads · 30 days
0
syvb/gpt-2-latent-reasoning
gpt-2-latent-reasoning is a text generation model from syvb. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as cc0-1.0.
NOTE: I quickly vibecoded this without much oversight for some quick experiments, I don't vouch for the quality of this model or its training process. You might want to try it for yourself a bit before using it.
Downloads · 30 days
0
Access
Public
Updated Apr 6, 2026
Repo size
12.4 GB
Likes
0
Public
Click a slice to open those files.
.pt12.4 GB · 100%
From the Hugging Face model README
NOTE: I quickly vibecoded this without much oversight for some quick experiments, I don't vouch for the quality of this model or its training process. You might want to try it for yourself a bit before using it.
GPT-2-large (774M) fine-tuned with Coconut (Chain of Continuous Thought) to perform multi-digit addition using latent reasoning — hidden states fed back as inputs instead of decoded to text.
| File | Description | Val Accuracy (teacher-forced) |
|---|---|---|
stage0.pt | Full text chain-of-thought | N/A (text mode) |
stage1.pt | Last CoT step latent | 99.2% |
stage2.pt | Last 2 CoT steps latent | Degraded (see below) |
stage3_alllatent.pt | All CoT steps latent | Degraded (see below) |
The model solves multi-digit addition problems with step-by-step carry propagation:
Problem: 347 + 285 =
CoT: 7+5=12 write 2 carry 1 | 4+8+1=13 write 3 carry 1 | 3+2+1=6 write 6
Answer: 632
Training follows a 4-stage curriculum. Stage 0 trains with full text CoT. Each subsequent stage replaces more CoT steps with latent continuous thought vectors (hidden states fed back as inputs instead of decoded to text).
gpt2-large (36 layers, 1280 hidden dim)<bot> (begin of thought), <sep> (step separator), <eot> (end of thought), <act> (activation marker)GPT-2-large dramatically improved over GPT-2-small for Coconut training:
However, accuracy still degrades sharply as more steps become latent (Stages 2-3), consistent with the original Coconut paper's findings that latent reasoning requires extensive training.
These are raw PyTorch state dicts for GPT-2-large with a resized token embedding (4 extra special tokens). To load:
from transformers import GPT2LMHeadModel
model = GPT2LMHeadModel.from_pretrained("gpt2-large")
model.resize_token_embeddings(50261) # 50257 + 4 special tokens
import torch
state_dict = torch.load("stage1.pt", map_location="cpu")
model.load_state_dict(state_dict)
Full training code: github.com/syvb/cocoracle