Learning to Discover at Test Time — part 3/5
Cleaned-text code points [31035, 47022). Bibliography omitted here; source.md includes it.
In Circle packing, the goal is to maximize the sum of radii of n n non-overlapping circles packed inside a unit square. We follow the setup from prior work Novikov et al. (2025) ; Georgiev et al. (2025) . The state s s is a list of circle centers and radii. The action a a consists of thinking tokens followed by Python code that optimizes circle positions and radii. The reward is the sum of radii achieved for valid packings, and 0 0 otherwise. We present the results below mostly for comparison purposes, as several recent works on evolutionary algorithms reported their performance using this task.
Table 3 shows results. TTT-Discover with Qwen3-8B matches the best known constructions for both n = 26 n=26 and n = 32 n=32 . We make no improvements here, but include these results for completeness. The algorithms found by TTT-Discover are presented in Appendix B.1 . Algorithms initialize circles in staggered or hexagonal grid arrangements, then refine positions and radii using sequential least squares programming with boundary and pairwise non-overlap constraints. This solution is a lot simpler than recent work, such as ShinkaEvolve Lange et al. (2025) , especially in terms of initialization, where their solution uses an initialization based on simulated annealing algorithm, while TTT-Discover initializes only with a simple geometric arrangement.
#### 4.1.4 Expert Review
### 4.2 Kernel Engineering
GPU kernels are the computational foundation of modern AI, every forward pass and backward pass ultimately executes as kernel code on hardware. We apply our method to GPU kernel optimization, where a new state-of-the-art kernel is a faster implementation than existing ones.
GPUMODE is an open community for kernel development that also hosts competitions for domain experts. We test our method on two competitions: TriMul (triangular matrix multiplication), a core primitive in AlphaFold’s architecture Jumper et al. (2021) , and DeepSeek MLA (Multi-head Latent Attention), a key component in DeepSeek’s inference stack Liu et al. (2024a) . Each GPU type for the TriMul competition (NVIDIA H100, A100, B200, AMD MI300X) has a separate leaderboard, as performant implementations differ across architectures. For The MLA competition there is only an MI300X leaderboard.
As these competitions were conducted earlier, we retrospectively evaluate our performance while respecting competition standards. We prefer GPUMODE because their leaderboards are well-tested through human competitions with a robust evaluation harness Zhang et al. (2025a) , and their benchmarks avoid signal-to-noise issues where simple operations or small inputs cause overheads to dominate runtime.
Environment: The state s s is a GPU kernel code. The action a a consists of thinking tokens followed by kernel code written in Triton Tillet et al. (2019) . The dynamics parse the code from the action: s ′ = Parse ( a ) s^{\prime}=\texttt{Parse}(a) . For the initial state, we provide unoptimized kernels, detailed in Appendix C . The reward is proportional to the inverse of the geometric mean of runtimes on a fixed set of input shapes (following the leaderboard), or zero if the kernel fails correctness checks or times out. We evaluate runtime remotely on Modal to scale and ensure consistent hardware conditions. For TriMul, we evaluate the runtime only on H100s during training, even though we still evaluate the generated kernels for A100, B200, and MI300X for final report. Since MI300X is not available on Modal, for MLA-Decode we use H200s, and hope the kernels generalize to MI300X. Further details about the prompts and environments are in Appendix C .
Results. We report the runtime of the best kernels and the baselines in Table 4 . Our TriMul kernels achieve state-of-the-art across the board in all GPU types. For A100s, our best kernel is 50 % 50\% faster than the top human kernel, even though our reward function did not time the kernels on A100s. We uniformly achieve > 15 % >15\% improvement over the best human submissions for all GPU types. Finally, we submit to the official TriMul A100/H100 leaderboard 1 1 1 See leaderboards . For TriMul B200/MI300X and MLA-Decode MI300X tasks, due to an infra problem on GPU Mode’s server, we could not submit to the official leaderboard. .
The discovered kernels for Trimul identify heavy memory I/O incurred by frequent elementwise operations as a major bottleneck to optimize. Specifically, the kernels fuse: (i) operations in the input LayerNorm, (ii) sigmoid and elementwise multiplication in input gating, and (iii) operations in the output LayerNorm and gating. As for the most compute-heavy operation, which is the matmul with O ( N 3 ) O(N^{3}) complexity, the kernels convert the inputs to FP16 and delegate the computation to cuBLAS/rocBLAS to effectively leverage TensorCores/MatrixCores of the hardwares.
Discovered MLA-Decode kernels. The kernels shown in table 5 mainly rely on torch.compile() for optimization. Specifically, they adopt a specific configuration of torch.compile . However, these kernels do not leverage Triton for fine-grained optimization, which may limit further improvements and more flexible use case. We additionally filter and evaluate generated kernels that explicitly use Triton despite their slightly slower runtime, and report in Appendix C .
#### 4.2.1 Expert Review
Below, we provide verbatim reviews from the GPUMode organizers for our TriMul competition kernels.
### 4.3 Algorithm Engineering
Hard optimization problems like package-delivery routing, crew scheduling, factory production planning, power-grid balancing—appear throughout industries and must be solved repeatedly at scale. We apply our method to these algorithm engineering problems, where a new state-of-the-art would be writing a higher-scoring algorithm than existing ones written by human experts.
AtCoder Heuristic Contest (AHC) is a series of programming competitions focused on optimization problems drawn from real-world industrial challenges AtCoder Inc. (2025) , attracting hundreds of participants including industry experts. We attempted to evaluate on two past contests, ahc039 and ahc058. ahc039 ("Purse Seine Fishing") is a computational geometry problem where you design a simple closed net on a 2D map, restricted to horizontal/vertical edges, to capture many target points while avoiding penalty points under a budget. ahc058 ("Apple Incremental Game") is a production planning problem where upgrades trade off immediate output versus growing future production capacity, and the goal is to schedule upgrades to maximize final output.
We select ahc039 because ShinkaEvolve Lange et al. (2025) reported a solution that would have placed 2nd, and ahc058 because Sakana AI’s ALE-Agent achieved the first-ever AI victory in an AHC Sakana AI (2026) . We use the evaluation harness from ALE-Bench Imajuku et al. (2025) . We use the public test case generator to create local tests, select our best-performing algorithm, and submit it to be scored on the official platform.
Environment: The state s s is an algorithm implementation in C++. The action a a consists of thinking tokens followed by C++ code. The dynamics parse the code from the action: s ′ = Parse ( a ) s^{\prime}=\texttt{Parse}(a) . The reward is the score on locally generated test cases, or zero if the algorithm fails correctness checks or exceeds the time limit of 2 seconds and memory limit of 1024MB. We select the best-performing algorithm and submit it to be scored on the official private tests. We use the evaluation harness released by Imajuku et al. (2025) . For initial states, for the ahc039 competition we use the same initial program as Lange et al. (2025) , which is based on ALE-Agent Imajuku et al. (2025) best program, that would have placed 5th in the competition leaderboard. For ahc058 we start from scratch, similar to ALE-Agent Sakana AI (2026) .
Previous state-of-the-art. We report the top human submissions on each contest leaderboard. For AI baselines, we compare to ALE-Agent Imajuku et al. (2025) and ShinkaEvolve Lange et al. (2025) , which use ensembles of models including the gpt, Gemini, and Claude families of models. ALE-Agent Imajuku et al. (2025) starts from scratch for both problems. ShinkaEvolve Lange et al. (2025) reports results in ahc039 where they start from ALE-Agent solution, and improve it from 5th place to 2nd place.
Results. We report results in Table 6 . For both competitions, if we had submitted during competition time, our algorithms would have gotten the 1st place. For ahc039, we marginally improve upon the best human, while there is a significant gap between next best AI and human scores. For ahc039, we follow ShinkaEvolve by starting from the ALE-Agent solution and improve it from 5th place to 1st place, while ShinkaEvolve reaches the 2nd place using significantly more capable frontier models such as Gemini 2.5 Pro. For ahc058, we start from scratch and outscore all submissions in the competition.
For AHC039, the solution builds a large pool of promising axis-aligned rectangles using prefix sum scoring, then greedily seeds a connected union and uses simulated annealing with add, remove, replace, expand, shrink, and slide moves to optimize the rectangle union score under perimeter and vertex constraints, followed by cleanup and final greedy refinement.
For AHC058, the solution first builds several reasonable plans using greedy rules, different biases, and a short beam search to explore promising early decisions. Then, the program improves the best plan with simulated annealing that makes random edits, swaps, and partial rebuilds before finishing with a small local cleanup pass. It estimates the value of actions using a simple formula for how much future production an upgrade is likely to create, which guides both greedy choices and pruning. For performance, it caches intermediate states so it only recomputes parts of the plan that change. Overall, the program balances broad exploration early with focused local improvement later.
### 4.4 Single Cell Analysis
Single-cell RNA-sequencing (RNA-seq) aims to help us understand how organisms work and get sick by resolving biology at the level of individual cells; measuring which genes each cell is using to reveal cell types, states, and how they change. Practically, it isolates single cells, tags their mRNA with a Unique Molecular Identifier (UMI), sequences it, and outputs a per-cell gene-by-count table. RNA-seq protocols suffer from measurement noise in the observed UMI counts. Thus, denoising algorithms significantly increases the realized value of expensive experiments. Each sequencing run costs thousands of dollars, and better denoising methods reduce the need for deeper sequencing.
We apply our method to one of the recent benchmarks OpenProblems Luecken et al. (2025) , an important set of open problems for single-cell analysis. We use the denoising task therein. Batson et al. (2019) demonstrated that partitioning the observed molecules of a single dataset into training and test sets via binomial sampling and evaluating the denoised training set against the held-out test counts provides a proxy for accuracy against true expression values, providing an evaluation framework without requiring external ground truth data.
Environment. The state s s is an algorithm implementation. The action a a consists of thinking tokens followed by code. The dynamics parse the code from the action: s ′ = Parse ( a ) s^{\prime}=\text{Parse}(a) . The benchmark evaluates denoising quality using two complementary metrics: mean squared error (MSE) in log-normalized space, which measures overall reconstruction accuracy, and Poisson negative log-likelihood, which assesses how well the denoised counts match the statistical properties expected of count data. In our context, the reward is the MSE score, or zero if it violates constraints we add for the Poisson score or the algorithm exceeds the time limit of 400 400 seconds. The Denoising benchmark offers 3 datasets: PBMC, Pancreas, and Tabula Muris Senis Lung, in order of size. We train our policy by using Pancreas in our environment, and ultimately performance is reported by running the algorithm on the held out PBMC and Tabula datasets.
Previous state-of-the-art. We report the state of the art as described by the OpenProblems Luecken et al. (2025) benchmark. The best result was provided by MAGIC Van Dijk et al. (2018) using an approximate solver and reversed normalization. MAGIC is a well known technique, frequently used in the literature Youssef et al. (2024) ; Venkat et al. (2025) , the only method different from MAGIC that provides good performance is ALRA Linderman et al. (2022) , ranked third. We also compare with OpenEvolve and Best-of-25600.
Results. The improved function obtained via TTT-Discover shows consistent improvements on both datasets (see Table 7 ). TTT-Discover is initialized with MAGIC code. TTT-Discover adds gene-adaptive transform ensembling, low-rank SVD refinement, and log-space polishing steps that directly optimize the benchmark metric.
#### 4.4.1 Expert Review
Below, we provide a verbatim review from Prof. Eric Sun.
### 4.5 Ablations
We have three sets of ablations. First, we ablate the design choices for the train method, while keeping our reuse method, PUCT, fixed. We test (i) TTT with entropic objective using constant β = 2 \beta=2 ( Jiang et al. (2025) ), (ii) TTT with no entropic objective (expected reward), (iii) No TTT (only reuse). Second, we ablate the choice of the Reuse method , while keeping our train method, TTT with entropic objective using adaptive β \beta , fixed. We replace PUCT with (i) ϵ − \epsilon- greedy reuse with ϵ = 0.1 \epsilon=0.1 as this is perhaps the most naive reuse method, and (ii) no reuse. Finally, we report the naive RL baseline, where we use the expected reward objective with no reuse, and the Best-of- 25600 25600 baseline.
For each ablation, we report the runtime of the best kernel found in Table 8 , and the reward distribution in Figure 4 . The rewards distributions and best kernel runtimes are computed with our evaluator, not the leaderboard.
Only the full TTT-Discover algorithm achieves the best performance in the TriMul competition. When using a constant β \beta , the improvements diminish later in the training. Using the expected reward objective, improvements are slower overall. Without any test-time training, both the mean reward and the max reward stagnates. ϵ \epsilon -greedy reuse works reasonably well, especially with an early lucky kernel. In early experiments with other applications, the lack of exploration was also a bigger problem than it is in kernel engineering tasks. Naive RL and no reuse make minimal improvements.
It is entirely possible that additional tuning (e.g., a task-specific β \beta schedule) or hyperparameter interactions (e.g., batch size and reuse) can provide improvements in the ablation configurations. For each component, many additional knobs could be ablated (e.g., PUCT exploration bonus, learning rate, batch size). However, our focus was on identifying design choices that works reliably across diverse applications within our budget with minimal task-specific tuning. In practice, the key hyperparameters such as learning rate, batch size, and LoRA rank were fixed after the initial iterations of the project.
## 5 Related Works
In this section, we first provide a broad overview of continual learning and test-time training, using some of the exposition in Tandon et al. (2025) . Then towards the end of § 5.2 , we discuss the most relevant work on test-time training: MiGrATe Phan et al. (2025) and ThetaEvolve Wang et al. (2025a) . Finally, we discuss two pieces of work with tangential formulations: RL on a single training problem that is not the test problem Wang et al. (2025b) (§ 5.3 ), and RL on the entire test set Zuo et al. (2025) (§ 5.4 ).