interwhen: A Generalizable Framework for Steering Reasoning Models with Test-time Verification
Organizations: Microsoft Research, India · IIT Bombay · Carnegie Mellon University · Arizona State University
Abstract
Reasoning models produce long traces of intermediate decisions and tool calls, making test-time verification important for ensuring correctness. Existing approaches either verify only the final answer, which misses early errors, or rely on branch-and-verify strategies that explore multiple trajectories. We introduce interwhen, a single-trajectory verification framework that steers model behavior by providing feedback on intermediate reasoning traces. It addresses two key challenges. First, given a set of verifiers, obtaining verifiable states from the reasoning trace typically requires prompt engineering or external task decomposition into fixed steps. Instead, we propose a monitoring system that periodically polls the reasoning trace and forks inference of the reasoning model to recover intermediate states. Verifiers are run asynchronously alongside generation, adding negligible overhead on correct executions and intervening only when violations occur. Second, beyond math and code, a central challenge for process verification is the scarcity of verifiers. interwhen addresses this through automatic verifier synthesis from natural-language policy documents. Given a policy, it can generate code-based verifiers, including provably correct verifiers in Lean and z3. Together, these contributions yield a plug-and-play test-time verification system that can improve task completion and policy compliance of any reasoning agent. On reasoning benchmarks where policies encode mathematical or logical constraints, interwhen achieves near-perfect accuracy for reasoning models using a fraction of the tokens of baselines. On agentic benchmarks with policy-based verifier generation, it enables improvements in task quality for SLMs without any finetuning, e.g., task completion rate of Qwen3-30B jumps from 32% to 87% on the telecom domain in tau2-bench. Code at https://github.com/microsoft/interwhen.
Figures & tables
Appendix figures & tables20 assets
Supplementary material from the paper’s appendix.
Appendix
| Game24 | Maze | SpatialMap | ZebraLogic | ZebraLogic XL | VERINA-Code | VERINA-Spec | ||||||||
| Method | Acc | Tok | Acc | Tok | Acc | Tok | Acc | Tok | Acc | Tok | Acc | Tok | Acc | Tok |
| GT-c-2 | 98.53 | 103.81 | 88.80 | 100 | 74.80 | 100.06 | 98.58 | 106.9 | 92.71 | 133.3 | 59.79 | 147.61 | 29.10 | 161.90 |
| IW-GT-2 | 98.60 | 72.66 | 97.93 | 133.36 | 85.33 | 154.46 | 99.49 | 111.2 | 97.40 | 112.9 | 73.54 | 174.03 | 37.57 | 188.57 |
| GT-c-4 | 99.49 | 106.02 | 88.80 | 100 | 74.80 | 100.06 | 99.49 | 109.2 | 97.40 | 144.8 | 64.02 | 216.40 | 33.33 | 269.84 |
| IW-GT-4 | 99.49 | 68.96 | 97.93 | 133.36 | 85.33 | 154.46 | 99.90 | 112.0 | 99.48 | 116.6 | 76.54 | 226.24 | 42.33 | 279.18 |
| Method | Reward | Env. pass | Action | Token% |
| CoT | 32.17 | 35.00 | 76.23 | 100.00 |
| IW (policy) | 42.11 | 42.00 | 81.10 | 116.70 |
| IW (policy + trace) | 71.10 | 81.20 | 89.68 | 97.40 |
| IW (policy + trace + prompt) | 87.70 | 90.80 | 98.80 | 96.90 |
| IW (prompt only) | 38.67 | 36.63 | 77.57 | 112.25 |
| Instruct | Thinking | ||||
| Dataset | Metric | CoT | IW | CoT | IW |
| ZebraLogic | Acc. (%) | 93.0 | 97.4 | 95.5 | 97.9 |
| % Tok. | 100 | 104.9 | 100 | 105.6 | |
| ZebraLogic X-Large | Acc. (%) | 69.8 | 90.6 | 79.2 | 90.6 |
| % Tok. | 100 | 103.1 | 100 | 103.4 | |
| Extraction setting | Samples | Wrong | Missed |
| Maze trace state | 12,000 | 5 ( ) | 15 ( ) |
| Structured tool calls | 14,587 | 0 | 0 |
| User-message values (3B SLM) | 398 | 0 | 0 |
| Extractor | Avg@4 | Env. Pass | Action Pass |
| Qwen2.5-3B-Instruct | |||
| GPT-5.4 | |||
| (GPT-5.4 Qwen2.5-3B) |
| Model | Method | Maze | SpatialMap | GameOf24 | Verina-Code | Verina-Spec | |||||
| Acc. | %Red | Acc. | %Red | Acc. | %Red | Acc. | %Red | Acc. | %Red | ||
| Qwen3-30B-A3B Thinking-2507 | Base | 88.53 | 0.00 | 74.67 | 0.00 | 95.01 | 0.00 | 56.08 | 0.00 | 25.40 | 0.00 |
| k-Stable (ours) | 88.53 | 32.24 | 75.00 | 10.83 | 95.45 | 31.65 | 56.61 | 3.54 | 25.40 | 55.09 | |
| DEER | 88.53 | 0.61 | 74.87 | 8.23 | 95.01 | 3.82 | 56.08 | 2.00 | 25.40 | 6.88 | |
| EAT | 88.53 | 0.00 | 74.60 | 0.41 | 95.01 | 0.00 | 56.08 | 0.00 | 25.40 | 1.70 | |
| QwQ-32B | Base | 85.80 | 0.00 | 74.93 | 0.00 | 83.70 | 0.00 | 56.08 | 0.00 | 37.57 | 0.00 |
| Method | Value | Maze | SpatialMap | VERINA Code | VERINA Spec | ||||||||
| Acc. | Tokens | %Red | Acc. | Tokens | %Red | Acc. | Tokens | %Red | Full Spec | Tokens | %Red | ||
| Baseline | 0 | 86.5 | 4098.4 | 0.0 | 69.7 | 5067.1 | 0.0 | 33.9 | 2066.8 | 0.0 | 20.6 | 2712.4 | 0.0 |
| EAT | 0.2 | 80.3 | 387.1 | 90.6 | 66.7 | 964.4 | 81.0 | 31.8 | 323.6 | 84.3 | 11.1 | 384.1 | 85.8 |
| 0.1 | 79.7 | 464.3 | 88.7 | 68.3 | 1643.0 | 67.6 | 32.3 | 358.5 | 82.7 | 13.2 | 549.8 | 79.7 | |
| 0.04 | 80.4 | 1380.7 | 66.3 | 70.0 | 3005.9 | 40.7 | 30.7 | 639.4 | 69.1 | 15.9 | 1058.8 | 61.0 | |
| 0.008 | 86.3 | 3825.9 | 6.6 | 69.7 | 4873.3 | 3.8 | 33.3 | 1509.6 | 27.0 | 20.1 | 2272.7 | 16.2 | |
| Method | Value | Maze | SpatialMap | VERINA Code | VERINA Spec | ||||||||
| Acc. | Tokens | %Red | Acc. | Tokens | %Red | Acc. | Tokens | %Red | Full Spec | Tokens | %Red | ||
| Baseline | 0 | 88.5 | 4486.3 | 0.0 | 74.7 | 7112.1 | 0.0 | 56.1 | 2881.2 | 0.0 | 25.4 | 3529.1 | 0.0 |
| EAT | 0.2 | 81.9 | 1090.0 | 75.7 | 71.1 | 2041.0 | 71.3 | 54.5 | 1208.3 | 58.1 | 21.7 | 1804.1 | 48.9 |
| 0.1 | 81.8 | 1190.5 | 73.5 | 71.1 | 2255.0 | 68.3 | 55.0 | 1574.7 | 45.4 | 24.3 | 2351.0 | 33.4 | |
| 0.04 | 81.5 | 1349.0 | 69.9 | 71.9 | 2847.5 | 60.0 | 55.6 | 2095.1 | 27.3 | 24.9 | 3007.3 | 14.8 | |
| 0.008 | 85.3 | 3118.5 | 30.5 | 73.2 | 4937.2 | 30.6 | 55.6 | 2790.3 | 3.2 | 25.9 | 3468.9 | 1.7 | |
| Method | Value | Maze | SpatialMap | VERINA Code | VERINA Spec | ||||||||
| Acc. | Tokens | %Red | Acc. | Tokens | %Red | Acc. | Tokens | %Red | Full Spec | Tokens | %Red | ||
| Baseline | 0 | 85.8 | 5411.4 | 0.0 | 74.9 | 6246.0 | 0.0 | 56.1 | 2881.4 | 0.0 | 37.6 | 2674.0 | 0.0 |
| EAT | 0.2 | 84.5 | 1715.5 | 68.3 | 73.7 | 3344.8 | 46.5 | 54.5 | 1070.2 | 62.9 | 34.4 | 1220.3 | 54.4 |
| 0.1 | 84.3 | 2290.0 | 57.7 | 73.8 | 3708.3 | 40.6 | 56.1 | 1469.8 | 49.0 | 34.4 | 1223.2 | 54.3 | |
| 0.04 | 84.7 | 3253.5 | 39.9 | 74.2 | 4452.2 | 28.7 | 58.2 | 1997.8 | 30.7 | 34.4 | 1319.4 | 50.7 | |
| 0.008 | 85.4 | 4928.6 | 8.9 | 74.5 | 5849.2 | 6.4 | 56.1 | 2635.9 | 8.5 | 36.5 | 1910.8 | 28.5 | |
| Dataset | Question | Policy Rules ( ) | Intermediate State ( ) | Verifier ( ) | Verifier Feedback |
| Maze | Given a grid maze with start (S) and end (E), e.g., “How many right turns are needed to go from S to E?” | (1) Each proposed move is a valid transition (no walls/out-of-bounds). (2) Turn classification (left/right) and turn counts are correct. | Current position, proposed movement direction, updated left/right turn counts at each step. | Rule-based (Python matrix) | Indicates whether a step leads to an invalid position or whether the turn direction/count is incorrect. |
| SpatialMap | Given object locations, e.g., “What is to the north-west of the park?” or “How many objects are to the east of the school?” | Generated spatial claims are logically consistent with the constraints in the problem description. | Intermediate claims and inferences about spatial relationships between objects. | Formal (Z3 SMT solver) | Indicates that a generated claim contradicts the spatial constraints in the problem. |
| GameOf24 | Given four integers, construct an expression using to reach 24, e.g., “Use 1, 5, 5, 5 to make 24.” | (1) The expression uses exactly the four input numbers, each exactly once. (2) The expression evaluates to exactly 24. | The candidate arithmetic expression derived so far from the main reasoning trace. | Rule-based (Python) | Indicates incorrect arithmetic result, use of extra/missing numbers. |
| ZebraLogic | Given houses, features, and natural-language clues, e.g., “The cat owner lives next to the blue house.” Deduce the unique assignment of all features to houses. | Current attribute-to-house assignments satisfy all puzzle constraints. | JSON representation of current assignments of attributes to houses. | Formal (Z3 SMT solver) | Indicates that the current assignments contradict the constraints in the puzzle. |
| Verina | Given a problem description, generate either (a) the function body given a signature and pre/postconditions, or (b) pre/postconditions given auxiliary functions and a reference implementation. | Generated Lean4 code or specification compiles successfully. | Lean4 code or specification corresponding to the reasoning trace so far. | Lean4 compiler | Compilation error messages along with basic Lean4 syntax guidance. |
| -bench (Telecom) | Given a user instruction (such as recharging data on a user’s phone line) and list of tools, complete the task while adhering to the policy | (1) can only have one bill in the AWAITING PAYMENT status at a time. (2) the maximum amount of data that can be refueled is 2GB. … | Tool calls and tool responses | Rule-based (Python or Lean). Rules are generated by an LLM. | Indicates if the tool call is invalid or against the policy. May also give suggestions on which tool calls to make. |
| Game24 | Maze | SpatialMap | ZebraLogic | ZebraLogic XL | VERINA-Code | VERINA-Spec | |||||||||
| Avg Compute | Method | Acc | Tok | Acc | Tok | Acc | Tok | Acc | Tok | Acc | Tok | Acc | Tok | Acc | Tok |
| CoT | 95.0 | 100 | 88.5 | 100 | 74.7 | 100 | 95.5 | 100 | 79.2 | 100 | 56.1 | 100 | 25.4 | 100 | |
| GT | 96.1 | 116.3 | 88.9 | 119.7 | 73.9 | 111.8 | 98.5 | 106.6 | 92.7 | 119.3 | 53.4 | 111.4 | 25.9 | 112.8 | |
| IW | 97.2 | 61.6 | 97.73 | 133.1 | 84.73 | 152.9 | 98.5 | 108.9 | 92.2 | 103.2 | 71.6 | 133.9 | 37.0 | 126.9 | |
| Bo2 | 97.4 | 199 | 88.5 | 201 | 75.1 | 201 | 98.5 | 201.3 | 92.7 | 203.2 | 57.1 | 202 | 27.0 | 203 | |
| IW-GT-2 | 98.60 | 72.66 | 97.93 | 133.36 | 85.33 | 154.46 | 99.49 | 112.2 | 97.4 | 113.1 | 73.54 | 174.03 | 37.57 | 188.57 | |
| Game24 | Maze | SpatialMap | ZebraLogic | ZebraLogic XL | VERINA-Code | VERINA-Spec | |||||||||
| Avg Compute | Method | Acc | Tok | Acc | Tok | Acc | Tok | Acc | Tok | Acc | Tok | Acc | Tok | Acc | Tok |
| CoT | 92.7 | 100 | 74.8 | 100 | 70.8 | 100 | 73.9 | 100 | 23.4 | 100 | 35.4 | 100 | 22.2 | 100 | |
| GT | 93.1 | 111.9 | 74.9 | 117.7 | 70.4 | 107.8 | 78.2 | 143.0 | 31.8 | 170.7 | 36.0 | 101.2 | 23.2 | 109.0 | |
| IW | 93.5 | 90.2 | 81.3 | 112.5 | 79.3 | 114.4 | 75.5 | 99.4 | 29.2 | 97.8 | 51.9 | 116.2 | 25.9 | 179.4 | |
| Bo2 | 93.1 | 200.1 | 74.9 | 199.4 | 70.4 | 199.7 | 78.2 | 201.2 | 31.8 | 200.1 | 36.0 | 204.5 | 23.2 | 199.7 | |
| IW-GT-2 | 95.3 | 104.2 | 88.7 | 160.4 | 80.1 | 139.8 | 82.7 | 144.9 | 36.5 | 175.6 | 58.7 | 196.6 | 32.3 | 310.7 | |