DeepScaleR Guide: Surpassing o1 with a 1.5B Model via RL

The Parameter Paradox in Test-Time Reasoning
For years, an unyielding axiom governed modern frontier machine learning: high-order logical deduction and competition-grade mathematical reasoning required massive models. When proprietary foundation models such as OpenAI o1 and commercial reasoning APIs demonstrated mastery over the American Invitational Mathematics Examination (AIME) and Olympiad-level code synthesis, they relied on massive mixture-of-experts (MoE) parameters and colossal cluster allocations.
The prevailing assumption was that small language models (SLMs, under 3 billion parameters) possessed hard representational ceilings. While models like DeepSeek-R1-Distill-Qwen-1.5B inherited high-quality reasoning traces via teacher distillation, their performance hit a wall on elite benchmarks:
- On AIME 2024, distilled 1.5B models achieved only 28.8% Pass@1, failing whenever problems demanded deep, multi-phase verification.
- When practitioners attempted to train 1.5B models with standard reinforcement learning (RLVR), training collapsed into repetitive looping or hit memory ceilings.
- Running long-context reinforcement learning on 16,384 tokens from step 0 caused immediate GPU out-of-memory (OOM) failures, extreme rollout variance, and reward starvation.
For organizations building edge intelligence, high-throughput autonomous agents, or private enterprise systems—such as real-time document intelligence via automated web scraping or live database workflows via real-time data fetching—running 70B+ or 671B MoE reasoning models creates prohibitive infrastructure costs, high carbon footprints, and unacceptable token generation latencies.
Can a tiny, 1.5-billion parameter model truly outperform OpenAI o1-preview on competition-level mathematics?
Enter DeepScaleR: Iterative Context Lengthening via RL
In February 2025, researchers from the UC Berkeley Sky Computing Lab, Berkeley AI Research (BAIR), and Agentica shattered the parameter barrier with the release of DeepScaleR: Surpassing O1-Preview with a 1.5B Model by Scaling RL to 16K Context (led by Michael Luo, Sijun Tan, Colin Cai, et al.).
The researchers revealed a revolutionary insight: small language models fail at complex reasoning not because their parametric representation is fundamentally defective, but because their test-time compute context is artificially constrained.
When solving multi-hop mathematics, small models need space to explore dead ends, test alternative hypotheses, and backtrack. By fine-tuning DeepSeek-R1-Distill-Qwen-1.5B with distributed Group Relative Policy Optimization (GRPO) using a novel Iterative Context Lengthening schedule, DeepScaleR produced historic results:
- 43.1% Pass@1 on AIME 2024: Surging from a distilled baseline of 28.8% to 43.1%, outperforming OpenAI o1-preview (40.0%) on a 1.5B parameter budget.
- 87.8% Accuracy on MATH500: Rivaling frontier models and establishing a new world record for sub-3B parameters.
- Sub-Second Edge Deployment: Running on consumer GPUs, edge accelerators, and local laptop chips (via Ollama and llama.cpp) with zero reliance on cloud APIs.
+---------------------------------------------------------------------------------------------------+
| The DeepScaleR Scaling Timeline |
+---------------------------------------------------------------------------------------------------+
| |
| STAGE 1: 4K Context Initialization (Steps 0 - 400) |
| ============================================================================================= |
| Base: DeepSeek-R1-Distill-Qwen-1.5B | AIME Baseline: 28.8% |
| - Fast rollout generation on modest token budgets |
| - Model learns basic self-correction and answer formatting |
| |
| | |
| v |
| STAGE 2: 8K Context Expansion (Steps 400 - 1040) |
| ============================================================================================= |
| Expand Max Sequence Length: 4K -> 8K Tokens | AIME Accuracy: 33.2% |
| - Policy develops multi-hypothesis exploration |
| - Deeper mathematical verifications without premature truncation |
| |
| | |
| v |
| STAGE 3: 16K Deep Scaling (Steps 1040 - 1520) |
| ============================================================================================= |
| Expand Max Sequence Length: 8K -> 16K Tokens | AIME Accuracy: 43.1% (Surpasses o1-preview) |
| - Spontaneous high-order backtracking and algebraic sandwich bounds |
| - Full-fledged Olympiad-grade reasoning at 1.5B scale |
| |
+---------------------------------------------------------------------------------------------------+ The Three Structural Pillars of DeepScaleR
- Iterative Context Lengthening: Rather than training on a rigid 16k context window from the first iteration—which causes massive compute waste when early policies only generate 2k tokens—DeepScaleR scales context limits progressively (4K to 8K, 16K, and 24K) as policy complexity deepens.
- Outcome-Based Verifiable Rewards Without Neural Judges: All reinforcement learning gradients are computed against deterministic mathematical equivalence checks (SymPy / LaTeX extraction). Zero neural reward models means zero reward hacking.
- Decoupled Distributed Rollout Engine via Ray and vLLM: Rollout workers execute generation on high-throughput vLLM instances with Radix Attention, streaming trajectories to training workers that update weights via distributed ZeRO/FSDP.
Mathematical Foundations and Architecture
To understand how DeepScaleR unlocks long-chain reasoning on compact models, we analyze the mechanics of iterative context scheduling, token-level advantage estimation, and the scaling laws of test-time compute.
1. Iterative Context Lengthening Mechanics
Let L_max(s) denote the maximum allowed generation horizon at training step s:
- L_max(s) = 4,096 for steps 0 <= s < 400
- L_max(s) = 8,192 for steps 400 <= s < 1040
- L_max(s) = 16,384 for steps 1040 <= s < 1520
- L_max(s) = 24,576 for steps s >= 1520
Why is progressive lengthening mathematically superior to training at L_max = 16k from step 0?
- Curriculum on Search Depth: In early training, a model’s policy entropy is high. Allowing 16k tokens immediately causes the model to wander into degenerative token repetition loops before it learns basic verification.
- Computational Economics: Rollout generation time scales quadratically with sequence length under un-optimized attention and linearly in KV cache memory. Keeping L_max = 4k for the first 400 steps speeds up rollout collection by over 4.2x.
- Truncation-Induced Exploration Signals: When context is extended from 4k to 8k, trajectories that previously ran out of compute budget and received reward R = 0 suddenly have the headroom to complete derivation, producing strong positive advantage spikes that propel policy evolution.
2. Group Relative Policy Optimization (GRPO) with Length Normalization
DeepScaleR eliminates the critic model by sampling a group of G = 16 candidate reasoning traces {y_1, y_2, …, y_G} for each math prompt x.
Rewards R_i in {0.0, 1.0} evaluate exact symbolic equivalence between extracted terminal answer ans(y_i) and ground truth y*: R_i = 1.0 if ans(y_i) == y*, else 0.0.
Advantages are normalized across the sampled group: A_hat_i = (R_i - mean(R)) / (std(R) + eps_adv)
To ensure that long trajectories do not dominate gradient magnitude, DeepScaleR applies per-token length normalization in the clipped surrogate objective: L*{GRPO}(theta) = (1 / G) * sum*{i=1}^G (1 / |yi|) * sum{t=1}^{|yi|} min( r{i,t}(theta) _ Ahat_i, clip(r{i,t}(theta), 1 - eps, 1 + eps) _ A_hat_i ) - beta * D_KL(pi_theta || pi_ref)
where r*{i,t}(theta) = pi_theta(y*{i,t} | x, y*{i,<t}) / pi_old(y*{i,t} | x, y_{i,<t}).
3. The Test-Time Compute Scaling Law at 1.5B Scale
A fundamental empirical contribution of DeepScaleR is demonstrating that small models exhibit the exact same test-time compute scaling curve as frontier models.
+---------------------------------------------------------------------------------------+
| AIME 2024 Pass@1 vs. Test-Time Context Length |
+---------------------------------------------------------------------------------------+
| |
| Pass@1 (%) |
| 50% | |
| | * (16K: 43.1%) |
| 40% | --------------- |
| | * (8K: 33.2%) [OpenAI o1-preview: 40.0%] |
| 30% | * (4K: 28.8%) |
| | |
| 20% | |
| +-------------------------------------------------------------------------> |
| 0K 4K 8K 12K 16K Tokens |
| |
+---------------------------------------------------------------------------------------+ As maximum context length extends from 4K to 16K, accuracy scales monotonically from 28.8% to 43.1%. The model allocates the additional tokens to deeper verification loops, intermediate sanity checks, and self-correction.
Production Implementation: Dynamic Context Manager, Symbolic Verifier, and GRPO
To implement DeepScaleR in production, engineering teams must manage dynamic sequence length boundaries, distributed rollouts, and exact symbolic verification.
Below is an end-to-end PyTorch and Python implementation featuring:
- The
IterativeContextSchedulerdynamically controlling generation length limits across training milestones. - The
MathematicalSymbolicVerifiervalidating extracted LaTeX answers against ground truth using SymPy. - The
DeepScaleRGRPOEngineexecuting length-normalized policy updates.
# deepscaler_core.py
# Production Implementation of DeepScaleR Iterative Context Lengthening & GRPO
import torch
import torch.nn as nn
import torch.nn.functional as F
import re
from typing import List, Dict, Tuple, Optional
class IterativeContextScheduler:
def __init__(self, stage_milestones: Optional[Dict[int, int]] = None):
self.milestones = stage_milestones or {
0: 4096,
400: 8192,
1040: 16384,
1520: 24576
}
def get_max_tokens(self, current_step: int) -> int:
active_length = 4096
for milestone, length in sorted(self.milestones.items()):
if current_step >= milestone:
active_length = length
return active_length
class MathematicalSymbolicVerifier:
def __init__(self):
self.boxed_regex = re.compile(r"\\boxed\{([^}]+)\}")
self.answer_regex = re.compile(r"<answer>(.*?)</answer>", re.DOTALL)
def extract_answer(self, text: str) -> Optional[str]:
ans_match = self.answer_regex.search(text)
if ans_match:
return ans_match.group(1).strip()
boxed_matches = self.boxed_regex.findall(text)
if boxed_matches:
return boxed_matches[-1].strip()
lines = [l.strip() for l in text.splitlines() if l.strip()]
if lines:
return lines[-1].replace("The answer is", "").strip()
return None
def verify(self, prediction: str, ground_truth: str) -> bool:
pred_clean = prediction.strip().lower().replace(" ", "").replace("$", "")
gold_clean = ground_truth.strip().lower().replace(" ", "").replace("$", "")
if pred_clean == gold_clean:
return True
try:
if abs(float(pred_clean) - float(gold_clean)) < 1e-5:
return True
except ValueError:
pass
return False
class DeepScaleRGRPOEngine(nn.Module):
def __init__(self, policy_model, ref_model, clip_eps: float = 0.2, beta_kl: float = 0.04):
super().__init__()
self.policy = policy_model
self.ref_model = ref_model
self.clip_eps = clip_eps
self.beta_kl = beta_kl
def forward_step(
self,
input_ids: torch.Tensor,
attention_mask: torch.Tensor,
old_logprobs: torch.Tensor,
rewards: torch.Tensor
) -> Tuple[torch.Tensor, Dict[str, float]]:
G, SeqLen = input_ids.shape
mean_r = rewards.mean()
std_r = rewards.std() + 1e-8
advantages = (rewards - mean_r) / std_r
logits = self.policy(input_ids, attention_mask=attention_mask).logits
log_probs = F.log_softmax(logits[:, :-1, :], dim=-1)
targets = input_ids[:, 1:].unsqueeze(-1)
curr_logprobs = torch.gather(log_probs, dim=-1, index=targets).squeeze(-1)
with torch.no_grad():
ref_logits = self.ref_model(input_ids, attention_mask=attention_mask).logits
ref_log_probs = F.log_softmax(ref_logits[:, :-1, :], dim=-1)
ref_logprobs = torch.gather(ref_log_probs, dim=-1, index=targets).squeeze(-1)
shifted_mask = attention_mask[:, 1:]
shifted_old = old_logprobs[:, 1:]
ratios = torch.exp(curr_logprobs - shifted_old)
adv_expanded = advantages.unsqueeze(-1).expand_as(ratios)
surr1 = ratios * adv_expanded
surr2 = torch.clamp(ratios, 1.0 - self.clip_eps, 1.0 + self.clip_eps) * adv_expanded
policy_loss = -torch.min(surr1, surr2)
log_ratio = ref_logprobs - curr_logprobs
kl_div = torch.exp(log_ratio) - log_ratio - 1.0
token_loss = policy_loss + self.beta_kl * kl_div
seq_lengths = shifted_mask.sum(dim=-1).clamp(min=1.0)
per_seq_loss = (token_loss * shifted_mask).sum(dim=-1) / seq_lengths
total_loss = per_seq_loss.mean()
metrics = {
"loss": total_loss.item(),
"mean_reward": mean_r.item(),
"advantage_std": std_r.item(),
"active_tokens": shifted_mask.sum().item()
}
return total_loss, metrics Architectural Walkthrough
- Staged Milestone Transition: The
IterativeContextSchedulerdynamically adjusts generation constraints during training. By graduating from 4K to 8K and 16K, memory overhead is kept manageable while preventing early exploratory divergence. - Robust Mathematical Parsing: The
MathematicalSymbolicVerifierextracts answers from multiple conventions (XML<answer>, LaTeX\boxed{}, or terminal lines), ensuring that formatting nuances do not artificially penalize valid mathematical deductions. - Sequence Length Normalization: Rather than averaging loss across all tokens in the batch (which would cause a 14,000-token trajectory to contribute 7x more gradient signal than a 2,000-token trajectory),
DeepScaleRGRPOEnginecomputes per-trajectory loss normalized by each sequence’s own active token count before averaging across the batch.
Case Study: Deconstructing a 14,000-Token Reasoning Rollout on AIME
To understand how a 1.5B parameter model achieves 43.1% on AIME 2024, consider an empirical trace where DeepScaleR solves an Olympiad polynomial geometry problem:
The AIME Problem Setup: Let $P(x)$ be a cubic polynomial with real coefficients such that the roots of $P(x) = 0$ form an arithmetic progression. Given conditions on $P(1), P(2),$ and $P(3)$, determine the minimum possible value of the constant term.
1. The 4K Failure Mode (Premature Truncation): During early training (Stage 1, $L_{\text{max}} = 4,096$ tokens), the model initiates an exploratory search:
- It defines roots as $r - d, r, r + d$.
- It sets up the system of Vieta’s formulas and attempts to substitute coordinates.
- The Truncation Wall: At token 4,096, the model is halfway through checking whether the roots can be complex. Because the context limit is reached, token generation cuts off abruptly. The terminal answer is missing, receiving reward $R = 0.0$.
2. The 16K Success Mode (DeepScaleR Emergent Backtracking): In Stage 3 ($L_{\text{max}} = 16,384$ tokens), DeepScaleR has the token budget to complete, verify, and correct its work:
“<think> Let the roots of P(x) = 0 be r1, r2, r3 forming an arithmetic progression. Let r1 = a - d, r2 = a, r3 = a + d, where d >= 0. Then P(x) = k(x - (a - d))(x - a)(x - (a + d)) = k(x - a)((x - a)^2 - d^2). Let u = x - a. Then P(x) = k u (u^2 - d^2) = k(u^3 - u d^2).
Let’s substitute the given values: P(1) = k(1 - a)((1 - a)^2 - d^2) = c1 P(2) = k(2 - a)((2 - a)^2 - d^2) = c2 P(3) = k(3 - a)((3 - a)^2 - d^2) = c3
Let’s consider whether k can be determined directly by finite differences. Since P(x) is a cubic, the third forward difference Delta^3 P(x) = 6k. Let’s compute Delta P(1) = P(2) - P(1), Delta P(2) = P(3) - P(2)… (The model explores the finite difference method for ~1,500 tokens).
Wait! Delta^3 requires four points P(0), P(1), P(2), P(3), but we are only given THREE points! Let me re-read the prompt: We are given P(1), P(2), and P(3). We cannot compute the third difference without a fourth evaluation! That path is an impasse. Let’s backtrack!
Let’s return to the algebraic expansion: P(x) = k x^3 + b x^2 + c x + d_0. What does the arithmetic progression of roots imply about the coefficients? If roots are a - d, a, a + d, their sum is 3a. By Vieta’s formulas, sum of roots = -b / k. Therefore, 3a = -b / k => a = -b / (3k). Notice that the average of the roots is the inflection point of the cubic! At x = a, P”(a) = 0. This is a crucial geometric invariant! The center of symmetry of the cubic is x = a.
Let’s test this: Does the symmetry point x = a constrain the relation between P(1), P(2), P(3)? Let’s analyze two cases: Case 1: a = 2 (the middle point). If a = 2, then P(2) = P(a) = 0! Let’s check the given value: Is P(2) = 0? (The model tests whether the given c2 matches 0. If c2 != 0, a cannot equal 2). c2 is given as 12. So a != 2. Therefore, d cannot be symmetric around 2.
Let’s expand k in terms of a: (The model derives the exact quadratic constraint on d^2, spending ~3,000 tokens checking non-negativity d^2 >= 0).
Let’s double check this boundary condition: We require d^2 >= 0 for the roots to be real. If d^2 < 0, the roots would be complex, but the prompt specified ‘roots form an arithmetic progression of real numbers’. Setting the discriminant of the quadratic in a to be non-negative: Delta_a >= 0. Solving Delta_a: 4(c2 - c1)^2 - … >= 0. (After 9,200 tokens of rigorous algebra and invariant tracking, the model derives the global minimum of the constant term P(0)). Substituting a = 5/3 and d^2 = 7/9 into P(0) = -k a (a^2 - d^2)… Final value evaluates to 48. Let’s do a sanity check by reconstructing the polynomial P(x) with these parameters and evaluating P(1), P(2), P(3). P(1) = 12, P(2) = 12, P(3) = … All constraints match perfectly! </think> <answer> 48 </answer>”
This case study exemplifies why iterative context lengthening is transformative: the 1.5B model used over 9,000 tokens to explore an initial hypothesis (finite differences), detect its insufficiency, backtrack to an algebraic invariant (inflection point symmetry), check reality constraints ($d^2 \ge 0$), and perform a complete sanity check.
Empirical Evaluation and Benchmark Analysis
In UC Berkeley’s formal evaluations, DeepScaleR-1.5B-Preview was benchmarked against leading open-source models and proprietary frontier systems on prestigious international mathematics competitions.
Primary Benchmark Results
| Model Architecture | Parameter Scale | Training Recipe | AIME 2024 (Pass@1 %) | MATH500 (Acc %) | AMC 2023 (Acc %) |
|---|---|---|---|---|---|
| Qwen2.5-1.5B-Base | 1.5 Billion | Pre-trained Base | 1.8% | 24.6% | 14.2% |
| Qwen2.5-Math-1.5B | 1.5 Billion | Math SFT | 14.4% | 58.4% | 36.8% |
| DeepSeek-R1-Distill-1.5B | 1.5 Billion | Teacher Distillation | 28.8% | 82.2% | 52.4% |
| OpenAI o1-preview | Frontier MoE (~200B+) | Proprietary Large RL | 40.0% | 85.5% | 61.2% |
| DeepScaleR-1.5B-Preview | 1.5 Billion | Iterative Context RL | 43.1% (+14.3%) | 87.8% | 64.8% |
Key Analytical Takeaways
- Surpassing OpenAI o1-preview at 1/100th the Size: DeepScaleR achieves 43.1% on AIME 2024, surpassing OpenAI o1-preview (40.0%) by +3.1%. This provides conclusive proof that test-time compute scaling is a universal scaling law that operates effectively even at the 1.5B parameter scale.
- Distillation Provides the Seed; RL Expands the Horizon: While DeepSeek-R1-Distill-1.5B reached 28.8% on AIME, distillation alone hit an asymptotic ceiling. Scaling RL with context lengthening allowed the 1.5B student model to break through teacher constraints, gaining an additional +14.3% absolute accuracy.
- Drastic Inference Cost Reductions: Serving a 1.5B model requires under 4GB of VRAM in FP16 (or under 1.2GB in 4-bit quantizations). A single desktop consumer GPU (such as an NVIDIA RTX 4090) can serve DeepScaleR with massive batch concurrency, delivering enterprise reasoning at less than 1% of the API cost of proprietary models.
Enterprise Integration and Data Flywheels with AI Fetchly
For organizations deploying automated quantitative research, complex tax calculation engines, or smart-contract audit platforms, DeepScaleR provides an ideal edge-native solution: tiny memory footprint, extreme accuracy, and zero external API dependencies.
+---------------------------------------------------------------------------------------------------+
| Enterprise DeepScaleR Architecture with AI Fetchly |
+---------------------------------------------------------------------------------------------------+
| |
| +--------------------------+ Enterprise Query +-------------------------------+ |
| | Enterprise Application | =============================> | DeepScaleR-1.5B Engine | |
| | (Financial / Legal / Tax)| | (Ollama / vLLM Edge Cluster) | |
| +--------------------------+ +-------------------------------+ |
| | |
| 16K Extended <think> Rollout |
| v |
| +-------------------------------+ |
| | Symbolic Verifier Checkpoint | |
| | - Numerical Constraint SAT | |
| | - Multi-Path Verification | |
| +-------------------------------+ |
| | |
| +---------------------------------------+ |
| | |
| Tool Trigger: Enterprise Records Live Web Verification |
| v v |
| +---------------------------+ +---------------------------+ |
| | AI Fetchly Data Pipeline | | AI Fetchly Web Extractor | |
| | Sub-500ms API Retrieval | | Stealth Headless Scraping | |
| +---------------------------+ +---------------------------+ |
| | | |
| +-------------------+-------------------+ |
| | |
| v |
| [ Verified Mission Completion ] |
| |
+---------------------------------------------------------------------------------------------------+ 1. Grounding Edge Reasoning with Real-Time Data
In production enterprise applications, mathematical problem-solving requires grounding in real-time facts:
- Connect unified API integration to inject external stock tickers, currency rates, or inventory numbers directly into the reasoning prompt.
- Use real-time data fetching to retrieve live database schemas and statistical distributions.
- Extract complex unstructured financial tables from regulatory filings via automated web scraping.
2. Edge Deployment and Operational Economics
Deploying DeepScaleR-1.5B in production environments:
- Local Latency: Generates tokens at over 120 tokens/second on a single workstation GPU or modern Apple Silicon device using Ollama.
- Cost Scaling: Review our flexible pricing to calculate throughput and API economics, or explore our developer documentation for reference architectures and production SDKs.
Summary and Key Takeaways
DeepScaleR fundamentally reframes the frontier of small language models:
- 1.5B Models Can Beat Frontier Giants: DeepScaleR proves that compact models achieve 43.1% on AIME 2024 and 87.8% on MATH500, outperforming OpenAI o1-preview.
- Iterative Context Lengthening is Essential: Progressively expanding context from 4K to 8K, 16K, and 24K prevents early training collapse and unlocks deep exploratory search.
- Outcome Verifiability Drives True Growth: Pure reinforcement learning over deterministic mathematical verifiers allows models to surpass distilled teacher checkpoints.
- Enterprise Edge Ready: When paired with high-performance web extraction from AI Fetchly, DeepScaleR delivers private, low-latency, and cost-effective reasoning across mission-critical workflows.