| name | alphaone-test-time-reasoning |
| title | AlphaOne: Reasoning Models Thinking Slow and Fast at Test Time |
| version | 0.0.2 |
| engine | skillxiv-v0.0.2-claude-opus-4.6 |
| license | MIT |
| url | https://arxiv.org/abs/2505.24863 |
| keywords | ["Test-Time Computation","Reasoning","Token Prediction","Inference Optimization"] |
| description | Dynamically modulate reasoning depth at test time using alpha moments and Bernoulli scheduling to optimize inference speed-quality tradeoffs without retraining. |
Optimize Reasoning Compute Dynamically at Test Time
AlphaOne introduces a universal framework for controlling how much a reasoning model thinks before generating answers. Rather than forcing a fixed amount of reasoning computation, it learns to schedule thinking tokens based on problem difficulty—generating more internal reasoning for hard problems and fewer for easy ones. This adaptive approach maintains quality while reducing computational waste.
The core innovation is the alpha moment: a unified parameter that scales the entire internal thinking phase. By modeling reasoning token insertion as a stochastic process, AlphaOne can dynamically interpolate between "fast thinking" (minimal internal computation) and "slow thinking" (deep reasoning) at inference time, without requiring model retraining.
Core Concept
AlphaOne decouples thinking from generation through three key mechanisms:
- Alpha moment (α): A universal scalar parameter controlling pre-response reasoning intensity
- Bernoulli scheduling: Models token insertion as a stochastic process rather than fixed sequences
- Post-α deterministic generation: Fast, confident generation once reasoning is complete
- Test-time control: Adjust α at inference without model changes
The insight is that reasoning models contain both "slow thinking" (internal reasoning tokens) and "fast thinking" (direct generation). By controlling when to transition from thinking to generation, you optimize the speed-quality frontier dynamically.
Architecture Overview
- Reasoning token mechanism: Model emits special tokens during internal reasoning phase
- Scheduling policy: Bernoulli process determines whether each reasoning step continues or transitions to generation
- Alpha parameter: Scales probability of continuing reasoning (higher α = more thinking)
- Pre-α phase: Scaled-down reasoning with uniform probability control
- Post-α phase: Deterministic, high-confidence generation with no internal reasoning
- Inference controller: Runtime system to select α value per input
Implementation
This implementation shows how to add dynamic reasoning scheduling to a standard language model:
import torch
import torch.nn.functional as F
from transformers import AutoModelForCausalLM, AutoTokenizer
class AlphaOneReasoner:
def __init__(self, model_name, reasoning_token_id=None):
self.model = AutoModelForCausalLM.from_pretrained(model_name)
self.tokenizer = AutoTokenizer.from_pretrained(model_name)
self.reasoning_token_id = reasoning_token_id or self.tokenizer.eos_token_id
def generate_with_alpha(self, prompt, alpha=0.5, max_reasoning_tokens=200):
"""
Generate response with controlled reasoning depth via alpha parameter.
alpha: 0.0 = fast thinking only, 1.0 = maximum reasoning
"""
input_ids = self.tokenizer.encode(prompt, return_tensors='pt')
device = input_ids.device
reasoning_phase = True
reasoning_tokens = []
current_ids = input_ids.clone()
step = 0
while reasoning_phase and step < max_reasoning_tokens:
with torch.no_grad():
outputs = self.model(current_ids)
next_logits = outputs.logits[:, -1, :]
probs = F.softmax(next_logits, dim=-)
next_token = torch.multinomial(probs, num_samples=)
next_token.item() == .reasoning_token_id:
continue_prob = alpha
:
continue_prob = alpha *
should_continue = torch.bernoulli(torch.tensor(continue_prob)).item()
should_continue step < max_reasoning_tokens:
reasoning_tokens.append(next_token.item())
current_ids = torch.cat([current_ids, next_token], dim=)
step +=
:
reasoning_phase =
max_new_tokens =
response_ids = current_ids.clone()
_ (max_new_tokens):
torch.no_grad():
outputs = .model(response_ids)
next_logits = outputs.logits[:, -, :]
next_token = torch.argmax(next_logits, dim=-, keepdim=)
next_token.item() == .tokenizer.eos_token_id:
response_ids = torch.cat([response_ids, next_token], dim=)
full_response = .tokenizer.decode(response_ids[])
reasoning_text = .tokenizer.decode(reasoning_tokens) reasoning_tokens
{
: full_response,
: (reasoning_tokens),
: alpha
}
Implement adaptive alpha selection based on input difficulty:
def estimate_difficulty_and_select_alpha(prompt, difficulty_classifier):
"""
Estimate problem difficulty and select appropriate alpha.
Easy problems use low alpha (fast), hard problems use high alpha (slow).
"""
difficulty_score = difficulty_classifier(prompt)
alpha = 0.2 + (difficulty_score * 0.6)
return alpha
for problem in test_problems:
alpha = estimate_difficulty_and_select_alpha(problem, classifier)
result = reasoner.generate_with_alpha(problem, alpha=alpha)
print(f"Problem: {problem}")
print(f"Thinking depth (α={alpha}): {result['reasoning_tokens_count']} tokens")
print(f"Response: {result['full_response']}")
Create a utility to sweep alpha values and measure the speed-quality frontier:
def measure_speed_quality_frontier(model, test_set, alpha_values=[0.0, 0.3, 0.5, 0.7, 1.0]):
"""
Evaluate accuracy and latency across different alpha values.
Helps find optimal operating point for your use case.
"""
results = []
for alpha in alpha_values:
total_time = 0
correct = 0
for problem, correct_answer in test_set:
start = time.time()
response = model.generate_with_alpha(problem, alpha=alpha)
elapsed = time.time() - start
is_correct = check_correctness(response['full_response'], correct_answer)
correct += is_correct
total_time += elapsed
accuracy = correct / len(test_set)
avg_latency = total_time / len(test_set)
results.append({
'alpha': alpha,
'accuracy': accuracy,
'avg_latency_ms': avg_latency * 1000
})
print(f"α={alpha}: Accuracy={accuracy:.3f}, Latency={avg_latency*1000:.1f}ms")
return results
Practical Guidance
| Parameter | Typical Range | Notes |
|---|
| Alpha | 0.1 - 0.9 | Lower = fast inference, higher = better accuracy |
| Max reasoning tokens | 100 - 500 | Caps internal thinking length |
| Temperature (reasoning phase) | 0.7 - 1.0 | Higher for diverse reasoning paths |
| Temperature (generation phase) | 0.0 - 0.3 | Lower for confident, coherent responses |
| Difficulty classification threshold | 0.3 - 0.7 | Dividing point between easy/hard problems |
When to use AlphaOne:
- You have inference time constraints but want to preserve accuracy
- Problems vary significantly in difficulty (some easy, some hard)
- Your model has internal reasoning capability (like o1, Gemini 2.0 Thinking)
- You want inference optimization without retraining
- User experience matters (faster responses for easy questions)
When NOT to use AlphaOne:
- Your model doesn't produce internal reasoning tokens naturally
- All problems have similar difficulty levels (uniform alpha better)
- Inference latency isn't a constraint
- You need maximum accuracy regardless of compute cost
- Model doesn't support test-time scaling of reasoning
Common pitfalls:
- Setting fixed alpha for all inputs (defeats adaptive benefit)
- Alpha too low (1/3 of capacity) causes quality degradation
- Alpha too high (>0.85) wastes compute without accuracy gains
- Not measuring both latency and accuracy during tuning
- Difficulty classifier correlates poorly with actual problem hardness
- Applying AlphaOne to models without internal reasoning mechanisms
Reference
AlphaOne: Reasoning Models Thinking Slow and Fast at Test Time
https://arxiv.org/abs/2505.24863