| name | overclocking-llm-reasoning |
| title | Overclocking LLM Reasoning: Monitoring and Controlling Thinking Path Lengths in LLMs |
| version | 0.0.2 |
| engine | skillxiv-v0.0.2-claude-opus-4.6 |
| license | MIT |
| url | https://arxiv.org/abs/2506.07240 |
| keywords | ["thinking progress","reasoning control","inference optimization","overthinking"] |
| description | Extract and manipulate internal progress vectors in reasoning models to accelerate thinking phases while maintaining answer quality, achieving 80%+ improvements in token efficiency. |
Overclocking LLM Reasoning
Core Concept
Reasoning models encode their progress through thinking phases in hidden representations. By extracting these "thinking progress vectors" (TPVs), you can monitor and manipulate reasoning length at inference time. The key insight: models maintain an internal estimate of their relative position within the explicit thinking phase, which can be extracted and controlled via intervention on hidden states.
Architecture Overview
- Progress monitoring: Train linear/GRU models to detect position in thinking phase
- Progress vector extraction: Identify TPVs from hidden state trajectories
- Intervention mechanism: Shift hidden representations along progress vectors to accelerate thinking
- Efficiency gains: Reduce token usage by 30% while improving answer quality
Implementation
Step 1: Train Progress Monitor
Build a model to predict progress position from hidden states:
class ProgressMonitor:
def __init__(self, hidden_dim: int, model_type: str = "linear"):
self.hidden_dim = hidden_dim
self.model_type = model_type
if model_type == "linear":
self.monitor = torch.nn.Linear(hidden_dim, 1)
else:
self.monitor = torch.nn.GRU(
hidden_dim,
64,
batch_first=True
)
self.head = torch.nn.Linear(64, 1)
self.optimizer = torch.optim.Adam(
self.monitor.parameters(),
lr=1e-4
)
def train_on_thinking_traces(self,
hidden_states: torch.Tensor,
token_positions: torch.Tensor,
max_thinking_tokens: int):
"""Train monitor to predict normalized progress position."""
normalized_positions = token_positions / max_thinking_tokens
normalized_positions = torch.clamp(
normalized_positions,
0,
1
)
if self.model_type == "linear":
predictions = self.monitor(hidden_states)
:
gru_out, _ = .monitor(hidden_states)
predictions = .head(gru_out)
loss = torch.nn.functional.mse_loss(
predictions.squeeze(-),
normalized_positions
)
.optimizer.zero_grad()
loss.backward()
.optimizer.step()
loss.item()
() -> :
.model_type == :
progress = .monitor(hidden_state).item()
:
gru_out, _ = .monitor(hidden_state.unsqueeze())
progress = .head(gru_out).squeeze(-).item()
torch.sigmoid(torch.tensor(progress)).item()
Step 2: Extract Thinking Progress Vectors
Identify direction of progress in hidden space:
class ThinkingProgressExtractor:
def __init__(self, monitor: ProgressMonitor):
self.monitor = monitor
def extract_progress_vector(self,
hidden_trajectory: torch.Tensor
) -> torch.Tensor:
"""Extract dominant direction of progress through thinking."""
progress_scores = []
for h in hidden_trajectory:
prog = self.monitor.predict_progress(h)
progress_scores.append(prog)
progress_scores = torch.tensor(progress_scores)
centered = hidden_trajectory - hidden_trajectory.mean(dim=0)
U, S, V = torch.linalg.svd(centered, full_matrices=False)
progress_vector = V[0]
progress_signal = progress_scores.std()
progress_vector = progress_vector * progress_signal
return progress_vector
def extract_batch_vectors(self,
batch_trajectories: list) -> torch.Tensor:
"""Extract progress vectors for a batch of thinking traces."""
vectors = []
for trajectory in batch_trajectories:
vector = self.extract_progress_vector(trajectory)
vectors.append(vector)
return torch.stack(vectors)
Step 3: Implement Progress Vector Intervention
Manipulate hidden states to control thinking length:
class ThinkingIntervenor:
def __init__(self, progress_vector: torch.Tensor):
self.progress_vector = progress_vector
self.progress_vector = (self.progress_vector /
self.progress_vector.norm())
def intervene_hidden_state(self, hidden_state: torch.Tensor,
alpha: float) -> torch.Tensor:
"""Shift hidden state along progress vector.
alpha > 0: accelerate thinking (move toward completion)
alpha < 0: slow thinking (move away from completion)
"""
return hidden_state + alpha * self.progress_vector
def generate_with_intervention(self, model,
prompt: str,
max_thinking_tokens: int = 512,
alpha: float = 1.0) -> str:
"""Generate response with progress vector intervention."""
input_ids = model.tokenize(prompt)
thinking_output = model.generate(
input_ids,
max_new_tokens=max_thinking_tokens,
output_hidden_states=True,
return_dict_in_generate=True
)
thinking_hidden = thinking_output.hidden_states[-1][-1]
intervened_hidden = self.intervene_hidden_state(
thinking_hidden,
alpha
)
response = model.continue_generation_from_hidden(
intervened_hidden,
max_new_tokens=
)
model.detokenize(response)
Step 4: Optimize Intervention Strength
Find optimal alpha for efficiency-quality tradeoff:
def find_optimal_intervention(model,
test_questions: list,
intervener: ThinkingIntervenor,
correct_answers: list) -> float:
"""Search for alpha that maximizes accuracy per token."""
best_alpha = 0.0
best_score = 0.0
for alpha in [0.0, 0.5, 1.0, 1.5, 2.0]:
correct = 0
total_tokens = 0
for question, answer in zip(test_questions, correct_answers):
response = intervener.generate_with_intervention(
model,
question,
alpha=alpha
)
if evaluate_correctness(response, answer):
correct += 1
total_tokens += count_tokens(response)
accuracy = correct / len(test_questions)
efficiency = accuracy / (total_tokens / len(test_questions))
if efficiency > best_score:
best_score = efficiency
best_alpha = alpha
return best_alpha
Practical Guidance
Progress Monitoring: Linear monitors work well for simple progress prediction. Use GRU-based monitors for longer thinking trajectories with more complex patterns.
Extraction Strategy: PCA on centered hidden states reveals the primary thinking progress direction. Multiple runs produce consistent vectors, indicating robust estimation.
Intervention Tuning: Start with alpha=1.0 (natural progress speed). Increase alpha for efficiency-focused tasks, decrease for complex reasoning requiring more exploration.
Performance Gains: On math problems with 512-token budgets, intervention achieves 80%+ improvements (54 correct vs 100 baseline), with 30% average token reduction.
When to Apply: Use when your reasoning model exhibits overthinking (allocates tokens late in phase without improving answers) or when token budgets are constrained.
Reference
The approach works because models maintain internal progress estimates that can be extracted and manipulated. Key insight: controlling thinking length via progress vector intervention outperforms temperature-based controls because it targets fundamental progress encoding rather than probability distributions.