betaFeedback

WorksComputer Science

Test-Time Adaptation of Reasoning Strategies with Bayesian Nonparametric Memory

Abstract

While modern large language models (LLMs) have been trained to reason through verbalized chains-of-thought, the generation cost grows substantially due to suboptimal paths to reach the final answer. Furthermore, as new insights are discovered while observing various input queries (e.g. through self-reflection), limited mechanisms exist for carrying forward these findings to be applied to subsequent problems. One can view the list of such strategies or behaviors as a growing cheatsheet, with elements retrieved from this memory module at inference-time. In this work, we consider structured cheatsheets, with learned clusters of behaviors. We introduce a Hierarchical Dirichlet Process Gaussian Mixture Model (HDP-GMM) over behavior embeddings, which shares components across domains while allowing domain-specific mixing weights, and uses the posterior predictive to retrieve relevant behaviors for a query; we call this a Bayesian Cheatsheet\textit{Bayesian Cheatsheet}. This mechanism allows for cheap adaptation in an online test-time training (TTT) setting, softly updating the mixture's sufficient statistics following each sample and enabling the creation of new components when the synthesized behaviors are sufficiently novel. We demonstrate that Bayesian Cheatsheet achieves clear performance gains relative to existing memory modules across reasoning benchmarks such as AIME'25, Omni-MATH, and PhysReason, even in the cold-start setting. We show that the Bayesian Cheatsheet is an adaptively reorganizing memory module, as behaviors can be re-assigned to components through a single step of collapsed Gibbs sampling. Our findings highlight the value of Bayesian-inspired memory modules for effective test-time adaptation and the role of structure in metacognitive reasoning.

Figure 1. Bayesian Cheatsheet learns a structured memory module offline and adapts it at test time. Left: behaviors are mined offline by an LLM solving problems and self-reflecting on its solutions; the extracted behaviors are embedded and clustered into shared components with domain-specific weights by fitting an HDP-GMM. Middle: at test time, a novelty score based on the HDP-GMM’s posterior predictive determines whether a new behavior updates existing components’ sufficient statistics (top) or spawns a new component and initializes its sufficient statistics (bottom). Right: evaluation on AIME’25 with Granite-4.2-3B shows that Bayesian Cheatsheet (BC-TTT) outperforms the compared adaptive memory mechanisms in the online setting.

Introduction

Large language models increasingly solve complex problems by generating verbalized intermediate reasoning steps (Wei et al., 2022; Nye et al., 2021). Given that related problems can often be solved with similar strategies, storing such strategies, which we call behaviors, can improve reasoning efficiency in solving future problems — that is, they do not need to be rediscovered. This is a key premise of metacognitive reasoning [10, 11] (Shinn et al. 2023), where reflecting on reasoning to extract generalizable lessons and using those lessons to guide subsequent attempts have been shown to be effective. At the same time, this begs the question: how can we design systems to optimally retain and retrieve useful abstractions for LLM reasoning and decision-making?

Recent methods accumulate and revise reasoning behaviors, reflections, and procedural guidance over time [11] (Suzgun et al. 2026; Zhang et al. 2026b; Ouyang et al. 2026). As memory grows, context limits and costs make it desirable to maintain an external, structured memory with selective reuse to avoid context explosion. Existing structured memory systems [8] (Xu et al. 2025) often rely on LLM judgments and similarity-based heuristics to define and evolve the memory structure; this organization can become difficult to maintain as the memory grows.

In this work, we use the term cheatsheet to refer to a general abstraction: it is a collection of concise, natural-language insights that can be consulted while solving a new problem. A cheatsheet induces two key design questions: 1) what type of information should be stored? and 2) how should it be organized for effective reuse and continual adaptation? In this work, we focus on the latter, while for the former, we simply use short reasoning behaviors generated through self-reflection to form the memory content. This allows for a clear comparison of memory organization mechanisms without the confounding effect of differences in the memory content. As a cheatsheet grows, its organization must support more than the retrieval of similar entries — related behaviors may form groups, which may also be reusable across domains. New experiences encountered at test-time may reinforce the contents of an existing group, or reveal a strategy that is not captured under the current organization. However, static cheatsheets, as well as flat similarity-based retrieval, do not address this, and while clustering provides additional organization for reuse, it does not facilitate principled growth and requires the number of clusters to be known in advance.

We introduce the Bayesian Cheatsheet, a structured memory module based on a Hierarchical Dirichlet Process Gaussian Mixture Model (HDP-GMM) (Rasmussen, 2000; Teh et al., 2006) over behavior embeddings. The HDP-GMM formulation, as a non-parametric unbounded clustering mechanism, offers a few benefits that are particularly desirable for test-time memory management: 1) the number of clusters is purely driven by the data seen thus far, 2) the hierarchical structure offers a flexible mechanism to distinguish generally usable memories from domain-specific ones, and 3) the posterior probabilities of cluster assignment serve a dual purpose, in assigning memories to clusters as well as input-conditioned retrieval. The HDP prior additionally induces a rich-get-richer bias – memory components repeatedly observed in experience become more likely to be used in the future, while new components may still be created.

Our Bayesian Cheatsheet memory learns globally shared components (clusters) of behaviors, allowing for probabilistically latent assignment. At inference time, it predicts the query’s domain and retrieves behaviors from components to add to the language model’s context. In an online test-time training setting with streaming samples, Bayesian Cheatsheet cheaply incorporates newly mined behaviors into the memory through additive sufficient statistics, while also permitting the creation of new components for samples where the behaviors are sufficiently novel. Bayesian Cheatsheet also allows the memory to periodically reorganize itself as its contents evolve without requiring a refitting step every sample. As a result, this mechanism supports lightweight continual adaptation in a statistically-informed, training-free manner through principled changes to an external memory module.

Related Work

Test-time adaptation and continual learning. Early test-time training methods adapted models through self-supervised losses on test inputs (Sun et al., 2020), with later work on language models drawing adaptation data from retrieved text [16] or input–output demonstrations supplied with a reasoning task [2]. Continual learning additionally aims to retain previously learned capabilities across updates; Learning without Forgetting (Li & Hoiem, 2016) and elastic weight consolidation [25] constrain changes in predictions and important parameters, respectively. On-policy distillation trains a student on its own generated sequences using a teacher’s predictions [1]; in self-distillation, the model itself supplies the teacher predictions when conditioned on richer information. Self-distillation fine-tuning uses demonstrations to acquire skills with less forgetting (Shenfeld et al., 2026), and related methods distill guidance from textual feedback [19], verified solutions (Zhao et al., 2026), or subsequent user messages [26]. While these methods parametrically update language model weights, we focus on continual adaptation through an external memory.

Memory and retrieval-augmented reasoning with LLMs. Retrieval-augmented generation (Lewis et al., 2020) provides external evidence at inference time by retrieving relevant information from a corpus or memory store, with structures ranging from vector indexes to interconnected knowledge graphs [21]. As these memories grow, their contents must also be managed and revised: MemGPT manages information beyond the context window (Packer et al., 2023), Mem0 consolidates conversational records [8], and A-MEM links and updates structured notes (Xu et al., 2025). For reasoning, ExpeL and Metacognitive Reuse extract reusable guidance from prior problem solving [11] (Zhao et al. 2024), while Dynamic Cheatsheet, ACE, and ReasoningBank maintain and refine strategies as experience accumulates (Suzgun et al., 2026; Zhang et al., 2026b; Ouyang et al., 2026). Recent approaches also learn how memory is constructed or used: ALMA searches over executable memory designs (Xiong et al., 2026), and MILES learns selection over an expanding library of step-level instructions (Tong & Gong, 2026). The focus in this work is on the probabilistic organization of such memory content.

Structured Retrieval for Metacognitive Reasoning

Problem Setup. We consider JJ domains D={1,…,J}\mathcal{D} = \{1, \ldots, J\} (in our experiments, math and physics), each with a corpus of prompts. From these prompts we mine behaviors – short natural-language reasoning strategies, extracted by having the model solve a problem, reflect on which general strategies its solution used, and record them (details in Appendix § 10) – and embed their descriptions with a fixed sentence encoder E:S→RD0\mathcal{E}: \mathcal{S} \to\mathbb{R}^{D_0} (where S\mathcal{S} is the space of text strings, including queries and behaviors), then project into a lower-dimensional space via f:RD0→RDf: \mathbb{R}^{D_0} \to\mathbb{R}^{D} (PCA, fit once over the mined corpus). We use ed,i∈RDe_{d,i} \in\mathbb{R}^{D} to denote the projected embedding of the ii-th behavior mined from domain dd, and ndn_d for the number of behaviors mined from domain dd.

At inference, we condition generation on a small subset of behaviors selected for relevance to the current query xx: given e(x)e(x), a selection rule Sel⁡\operatorname{Sel} returns a set of behaviors whose natural-language descriptions are inserted into the prompt. In the online setting we study in this work, new pairs of (query, mined-behavior) arrive sequentially as new samples are seen, and the organizing structure itself must be able to adapt and incorporate each one, and optionally, perform periodic reorganization. We formalize any such structure with these properties as three operations on a state Ω\Omega, which represents the current memory organization:

retrieve⁡:RD×Ω→ΔK,update⁡:RD×Ω→Ω,refit⁡:Ω→Ω\operatorname{retrieve}: \mathbb{R}^{D} \times\Omega\to\Delta^{K}, \qquad\operatorname{update}: \mathbb{R}^{D} \times\Omega\to\Omega, \qquad\operatorname{refit}: \Omega\to\Omega

Here, ΔK\Delta^{K} is the simplex of weights over the set of components. If the mechanism has a flat structure, KK is simply the total number of behaviors (each behavior is treated as its own component); otherwise, if there is clustering, we take KK to be the number of currently active components. This allows us to consider different practical instantiations (organizing structures) under a consistent online setup, with these being the central three operations of the online TTT loop.

Starting Point: kk-means clustering. The simplest instantiation partitions RD\mathbb{R}^{D} into KK hard clusters with centroids μ1,…,μK\mu_1, \ldots, \mu_K, i.e. Ω=(μ1,…,μK,n1,…,nK)\Omega= (\mu_1, \ldots, \mu_K, n_1, \ldots, n_K) where nkn_k counts points currently assigned to cluster kk.

retrieve⁡(e(x),Ω)=softmax⁡k(−∥e(x)−μk∥22σ2),σ2=1K∑kσk2\operatorname{retrieve}(e(x), \Omega) = \operatorname{softmax}_{k}\left(-\frac{\lVert e(x)-\mu_k\rVert^2}{2\sigma^2}\right), \qquad\sigma^2 = \frac{1}{K}\sum_k \sigma_k^2

where σk2\sigma_k^2 is the scalar cluster variance. Given a newly mined behavior with embedding ete_t, the update⁡(et,Ω)\operatorname{update}(e_t, \Omega) operator allows for the mechanism to grow the number of clusters by checking whether 1−max⁡jcos⁡(et,μj)1-\max_j \cos(e_t,\mu_j) exceeds a threshold τKM\tau_{\mathrm{KM}}. If so, it creates a new cluster with centroid μK+1=et\mu_{K+1}=e_t and count nK+1=1n_{K+1}=1. Otherwise, it assigns the behavior to the nearest centroid k⋆k^\star and updates, while every other centroid is unchanged:

μk⋆←nk⋆μk⋆+etnk⋆+1,nk⋆←nk⋆+1\mu_{k^\star}\leftarrow\frac{n_{k^\star}\mu_{k^\star}+e_t}{n_{k^\star}+1},\qquad n_{k^\star}\leftarrow n_{k^\star}+1

The refit(Ω\Omega) operator entails one full pass of Lloyd’s algorithm: all accumulated points are reassigned to their nearest centroids, each centroid is recomputed as the mean of its assigned points, and any remaining empty clusters are removed.

This approach has a few key limitations. First, hard assignment assumes clear specialization of the components in natural language, while behaviors perhaps should actually lie in multiple clusters, and kk-means requires prescribing the number of clusters a priori for its initialization; we want this to be determined in a data-driven manner. Second, “growth” (in terms of the creation of new components) is not tied to the probability-based retrieval mechanism, which can lead to many singleton components or a few overloaded components. Also, kk-means remains flat and unable to express the notion of domain-specificity; we want a structure that can encode domain-awareness while allowing for behaviors to possibly be shared across domains, motivating a hierarchy.

Bayesian Cheatsheet: Behavior Mixtures via HDP-GMM

We develop the Bayesian Cheatsheet, a nonparametric instantiation of a structured cheatsheet using a Dirichlet Process Gaussian Mixture Model (DP-GMM) (Rasmussen, 2000) to model behavior embeddings and counts for each component. This serves as an analogue to the kk-means approach, with probabilistically latent assignment in lieu of hard assignment, countably infinite components with probability-driven growth rather than a fixed number, and an extension to a Hierarchical DP-GMM for domain-aware modeling. The detailed algorithm is included in Appendix § 8.

Generative Mixtures with Dirichlet Processes

First consider a single domain. We draw a random probability measure:

G∼DP⁡(γ,H),H=NIW⁡(μ0,κ0,Ψ0,ν0)G\sim\operatorname{DP}(\gamma,H),\qquad H=\operatorname{NIW}(\mu_0,\kappa_0,\Psi_0,\nu_0)

with the NIW distribution being the conjugate base distribution over Gaussian parameters. GG is a discrete random probability measure, and thus can be written as

G=∑k=1∞πkδϕk,ϕk=(μk,Σk),ϕk∼i.i.d.HG=\sum_{k=1}^{\infty}\pi_k\delta_{\phi_k},\qquad\phi_k=(\mu_k,\Sigma_k),\qquad\phi_k\overset{\mathrm{i.i.d.}}{\sim}H

as many observations can share the same atomic value ϕk\phi_k. We model each behavior embedding eie_i as:

zi∣π∼Cat⁡(π),ei∣zi=k∼N(μk,Σk).z_i\mid\pi\sim\operatorname{Cat}(\pi),\qquad e_i\mid z_i=k\sim\mathcal{N}(\mu_k,\Sigma_k).

Marginalizing over GG yields the Chinese Restaurant Process (CRP). Conditioned on the previous assignments, a new behavior is assigned to an existing component kk with probability proportional to its occupancy nkn_k, or instantiates a new component with probability proportional to γ\gamma. As a result, the number of components (KK) is determined in a data-driven manner rather than fixed a priori.

Given a mined corpus of behavior embeddings XX, the retrieve(xx) operation uses the posterior assignment probability:

p(zx=k∣e(x),X)∝nk p(e(x)∣Xk)(1)p(z_x=k\mid e(x),X)\propto n_k\,p(e(x)\mid X_k) \tag*{(1)}

where Xk={ei:zi=k}X_k=\{e_i:z_i=k\} and p(e(x)∣Xk)p(e(x)\mid X_k) is the posterior predictive density for component kk. Correspondingly, the unnormalized score for spawning a new component is given by γ p(e(x)∣H)\gamma\,p(e(x)\mid H). Under the NIW prior, the predictive densities are multivariate Student-tt distributions.

Crucially, the posterior of each component depends only on three additive sufficient statistics:

nk=∣{i:zi=k}∣,Sk(1)=∑i:zi=kei,Sk(2)=∑i:zi=keieiT(2)n_k=\left|\{i:z_i=k\}\right|,\qquad S_k^{(1)}=\sum_{i:z_i=k}e_i,\qquad S_k^{(2)}=\sum_{i:z_i=k}e_i e_i^{\mathsf{T}} \tag*{(2)}

Thus, incorporating a newly discovered behavior at test-time requires only incrementing these three values, allowing for online adaptation without needing to refit the full mixture after each observation.

Hierarchical Construction for Cross-Domain Structure

A single DP-GMM fit on a pooled corpus of cross-domain problems and behaviors cannot express the prevalence of components at the domain-specific level. At the same time, fitting independent DP-GMMs per domain can result in redundancy and unnecessary overhead, preventing components from being shared. For instance, a behavior like "use modular arithmetic" could be useful for a number theory problem as well as for periodic boundary conditions in a physics problem.

A Hierarchical Dirichlet Process (HDP) (Teh et al., 2006) addresses this by drawing the atoms {ϕk}\{\phi_k\} once at the global level, and letting each domain draw its own DP over them, with θd,i=(μd,i,Σd,i)\theta_{d,i} = (\mu_{d,i}, \Sigma_{d,i}):

G0∼DP⁡(γ,H),Gd∣G0∼DP⁡(αd,G0),∀d∈D,θd,i∣Gd∼Gd,ed,i∣θd,i∼N(μd,i,Σd,i)\begin{aligned} G_0 &\sim\operatorname{DP}(\gamma, H),\\ G_d \mid G_0 &\sim\operatorname{DP}(\alpha_d, G_0), \quad\forall d \in\mathcal{D},\\ \theta_{d,i} \mid G_d &\sim G_d,\\ e_{d,i} \mid\theta_{d,i} &\sim\mathcal{N}(\mu_{d,i}, \Sigma_{d,i}) \end{aligned}

Thus, the Gaussian parameters ϕk=(μk,Σk)\phi_k = (\mu_k, \Sigma_k) are shared across domains, while the mixing weights πd\pi_d are domain specific. Marginalizing the global and domain-specific random measures yields the Chinese Restaurant Franchise (CRF) representation.

As in the single-domain construction, let zd,i=kz_{d,i} = k denote that behavior (d,i)(d, i) uses the shared atom ϕk\phi_k. Conditional on πd\pi_d, this assignment has probability p(zd,i=k∣πd)=πd,kp(z_{d,i} = k \mid\pi_d) = \pi_{d,k}. We distinguish the local occupancy of component kk in domain dd, nd,k=∣{i:zd,i=k}∣n_{d,k} = \lvert\{i : z_{d,i} = k\}\rvert, from its global occupancy Nk=∑d∈Dnd,kN_k = \sum_{d \in\mathcal{D}} n_{d,k}. The local counts determine the domain-specific mixing weights, whereas the posterior of the shared Gaussian component uses observations pooled across domains. The sufficient statistics Equation (2) generalize by using NkN_k and summing Sk(1)S_k^{(1)} and Sk(2)S_k^{(2)} over every domain.

Posterior Inference via Collapsed Gibbs Sampling

To fit the HDP-GMM, we use a collapsed Gibbs sampler (Neal, 2000) in the CRF representation, leveraging NIW-Gaussian conjugacy in marginalizing out the Gaussian parameters ϕk\phi_k. We also integrate out the random measures, retaining local groups and their mappings to shared global components (Teh et al., 2006). Marginalizing over the local-group choice gives the assignment probability for an existing component:

p(zd,i=k∣⋅)∝(nd,k−i+αdβ^k−i)pk−(d,i)(ed,i),k=1,…,K(3)p(z_{d,i} = k \mid\cdot) \propto\left(n_{d,k}^{-i} + \alpha_d \widehat{\beta}_k^{-i}\right)p_k^{-(d,i)}(e_{d,i}), \qquad k = 1,\ldots,K \tag*{(3)}

Here, nd,k−in_{d,k}^{-i} counts behaviors assigned to component kk within domain dd, β^k−i\widehat{\beta}_k^{-i} is the global predictive mass derived from the group-to-component counts, and pk−(d,i)p_k^{-(d,i)} is the Student-tt posterior predictive computed from behaviors pooled across domains – all excluding observation (d,i)(d, i).

Relative to the single-domain posterior rule (1), the hierarchical structure lets the memory reflect both domain-specific patterns as well as cross-domain reuse. The local count nd,k−in_{d,k}^{-i} concentrates observations onto prevalent components that are already common within domain dd, following the "rich-get-richer" effect associated with DPs. The αdβ^k−i\alpha_d\widehat{\beta}_k^{-i} term allows a domain to draw on components learned across the corpus through the mixing weights. The predictive density weights this by how well the behavior’s embedding fits the component, so assignment depends on both the behavior itself and the frequency of its component. Overall, this allows the memory to share existing reasoning patterns across domains while also accommodating additional components as behaviors accumulate.

A complete step of partially collapsed Gibbs resamples every zd,iz_{d,i} in random order and recomputes both the local counts and the globally pooled sufficient statistics. Offline fitting of the HDP-GMM repeats this procedure for a fixed iteration count. Further mathematical details on the two-level sampling procedure for our collapsed Gibbs sampling process are included in Appendix C.

Test-Time Adaptation

Retrieval via the posterior predictive. In the offline phase, the embedding used is the behavior’s own embedding (applying E\mathcal{E}), and we apply PCA for efficiency in fitting the mixture model (described in Appendix D.2). At inference time, e(x)e(x) is approximated with a small learned projector fθf_{\theta} to map raw query embeddings into the same space (see Appendix § 10). With domain-conditioning, the query’s domain is inferred using a nearest-centroid classifier, where cdc_d is the centroid of domain dd’s data:

dx=d^(x)=arg⁡min⁡d∈Ddist⁡(e(x),cd)d_x = \hat{d}(x) = \arg\min_{d \in\mathcal{D}} \operatorname{dist}(e(x), c_d)

Then retrieve(e(x),Ω)(e(x), \Omega) combines these domain-specific mixture weights with the globally shared component predictives, so domains can share the same components but retrieve them with different probabilities. The normalized weight for each component under the Student-tt posterior predictive is:

wdx,k(e(x))=π^dx,kpk(e(x))∑j=1Kπ^dx,jpj(e(x))(4)w_{d_x,k}(e(x)) = \frac{\hat{\pi}_{d_x,k}p_k(e(x))}{\sum_{j=1}^{K}\hat{\pi}_{d_x,j}p_j(e(x))} \tag*{(4)}

We consider component selection either by taking the top-k′k' components by weight or choosing every component whose weight exceeds a threshold τ\tau. Once components are selected, the medoid element is returned for each component, treated as its representative element.

Online updates and new component creation. After generating a response to query xtx_t, the model mines a new behavior by self-reflection on its reasoning, with embedding ete_t and domain dt=d^(xt)d_t = \hat{d}(x_t). A discrete CRF partition produces the mixing weights, while responsibility-weighted Gaussian statistics determine the online densities; the predictive probability of a new component is:

ρnew(et)=π^dt,newp0(et)π^dt,newp0(et)+∑k=1Kπ^dt,kpk(et)(5)\rho_{\mathrm{new}}(e_t) = \frac{\hat{\pi}_{d_t,\mathrm{new}}p_0(e_t)}{\hat{\pi}_{d_t,\mathrm{new}}p_0(e_t) + \sum_{k=1}^{K}\hat{\pi}_{d_t,k}p_k(e_t)} \tag*{(5)}

Inspired by Kulis & Jordan [27], we use thresholding: if ρnew(et)\rho_{\mathrm{new}}(e_t) exceeds τnew\tau_{\mathrm{new}}, we spawn a new globally shared component, initialize its Gaussian sufficient statistics using ete_t, and create a local group containing this behavior. Otherwise, it is softly added to existing components with wdt,k(et)>10−6w_{d_t,k}(e_t) > 10^{-6}, weighted accordingly. The effective Gaussian sufficient statistics for update(et,Ω)(e_t, \Omega) are:

N~k←N~k+wdt,k(et),S~k(1)←S~k(1)+wdt,k(et)et,S~k(2)←S~k(2)+wdt,k(et)etetT(6)\widetilde{N}_k \leftarrow\widetilde{N}_k + w_{d_t,k}(e_t), \qquad\widetilde{S}^{(1)}_k \leftarrow\widetilde{S}^{(1)}_k + w_{d_t,k}(e_t)e_t, \qquad\widetilde{S}^{(2)}_k \leftarrow\widetilde{S}^{(2)}_k + w_{d_t,k}(e_t)e_te_t^{\mathsf{T}} \tag*{(6)}

We also separately store the hard assignment zt=arg⁡max⁡kwdt,k(et)z_t = \arg\max_k w_{d_t,k}(e_t) and sample its local group assignment conditional on ztz_t, incrementing the local group element count and ndt,ztn_{d_t,z_t}. If a new local group is created, we also increment MztM_{z_t}, the global group count.

Periodic refitting. Every gg samples (the refit interval), we perform refit(Ω)(\Omega) by rebuilding Gaussian statistics from the stored hard assignments and performing a single collapsed Gibbs step over all behaviors, keeping domain labels fixed. We then greedily merge components whose symmetric Gaussian KL-divergence is <ϵ< \epsilon, updating group mappings, counts, and statistics. This allows for reorganization to reconcile drift that may be introduced by performing many soft updates over time.

Results

Experimental Setup

Models. All experiments are performed with the Qwen3-32B (Yang et al., 2025) and Granite-4.2-30B (IBM Granite Team, [20]) language models, with thinking/reasoning modes enabled. Allowing language models to leverage their reasoning abilities to the fullest ensures that retrieved reasoning behaviors from cheatsheets can be reflected in their natural language reasoning traces.

Datasets. We evaluate on three reasoning-intensive benchmarks: AIME’25 (Art of Problem Solving, [3]), Omni-MATH2 (Gao et al., [14]), and PhysReason3 (Zhang et al., 2025), averaged over 3 seeds. Our behavior corpus (existing memory) was mined offline from NuminaMath-CoT (Li et al., 2024) and the Camel Physics (Li et al., 2023) datasets; the respective language model solves each problem and produces a self-reflection of the behaviors that were useful in solving the problem, regardless of the answers’ correctness. The corpus was mined separately for each language model, providing an on-policy reasoning bank. Further details on the behavior corpus are included in Appendix § 10.§ 1.

Baselines. We consider a number of baselines, evaluated both with and without the pre-mined memory, with the key differences being the retrieval and adaptation mechanisms. This includes: 1. random behavior selection of k′k' elements; 2. Metacognitive Reuse Didolkar et al. [11], which involves flat cosine-similarity retrieval over the behavior library (top-k′k') in embedding space; and 3. direct behavior retrieval, performing flat retrieval in the fθf_\theta-projected space rather than embedding space. For the dynamic (test-time adaptation) setting, we consider the Dynamic Cheatsheet Suzgun et al. (2026) method (both DC-Cu and DC-RS), which grows the library as it solves, with up to max_new=3 elements added per sample, and has the ability to rewrite and refine the cheatsheet purely in natural language (as it has a flat structure). We also consider the ACE method Zhang et al. (2026b) which, on top of Dynamic Cheatsheet, introduces iterative refinement through a reflector as well as editing and deduplication. In practice, we use k′=5k' = 5 for all experimental results.

Methods. We evaluate the Bayesian Cheatsheet (BC) as described in § 4, as well as kk-means clustering as introduced in § 3. We also include BC-centroids, which selects the k′k' closest centroids over the HDP-GMM-fitted components, rather than posterior predictive selection. This allows us to isolate the role of 1. structure (these mechanisms against the baselines), 2. adaptation (HDP-GMM vs kk-means), 3. flexible assignment (hard kk-means vs soft kk-means and HDP-GMM), and 4. component selection (posterior predictive vs. nearest-centroid top-k′k'). To bring the kk-means algorithms to a level playing field with the HDP-GMM mechanism, we introduce adaptive versions with online updates for each, along with analogues for the Gibbs refit. Hard kk-means assigns each new behavior to its nearest centroid and updates that centroid, while refitting is just Lloyd reassignment. For soft kk-means (an isotropic generative variant), the online updates fold each new behavior into every cluster with weight above 10−610^{-6}, with the refitting being a responsibility-weighted soft EM procedure. To standardize across methods, we take KK (number of initial clusters for kk-means methods) to be the same number of components yielded in fitting the HDP-GMM, yielding 64 clusters (Qwen), and 62 clusters (Granite) – we include a list of labels for each component in Appendix § 13.§ 1.

Bayesian Cheatsheets Improve Metacognitive Reasoning

Figure 2 and Appendix Table 4 show that BC-PP improves over Metacognitive Reuse by +2.2–5.3 points for Qwen and +1.3–3.2 for Granite across all three benchmarks. While BC-PP generally outperforms BC-centroids (with the exception of AIME’25 and a tie for PhysReason on Granite), the latter outperforms the baselines in nearly all settings. Since these methods have access to the same offline-mined corpus for each respective language model, our gains indicate that memory structure and component selection are vital. Furthermore, the results with BC-PP indicate that there is additional value yielded through the posterior-predictive selection mechanism beyond organizing behaviors into components. Thus, effective reasoning strategy reuse depends not only on the availability of useful behaviors, but also on how the memory makes them accessible for a given query.

Figure 2. Static retrieval with Qwen3-32B using the mined behavior corpus. Bayesian Cheatsheet – specifically, our posterior predictive strategy (BC-PP) – achieves the strongest performance across the board, while our top-k′k' nearest-centroid variant also performs well relative to the baselines.

Bayesian Cheatsheet Enables Online Adaptation

We next evaluate Bayesian Cheatsheet in the online adaptation setting, where we denote it as BC-TTT. As described in § 4.4, we allow for new behaviors to be generated through self-reflection and subsequently either added to existing components or used to seed new components that are spawned.

Our results in Table 1 show that online updates improve Bayesian Cheatsheet over static retrieval across both models and all benchmarks, even without periodic refitting. Our comparison against the kk-means methods (described in § 3) demonstrates that 1) soft assignment can be valuable, as soft kk-means matches or outperforms the hard assignment variant on AIME’25 and PhysReason, and 2) the HDP-GMM structure helps with domain-conditioning in retrieval as well as principled growth in the online setting. Our comparisons against Dynamic Cheatsheet and ACE – methods which also incorporate experience through online memory updates, albeit in a flat structure – are particularly relevant. The gains of BC-TTT over these methods suggest that component-based online adaptation is effective; while allowing the organization of the cheatsheet to adapt based on the novelty of the behaviors encountered can help, it could also have tradeoffs, as seen with Granite slightly degrading on AIME’25 and Omni-MATH, but still continuing to outperform all other methods.

MethodConditionQwen3-32B AIME’25Qwen3-32B OMQwen3-32B PRGranite-4.2-30B AIME’25Granite-4.2-30B OMGranite-4.2-30B PR
Hard kk-meansStatic73.320.318.775.627.018.3
Hard kk-meansOnline, no refit75.624.523.577.828.620.4
Hard kk-meansOnline, with refit74.424.824.876.731.624.6
Soft kk-meansStatic73.321.623.675.628.423.2
Soft kk-meansOnline, no refit75.623.428.578.926.922.0
Soft kk-meansOnline, with refit76.723.129.177.829.827.4
DC-CuStatic73.317.918.174.426.818.1
DC-CuOnline, curation75.621.824.677.828.322.4
DC-CuOnline, with refit––––––
DC-RSStatic75.617.821.777.828.422.6
DC-RSOnline, curation78.921.025.781.130.223.0
DC-RSOnline, with refit––––––
ACEStatic––––––
ACEOnline, curator78.923.226.081.129.325.1
ACEOnline, with refit––––––
BC-TTT (ours)Static77.822.327.080.031.623.9
BC-TTT (ours)Online, no refit81.126.430.185.634.626.8
BC-TTT (ours)Online, with refit82.226.631.384.434.330.7

Table 1. Static prompting vs. online adaptation, with and without periodic refitting (g=50g = 50 for OM and PR, g=10g = 10 for AIME’25), for Qwen3-32B and Granite-4.2-30B. The static version of DC-RS is Metacognitive Reuse (in Table 4). DC-Cu and DC-RS involve "curation" where the cheatsheet can be refined (does not have a separate refit), while ACE similarly uses a curator for adaptation and does not have a static equivalent. We denote these entries with a "–". Bayesian Cheatsheet (BC-TTT) improves over existing methods across models and benchmarks, both with and without refit.

Periodic Refitting of Components. We quantify how much a refit changes the behavior-component assignment with a maximum-overlap bipartite matching. Let ℓbefore,ℓafter\ell_{\mathrm{before}}, \ell_{\mathrm{after}} be the cluster labels assigned to the nn accumulated points immediately before and after a refit (which may consist of different label sets and active label counts). Consider the contingency table:

M[b,a]=∣{i∈[n]:ℓbefore(i)=b, ℓafter(i)=a}∣(7)M[b,a] = \left|\{i \in[n] : \ell_{\mathrm{before}}(i) = b,\ \ell_{\mathrm{after}}(i) = a\}\right| \tag*{(7)}

We want to find the label correspondence maximizing total overlap over one-to-one matchings σ\sigma:

σ∗=arg max⁡σ ∑bM[b,σ(b)](8)\sigma^* = \underset{\sigma}{\operatorname{arg\,max}}\ \sum_b M[b,\sigma(b)] \tag*{(8)}

This is an assignment problem, which is solvable with the Hungarian algorithm. A point is counted as a reassignment only if its label in ℓafter\ell_{\mathrm{after}} differs from the matched image of its label in ℓbefore\ell_{\mathrm{before}}. A pure relabeling should receive zero churn, and we are only counting the points that change clusters:

churn⁡=1n∑i=1n1[ℓafter(i)≠σ∗(ℓbefore(i))](9)\operatorname{churn} = \frac{1}{n}\sum_{i=1}^{n} \mathbf{1}\left[\ell_{\mathrm{after}}(i) \ne\sigma^*(\ell_{\mathrm{before}}(i))\right] \tag*{(9)}

Figure 3 shows that Bayesian Cheatsheet’s assignment churn remains near 4% across refits on PhysReason-mini. At the third refit, churn is 3.98%, compared to 12.31% for hard kk-means and 11.19% for soft kk-means. The gap becomes wider over the refit rounds, as both kk-means methods have increasingly larger changes in component membership. As a result, this indicates that Bayesian Cheatsheet’s online updates preserve more of the existing organization through refitting while component parameters and domain-specific weights still evolve as new behaviors are incorporated. Thus, churn is a measure of the stability of memory’s organization, and while BC is still subject to changing through online adaptation, it is quite stable.

Assignment churn for Bayesian Cheatsheet, hard k-means, and soft k-means

Figure 3. Assignment churn (Qwen3-32B) on PhysReason-mini; refits every 10 queries.

Cold-Start Memory Accumulation. Thus far, we have considered the setting where an offline-mined behavior corpus is available to the language model as memory in metacognitive reasoning. What if the language model were instead given a blank slate and tasked with learning the cheatsheet on-the-fly, purely through self-reflection? We evaluate our method (an empty memory initialized with an NIW prior) as well as ACE and DC-Cu (in their cold-start constructions), to determine whether Bayesian Cheatsheet is dependent on a warm-started memory module.

Our findings in Table 2 with Omni-MATH and PhysReason show that even without an offline-mined corpus, Bayesian Cheatsheet outperforms cold-start baselines for both language models and clearly improves over the memory-free setting. PhysReason seems particularly difficult to improve on in the cold-start setting (DC-Cu regresses), suggesting that physics benefits from more extensive guidance; nonetheless, BC-TTT still achieves gains. This demonstrates that Bayesian Cheatsheet can construct useful behavior memory purely from test-time experience, aided by its dynamic reorganization capabilities with periodic refitting, achieving effective adaptation to new data.

MethodQwen3-32BGranite-4.2-30B
OMPROMPR
Base model (no memory)18.116.424.816.4
DC-Cu, cold-start22.515.925.515.3
ACE, cold-start21.017.727.916.4
BC-TTT, cold-start (ours)24.120.531.918.1

Table 2. Accuracy on Omni-MATH (n=916n = 916) and PhysReason (n=226n = 226) with no pre-mined behavior corpus. Memory-based methods start from an empty memory and accumulate behaviors through self-reflection at test time. Bayesian Cheatsheets use a periodic refit interval of g=50g = 50.

Discussion

We introduce the Bayesian Cheatsheet, a structured memory module for language models which uses Dirichlet Process Gaussian Mixture Models for component structure. We leverage this mechanism to organize reasoning strategies for inference-time retrieval, and demonstrate that this mechanism exhibits desirable properties in continual test-time adaptation while achieving clear gains in performance across reasoning benchmarks. Bayesian Cheatsheets offer a potential mechanism for offline domain adaptation through their hierarchical design; new behaviors and mixing weights can be learned for unseen domains, while also inferring shared cross-domain structure. In this work, we focus on single-turn problem solving with small-to-medium-size non-agentic language models (≈30B\approx30B parameters); while agentic and multi-turn benchmarks are currently beyond our scope, they offer practical potential for iterative retrieval from the Bayesian Cheatsheet. Furthermore, the refitting and retrieval costs eventually grow over indefinitely long evaluation streams, suggesting the need for principled discarding mechanisms to selectively retain behaviors. Overall, our findings highlight the potential for Bayesian-inspired methods to yield value for test-time adaptation of language models, given the setting’s analogues to online learning, offering an effective, statistically-grounded mechanism.

Additional Related Work

LLM reasoning methods. In-context learning provides language models with the ability to infer a task based on demonstrations, without updating their parameters [7], a behavior that has an implicit Bayesian interpretation (Xie et al., 2022). Reasoning-oriented prompting makes intermediate computations available in natural language in the context through scratchpads (Nye et al., 2021) and chain-of-thought (Wei et al., 2022), which enables approaches that decompose problems into simpler subproblems (Zhou et al., 2023), aggregate multiple reasoning paths through self-consistency (Wang et al., 2023), or search over alternative intermediate steps (Yao et al., 2023).

Self-reflection extends this notion by allowing models to critique and revise their own solutions. Self-Refine alternates between generation, feedback, and revision (Madaan et al., 2023), while Reflexion retains verbal feedback in episodic memory for subsequent attempts (Shinn et al., 2023). Related work on metacognition studies whether models can extract generalizable lessons from problem solving [10], although some evaluations of intrinsic self-correction show that revisions can fail to improve reasoning without external feedback [18]. These behaviors can also be learned through training, as in STaR’s fine-tuning on self-generated rationales that lead to correct answers (Zelikman et al., 2022), training to self-correct (Kumar et al., 2024; Ramji et al., 2025), and Experiential Reinforcement Learning’s use of feedback-guided revisions (Shi et al., 2026).

Bayesian modeling for natural language. Bayesian nonparametric models have been used in language tasks to learn latent structures where size is not fixed a priori, ranging from word segmentation [15] to the reusable grammar subtrees of adaptor grammars [22]. The hierarchical Dirichlet process (Teh et al., 2006) is particularly useful in topic modeling, allowing for topics to be shared across documents while having document-specific proportions, while hierarchical Pitman–Yor language models (Teh, 2006) are useful for different-length contexts. Related hierarchical sharing appears in domain adaptation, where Finkel & Manning (2009) link domain-specific model parameters through a shared Gaussian prior, which balances cross-domain guidance with domain-specific observations. For continuous representations, Gaussian LDA [9] models word embeddings with Gaussian topic distributions with a fixed topic inventory. By contrast, infinite Gaussian mixtures, as introduced in (Rasmussen, 2000), should allow the number of occupied components to grow with the data. Bayesian inference has also been used with modern language models in uncertainty quantification and guided generation. Laplace-LoRA approximates a posterior over adaptation parameters for improved calibration (Yang et al., 2024a), while Hu et al. (2024) use amortized posterior inference for constrained generation and implicit reasoning.

Test-time adaptation and continual learning (continued). SEAL (Zweiger et al., 2025) learns to generate synthetic training data and the updates to adapt the language model (i.e. learning how to adapt itself). In architectures such as Titans [6] and ATLAS [5], adaptation instead takes place through a neural memory that learns from the incoming context. For agents, AutoHarness (Lou et al., 2026) uses environment feedback to synthesize and refine code that constrains an LLM’s actions, while Hyperagents (Zhang et al., 2026a) make both the task-solving program and the procedure for modifying it editable. Harness Continual Learning [23] treats prompts, memory, skills, and routing as a persistent, jointly updated state, evaluating candidate changes to improve on the current task while retaining earlier capabilities before deployment.

Memory and retrieval-augmented reasoning with LLMs (continued). Nonparametric retrieval allows for new information to be incorporated without retraining the language model; nearest-neighbor language models can do this by changing the retrieval datastore [24]. Hierarchical retrieval methods organize information at multiple levels of abstraction: for example, RAPTOR recursively clusters and summarizes document passages into a retrieval tree (Sarthi et al., 2024), while MemTree incrementally builds a hierarchy of semantic summaries as observations arrive (Rezazadeh et al., 2024). Buffer of Thoughts maintains reusable thought templates as procedural memory (Yang et al., 2024b), and Memp distills trajectories into both detailed instructions and higher-level abstractions that can be revised over time with experience [12]. In MemRL, the utility of stored experiences is learned from feedback, so that retrieval accounts for their usefulness (Zhang et al., 2026c). In ALMA, memory organization is a learned goal, where executable designs specifying what to store, how to retrieve, and how to update (the three key operations we defined in § 3) are searched over (Xiong et al., 2026).

Bayesian Cheatsheet Algorithm

The memory (modeled by Ω\Omega) stores records of behaviors and their embeddings, as well as domain, component, and local group assignments, local and global CRF counts, Gaussian sufficient statistics, and the medoid elements for retrieval.

Algorithm 1 Bayesian Cheatsheet for Test-Time Adaptation (with periodic refitting)

Require: Initial memory Ω0\Omega_0, NIW prior HH, concentrations γ\gamma, {αd}\{\alpha_d\}, queries x1:Tx_{1:T} Require: Retrieval budget k′k', novelty threshold τnew\tau_{\mathrm{new}}, refit interval gg (or disabled), merge threshold ϵ\epsilon

  1. Set Ω←Ω0\Omega\leftarrow\Omega_0; compute component predictives, CRF weights, and medoids

  2. for t=1,2,…,Tt = 1, 2, \ldots, T do

  3. Embed query as e(xt)e(x_t) and infer dt=d^(xt)d_t = \hat d(x_t); use the sole domain in cold start

  4. Set the retrieved behavior set Rt←∅R_t \leftarrow\varnothing

  5. if memory is nonempty then

  6. Select up to k′k' highest-weight components via wdt,k(e(xt))w_{d_t,k}(e(x_t)) (Eq. (4))

  7. Set RtR_t to one medoid behavior per selected component

  8. end if

  9. Generate the response using RtR_t, then mine a behavior btb_t and compute its embedding ete_t

  10. Set ρnew(et)=1\rho_{\mathrm{new}}(e_t) = 1 if memory is empty; otherwise evaluate Eq. (5) on the current memory

  11. if memory is empty or ρnew(et)>τnew\rho_{\mathrm{new}}(e_t) > \tau_{\mathrm{new}} then

  12. Create a global component ztz_t with zero CRF counts; set ℓt←\ell_t \leftarrow new

  13. (N~zt,S~zt(1),S~zt(2))←(1,et,etetT)(\widetilde N_{z_t}, \widetilde S^{(1)}_{z_t}, \widetilde S^{(2)}_{z_t}) \leftarrow(1, e_t, e_t e_t^{\mathsf T})

  14. else

  15. Cache wdt,k(et)w_{d_t,k}(e_t) for all existing kk using Eq. (4), before changing Ω\Omega

  16. for each kk with wdt,k(et)>10−6w_{d_t,k}(e_t) > 10^{-6} do

  17. (N~k,S~k(1),S~k(2))←(N~k,S~k(1),S~k(2))+wdt,k(et)(1,et,etetT)(\widetilde N_k, \widetilde S^{(1)}_k, \widetilde S^{(2)}_k) \leftarrow(\widetilde N_k, \widetilde S^{(1)}_k, \widetilde S^{(2)}_k) + w_{d_t,k}(e_t)(1, e_t, e_t e_t^{\mathsf T})

  18. end for

  19. Set zt←arg max⁡kwdt,k(et)z_t \leftarrow\operatorname{arg\,max}_k w_{d_t,k}(e_t) using the cached weights

  20. Assign weight ndt,ℓn_{d_t,\ell} to each local group ℓ\ell in dtd_t mapped to ztz_t

  21. Include a new group with weight αdtβzt\alpha_{d_t}\beta_{z_t}; normalize and sample ℓt\ell_t

  22. end if

  23. if ℓt=\ell_t = new then

  24. Create an empty local group ℓt\ell_t mapped to ztz_t; increment mdt,ztm_{d_t,z_t} and MztM_{z_t}

  25. end if

  26. Increment integer occupancies ndt,ℓtn_{d_t,\ell_t} and ndt,ztn_{d_t,z_t}; store (bt,dt,et,zt,ℓt)(b_t, d_t, e_t, z_t, \ell_t) once

  27. if refitting enabled and t mod g=0t \bmod g = 0 then

  28. Rebuild Gaussian statistics from all stored hard assignments and refresh NIW predictives

  29. Run one random-order collapsed Gibbs step with fixed domains (Appendix C)

  30. Greedily merge pairs with symmetric Gaussian KL <ϵ< \epsilon; update Ω\Omega and predictives at each merge

  31. end if

  32. Refresh NIW predictives, all CRF mixing weights (Appendix C), and medoids

  33. end for

Collapsed Gibbs Sampling

This section expands on the collapsed Gibbs sampler in § 4.3, which organizes behavior embeddings into shared components while preserving domain-specific use patterns. We first obtain each component’s posterior predictive from its pooled sufficient statistics, then describe the CRF assignment updates and the resulting domain-specific retrieval weights.

Given the global sufficient statistics for component kk, the posterior over ϕk\phi_k is NIW⁡(μk′,κk′,Ψk′,νk′)\operatorname{NIW}(\mu'_k, \kappa'_k, \Psi'_k, \nu'_k):

κk′=κ0+Nk,νk′=ν0+Nk,\kappa'_k = \kappa_0 + N_k, \qquad\nu'_k = \nu_0 + N_k,
μk′=κ0μ0+Sk(1)κk′,Ψk′=Ψ0+(Sk(2)−NkeˉkeˉkT)+κ0Nkκk′(eˉk−μ0)(eˉk−μ0)T\mu'_k = \frac{\kappa_0\mu_0 + S^{(1)}_k}{\kappa'_k}, \qquad\Psi'_k = \Psi_0 + \left(S^{(2)}_k - N_k\bar e_k\bar e_k^{\mathsf T}\right) + \frac{\kappa_0N_k}{\kappa'_k}(\bar e_k-\mu_0)(\bar e_k-\mu_0)^{\mathsf T}

Here, eˉk=sk(1)Nk\bar{e}_k = \frac{s_k^{(1)}}{N_k} for Nk>0N_k > 0. Integrating ϕk\phi_k out of the Gaussian likelihood gives a multivariate Student-tt posterior predictive:

pk(e)≡p(e∣Xk)=tνk′−D+1(e | μk′,κk′+1κk′(νk′−D+1)Ψk′)(10)p_k(e) \equiv p(e \mid X_k) = t_{\nu'_k-D+1}\left(e \,\middle|\, \mu'_k, \frac{\kappa'_k+1}{\kappa'_k(\nu'_k-D+1)}\Psi'_k\right) \tag*{(10)}

For an empty component, the sufficient statistics are zero, so the posterior parameters reduce to (μ0,κ0,Ψ0,ν0)(\mu_0,\kappa_0,\Psi_0,\nu_0). Then, integrating over this NIW prior yields the prior predictive, which we denote p0(e)=p(e∣H)p_0(e) = p(e \mid H).

When resampling observation (d,i)(d,i), we use a two-level assignment/partition structure based on Teh et al. (2006). We maintain an auxiliary partition of the behavior observations within each domain dd into local groups, each of which is mapped to a global component, of which there are KK total. Multiple groups may map to the same component, inducing component-sharing across domains. Let ℓd,i\ell_{d,i} denote the local-group assignment for sample (d,i)(d,i), so nd,ℓ−in_{d,\ell}^{-i} is the count of behaviors already in group ℓ\ell excluding (d,i)(d,i), kℓk_\ell is the component that group ℓ\ell maps to, and Mk−i=∑d′∈Dmd′,k−iM_k^{-i} = \sum_{d'\in\mathcal{D}}m_{d',k}^{-i} is the total number of groups across all domains mapped to component kk, excluding (d,i)(d,i).

A first categorical draw is done to assign ℓd,i\ell_{d,i} over the set of existing local groups as well as a potential new group.

p(ℓd,i=ℓ∣⋅)∝{nd,ℓ−ipkℓ−(d,i)(ed,i),ℓ is an existing local groupαdγ+∑j=1KMj−i(∑k=1KMk−ipk−(d,i)(ed,i)+γp0(ed,i)),ℓ=new(11)p(\ell_{d,i}=\ell\mid\cdot)\propto \begin{cases} n_{d,\ell}^{-i}p_{k_\ell}^{-(d,i)}(e_{d,i}), & \ell\text{ is an existing local group}\\ \frac{\alpha_d}{\gamma+\sum_{j=1}^{K}M_j^{-i}}\left(\sum_{k=1}^{K}M_k^{-i}p_k^{-(d,i)}(e_{d,i})+\gamma p_0(e_{d,i})\right), & \ell=\text{new} \end{cases} \tag*{(11)}

Marginalizing over local group choice gives the equivalent component-level assignment score, for β^k−i=Mk−iγ+∑j=1KMj−i\hat{\beta}_k^{-i}=\frac{M_k^{-i}}{\gamma+\sum_{j=1}^{K}M_j^{-i}}:

p(zd,i=k∣⋅)∝(nd,k−i+αdβ^k−i)pk−(d,i)(ed,i),p(z_{d,i}=k\mid\cdot)\propto\left(n_{d,k}^{-i}+\alpha_d\hat{\beta}_k^{-i}\right)p_k^{-(d,i)}(e_{d,i}),

If a new group is spawned, we next sample the component this new group maps to, setting zd,iz_{d,i}:

p(zd,i=k∣ℓd,i=new,⋅)∝{Mk−ipk−(d,i)(ed,i),k=1,…,K (existing)γp0(ed,i),k=new(12)p(z_{d,i}=k\mid\ell_{d,i}=\text{new},\cdot)\propto \begin{cases} M_k^{-i}p_k^{-(d,i)}(e_{d,i}), & k=1,\ldots,K\ \text{(existing)}\\ \gamma p_0(e_{d,i}), & k=\text{new} \end{cases} \tag*{(12)}

The mixing weights used in retrieval are estimates derived from the group-to-component mapping counts, which are posterior means under the partition structure:

β^k=Mkγ+∑j=1KMj,β^new=γγ+∑j=1KMj,\hat{\beta}_k=\frac{M_k}{\gamma+\sum_{j=1}^{K}M_j},\qquad \hat{\beta}_{\mathrm{new}}=\frac{\gamma}{\gamma+\sum_{j=1}^{K}M_j},
π^d,k=nd,k+αdβ^kαd+∑j=1Knd,j,π^d,new=αdβ^newαd+∑j=1Knd,j.\hat{\pi}_{d,k}=\frac{n_{d,k}+\alpha_d\hat{\beta}_k}{\alpha_d+\sum_{j=1}^{K}n_{d,j}},\qquad \hat{\pi}_{d,\mathrm{new}}=\frac{\alpha_d\hat{\beta}_{\mathrm{new}}}{\alpha_d+\sum_{j=1}^{K}n_{d,j}}.

Implementation and Reproducibility

Behavior Mining Procedure and Corpus

We construct a separate behavior corpus for each language model, Qwen3-32B and Granite-4.2-30B, using the same model for behavior mining and evaluation (i.e. the behaviors are on-policy for the respective model). We randomly sampled 20,000 mathematics prompts from NuminaMath-CoT (Li et al. (2024)) and 20,000 physics prompts from Camel Physics (Li et al. (2023)).

Mining follows a three-stage metacognitive procedure, inspired by Didolkar et al. [11]. First, the model solves each problem by generating a chain-of-thought solution. It then reflects on the solution, assessing its correctness and identifying missing or reusable reasoning behaviors. Finally, it extracts these behaviors as structured {name: description} records. Extraction is performed regardless of whether the generated answer is correct or not. The extraction prompt instructs the model to replace problem-specific numerical values with symbolic placeholders, so that the descriptions are generalizable and transferable strategies are expressed.

After extraction is performed over the full prompt set, we deduplicate behavior records based on exact match of their labels (the name field). The resulting Qwen corpus contains 57,955 mathematics behaviors and 75,324 physics behaviors, while the Granite corpus contains 26,305 mathematics behaviors and 15,839 physics behaviors; the difference reflects this deduplication step. In warm-started comparisons for a given language model, all memory-based methods use the same model-specific corpus, for standardized comparison.

We embed behavior descriptions using granite-embedding-english-r2 (Awasthy et al. [4]) and fit a separate PCA transform on each model’s mined corpus, reducing the embeddings to D=128D = 128 dimensions. Each of these PCA transforms is held fixed during fitting of the mixture as well as test-time adaptation.

Mixture Hyperparameters

We fit a separate HDP-GMM for each model’s corpus using the configuration detailed in Table 3, using the Gibbs sampling procedure described in § 4.3 and Appendix § 9. The resulting fitted mixtures contain 64 components for Qwen and 62 for Granite, without setting any fixed component numbers a priori. The prior scale Ψ0\Psi_0 is set relative to the empirical covariance of the projected behavior embeddings. The main results use explicit domain conditioning (described in § 4.4), where the projected query is assigned to its nearest domain centroid, and retrieval combines the mixture weights for that domain with the shared component predictive densities. In both the static and the online settings (Tables 4 and Table 1), we use the top-k′=5k^{\prime} = 5 components based on normalized weights.

ParameterValue
Global concentration γ\gamma5.0
Domain concentration αd\alpha_d1.0
NIW scale Ψ0\Psi_01.2×1.2 \times empirical covariance in PCA space
NIW degrees of freedom ν0\nu_0D+2=130D + 2 = 130
NIW mean strength κ0\kappa_00.01
Projection dimension DD128
Offline Gibbs steps / burn-in100 / 50
Novelty threshold τnew\tau_{\mathrm{new}}0.5
Symmetric KL merge threshold ϵ\epsilon0.1
Refit interval gg10 (AIME’25, PhysReason-mini); 50 (Omni-MATH, PhysReason-full)
Retrieval (static and online)Top-k′=5k^{\prime} = 5
Domain conditioningNearest-centroid classifier (explicit)

Table 3. Hyperparameters for HDP-GMM fitting and retrieval, as well as the refit window. The refit settings only apply to the settings where periodic refitting is used.

Learning the Query Projector (fθf_\theta)

The learned query projector fθf_\theta maps the problem’s embedding into the (PCA-transformed) space in which the behavior mixture was fitted. We use a multilayer perceptron with two hidden layers (width=[512, 256]) and a 128-dimensional output. The training data of (query, behavior) pairs comes from the mining procedure in Appendix § 10.§ 1; for a pair (x,b)(x,b), let q(x)=E(x)q(x) = \mathcal{E}(x) be the raw query embedding and let ub=PCA⁡(E(b))u_b = \operatorname{PCA}(\mathcal{E}(b)) be the projected behavior embedding.

Because downstream retrieval evaluates a Student-tt posterior predictive density under the fitted mixture, which depends on the scale of fθ(q(x))f_\theta(q(x)) relative to each component, we train fθf_\theta with a mean squared error objective over the training pairs T\mathcal{T} to train its output to match the coordinates and scale of the behavior embeddings:

L(θ)=1∣T∣∑(x,b)∈T∥fθ(q(x))−ub∥22\mathcal{L}(\theta) = \frac{1}{|\mathcal{T}|} \sum_{(x,b)\in\mathcal{T}} \lVert f_\theta(q(x)) - u_b \rVert_2^2

We learn such a projector for the respective language models, so one each for Qwen and Granite, ensuring that projected queries and the stored behavior embeddings are expressed in a shared space. Our training is performed with AdamW for 10 epochs with a batch size of 256, learning rate of 1×10−41 \times10^{-4}, and weight decay of 10−410^{-4}. The resulting projector fθf_\theta, which is just 0.56MM parameters, is held fixed during evaluation, with minimal overhead.

Cold-Start Setting and Evaluation

In the cold-start setting, we no longer provide the language model with access to offline-mined behaviors, and we do not have fθf_\theta. This means that we directly operate in the raw embedding dimension (768), but since Gibbs steps occur over a smaller corpus (fewer behaviors are mined over the test set compared to the offline mining setting), this remains computationally feasible. Since there is no empirical covariance to work from or PCA performed, we set Ψ0=I768\Psi_0 = I_{768}, and ν0=D+2=770\nu_0 = D+2 = 770. Domain-conditioning does not arise since we treat the samples in a test set as belonging to a single domain, so this is analogous to the non-hierarchical construction.

For evaluation (in both the cold-start setting as well as with the offline-mined memory), all models are given a thinking budget of 64k tokens, and generations are sampled with temperature 0.7. For both settings, memory is reset following each evaluation run – for the cold-start setting, this ensures every benchmark is run without memory, while for the offline-mined memory setting, we revert back to the "pre-trained" mixture fit on the offline behavior corpus.

Complete Baseline Results

We include the full static-retrieval results against the baselines in Table 4, complementing the results with Qwen3-32B in Figure 2. We find that with Granite-4.2-30B, Bayesian Cheatsheet outperforms the baselines again across the benchmarks, with the BC-centroids variant performing comparably to BC-PP, our main method using the posterior predictive; BC-centroids outperforms BC-PP on AIME’25, while BC-PP is better on Omni-MATH, and they are tied on PhysReason.

Table 4: Static-retrieval results using the mined behavior corpus for Qwen3-32B and Granite-4.2-30B. OM and PR denote Omni-MATH and PhysReason, respectively. Bold and underlined values indicate the best and second-best results within each model and benchmark.

MethodQwen3-32BGranite-4.2-30B
AIME’25OMPRAIME’25OMPR
Base model71.118.116.473.324.816.4
Random behavior selection72.218.918.673.327.516.4
Direct behavior retrieval72.218.623.574.428.219.5
Metacognitive Reuse, k′=5k^\prime= 575.617.821.777.828.422.6
BC-centroids74.420.524.881.129.123.9
BC-PP (ours)77.822.327.080.031.623.9

Ablations

The ablations below use the Qwen3-32B language model, and consider different parts of our inference and online update procedure.

Top-k′k^\prime Retrieval

In Table 5, we perform a sweep over the number of retrieved components (k′k^\prime) used in static retrieval with BC-PP (corresponding to Table 4). Since we draw the medoid element from each component, k′k' is also the number of behaviors added to the prompt for metacognitive reasoning. We hold all other hyperparameters fixed. We adopt k′=5k' = 5, which generally performs the best across the board. Notably, relative to the baselines in Table 4, BC-PP with k′=3k' = 3 would also outperform every baseline across the three benchmarks for Qwen3-32B.

k′k'AIME’25Omni-MATHPhysReason
172.219.524.8
276.720.224.8
376.722.525.2
577.822.327.0

Table 5. Effect of the retrieval size k′k' (number of components) on static BC-PP accuracy.

Figure 4. Static BC-PP accuracy versus retrieval size k′k' for Qwen3-32B.

Refit Interval Sweep

For the online setting with refitting, we sweep the refit interval on Omni-MATH (n=916n = 916), while holding k′=5k' = 5 and the novelty threshold as well as the inference recipe (including domain conditioning) constant, and report the performance. We explore a wide range of values including g=0g = 0 (no refits, but new components may still be spawned) for comparison.

There are two ways that the component count can increase: 1) a new component is spawned through the novelty-driven trigger specified in § 4.4, and 2) a new component is formed during collapsed Gibbs resampling (refit step), so a new component effectively "splits" out of an existing one. In Table 6, we report both the total number of new components compared to the offline-fit state of the HDP-GMM (K=64K = 64 for Qwen3-32B) as well as the subset of novelty-induced new components.

ggAccuracyKfinalK_{\mathrm{final}}Net increaseNovelty-triggered
026.4761212
524.894305
1025.286224
2525.285214
5026.6852111
7526.4852114
10025.3791511
25025.97397
50025.9751110

Table 6. Effect of the refit interval gg on online Qwen3-32B accuracy on Omni-MATH. KK is the final component count (initial is 64), “net increase” is the net change in the number of components over the run, and “novelty” denotes the subset of those new components that were novelty-triggered.

We observe that when refits are more aggressively performed (at small values of gg), the proportion of novelty-triggered new components to the total new components is much smaller. This suggests that most new components emerge due to the stochastic nature of the collapsed Gibbs sampling procedure, which is performed more often. As the refit interval increases, the majority of the new components are due to novelty identified over the test set pass. Based on having the highest performance and a near-even balance of novelty-triggered components and Gibbs-induced splits, we take g=50g = 50 for the results with refitting in Table 1 and Table 2. We note that other values of gg also perform comparably: in fact, every value of gg tested here would at least match or outperform the strongest performing baseline for Omni-MATH in Table 1. The g=10g = 10 value is used for AIME’25 and PhysReason-mini since a single pass over the test set only contains 30 and 31 samples, respectively.

Hierarchical Structure and Domain-Conditioned Retrieval

The inclusion of the hierarchical structure allows for domain-conditioning in retrieval through the mixture weights, permitting both cross-domain behavior sharing and potential offline domain adaptation. Does it actually make a difference in downstream performance, compared to a flat, domain-pooled DP-GMM structure? We compare the results in Table 7, finding that the hierarchical structure does noticeably improve performance on all three benchmarks, suggesting that explicit domain-conditioning is indeed helpful.

Mixture structureConditionAIME’25Omni-MATHPhysReason
HDP-GMM (hierarchical)Online, no refit81.126.430.1
DP-GMM (pooled)Online, no refit76.724.027.3

Table 7.

Table 7: Hierarchical (HDP-GMM) vs. flat, domain-pooled (DP-GMM) mixture structure for Qwen3-32B in the online setting without refitting (all other mechanisms and hyperparameters are held fixed). The hierarchical structure clearly improves performance on all three benchmarks.

Component Creation and Merging

We also consider the protocols for new component creation, as well as consolidation, in the online test-time training setting. As described in § 4.4 (Eq. (5)), if ρnew(et)>τnew\rho_{\mathrm{new}}(e_t) > \tau_{\mathrm{new}}, we instantiate a new component – this is analogous to deterministic cluster creation used in DP-means ([27]). We alternatively consider a sampling scheme where we draw a Bernoulli(ρnew(et)\rho_{\mathrm{new}}(e_t)) variable at each step and instantiate a new component when it takes the value 1. This procedure is faithful to the component-birth mechanism in the CRP, treating ρnew(et)\rho_{\mathrm{new}}(e_t) as a probability to be sampled. We also ablate the inclusion of the ability to merge a pair of components together where symmetric Gaussian KL <ϵ< \epsilon, during the refitting stage.

We report the results in Table 8, with all experiments involving periodic refitting (g=50g = 50). We find that the current configuration with thresholding and KL-based merging together performs slightly better, but the combination of Bernoulli sampling without the heuristic merge also is quite effective, and would outperform all baselines in Table 1.

ConfigurationOmni-MATH
Threshold, KL-merge26.6
Sampling, KL-merge26.0
Threshold, no KL-merge25.9
Sampling, no KL-merge26.2

Table 8.

Table 8: Performance on Omni-MATH under four combinations of new-component creation mechanism (threshold vs. sampling) and KL-based component consolidation (with vs. without). All experiments involve periodic refitting (g=50g = 50).

We also report the number of final components, the net increase, and the breakdown of how those components were introduced, consistent with Table 6. These statistics (specifically for Omni-MATH evaluations) can be found in Table 9 and Table 10. The former analyzes the setting without refitting (g=0g = 0), to isolate the increase in components, as they cannot be created through running a step of collapsed Gibbs sampling. For “threshold”, all new components are novelty-triggered, while for “sampling”, they are introduced through the Bernoulli draw. The latter includes refitting (g=50g = 50), reflecting these statistics for the same experiments whose benchmark performances are in Table 8.

ProtocolKfinalK_{\mathrm{final}}Net increase
Threshold76+12 (novelty-triggered)
Sampling138+74 (Bernoulli-triggered)

Table 9. Component count and change on Omni-MATH without periodic refitting (g=0g = 0), comparing threshold vs. sampling-based component creation mechanisms. All component births are dependent on the component creation mechanism.

ConfigurationKfinalK_{\mathrm{final}}Net increaseOnline-spawnedRefit-triggered (Net)
Threshold, KL-merge85+211110
Sampling, KL-merge129+6569−4
Threshold, no KL-merge82+18216
Sampling, no KL-merge130+6668−2

Table 10. Component counts and changes on Omni-MATH with periodic refitting (g=50g = 50), comparing threshold vs. sampling-based component creation mechanisms.

Table 9: Component count and change on Omni-MATH without periodic refitting (g=0g = 0), comparing threshold vs. sampling-based component creation mechanisms. All component births are dependent on the component creation mechanism.

Table 10: Component counts and changes on Omni-MATH with periodic refitting (g=50g = 50), comparing threshold vs. sampling-based component creation mechanisms.

We find that the Bernoulli-based sampling procedure spawns many more components than the threshold-based method, both in isolation (g=0g = 0) and with refitting. Notably, while the final number of components decreases slightly without KL-merge in the thresholding method, there are fewer (2, compared to 11) novelty-triggered component births. Thus, merging results in a higher novelty score for subsequent points by way of condensing coverage, which leads to new components being created through the τnew\tau_{\mathrm{new}} threshold. Even without the KL-based component merging, the Gibbs refit serves to collapse some of the components; with more components being created in the sampling variant, refit actually contributes a net decrease in components created.

Novelty Threshold

Our main experiments use τnew=0.5\tau_{\mathrm{new}} = 0.5; we ablate the value of τnew\tau_{\mathrm{new}} in Table 11. We find that for small values of τnew\tau_{\mathrm{new}}, the novelty score consistently exceeds the threshold, aggressively creating new components (212) that need to be pruned through the periodic Gibbs sweep. We find that this likely leads to noise in retrieval, noticeably hurting performance. As we increase it, we achieve a mix of novelty-triggered and refit-induced component births at 0.5, while increasing it to 0.7 results in novelty scores being too low to spawn new components, so all births are purely through the periodic refitting. Performance generally stabilizes, while peaking at τnew=0.5\tau_{\mathrm{new}} = 0.5; given it also balances novelty-based spawning with refit-based creation, we retain this for our main recipe.

τnew\tau_{\mathrm{new}}AccuracyKfinalK_{\mathrm{final}}Net increaseNovelty-triggeredRefit-triggered (Net)
0.124.3206+142212−70
0.326.0127+6365−2
0.526.685+2111+10
0.726.184+200+20
0.926.083+190+19

Table 11. Comparing the impact of the novelty threshold on Omni-MATH performance and component growth; all experiments use the main configuration (threshold-based component creation, refitting with g=50g = 50, and KL-based component merging during refitting).

Table 11: Comparing the impact of the novelty threshold on Omni-MATH performance and component growth; all experiments use the main configuration (threshold-based component creation, refitting with g=50g = 50, and KL-based component merging during refitting).

Qualitative Examples

Component Meta-Labels

To analyze the components generated by fitting the HDP-GMM and the structure it induces (in terms of common thematic areas), we study whether generalizable meta-labels can be produced for each component. Specifically, we utilize Claude Opus 5 to produce a label given the list of behaviors assigned to a given component: the results for Qwen (Table 12) and Granite (Table 13) are below.

#DomainLabel
0MathUnit consistency & dimensional-analysis checks
1PhysicsMulti-method cross-checks & literature verification
2MathSolution verification & domain-restriction checks
3PhysicsCosmology & dark-matter physics
4MathSymmetry-based algebraic simplification
5PhysicsApplied materials & optics engineering formulas
6PhysicsFluid dynamics & flow-stability analysis
7MathAlgebraic equation-solving techniques
8PhysicsParticle-physics conservation laws & decay formulas
9PhysicsEmpirical calibration & uncertainty propagation
10MathAlgebraic simplification & symbolic manipulation
11MathMulti-step problem decomposition & dependency tracking
12MathPolynomial/rational-expression factoring & proportionality
13PhysicsDynamical-systems stability & boundary-case verification
14MathEuclidean geometry theorems & area formulas
15PhysicsNuclear astrophysics & stellar nucleosynthesis
16PhysicsCondensed-matter magnetism & superconductivity
17MathCoordinate systems, symmetry & 3D rotations
18PhysicsConservation laws & flow/capacity analysis
19MathGraph-theoretic counting & distribution symmetry
20PhysicsEstimation, decomposition & bounding heuristics
21MathCalculus optimization: extrema & discriminants
22PhysicsMagnetostatics & magnetic-field formulas
23PhysicsPeer-review citation & experimental-design practices
24MathFinancial & percentage word problems
25MathUnit verification & function-symmetry identities
26PhysicsCross-disciplinary tradeoff & Bayesian reasoning
27PhysicsGeneral problem-solving verification checks
28PhysicsAstrophysics: supernovae, dark matter & black holes
29PhysicsFluid/thermodynamic physics & dimensional consistency
30PhysicsTopological & condensed-matter quantum systems
31PhysicsGeneral relativity, black holes & cosmology
32PhysicsNuclear/particle physics & authoritative-source verification
33MathCombinatorics: subsets, Burnside’s lemma & pigeonhole
34MathCoordinate geometry: lines, conics & perpendicularity

Table 12. Short thematic labels for each of the K=64K = 64 HDP-GMM components fit on the Qwen3-32B mined behavior corpus.

(continued from previous page)

#DomainLabel
35MathPercentage/ratio word problems
36PhysicsQuantum information & computation protocols
37PhysicsPhysics heuristics & fluid/thermodynamic formulas
38PhysicsMaterials science: nanoparticles & phonon scattering
39MathCombinatorial game theory & optimal strategy
40MathGeometry: circles, loci & optical formulas
41PhysicsProblem-solving meta-strategies & memorized constants
42MathArithmetic: place value, fractions & percentages
43PhysicsCross-domain dimensional analysis (physics/chemistry)
44PhysicsSpecial relativity: time dilation & Lorentz transforms
45PhysicsBiophysics & fluid/cell mechanics
46PhysicsCondensed matter: band structure & Hall effect
47PhysicsThermodynamics: phase changes & adiabatic processes
48MathLogic & proof techniques
49MathGeometry/trigonometry fundamentals (circles, hyperbolas)
50PhysicsOptics: lenses, mirrors & convection
51PhysicsAtomic physics: quantum numbers & spectra
52PhysicsBiophysics/biochemistry: membranes & virial coefficients
53MathProbability: independence & conditional rules
54MathNumber theory: modular arithmetic & divisibility
55MathCalculus: derivatives, optimization & monotonicity
56PhysicsSymbolic problem-solving with placeholder variables
57PhysicsSolid-state/thermal physics & perturbation theory
58MathNumber theory: primality, divisors & CRT
59PhysicsAstrophysics: gravitational waves & black holes
60MathAlgebra: Vieta’s formulas & symmetric polynomials
61MathStatistics: central tendency & distributions
62PhysicsTheoretical physics: QFT & string theory
63MathIntegration techniques & trigonometric identities

Table 13. Short thematic labels for each of the K=62K = 62 components in the HDP-GMM memory module fit from the Granite-4.2-30B-mined behavior corpus.

#DomainLabel
0PhysicsChaos theory & dynamical-systems criteria
1MathTrigonometric identities in optics & triangle geometry
2MathCombinatorics: permutations & circular arrangements
3PhysicsCondensed-matter defect & superconductor classification
#DomainLabel
4PhysicsEnergy-efficiency metric definition protocols
5MathCombinatorial game theory & parity arguments
6PhysicsCryptographic protocol layering & classification
7PhysicsRadiation dosimetry & hazard classification
8PhysicsQuantum field theory formalism
9MathSolid geometry: coordinates, area & volume
10MathRectangle/area word problems
11PhysicsBiomechanics & sensory-perception force models
12MathCircle/conic geometry: tangents & distances
13PhysicsAtomic transitions & qubit-state definitions
14PhysicsNanostructure electronic transport & quantum Hall effect
15MathSolution-verification protocols & boundary conditions
16PhysicsAstrophysics: gravitational-wave & stellar-remnant scaling
17MathAge/time word problems & exponential decay
18MathProbability: equally-likely outcomes & GF(2) spaces
19PhysicsMagnetostatics: Biot–Savart law & synchrotron radiation
20MathRelative motion & relativistic velocity addition
21PhysicsIon-channel biophysics & membrane potentials
22MathArithmetic sequences & periodic scheduling
23PhysicsDimensional consistency in thermo/fluid dynamics
24MathGraph theory: degree sums & polyhedra
25MathCombinatorial geometry: line arrangements & gears
26MathFunction symmetry: odd/even parity arguments
27MathNumber-theory & arithmetic word problems
28MathDescriptive statistics: mode, median & dice probability
29MathVolume/geometry word problems
30MathFinancial word problems: sequential transactions & tax
31MathAlgebra: matrices, determinants & polynomial roots
32MathAlgorithmic complexity & search-strategy heuristics
33MathBalance-scale, BMI & series-convergence identities
34MathStatistical estimation & election vote-counting
35PhysicsVector sign conventions in optics & waves
36MathChemistry stoichiometry & mixture conservation
37MathAnimal/leg counting & ratio-substitution algebra
38MathCalculus optimization & blackbody/standard-candle checks
39PhysicsTraffic-flow control & capacity-constrained systems
40PhysicsCondensed-matter & particle-physics regime classification
41PhysicsTopological defects & anyon/monopole physics
42PhysicsDiffusion & optical-fiber transport formulas
43PhysicsSpace-weather & astrobiology assessment protocols
44PhysicsNuclear physics & technology-readiness evidence
45PhysicsDark matter, gravity & black-hole bounds
46PhysicsMaterials characterization & attenuation formulas
47PhysicsWave/vibration frequency analysis
#DomainLabel
48MathOlympiad geometry/algebra lemmas & proof techniques
49MathGrid/number-theory formulas & metric geometry
50MathGeometric length & area word problems
51MathState-tracking & cyclic-structure combinatorics
52PhysicsDark-matter & gravitational-wave detector-signature protocols
53PhysicsParticle-physics decay & resonance formulas
54PhysicsSystem boundary & scope-definition protocols
55MathLogic puzzles & multi-component reasoning
56PhysicsThermodynamics & propulsion/fission-yield formulas
57PhysicsDomain-agnostic evaluation & classification protocols
58PhysicsCircuit & electrostatics formulas
59PhysicsBiophysics & semiconductor measurement protocols
60MathKinematics & geometric-probability word problems
61MathLogic puzzles & linguistic disambiguation

Table 13 (PDF p. 24).

Example Behaviors (Component Medoids)

To illustrate the notion of a behavior obtained through the language model’s self-reflection, we provide a list of a few behaviors – specifically, the medoid elements of some of the Qwen3-32B components described in Table 12. We observe that the behaviors, while providing guidance for solution strategies, are still fairly general, which facilitates effective reuse at inference time.

#DomainRepresentative behavior
0MathAlways check and convert units to ensure consistency before performing calculations, using known conversion factors if necessary.
4MathWhen solving equations, check for symmetry in variables (e.g., if swapping xx and yy yields the same equation) to simplify or identify solutions.
8PhysicsUse symmetry to simplify field contributions: opposite sides of a loop may cancel if their contributions are equal and opposite, but verify directions to avoid assuming cancellation.
14MathWhen solving for area, cross-check the result with perimeter calculations (if relevant) to ensure logical consistency.
18PhysicsUse multiple independent sources or methods to confirm the value of critical parameters (e.g., particle masses) before finalizing a solution.
30PhysicsWhen analyzing perturbations, always check if they break a symmetry that protects the system’s properties.
37PhysicsWhen solving for critical points (e.g., minima/maxima) in equations, use known physical constraints (e.g., SOFAR channel depth) to simplify calculations and avoid unphysical solutions.
39MathIn strategic games, determine if a player has a forced win by identifying whether the opponent can always block or avoid the winning condition regardless of moves.
41PhysicsWhen solving a problem, outline the key concepts and their relevance before providing detailed analysis to ensure clarity and completeness.

Table 14. Selected representative behaviors from a subset of the K=64K = 64 HDP-GMM components fit from the Qwen3-32B-mined behavior corpus (component numbers match those in Table 12)

(continued from previous page)

#DomainRepresentative behavior
43PhysicsUse a domain-specific checklist of experimental techniques (e.g., NMR, neutron scattering) to verify that no relevant methods are omitted when solving problems involving material property analysis.
49MathWhen solving geometric problems, always consider whether the figure is a special case (e.g., square, rhombus, rectangle), as this can simplify calculations.
52PhysicsConsider material properties (e.g., aa, bb) when solving applied problems to ensure practical feasibility.

Table 4.

References

  1. [1]Rishabh Agarwal, Nino Vieillard, Yongchao Zhou, Piotr Stanczyk, Sabela Ramos, Matthieu Geist, and Olivier Bachem. On-Policy Distillation of Language Models: Learning from Self-Generated Mistakes. In International Conference on Learning Representations (ICLR), 2024. https://arxiv.org/abs/2306.13649.
  2. [2]Ekin Akyürek, Mehul Damani, Adam Zweiger, Linlu Qiu, Han Guo, Jyothish Pari, Yoon Kim, and Jacob Andreas. The Surprising Effectiveness of Test-Time Training for Few-Shot Learning. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pp. 942–963. PMLR, 2025. https://arxiv.org/abs/2411.07279.
  3. [3]Art of Problem Solving. 2025 AIME I Problems. https://artofproblemsolving.com/wiki/index.php?title=2025_AIME_I_Problems, 2025.
  4. [4]Parul Awasthy, Aashka Trivedi, Yulong Li, Meet Doshi, Riyaz Bhat, Vignesh P, Vishwajeet Kumar, Yushu Yang, Bhavani Iyer, Abraham Daniels, Rudra Murthy, Ken Barker, Martin Franz, Madison Lee, Todd Ward, Salim Roukos, David Cox, Luis Lastras, Jaydeep Sen, and Radu Florian. Granite embedding R2 models, 2025. arXiv preprint arXiv:2508.21085. https://arxiv.org/abs/2508.21085.
  5. [5]Ali Behrouz, Zeman Li, Praneeth Kacham, Majid Daliri, Yuan Deng, Peilin Zhong, Meisam Razaviyayn, and Vahab Mirrokni. ATLAS: Learning to Optimally Memorize the Context at Test Time. arXiv preprint arXiv:2505.23735, 2025a. https://arxiv.org/abs/2505.23735.
  6. [6]Ali Behrouz, Peilin Zhong, and Vahab Mirrokni. Titans: Learning to Memorize at Test Time. arXiv preprint arXiv:2501.00663, 2025b. https://arxiv.org/abs/2501.00663.
  7. [7]Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language Models are Few-Shot Learners. In Advances in Neural Information Processing Systems 33 (NeurIPS 2020), 2020. https://arxiv.org/abs/2005.14165.
  8. [8]Prateek Chhikara, Dev Khant, Saket Aryan, Taranjeet Singh, and Deshraj Yadav. Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory. In Proceedings of the European Conference on Artificial Intelligence (ECAI), pp. 2993–3000, 2025. doi: 10.3233/FAIA251160. https://arxiv.org/abs/2504.19413.
  9. [9]Rajarshi Das, Manzil Zaheer, and Chris Dyer. Gaussian LDA for Topic Models with Word Embeddings. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing, pp. 795–804, 2015. https://aclanthology.org/P15-1077/.DOI
  10. [10]Aniket Didolkar, Anirudh Goyal, Nan Rosemary Ke, Siyuan Guo, Michal Valko, Timothy Lillicrap, Danilo Rezende, Yoshua Bengio, Michael Mozer, and Sanjeev Arora. Metacognitive capabilities of LLMs: An exploration in mathematical problem solving, 2024. arXiv preprint arXiv:2405.12205.arxiv.org/abs/2405.12205
  11. [11]Aniket Didolkar, Nicolas Ballas, Sanjeev Arora, and Anirudh Goyal. Metacognitive reuse: Turning recurring LLM reasoning into concise behaviors, 2025. arXiv preprint arXiv:2509.13237.arxiv.org/abs/2509.13237
  12. [12]Runnan Fang, Yuan Liang, Xiaobin Wang, Jialong Wu, Shuofei Qiao, Pengjun Xie, Fei Huang, Huajun Chen, and Ningyu Zhang. Memp: Exploring agent procedural memory. In Findings of the Association for Computational Linguistics: ACL 2026, 2026. arXiv:2508.06433.arxiv.org/abs/2508.06433
  13. [14]Bofei Gao, Feifan Song, Zhe Yang, Zefan Cai, Yibo Miao, Qingxiu Dong, Lei Li, Chenghao Ma, Liang Chen, Runxin Xu, Zhengyang Tang, Benyou Wang, Daoguang Zan, Shanghaoran Quan, Ge Zhang, Lei Sha, Yichang Zhang, Xuancheng Ren, Tianyu Liu, and Baobao Chang. Omni-MATH: A Universal Olympiad Level Mathematical Benchmark for Large Language Models. In International Conference on Learning Representations (ICLR), 2025.arxiv.org/abs/2410.07985
  14. [15]Sharon Goldwater, Thomas L. Griffiths, and Mark Johnson. Contextual Dependencies in Unsupervised Word Segmentation. In Proceedings of the 21st International Conference on Computational Linguistics and 44th Annual Meeting of the Association for Computational Linguistics, pp. 673–680, 2006. https://aclanthology.org/P06-1085/.DOI
  15. [16]Moritz Hardt and Yu Sun. Test-time training on nearest neighbors for large language models. In International Conference on Learning Representations (ICLR), 2024. arXiv:2305.18466.arxiv.org/abs/2305.18466
  16. [18]Jie Huang, Xinyun Chen, Swaroop Mishra, Huaixiu Steven Zheng, Adams Wei Yu, Xinying Song, and Denny Zhou. Large Language Models Cannot Self-Correct Reasoning Yet. In International Conference on Learning Representations (ICLR), 2024. https://arxiv.org/abs/2310.01798.
  17. [19]Jonas Hübotter, Frederike Lübeck, Lejs Behric, Anton Baumann, Marco Bagatella, Daniel Marta, Ido Hakimi, Idan Shenfeld, Thomas Kleine Buening, Carlos Guestrin, and Andreas Krause. Reinforcement Learning via Self-Distillation. arXiv preprint arXiv:2601.20802, 2026. https://arxiv.org/abs/2601.20802.
  18. [20]IBM Granite Team. Granite-4.2-30B. https://huggingface.co/ibm-granite/granite-4.2-30b, 2026.
  19. [21]Bernal Jiménez Gutiérrez, Yihe ng Shu, Weijian Qi, Sizhe Zhou, and Yu Su. From RAG to Memory: Non-Parametric Continual Learning for Large Language Models. In Proceedings of the 42nd International Conference on Machine Learning, 2025. https://arxiv.org/abs/2502.14802.
  20. [22]Mark Johnson, Thomas L. Griffiths, and Sharon Goldwater. Adaptor Grammars: A Framework for Specifying Compositional Nonparametric Bayesian Models. In Advances in Neural Information Processing Systems 19 (NIPS 2006), pp. 641–648, 2007. https://papers.nips.cc/paper_files/paper/2006/hash/62f91ce9b820a491ee78c108636db089-Abstract.html.
  21. [23]Borui Kang, Jinrui Gu, Junhan Lv, Wenbin Li, Lei Wang, and Yang Gao. Harness Continual Learning: Continual Adaptation Beyond Model Parameters. arXiv preprint arXiv:2608.19013, 2026. https://arxiv.org/abs/2608.19013.
  22. [24]Urvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer, and Mike Lewis. Generalization through Memorization: Nearest Neighbor Language Models. In International Conference on Learning Representations (ICLR), 2020. https://arxiv.org/abs/1911.00172.
  23. [25]James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, and Raia Hadsell. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, 114(13):3521–3526, 2017. doi: 10.1073/pnas.1611835114.DOI
  24. [26]Thomas Kleine Buening, Jonas Hübotter, Barna Pásztor, Idan Shenfeld, Giorgia Ramponi, and Andreas Krause. Aligning Language Models from User Interactions. arXiv preprint arXiv:2603.12273, 2026. https://arxiv.org/abs/2603.12273.
  25. [27]Brian Kulis and Michael I. Jordan. Revisiting k-means: New Algorithms via Bayesian Nonparametrics. In Proceedings of the 29th International Conference on Machine Learning (ICML), 2012. https://icml.cc/2012/papers/291.pdf.arxiv.org/abs/1111.0352

Paper details

vlnc:W_nbt3em6z
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 9

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents