Manuscript Offprint

arXiv:2610.10118

YANchor-4B: Effective Long-Horizon Reasoning in O(N) Time with O(1) Memory

Huishan Ji, Hua Xu, Weiming Zhang, Qirui Ye

Abstract

Long-horizon reasoning demands access to earlier information at a manageable generation cost. Full-history attention incurs growing storage and computation, while recurrent compression can lose precise details. Therefore, we present YANchor-4B, a general-purpose recurrent model that preserves crucial memory as ANchors for retrieval during subsequent reasoning. Beyond O(N)O(N)-time generation and O(1)O(1) memory, YANchor enables effective long-horizon reasoning through its multidimensional memory mechanism. For example, on challenging math problems, it achieves 82.93% mean pass@1 on AIME 2024–2026 and 63.64% on HMMT, substantially outperforming linear-time, constant-state counterparts, including larger models. It also delivers several-fold higher batched long-generation throughput than Transformer and hybrid baselines on H100. Furthermore, evaluations across dozens of benchmarks demonstrate YANchor's superiority in general-purpose capabilities.

AIME Avg.

Figure

HMMT

4B class

1 YANchor-4B

2 ARWKV-R1 1.5B

3 AHN-GDN 3B

MATH-500

Code Avg.

7-9B class

4 ARWKV-R1 7B

5 Falcon3-Mamba 7B

6 QRWKV7 7B

7 xLSTM 7B

8 RWKV-7 G1i 7.2B

9 RecurrentGemma 9B

Science Avg.

13-14B class

10 RWKV-7 G1j 13.3B

11 AHN-GDN 14B

12 Phi-3 Medium 4K

Figure 1. YANchor-4B and 11 bounded-state baselines on mathematics, code, and science. Models are grouped by parameter scale. Avg. denotes an equal-weight benchmark mean: AIME covers 2024–2026; Code covers HumanEval, MBPP, and LiveCodeBench v6; Science covers GPQA-Diamond, ARC-C, and ARC-E. HMMT uses February 2026. Section 5 defines the primary metrics.

Decode speed · token/s

Figure

Throughput · token/s

YANchor-4B + CUDA Graphs + Fused Kernels

Qwen3.5-4B + BF16 + FA4 + FlashInfer GDN Prefill + Fused CUDA GDN Decode

Gemma 4 E4B + BF16 + FlashAttention-4

MiniCPM5-2B + BF16 + FlashAttention-3

Figure

Memory demand · GiB

All baselines: vLLM O3 + CUDA Graphs + Chunked Prefill + Async Scheduling

Figure

Figure 2. Single-H100 inference: sustained decoding speed, higher batched throughput, and bounded memory demand. Left: cumulative decode speed. Middle: end-to-end output throughput, selecting the batch size with the highest measured throughput for each model and input length. Right: batch-512 peak memory demand; solid curves use measured components, dashed curves project KV growth, and the dotted line marks device capacity. Appendix D gives the workloads and runtime settings.

October 2026

1 Introduction

Long-horizon reasoning builds on earlier definitions, constraints, and intermediate results throughout a solution. These dependencies require continued access to earlier information. Full-history attention provides direct access, but its growing cache and attention computation make extended generation increasingly expensive.

Recurrent and state-space models keep a fixed-size summary of history. This gives favorable inference scaling, yet repeated state updates can weaken precise associations. Local attention preserves recent detail, while distant information eventually leaves its window. Effective long-horizon reasoning therefore requires a way to retain and retrieve crucial earlier information within a bounded state.

YANchor addresses this gap by preserving crucial memory as ANchors for retrieval during subsequent reasoning. Independent memory retains distant information, recurrent states summarize broader context, and local attention preserves recent detail. These complementary paths support effective long-horizon reasoning within a fixed-capacity history state, yielding O(1)O(1) history-state memory and O(N)O(N) generation time over N tokens.

To realize this design, YANchor adapts Qwen3.5-4B by preserving its recurrent layers and replacing global attention with local attention and independent memory. The memory learns how to write, select, and retrieve records for subsequent computation. Architectural adaptation and post-training develop its use in task solutions. Section 3 describes these mechanisms.

YANchor substantially outperforms linear-time, constant-state counterparts on difficult mathematical reasoning, including models with 7B–14B parameters (Figure 1). Its AIME 2024–2026 mean pass@1 reaches 82.93%, compared with 18.89% for RWKV-7 G1j 13.3B. The lead extends to HMMT, knowledge, code, and instruction following.

YANchor sustains long-sequence decoding and achieves several-fold higher batched throughput than Transformer and hybrid baselines on H100 (Figure 2). Fixed history storage keeps more long sequences resident as generation proceeds. Together, the capability and efficiency results show that difficult tasks can be solved within a history-state budget that does not grow with the solution.

Across the 24 common benchmarks, YANchor leads all 16 evaluated bounded-state baselines on 20 tasks. Its mean score of 78.64 exceeds the strongest baseline at 56.29 by 22.35 points. VL results establish multimodal capability, while long-memory tests confirm access to distant information.

October 2026

References (39)