Evolutionary System Prompt Learning for Reinforcement Learning in LLMs Lunjun Zhang, Ryan Chen, Bradly C. Stadie Abstract Building agentic systems that can autonomously self-improve from experience is a longstanding goal of AI. Large language models (LLMs) today primarily self-improve via two mechanisms: self-reflection for context updates, and reinforcement learning (RL) for weight updates. In this work, we propose Evolutionary System Prompt Learning (E-SPL) , a method for jointly improving model contexts and model weights. In each RL iteration, E-SPL samples trajectories under multiple system prompts in parallel, then jointly applies RL updates to LLM weights and evolutionary updates to system prompts. System prompts evolve via mutation and crossover, two genetic operators driven by LLM self-reflection; selection is based on relative performance ratings updated across RL iterations. E-SPL encourages a natural division between declarative knowledge encoded in prompts and procedural knowledge encoded in weights, resulting in improved performance across reasoning and agentic tasks. For instance, in an easy-to-hard (AIME → \rightarrow BeyondAIME) generalization setting, E-SPL improves RL success rate from 38.8 % → 45.1 % 38.8\%\rightarrow 45.1\% while also outperforming reflective prompt evolution ( 40.0 % 40.0\% ). Overall, our results demonstrate that RL and system prompt evolution are deeply synergistic, and combining the two yields consistent gains in sample efficiency and generalization. Code: github.com/LunjunZhang/E-SPL 1 Introduction Figure 1 : Evolving System Prompts helps RL generalize better . Evolutionary algorithms (EA) and reinforcement learning (RL) have long been studied as complementary paradigms for optimizing intelligent behaviors. Evolutionary methods excel at population-level exploration over discrete, high-level structures ( 41 ; 5 ; 47 ) , while reinforcement learning is well suited for fine-grained optimization of policy parameters through trial and error ( 92 ; 83 ; 76 ) . Historically, however, these two approaches have largely operated on different representational levels: evolution over programs ( 43 ) and architectures ( 79 ) on the one hand, and gradient-based learning over a fixed set of parameters ( 70 ; 57 ) on the other. Bridging these representational levels in a unified and scalable way remains an open challenge, particularly in the context of large language models (LLMs) ( 10 ; 1 ) , where both the model weights ( 33 ) and the model contexts ( 90 ; 105 ) critically shape behavior. Figure 2 : Evolutionary System Prompt Learning (E-SPL) jointly optimizes model contexts and model weights to enhance LLM self-improvement. Evolution updates system prompts; RL updates weights. The learned system prompts can encode declarative knowledge via articulated principles and strategies, while RL gradients can further hone the model’s procedural knowledge for reliable execution. Recent work on prompt evolution and LLM agents demonstrates that prompt (or context) engineering is a powerful mechanism for improving test-time performance. Techniques such as self-reflection ( 74 ; 53 ; 12 ) and population-based search ( 26 ; 20 ; 67 ; 3 ) show that prompts can encode substantial declarative knowledge and behavioral priors without modifying model weights. At the same time, RL has emerged as the predominant post-training approach to fundamentally improve reasoning capabilities ( 33 ; 25 ; 13 ; 15 ) . Despite their complementary strengths, existing approaches typically optimize model contexts and weights in isolation, leaving their potential synergies unexplored. In this work, we argue that effective self-improving agents should jointly evolve their high-level behavioral specifications and their low-level parametric policies. This perspective motivates Evolutionary System Prompt Learning (E-SPL) , a framework that tightly couples reinforcement learning over model weights with evolutionary search over system prompts. By maintaining a population of system prompts that are evaluated, rated, and evolved alongside RL training, E-SPL enables structured exploration over declarative knowledge while encoding procedural knowledge into weights. This joint optimization yields a synergistic dynamics in which improved prompts accelerate learning, and improved weights amplify the benefits of prompt evolution. Experimentally, E-SPL enhances RL performance of from 56.3\%\rightarrow 60.6\% on AIME 2025, 50.0\%\rightarrow 52.7\% on HMMT 2025 November test, and notably, 38.8\%\rightarrow 45.1\% on AIME \rightarrow BeyondAIME in an easy-to-hard generalization setting, using a base model of DeepSeek v3.1 ( 17 ) . E-SPL significantly outperforms prompt evolution as well, showing that weight updates are often necessary for improving the model’s tacit knowledge and intuition. On an agentic search task ( 34 ) , we improved RL performance from 44.2\%\rightarrow 48.6\% on OpenAI’s gpt-oss-120b ( 2 ) with limited data. Together, these results show that combining RL and system prompt evolution unlocks a synergistic form of self-improvement that neither approach achieves in isolation. Figure 3 : Evolutionary trees of E-SPL . During RL, E-SPL creates an evolutionary tree of system prompts, by re-suing the same data already generated by RL with minimal additional computational overhead. Each genetic operator (mutation or crossover) only requires a sampling server for LLM self-reflection with different context construction strategies, which can be concurrent with RL gradient updates. Discovered System Prompts for Solving Math Problems (deepseek v3.1) [1] For generating functions with a numerator (1-x^{M})^{k} and a denominator as a product of geometric series, the coefficient of x^{N} is a sum over j of binomial coefficients times the number of solutions to a Diophantine equation. If N{"name": "search", "arguments": {"query_list": ["Population New York City between 2020 and 2025"]}} \cdots System Prompt After E-SPL You are an expert research assistant. \cdots Workflow (follow exactly in this order) \boldsymbol{\cdots} 3. Call the search tool once — Use exactly this syntax \cdots 4. Verification block — For each result returned, output the following four lines in this order and nothing else : Source: Summary: Status: VERIFIED (or NOT VERIFIED) Phrase: "" (only if Status is VERIFIED) A result is VERIFIED only if: • the exact target phrase appears verbatim in the snippet, and • the domain ends with .org , .edu , .gov , is Wikipedia, or a major reputable outlet (e.g., nytimes.com , bbc.com , reuters.com , theguardian.com ) If the domain is not on this list, mark the result NOT VERIFIED even if the phrase is present. 5. Refine query (optional) — If all results are NOT VERIFIED, modify the query and repeat Step 3. Critical formatting rules (must be obeyed) • All tool calls must be wrapped exactly as {...} • The only user-visible output after verification is the single Answer: line; no bullet points, markdown, blank lines, or extra text Positive example (correct flow) User: "What other name is used for the 4 × 400 m relay?" Query: "4 x 400 metres relay" {"name": "search", "arguments": {"query_list": ["4 x 400 metres relay"]}} Source: en.wikipedia.org Summary: The 4 x 400 metres relay is also known as the "long relay". Status: VERIFIED Phrase: "long relay" \cdots Follow exactly this loop for every user query. Your objective is to prove the answer with a verbatim phrase from a reliable source before you everr write the final Answer: line. 3 Method In this section, we describe how to combine reinforcement learning (RL) on LLM weights with an evolutionary algorithm (EA) on LLM system prompts. In a nutshell, we condition RL weight updates on a population of system prompts, and reuse the resulting RL data to jointly evolve this population via two genetic operators, mutation and crossover, both of which are based on LLM self-reflection. We design the evolutionary algorithm to be directly compatible with RL post-training pipelines, allowing RL to benefit from an evolving repertoire of declarative knowledge while incurring minimal additional overhead. 3.1 Reinforcement Learning for Weight Update The RL component of E-SPL optimizes the LLM policy \pi_{\theta} to maximize rewards on dataset \mathcal{D} under a variety of system prompts. Each system prompt, denoted as \mathbf{s} , is a list of strategic instructions that contain declarative knowledge on how to solve various categories of problems. The system prompts are not given a priori , but are instead discovered by the LLM through self-reflection on its own experience during the RL training process. Each RL iteration uses M system prompts \{\mathbf{s}_{i}\}_{i=1}^{M} in parallel, so that the model weights do not overfit to any particular system prompt; this also induces direct evolutionary competition among system prompts. For each problem x\sim\mathcal{D} in the batch, and for each system prompt \mathbf{s}_{i} , we sample N trajectories \displaystyle y_{i,j}\sim\pi_{\theta}(\cdot\mid\mathbf{s}_{i},x)\quad\text{for }j=1,\dots,N (1) Then, we compute the outcome reward r_{i,j} for each trajectory and the value function estimate V_{i} accordingly: \displaystyle r_{i,j} \displaystyle=R(x,y_{i,j})\qquad V_{i}=\textstyle\frac{1}{N}{\textstyle\sum}_{j=1}^{N}r_{i,j} (2) The policy gradient objective for each problem x is: \displaystyle\mathcal{J}(\theta,x) \displaystyle={\textstyle\frac{1}{NM}}{\textstyle\sum_{i=1}^{M}}{\textstyle\sum}_{j=1}^{N}(r_{i,j}-V_{i})\log\pi_{\theta}(y_{i,j}|\mathbf{s}_{i},x) We perform the policy gradient update to LLM weights \theta on a batch of problems \mathcal{B}\sim\mathcal{D} , while regularizing the policy \pi_{\theta} to be close to the reference policy \pi_{\text{ref}} : \displaystyle\theta \displaystyle\leftarrow\theta+\alpha\,{\textstyle\frac{1}{|\mathcal{B}|}}{\sum}_{x\in\mathcal{B}}\nabla_{\theta}(\mathcal{J}(\theta,x)-\beta\,\mathrm{KL}\left(\pi_{\theta},\pi_{\text{ref}})\right) (3) When using low-rank adaptation ( 30 ) , the KL regularization is implicit (since \pi_{\theta} cannot deviate too much from \pi_{\text{ref}} by construction) and thus often ignored ( \beta=0 ). Performing policy gradients conditioned on learned system prompts also encourages a separation between two sources of knowledge: declarative knowledge that can be explicitly articulated and stored as principles in the system prompt, versus procedural knowledge that is tacit, intuitive, and only editable in weights. Conditioning the model on declarative knowledge in prompts reduces the optimization pressure to globally update the model in weights, and allows the weight updates to focus on acquiring procedural knowledge. 3.2 Evolutionary Algorithm for Context Update Our evolutionary algorithm ( EA ) optimizes the LLM system prompt to best elicit model capabilities and encode explicit knowledge learned from experience. Like in classical EA, we keep a population of candidates, and: (1) evaluate the fitness of different system prompts continuously during training; (2) select the successful ones from the population; (3) reproduce new system prompts from selected parents to add to the population via mutation and crossover – both grounded in LLM self-reflection but differing in their context construction strategies. The population \mathcal{S} starts with a single root, and gradually grows into an evolutionary tree. Fitness Evaluation Our EA estimates the competence of each system prompt using the same trajectories already generated by RL. To ensure seamless integration into existing RL pipelines, we eliminate the need for a separate fitness evaluation on a held-out validation set that is typical of prompt evolution algorithms. Instead, evolution directly leverages the noisy train-time batch statistics generated during RL rollouts, incurring negligible additional cost. Reusing on-policy batch statistics comes with an important consequence: absolute returns are not directly comparable across training iterations, as system prompts are evaluated on different data batches and under different model weights \theta . However, within each RL iteration, all sampled system prompts are evaluated under matched conditions – same batch, same weights. We therefore treat each RL iteration as a tournament round among selected system prompts, where only their relative ordering is meaningful across time. To convert the relative ordering into persistent, comparable ratings, we use the Bayesian skill rating system TrueSkill ( 28 ) , which models each rating as a Gaussian distribution \mathcal{N}(\mu,\sigma^{2}) . Concretely, given value estimates [V_{1},\dots,V_{M}] for the sampled prompts [\mathbf{s}_{1},\dots,\mathbf{s}_{M}] and their current ratings [(\mu_{1},\sigma_{1}),\dots,(\mu_{M},\sigma_{M})] , we compute the sorted ordering (in descending order) for \{\mathbf{s}_{i}\}_{i=1}^{M} : \displaystyle\mathbf{v} \displaystyle\leftarrow\mathrm{argsort}([V_{1},\dots,V_{M}]), and update their TrueSkill ratings associated with each sampled prompt \mathbf{s}_{i} in the population \mathcal{S} accordingly (see § B ): \displaystyle{(\mu_{i},\sigma_{i})}_{i=1}^{M}\leftarrow\mathrm{TrueSkill.update}({(\mu_{i},\sigma_{i})}_{i=1}^{M},\mathbf{v}), which performs approximate message passing between those ratings. This procedure yields a persistent estimate of each prompt’s competence that can aggregate evidence across iterations despite changing model weights. Selection We select the system prompts used in each RL iteration based on their TrueSkill scores. We use an optimistic estimate of each system prompt \mathbf{s}_{i} ’s skill level, which forms our sampling distribution for selection: \displaystyle\mathrm{score}_{i}=\mu_{i}+\lambda\sigma_{i}\qquad p_{i}\propto\exp(\mathrm{score}_{i}/T) (4) where \lambda>0 controls the degree of optimism in estimating skill levels, and T is a temperature term; both higher \lambda and higher T can encourage exploration. In addition, we apply a sliding window of size K , similar to a replay buffer, so that we only sample from the latest K system prompts. This strategy favors system prompts that perform well while maintaining a high degree of exploration. Algorithm 1 Evolutionary System Prompt Learning for RL Input: Problem set \mathcal{D}(\cdot) , reward function R(\cdot,\cdot) . Input: RL policy \pi_{\theta}(\cdot) ; reference policy \pi_{\text{ref}}(\cdot) . Input: RL hyper-parameters: N , \alpha , \beta . Input: Initial system prompt \mathbf{s}_{\text{root}} ; M , p_{\text{crossover}} . Input: Initial (\mu_{0},\sigma_{0}) for \mathrm{TrueSkill} ; \Delta\sigma ; \lambda . Initialize \mathcal{S}=\{(\mathbf{s}_{\text{root}},\mu_{0},\sigma_{0})\} . { Population to Evolve } while not converged do Sample a problem x\sim\mathcal{D} Sample M system prompts \{(\mathbf{s}_{i},\mu_{i},\sigma_{i})\}_{i=1}^{M}\sim\mathcal{S} , each according to probability p_{i}\propto\exp(\mu_{i}+\lambda\sigma_{i}) for i=1 to M do Sample N solutions \{y_{i,j}\}_{j=1}^{N} : y_{i,j}\sim\pi_{\theta}(\cdot\mid\mathbf{s}_{i},x) Reward r_{i,j}=R(x,y_{i,j}) , value V_{i}=\frac{1}{N}{\sum}_{j=1}^{N}r_{i,j} end for \mathcal{J}(\theta)={\frac{1}{NM}}{\sum}_{i}{\sum}_{j}(r_{i,j}-V_{i})\log\pi_{\theta}(y_{i,j}|\mathbf{s}_{i},x) \theta\leftarrow\theta+\alpha\nabla_{\theta}(\mathcal{J}(\theta)-\beta\mathrm{KL}(\pi_{\theta},\pi_{\text{ref}})) { RL update } \mathbf{v}\leftarrow\mathrm{argsort}([V_{1},\dots,V_{M}]) { Rank the list of \mathbf{s}_{i} } \{(\mu_{i},\sigma_{i})\}_{i=1}^{M}\leftarrow{\mathrm{TrueSkill}.\mathrm{update}}(\{(\mu_{i},\sigma_{i})\}_{i=1}^{M},\mathbf{v}) { Change the ratings in the population \mathcal{S} } k\leftarrow\mathrm{argmax}_{i}V_{i} { Only mutate the best prompt \mathbf{s}_{k} } Create mutation self-reflection prompt \Psi_{\text{reflect}} using [(x,y_{k,1},r_{k,1}),\dots,(x,y_{k,N},r_{k,N})] . \ell\sim\pi_{\text{ref}}(\cdot\mid\Psi_{\text{reflect}})\quad\mathrm{diff}\sim\pi_{\text{ref}}(\cdot\mid\mathbf{s}_{k},\ell) \mathbf{s}_{\text{mutate}}\leftarrow\mathrm{git}.\mathrm{apply}(\mathbf{s}_{k},\mathrm{diff}) { Mutation step } \mathcal{S}.\mathrm{append}((\mathbf{s}_{\text{mutate}},\mu_{k},\sigma_{k}+\Delta\sigma)) if p_{\text{crossover}}>\mathrm{random.rand()} then Let \mathcal{B}=\{x_{b}\}_{b=1}^{B} be a batch of B past problems Let \Omega=\{(\mathbf{s}_{i},\mu_{i},\sigma_{i})\}_{i=1}^{M} (\mathbf{s}^{\prime},\mu^{\prime},\sigma^{\prime})=\mathrm{Crossover}(\mathcal{B},R,\Omega,\pi_{\theta},\pi_{\text{ref}}) { Alg 2 } \mathcal{S}.\mathrm{append}((\mathbf{s}^{\prime},\mu^{\prime},\sigma^{\prime})) end if end while Algorithm 2 \mathrm{Crossover}(\mathcal{B},R,\Omega,\pi_{\theta},\pi_{\text{ref}}) Input: List of B problems: \mathcal{B} ; reward function R(\cdot,\cdot) . Input: List of M system prompts: \Omega . Input: RL policy \pi_{\theta}(\cdot) , reference policy \pi_{\text{ref}}(\cdot) . Let \Phi\in\mathbb{R}^{M\times B} { \Phi_{i,b} is the empirical return of the i -th system prompt in \Omega on the b -th problem in \mathcal{B} } for (\mathbf{s}_{i},\mu_{i},\sigma_{i}) in \Omega do for x_{b} in \mathcal{B} do Sample \{y_{i,b,j}\}_{j=1}^{N} from \pi_{\theta} : y_{i,b,j}\sim\pi_{\theta}(\cdot\mid\mathbf{s}_{i},x_{b}) { In practice, reuse the rollouts from RL in Alg 1 } \Phi_{i,b}=\frac{1}{N}{\sum}_{j=1}^{N}R(x,y_{i,b,j}) end for end for k\leftarrow\mathrm{argmax}_{i}{\sum}_{b}\Phi_{i,b} { \mathbf{s}_{k} is the overall top prompt } \boldsymbol{\varphi}=[\,] { Problems each \mathbf{s}_{i} was the top prompt for } for (\mathbf{s}_{i},\mu_{i},\sigma_{i}) in \Omega do \rho_{i}=[\,] for x_{b} in \mathcal{B} do if i=\mathrm{argmax}_{z}\Phi_{z,b} then \rho_{i} . \mathrm{append}(x_{b}) { \mathbf{s}_{i} is the top prompt for x_{b} } end if end for \boldsymbol{\varphi}.\mathrm{append}((\mathbf{s}_{i},\rho_{i})) { Analyze why \mathbf{s}_{i} did best on \rho_{i} } end for Create crossover self-reflection prompt \Psi_{\text{cr}} using \boldsymbol{\varphi} . \mathrm{diff}_{\text{cr}}\sim\pi_{\text{ref}}(\cdot\mid\mathbf{s}_{k},\Psi_{\text{cr}}) \mathbf{s}_{\text{crossover}}\leftarrow\mathrm{git}.\mathrm{apply}(\mathbf{s}_{k},\mathrm{diff}_{\text{cr}}) { Crossover step } \mu^{\prime}=({\sum}_{i}\frac{\mu_{i}}{\sigma_{i}^{2}})/({\sum}_{i}\frac{1}{\sigma_{i}^{2}}) , \sigma^{\prime}=\sqrt{{{1}/({{\sum}_{i}{{1}/{\sigma_{i}^{2}}}})+\Delta\sigma^{2}}} Return (\mathbf{s}_{\text{crossover}},\mu^{\prime},\sigma^{\prime}) Mutation After evaluating the empirical performance of selected system prompts \{\mathbf{s}_{i}\}_{i=1}^{M} , we identify the best: \displaystyle k\leftarrow\mathrm{argmax}_{i}V_{i} (5) and only apply mutation on this best candidate \mathbf{s}_{k} . This directly adds additional evolutionary pressure on the population: in each iteration, only the one system prompt that outperforms all of its competitively selected peers gets to produce a child of its own through mutation . To run mutation on \mathbf{s}_{k} , we first ask the reference policy \pi_{\text{ref}} to summarize each trajectory and self-reflect (using mutation self-reflection prompt \Psi_{\text{reflect}} ) on the mistakes that \pi_{\theta} made in those trajectories generated under the system prompt \mathbf{s}_{k} : \displaystyle\ell\sim\pi_{\text{ref}}(\cdot\mid\Psi_{\text{reflect}},(x,y_{k,1},r_{k,1}),\dots,(x,y_{k,N},r_{k,N})) where the model reasons across all the rollouts \{y_{k,j}\}_{j=1}^{N} and their outcomes \{r_{k,j}\}_{j=1}^{N} to identify past mistakes and potential strategies to avoid them going forward . Next, we use the lessons \ell from self-reflection to propose edits on the system prompt \mathbf{s}_{k} in a format similar to git diff: \displaystyle\mathrm{diff}\sim\pi_{\text{ref}}(\cdot\mid\mathbf{s}_{k},\ell)\qquad\mathbf{s}_{\text{mutate}}\leftarrow\mathrm{git}.\mathrm{apply}(\mathbf{s}_{k},\mathrm{diff}) Finally, we add \mathbf{s}_{\text{mutate}} to the population \mathcal{S} with \mathrm{TrueSkill} rating (\mu_{k},\sigma_{k}+\Delta\sigma) ; under mutation, a child inherits the parent’s rating but with increased uncertainty. This favors the child in the next round of selection according to Eq ( 4 ). Figure 8 : TrueSkill scores learned from train-time rankings are predictive of relative test-time performance of system prompts. E-SPL treats each RL iteration as a set of relative comparisons between system prompts for TrueSkill message passing. The visualization shows that E-SPL effectively aggregates noisy train-time comparisons into a stable and informative criterion for evolutionary selection. Crossover enables selective recombination of knowledge from multiple parents in producing an offspring. In contrast, mutation alone isolates evolutionary branches, requiring each lineage to independently rediscover similar declarative knowledge. Crossover therefore facilitates rapid dissemination of effective strategies across the population. Our crossover operator first computes V_{i} in Eq ( 2 ) for each problem in a batch \mathcal{B} , yielding a score matrix \Phi\in\mathbb{R}^{M\times B} where the rows represent M sampled system prompts \{\mathbf{s}_{i}\}_{i=1}^{M} and the columns represent B problems in the batch \{x_{b}\}_{b=1}^{B} . Each entry \Phi_{i,b} represents the average reward of problem x_{b} obtained under \mathbf{s}_{i} during this RL iteration. The matrix \Phi explicitly captures the problem-wise strengths of each system prompt by identifying which system prompts outperform others on specific problems. Incorporated into the crossover self-reflection prompt \Psi_{\mathrm{cr}} , this information grounds LLM self-reflection in concrete examples of differential advantages and enables targeted recombination of complementary prompt segments. The goal of the crossover operator is to produce children that inherit and recombine the strongest traits of multiple parents. In Algorithm 2 , after crossover self-reflection, we apply the proposed git diff edits to \mathbf{s}_{k} to obtain \mathbf{s}_{\text{crossover}} , which is added to the population \mathcal{S} with a TrueSkill rating initialized as a precision-weighted average of the parents’ ratings. Self-reflection is key to genetic operators Both mutation and crossover are LLM-based self-reflection processes that diagnose failures and synthesize structured edits to produce children for the population; they differ only in how the self-reflection context is constructed. Mutation reflects on agent trajectories from a single best-performing system prompt to repair its weaknesses, while crossover reflects on comparisons across multiple system prompts in their problem-wise performance to recombine complementary segments. 3.3 Algorithmic Summary Evolutionary System Prompt Learning ( E-SPL ) augments RL post-training with an evolutionary algorithm based on self-reflection from experience. In parallel with RL updates, E-SPL uses the relative ordering of each system prompt’s average reward to obtain TrueSkill ratings, which provide numerical scores that inform evolutionary selection. To create new system prompts for the population, E-SPL applies mutation and crossover operators based on LLM self-reflection. As a result, E-SPL brings the benefits of evolution to RL with minimal additional computational overhead. Figure 9 : An example of how the RL model learns to utilize learned system prompts (numbered G1 \dots G30) to solve problems. Example of How E-SPL Shapes Model Behavior Learned System Prompt When solving math problems, you MUST first carefully read and understand the helpful instructions and principles below: [G1] . When optimizing sums, set parameters to cancel dominant terms. For quadratic forms, choose parameters that minimize the leading coefficients, reducing the problem to analyzing remainder terms. \cdots [G22] . In modular arithmetic and sums, decompose terms via remainders or moduli. Use periodicity for remainder sums and CRT for coprime factors, ensuring multiplicative solutions for square-free moduli. \cdots Problem Let \mathbb{Z}/n\mathbb{Z} be the set of all integers modulo n (hence \mathbb{Z}/n\mathbb{Z} contains n elements). Find the second smallest composite number n , such that there exists a bijective function g:\mathbb{Z}/n\mathbb{Z}\to\mathbb{Z}/n\mathbb{Z} such that the 101 functions g(x),\ g(x)+x,\ g(x)+2x,\ \cdots,\ g(x)+100x are all bijective from \mathbb{Z}/n\mathbb{Z} to \mathbb{Z}/n\mathbb{Z} . Model Output Understanding the Condition: Each function h_{k}(x)=g(x)+kx (for k=0,1,\ldots,100 ) must be a permutation of \mathbb{Z}/n\mathbb{Z} . Since g is bijective, h_{0}(x)=g(x) is bijective by assumption. For k\geq 1 , h_{k} is bijective if and only if for every a\in\mathbb{Z}/n\mathbb{Z} , the equation g(x)+kx=a has a unique solution x . Alternatively , since g is a permutation, we can set y=g(x) and then x=g^{-1}(y) , so h_{k}(g^{-1}(y))=y+kg^{-1}(y). But perhaps a better approach is to consider the differences. Note: h_{k} is bijective if and only if the map x\mapsto g(x)+kx is injective. That is, if g(x)+kx=g(y)+ky then x=y . Equivalently, g(x)-g(y)=-k(x-y). Since g is arbitrary (but fixed for all k ), we need to choose g such that for each k=1,\ldots,100 , the equation g(x)-g(y)=-k(x-y) implies x=y . Alternatively , we can think about the differences: for each nonzero d\in\mathbb{Z}/n\mathbb{Z} , we require that g(x+d)-g(x)\neq-kd for all x and for all k=0,\ldots,100 . Actually, injectivity of h_{k} is equivalent to: if x\neq y , then g(x)+kx\neq g(y)+ky, i.e., g(x)-g(y)\neq-k(x-y) . So for each nonzero d , and for each k , we require that g(x+d)-g(x)\neq-kd for all x . But since g is a permutation, this is not easy to control. Another idea : Consider the composition h_{k}\circ g^{-1} . Let f=g^{-1} . Then h_{k}(g^{-1}(y))=y+kf(y) \cdots \dots But let’s think : For n to work, it must be that all prime factors are at least 103 ? But that gives large numbers. Maybe there is a trick: The number 101 is prime. So perhaps n must be coprime to 101 ! or something. Another idea : Consider the function for k=101 ? Not required. Given the instructions, we should use [G22] : In modular arithmetic, use CRT. If n= product of primes, then by CRT, the condition holds if and only if it holds for each prime power factor. So for each p^{a} dividing n , there exists a bijection g_{p} on Z/p^{a} such that the 101 functions are bijective. For a prime p>101 , take g(x)=x works. For p<=101 , we need to see if there is a bijection on Z/p^{a} . So the smallest composite would be one that has no prime factor <=101 , i.e., all factors >=103 . So the smallest is 103^{2}=10609 . But then the second smallest would be 103\times 107=11021 . \dots Final Answer: \boxed{11021} Ground truth answer: 11021 Figure 10 : An example of how the RL model learns to utilize learned system prompts to solve problems. Example of How E-SPL Shapes Model Behavior Learned System Prompt When solving math problems, you MUST first carefully read and understand the helpful instructions and principles below: \cdots [G26] . After deriving results, perform sanity checks: test small instances, ensure bounds, and verify extreme cases. Re-examine complex steps if results seem off. \cdots Problem Real numbers x_{1},x_{2},\cdots,x_{n} satisfy |x_{1}|+|x_{2}|+\cdots+|x_{3526}|=1 . Let M be the maximal possible value of \frac{1}{|x_{1}|+|x_{1}-x_{2}|+|x_{1}+x_{2}-x_{3}|+\cdots+|x_{1}+x_{2}+\cdots+x_{3525}-x_{3526}|} Find M\mod 1000 . Model Output Let’s analyze the problem step by step: Let S_{k}=x_{1}+x_{2}+\cdots+x_{k} for k=1,2,\dots,3526 , with S_{0}=0 . Then the denominator becomes: |S_{1}|+|S_{1}-S_{2}|+|S_{2}-S_{3}|+\cdots+|S_{3525}-S_{3526}|. But note: S_{1}=x_{1} , S_{1}-S_{2}=-x_{2} , S_{2}-S_{3}=-x_{3} , \cdots , S_{3525}-S_{3526}=-x_{3526} . So the denominator is: |S_{1}|+|x_{2}|+|x_{3}|+\cdots+|x_{3526}|. However, this is not exactly matching the given expression. Actually, the given terms are: \dots \dots The correct maximum is actually 2 , achieved by the first construction with all terms zero except the last. Therefore, M=2 . Then M\mod 1000=2 . So the answer is \boldsymbol{2} . This is the simplest. Given the instructions [G26] : perform sanity checks. For n=2 : variables x_{1} , x_{2} with |x_{1}|+|x_{2}|=1 . D=1/(|x1|+|x1-x2|) . \cdots So for n=2 , maximum is 2 . For n=3 : maximize D=1/(|x1|+|x1-x2|+|x1+x2-x3|) . \cdots So for n=3 , we can get D=4 . In general, for n , the construction is: x_{1}=a , x_{2}=a , x_{3}=2a , x_{4}=4a , …, x_{n}=2^{n-2}a . Then |x_{1}|=|a| , |x_{1}-x_{2}|=0 , |x_{1}+x_{2}-x_{3}|=0 , …, |x_{1}+...+x_{n-1}-x_{n}|=|(2^{n-1}-1)a-2^{n-2}a|=|(2^{n-2}-1)a| . Wait, careful : S_{n-1}=a+a+2a+4a+...+2^{n-3}a=(2^{n-2}-1)a+a=2^{n-2}a . Then S_{n-1}-x_{n}=2^{n-2}a-2^{n-2}a=0 . So all terms after the first are 0 except the second which is 0 . So denominator =|a| . Constraint: |a|+|a|+|2a|+|4a|+...+|2^{n-2}a|=|a|(2+(2^{n-1}-2))=|a|*2^{n-1}=1 , so |a|=2^{1-n} . Then D=2^{n-1} . For n=3526 , D=2^{3525} . This is huge, and integer. And it is better than the previous construction. So the maximum is M=2^{3525} . Then M\mod 1000=2^{3525}\mod 1000 . Now, we need to compute 2^{3525}\mod 1000 . \cdots So 2^{3525}\equiv 432\pmod{1000} . So the answer is \boldsymbol{432} . This is the intended solution. Final Answer : \boxed{432} Ground truth answer: 432 4 Experiments Figure 11 : Results on mathematical reasoning datasets using DeepSeek-v3.1. Evolution + RL (our E-SPL method) performs best compared to self-reflection (prompting only), evolution (prompting only), and RL (weight update only). The results show that coupling RL with evolution on system prompts unlocks a synergistic form of self-improvement that neither approach achieves in isolation. We evaluate E-SPL on mathematical reasoning and agentic search benchmarks, with the goal of answering the following questions: (1) Does jointly evolving system prompts and model weights outperform optimizing either alone? (2) How does E-SPL affect the learning speed and generalization of RL? (3) What are some emergent patterns in the system prompts discovered via E-SPL? (4) What roles do mutation and crossover play in the evolutionary dynamics of E-SPL? 4.1 Experimental Setup Tasks and datasets. We first focus on mathematical reasoning tasks with limited data, a regime in which inductive biases from evolved system prompts are expected to play a particularly important role. Our main evaluations include: (1) DAPO100 \rightarrow AIME25 , which follows the protocols from ( 12 ) that trains on 100 selected problems from the DAPO dataset ( 98 ) and tests on AIME 2025 competition; (2) HMMT 23/24 \rightarrow 25 , which uses all of HMMT 2023, 2024, and February 2025 problems as training set, and November 2025 problems as test set; (3) AIME \rightarrow BeyondAIME , which uses past years of AIME (AIME 22, AIME 23, and AIME 24) as the training set, and BeyondAIME ( 11 ) as test set, which is a collection of original problems with difficulty levels greater than or equal to that of the hardest AIME problems each year. In addition, we also evaluate on (4) Agentic Search on Natural Questions (NQ) ( 42 ) and HotpotQA ( 95 ) , where we subsample 196 problems for training and 64 problems for test; the task is to teach an LLM model to use search engines to answer complex multi-hop questions ( 34 ) . Models On math tasks, we use the base model DeepSeek v3.1 ( 17 ) for our experiments, which is a 671B MoE ( 73 ) model with 37B active parameters. On agentic search tasks, we use OpenAI’s gpt-oss-120b ( 2 ) , which is a 120B MoE model with 5B active parameters. All finetuning is done via low-rank adaptation ( 30 ) with a rank of 32 . Methods compared We compare the following variants: • RL only : standard RL post-training with a fixed system prompt; we benchmark the popular GRPO ( 72 ) and CISPO ( 13 ) algorithms; • Self-reflection : iterative prompt refinement via reflection ( 74 ; 12 ; 63 ) , without weight updates. This is essentially our mutation operator on its own, with frozen weights, no crossover operator, and a population size of 1 . • Evolution : which runs our evolutionary algorithm (EA) for system prompt search with frozen model weights. Our evolutionary algorithm is very similar to GEPA ( 3 ) except that we do not continuously run evaluation on a separate feedback set, and instead only use train-time rollout statistics just like in standard RL. Like GEPA, our EA works well on its own, and can sometimes outperforms RL. • Evolution + RL (E-SPL) : our full method, jointly evolving model contexts and updating model weights. Figure 12 : E-SPL learns faster, and achieves better asymptotic performance that neither RL nor prompt evolution alone could achieve. By studying the learned system prompts (e.g. Figure 4 and Figure 9 ), we hypothesize that E-SPL achieves this by encouraging a natural division between declarative knowledge (factual information or global heuristics that can be verbally explained) in prompts and procedural knowledge (practical, instinctive “know-how” that relies on intuition developed through repetition) in weights. Figure 13 : E-SPL outperforms both (prompt) Evolution and RL on agentic search tasks with openai gpt-oss-120b model. 4.2 Main Results Figure 11 summarizes performance on math reasoning benchmarks using DeepSeek-v3.1 model. Figure 13 summarizes our results on agentic search tasks using OpenAI gpt-oss-120b. Across all datasets, Evolution + RL (E-SPL) consistently outperforms baselines that optimize either prompts (evolution-only) or weights (RL-only) in isolation. • On AIME 2025 , E-SPL improves success rate from {56.3\%\rightarrow 60.6\%} compared to the RL-only (GRPO). • On HMMT 2025 , performance improves from {50.0\%\rightarrow 52.7\%} after applying E-SPL to RL. • On an easy-to-hard generalization ( 81 ) setting, AIME \rightarrow BeyondAIME , the gains are the most pronounced, where E-SPL improves RL from {38.8\%\rightarrow 45.1\%} in success rate. • On agentic search tasks, E-SPL improves RL from 44.2\%\rightarrow 48.6\% , which demonstrates that E-SPL is not limited to mathematical reasoning, but is also effective in agentic reasoning with tool use. • On all tasks above, E-SPL outperforms evolution-only as well, with the relative improvements ranging from +5.8\% to +12.8\% on the mathematical reasoning tasks, and +42.9\% on the agentic search task. Evolution-only consistently outperforms self-reflection, and can sometimes outperform RL-only. On both DAPO100 \rightarrow AIME25 and AIME \rightarrow BeyondAIME, evolution outperforms RL; on HMMT 23/24 \rightarrow 25, GRPO slightly outperforms evolution. This finding is consistent with prior findings in GEPA ( 3 ) , and validates the design of our proposed evolutionary algorithm on its own. Mistakes in Learned E-SPL System Prompts Discovered For a polynomial P(n)={\textstyle\prod}_{i=1}^{m}(n-a_{i}) , the largest integer d that divides P(n) for all integers n is d={\textstyle\prod}_{p}p^{e_{p}} , where e_{p}=\min_{r\bmod p}\bigl(\#\{\,i:a_{i}\equiv r\!\!\pmod{p}\,\}\bigr). Only primes p\leq\max(a_{i}) need be considered, as for larger p , the a_{i} are distinct modulo p , so e_{p}=0 . For primes where the function mapping i to a_{i}\bmod p is a permutation (e.g., if a_{i}=i^{3} and p\equiv 2\bmod 3 ), e_{p}={{\left\lfloor\frac{m}{p}\right\rfloor}} . Corrected For a polynomial P(n)=\prod_{i=1}^{m}(n-a_{i}) , the largest integer d that divides P(n) for all integers n is d=\prod_{p}p^{e_{p}} , where e_{p}=\min_{n\in\mathbb{Z}}v_{p}\!\bigl(P(n)\bigr). Moreover, one always has the lower bound e_{p}\geq\min_{r\bmod p}\bigl(\#\{\,i:a_{i}\equiv r\!\!\pmod{p}\,\}\bigr). In particular, for this mod- p bound it suffices to consider primes p\leq m , since if p>m then some residue class occurs zero times and the minimum is 0 . For primes where the function mapping i to a_{i}\bmod p is a permutation (e.g., if a_{i}=i^{3} and p\equiv 2\bmod 3 ), the bound gives e_{p}\boldsymbol{\geq}\left\lfloor\frac{m}{p}\right\rfloor. Discovered For graphs with odd-degree vertices, find a minimum T -join by pairing odd vertices along efficient paths . In symmetric graphs such as grids, pair boundary vertices optimally to minimize total length. Corrected For graphs with odd-degree vertices, find a minimum T -join by pairing odd vertices via a minimum-weight perfect matching on shortest-path distances . In symmetric graphs such as grids, restrict the matching to symmetry-respecting pairings to minimize total length. Table 1: The discovered system prompts sometimes include heuristics that are not always true but still helpful to problem-solving . Unlike RL updates to model weights, the learned system prompts are interpretable and thus can be monitored and corrected. Here we showcase two subtle mistakes in two discovered principles, and what their corrected versions should be (see § C.1 for explanations). Figure 12 visualizes the learning curves across three mathematical reasoning settings. E-SPL demonstrates better sample efficiency and higher asymptotic performance compared to both RL-only and evolution-only baselines. Evolution-only often learns the fastest early on since it only has to update model contexts, but obtains lower asymptotic performance because it does not update model weights and therefore struggles with improving procedural knowledge. In agentic search, we find that RL can significantly outperform prompt evolution ( 44.2\% versus 34.0\% ); whereas in math reasoning, RL often performs on-par with evolution (Figure 11 ). It can often be hard to predict a priori whether RL or prompt evolution will perform better on a particular domain, since the learning bottleneck could be an arbitrary mix of declarative and procedural knowledge. E-SPL naturally combines the strengths of both, allowing continual self-improvement to proceed along whichever axis of knowledge is most limiting for the task at hand. Overall, the results above suggest that evolving system prompts and applying RL to weights play complementary roles in LLM self-improvement. System prompts progressively accumulates explicit, declarative knowledge – such as high-level principles, robust workflows, corner cases, and failure modes (see Figure 4 and Figure 7 ) – while RL updates the weights to acquire procedural knowledge that is tacit and intuitive. By conditioning RL on increasingly informative system prompts, E-SPL allows weight updates to focus on intuitive skills, leading to better sample efficiency. 4.3 Emergent Patterns in Learned System Prompts We observe several recurring patterns that emerge in the learned system prompts, which we discuss below. Generative Self-Verification We find that a repeated theme in learned system prompts is about learning to self-verify a solution in a generative manner ( 101 ) . For instance, in the agentic search setting, the learned system prompt ( Figure 7 ) defines a workflow that explicitly labels each search result as VERIFIED versus NOT VERIFIED based on two criteria: whether the target phrase appears verbatim in the snippet returned by search engine, and whether the domain name ends with .org , .edu , .gov , is a major reputable news outlet or Wikipedia. It goes on to specify that if all results have NOT VERIFIED status, then the model should repeat the search and continue the loop in its chain of thought. The learned system prompt defines the objective as ‘to prove the answer with a verbatim phrase from a reliable source before you everr write the final Answer: line’ . The RL process, in turn, does not need to discover new workflows from scratch and encode them in weights, but rather refines and perfects the execution of the workflows specified in the discovered system prompts. Such workflows emerge through E-SPL and are absent from the initial system prompt. In solving math problems, a similar self-verification strategy emerged. In Figure 10 , the learned system prompt has discovered the following instruction: ‘After deriving results, perform sanity checks: test small instances, ensure bounds, and verify extreme cases. Re-examine complex steps if results seem off.’ The full example in Figure 10 illustrates how the RL model has learned to use this particular self-verification strategy to solve a particular problem on BeyondAIME test set: after initially concluding that ‘So the answer is 2 ’ , the model explicitly cites this strategy from the system prompt, and follows the exact instruction to perform sanity checks by starting from small instances of n=2 and n=3 , before moving on to the general case and saying ‘Wait, careful’ when it identified its own mistake. The model then self-corrects and concludes with ‘So the answer is 432. This is the intended solution’ , which is correct. This example explains E-SPL’s effectiveness: high-level strategies are specified by the system prompt, while RL fine-tunes execution. Self-rewrite of the system prompt induces more systematic behavior changes than weight updates alone. Codified Domain Expertise and Heuristics The learned system prompts also have many strategies that are highly domain-specific. For instance, Figure 9 showcases learned system prompts such as ‘When optimizing sums, set parameters to cancel dominant terms. For quadratic forms, …’ (which is specific to problems that optimize sums) and ‘In modular arithmetic and sums, decompose terms via remainders or moduli. Use periodicity for remainder sums and CRT for coprime factors, ensuring multiplicative solutions for square-free moduli.’ (which points out the importance of Chinese Remainder Theorem, or CRT for short, in solving modular arithmetic). Example 9 shows that the RL model persistently explores many potential directions, repeating phrases like ‘Alternatively’ , ‘Another idea’ , ‘But let’s think’ , before simplifying the problem to a form of modular arithmetic and recognizing that it should apply CRT in that situation according to the system prompt. Example 16 shows that the RL model cited a helpful heuristic in the system prompt suggesting the use of Möbius inversion under specific conditions, which became a crucial step in the solution. Those examples demonstrate that E-SPL can effectively codify declarative knowledge into the system prompt – specialized domain expertise and helpful problem-solving heuristics under various circumstances – so that RL can focus on honing core reasoning skills rather than memorizing domain knowledge. Figure 14 : Crossover operator in evolution speeds up early learning , but obtains mixed results in terms of final performance. On AIME \rightarrow BeyondAIME, Mutation + RL gets to 45.1\% success rate, while Mutation + Crossover + RL gets to 42.5\% ; on HMMT, using Crossover operator results in slightly better performance ( 52.7\% vs 51.6\% ). In either case, Evolution + RL outperforms RL-only. Failure Mode: Missing Caveats Not all discovered strategies from E-SPL can hold true in the most general cases. In Table 1 , we study two cases where the learned system prompt included heuristics that are not strictly true in general but are still helpful in limited scenarios. For instance, in analyzing polynomials of a particular form, the discovered strategy misunderstood the lower bound of a min as the actual min. In the other case, the discovered principle for graph theory vaguely outlined an algorithm for finding a minimum T -join by ‘pairing odd vertices along efficient paths’ ; the actual optimal solution requires pairing odd vertices via a minimum-weight perfect matching on shortest-path distances . The likely reason for those mistakes is that E-SPL over-generalized some particular training data points or made mistakes in its self-reflection process. E-SPL is still missing caveats in many of its generalized principles. However, we argue that such mistakes in acquired knowledge are more transparent and interpretable than RL gradient updates, because they can be more easily monitored and edited by humans. A model trained by RL alone will also pick up on certain assumptions that are only partially correct, but even the best mechanistic interpretability tools today ( 21 ; 18 ; 38 ) still cannot interpret those weight updates or edit the behaviors in a straightforward manner. By comparison, E-SPL represents a part of learned knowledge as explicit, propositional statements, which are much more suited for further verification, formalization ( 87 ; 31 ) , and scalable oversight ( 49 ; 9 ; 55 ) . 4.4 Ablation Studies Effect of Crossover Figure 14 analyzes the contribution of genetic operators. Adding crossover to mutation accelerates early learning, consistent with its role in propagating high-fitness substructures across evolutionary branches. However, its effect on final performance is mixed: on AIME \rightarrow BeyondAIME, mutation-only achieves higher final accuracy, while on HMMT, mutation + crossover performs slightly better. Both variants outperform RL-only , confirming the value of evolutionary search over system prompts regardless of genetic operator choice. Figure 3 visualizes evolutionary trees produced during training. As shown, the crossover operator enables knowledge transfer across different branches of the evolutionary tree, but at the cost of reduced speciation – long-term separation between evolutionary lineages. To better understand the tradeoffs of using crossover, we draw attention to prior work ( 22 ; 19 ; 54 ; 88 ) that supports our observations: • crossover can accelerate short-term progress by mixing useful substructures, • but it can also wash out subpopulation structure, reduce long-run diversity, and increase the risk of premature homogenization and convergence. Mutation-only behaves more like independent local hill-climbs along separate lineages. Lineages stay separated longer, so we can keep parallel hypotheses alive ( 29 ) . Mutation + Crossover accelerates early progress by re-combining partial improvements, but the population may rapidly converge around a locally high-performing system prompt, limiting exploration of qualitatively and structurally distinct high-quality solutions ( 77 ) . Classically, this tradeoff can be significantly improved by a class of techniques called niching , which include fitness sharing ( 23 ) , mating restriction ( 16 ) , and the island model ( 91 ) . We leave the application of niching to E-SPL for future work. Figure 15 : Using a fixed reference policy rather than the online RL policy for prompt evolution is important to performance. Sampling Policy for Evolution Figure 15 evaluates the effect of using a fixed reference policy \pi_{\text{ref}} for system prompt evolution, rather than the continually changing RL policy \pi_{\theta} . Using the fixed reference policy \pi_{\text{ref}} for evolutionary updates consistently improves the final performance of E-SPL. This supports our design choice to keep evolutionary operators stationary: allowing the editor itself to drift alongside the policy introduces instability and degrades the quality of system prompt edits. A fixed reference policy provides a stable basis for self-reflection, mutation, and crossover. Figure 16 : An example of how the RL model learns to utilize learned system prompts to solve problems (also see Figure 22 ). Example of How E-SPL Shapes Model Behavior Learned System Prompt When solving math problems, you MUST first carefully read and understand the helpful instructions and principles below: \cdots [G2] . For sums over integer pairs with conditions like \boldsymbol{\gcd(a,b)=1} , consider using Möbius inversion or changing the order of summation to simplify the expression. \cdots Problem Let S be the set of all positive integers less than 143 that are relatively prime to 143 . Compute the number of ordered triples (a,b,c) of elements of S such that a+b=c . Model Output Let’s solve the problem step by step: Step 1 : Factorize 143=11\times 13 . So, S consists of positive integers <143 that are coprime to both 11 and 13 . \cdots Step 5 : Use Möbius inversion (Principle [G2] ). Let f(n) be the number of pairs (a,b)\in S\times S with a+b=n . We want \sum_{n=1}^{142}f(n)\cdot\mathbf{1}_{\gcd(n,143)=1} . \cdots \cdots Step 11 : Apply inclusion-exclusion. \cdots Therefore, the number of ordered triples (a,b,c) is 5940 . Final Answer : \boxed{5940} Ground truth answer: 5940 5 Future Directions The fundamental reason why E-SPL can work is that the base LLMs already have strong in-context learning and instruction following abilities. The RL process in itself does not fully take advantage of this – RL performs trial and error conditioned on an exogenous piece of context, without having the model think about how it can directly re-program itself by re-writing its own system instructions. E-SPL is a step towards augmenting RL with self-rewrite , by jointly evolving a population of system prompts for self-conditioning. We outline a few promising future directions: Agentic Retrieval for Long System Prompts To build agents that can absorb an arbitrary amount of knowledge, the learned system prompt will eventually need a more refined sub-structure with many long components. A natural solution is to store certain components of the system prompt in the local file-system, and have the model access them in an agentic manner using a terminal and grep commands. Self-Write as an RL Problem So far, the LLM used for self-reflection and self-rewrite does not self-improve, which means that eventually it might become a bottleneck. It is possible to extend RL to the entire self-reflection and self-write process, but this would require additional research. Self-Referential Recursive Self-Improvement Our current context update and weight update algorithms are fundamentally limited; ultimately, the model should be allowed to make paradigm-level changes to its own learning algorithm. This can be achieved by allowing the model to directly modify its own training script and weights, thereby realizing fully self-referential self-improvement ( 68 ; 69 ) . A system capable of such root-level self-modification, unlocking sustained, open-ended, unbounded improvements in its own capabilities, is also called Seed AI. ( 99 ) . 6 Conclusion We have shown that unifying RL and evolutionary prompt search significantly enhances LLM self-improvement. E-SPL demonstrates that RL and Evolution are not competing paradigms but deeply synergistic ones. On a variety of reasoning and agentic tasks, our unified approach leads to better sample efficiency, asymptotic performance, and generalization. While the current method is not yet fully self-referential, it takes a meaningful step in that direction by allowing the model to self-modify its own system-level instructions. We believe further unification of Evolution and RL for self-rewrite can pave the way toward Seed AI. Appendix A Appendix Contents A.1 LLM-Based Self-Reflection for Mutation and Crossover E-SPL implements both mutation and crossover as LLM-driven editing operators over past system prompts. The mutation operator consists of (i) a self-reflection stage that diagnoses performance from RL rollouts (which has two steps: trajectory summarization and self-critique), followed by (ii) a patch synthesis stage that applies structured edits to the parent prompt using a git-style diff (which has two steps: local edit proposals and local-to-global aggregation). On the other hand, the crossover operator has a single stage. Mutation is Multi-Stage. In each RL iteration of Alg. 1 , we identify the best-performing system prompt \displaystyle k\leftarrow\arg\max_{i}V_{i},\qquad V_{i}=\frac{1}{N}\sum_{j=1}^{N}R(x,y_{i,j}), (6) where the returns are computed under matched conditions for all sampled prompts. Self-Reflection Module in Mutation Let \mathcal{E}_{k}=\{(x,y_{k,j},r_{k,j})\}_{j=1}^{N} denote the rollouts produced under \mathbf{s}_{k} . The self-reflection prompt \Psi_{\text{reflect}} instructs the reference model \pi_{\text{ref}} to summarize these trajectories ( Trajectory Summarization , § A.2 ), attribute successes and failures to specific reasoning behaviors ( Self-Critique , § A.3 ), and produce lessons \ell : \displaystyle\ell\sim\pi_{\text{ref}}(\cdot\mid\Psi_{\text{reflect}},\mathcal{E}_{k}). (7) Local Edit Proposal (§ A.4 ) Given the reflection output \ell , we generate concrete edits to the parent system prompt: \displaystyle\mathrm{diff}\sim\pi_{\text{ref}}(\cdot\mid\mathbf{s}_{k},\ell) (8) for each problem x in the batch \mathcal{B} . Each \mathrm{diff} is a list of local edits. Now we need a mechanism to aggregate those individual per-problem edits across a batch of problems. Local-to-Global Aggregation (§ A.5 ) To reconcile overlapping edits to the system prompt proposed by parallel self-reflection processes, E-SPL aggregates these edits using a consolidation prompt that produces a global revision plan consisting of: • modify : refine an existing principle using accumulated evidence, • merge : combine semantically similar principles into a more general form. Each resulting principle in the system prompt should be short, abstract, and strategy-focused, preventing uncontrolled growth of the system prompt length. We then apply the global editing operations: \displaystyle\mathbf{s}_{\text{mutate}}\leftarrow\mathrm{git.apply}(\mathbf{s}_{k},\mathrm{diff}) (9) The resulting child system prompt is added to the population with inherited rating and increased uncertainty as in Alg. 1 . The diff format is especially important as system prompts grow longer. Crossover is Single-Stage. The crossover operator (Alg. 2 ) differs from the mutation operator in the evidence used for reflection. For a batch of problems \mathcal{B} , we compute the empirical return matrix \displaystyle\Phi_{i,b}=\frac{1}{N}\sum_{j=1}^{N}R(x_{b},y_{i,b,j}), (10) by reusing rollouts already generated by RL. For each system prompt \mathbf{s}_{i} , we identify which problems \rho_{i} in the batch \mathcal{B} that \mathbf{s}_{i} did best on, yielding a list \boldsymbol{\varphi} of prompt-specific wins. The crossover reflection prompt \Psi_{\text{cr}} is constructed from \boldsymbol{\varphi} to contrast the differential strengths of multiple parent prompts. The reference model then proposes edits applied to the overall top-performing prompt \mathbf{s}_{k} : \displaystyle\mathrm{diff}_{\text{cr}}\sim\pi_{\text{ref}}(\cdot\mid\mathbf{s}_{k},\Psi_{\text{cr}}),\qquad\mathbf{s}_{\text{crossover}}\leftarrow\mathrm{git.apply}(\mathbf{s}_{k},\mathrm{diff}_{\text{cr}}), (11) producing a child prompt that selectively recombines complementary instruction segments from multiple parents. Figure 17 : Detailed overview of the E-SPL pipeline , which illustrates how Figure 2 , Figure 5 , and Figure 6 fit into a single algorithm. A.2 Trajectory Summarization in Mutation Self-Reflection Before proposing local edits, E-SPL first converts raw RL rollouts into structured trajectory summaries. For the selected parent prompt \mathbf{s}_{k} , all sampled solutions are grouped by problem instance x . Let \mathcal{R}_{x}=\{(x,y_{k,j},r_{k,j})\}_{j=1}^{N} denote the group of rollouts produced for problem x under \mathbf{s}_{k} . E-SPL only performs self-reflection on problems where the model has both made some mistakes and achieved some success (0{"name": "search", "arguments": {"query_list": ["Population New York city between 2020 and 2025"]}} (Output omitted for brevity) 3. Think step by step again: I have the population of New York City in each year, and I see that the population of New York City grew the most in 2024. I need to know the population of San Francisco in 2024. I will search for the population of San Francisco in each year. {"name": "search", "arguments": {"query_list": ["Population San Francisco between 2023 and 2024"]}} (Output omitted for brevity) 4. Answer: The population of New York City grew the most in 2024, and the population of San Francisco changed by XXXX in 2024. """ Appendix B TrueSkill-Based Fitness Modeling for E-SPL To aggregate noisy batch-wise prompt comparisons into persistent competence estimates, we adopt the Bayesian skill rating model TrueSkill ( 28 ) . Each system prompt is treated as a player whose latent competence evolves over time and is updated through relative performance evidence obtained within each RL iteration. Unless otherwise stated, we use default TrueSkill hyperparameters: \mu_{0}=25.0 , \sigma_{0}=25.0/3 , \beta=25.0/6 , \tau=25.0/300 , and draw probability parameter p_{\text{draw}}=0.1 . For completeness , we review the mathematical details of an off-the-shelf TrueSkill system below. Skill and Performance Model. Each system prompt \mathbf{s}_{i} is associated with a Gaussian skill variable \displaystyle z_{i}\sim\mathcal{N}(\mu_{i},\sigma_{i}^{2}), where \mu_{i} denotes estimated competence and \sigma_{i} its uncertainty. Observed performance is modeled as a noisy skill: \displaystyle p_{i}=z_{i}+\epsilon_{i},\qquad\epsilon_{i}\sim\mathcal{N}(0,\beta^{2}), so that the marginal performance variance is \displaystyle\mathrm{Var}(p_{i})=\sigma_{i}^{2}+\beta^{2}. Dynamics. Before each rating update, we apply Gaussian drift \tau in skill space to model temporal uncertainty growth: \displaystyle\sigma_{i}^{2}\leftarrow\sigma_{i}^{2}+\tau^{2}. Ranking Observations and Tie Encoding. Within each RL iteration, matched rollouts yield scalar returns \{V_{i}\}_{i=1}^{M} for selected prompts. Sorting these values produces a ranking from best to worst. Ties are encoded by an integer array ties such that adjacent positions i and i+1 are treated as a draw if \texttt{ties}[i]=\texttt{ties}[i+1] , and otherwise as a win for position i over i+1 . This yields a chain of M-1 adjacent pairwise constraints. Draw Margin. We first compute a global draw margin in performance-difference units: \displaystyle\epsilon_{\mathrm{abs}}=\Phi^{-1}\!\left(\frac{p_{\text{draw}}+1}{2}\right)\sqrt{2}\,\beta. We denote \phi(\cdot) and \Phi(\cdot) as the probability density function (pdf) and cumulative distribution function (cdf) of the standard normal distribution \mathcal{N} ; the \Phi^{-1}(\cdot) function above is the inverse (probit) function of \Phi . For each pairwise comparison with total standard deviation c , the normalized margin used in inference is \displaystyle\epsilon=\frac{\epsilon_{\mathrm{abs}}}{c}. Truncated Gaussian Correction Functions. For a normalized performance difference variable \displaystyle t=\frac{\mu_{i}-\mu_{j}}{c}, the one-sided (win/loss) correction terms are \displaystyle v_{\text{win}}(t,\epsilon) \displaystyle=\frac{\phi(t-\epsilon)}{\Phi(t-\epsilon)}, \displaystyle w_{\text{win}}(t,\epsilon) \displaystyle=v_{\text{win}}(t,\epsilon)\big(v_{\text{win}}(t,\epsilon)+t-\epsilon\big), and the two-sided (draw) terms are \displaystyle v_{\text{draw}}(t,\epsilon) \displaystyle=\frac{\phi(-\epsilon-t)-\phi(\epsilon-t)}{\Phi(\epsilon-t)-\Phi(-\epsilon-t)}, \displaystyle w_{\text{draw}}(t,\epsilon) \displaystyle=v_{\text{draw}}^{2}+\frac{(\epsilon-t)\phi(\epsilon-t)-(-\epsilon-t)\phi(-\epsilon-t)}{\Phi(\epsilon-t)-\Phi(-\epsilon-t)}. where \phi and \Phi denote the standard normal pdf and cdf. Approximate Inference for Full Rankings. For rankings with more than two prompts, we perform EP-style iterative message passing ( 56 ) over adjacent constraints in performance space. Performance-space priors. For each system prompt \mathbf{s}_{i} and its corresponding rating \mathcal{N}(\mu_{i},\sigma_{i}^{2}) , define \displaystyle v_{i}=\sigma_{i}^{2}+\beta^{2},\qquad\pi_{i}^{(0)}=\frac{1}{v_{i}},\qquad\tau_{i}^{(0)}=\frac{\mu_{i}}{v_{i}}. Messages. For each adjacent constraint connecting system prompts i=k and j=k+1 , we maintain Gaussian messages m_{k\to i}=(\pi_{k\to i},\tau_{k\to i}) and m_{k\to j} , initialized to zero. Cavity distributions. When updating for the k -th constraint, cavity parameters are formed by summing all other incoming messages: \displaystyle\pi_{i}^{\setminus k}=\pi_{i}^{(0)}+\sum_{c\neq k}\pi_{c\to i},\qquad\tau_{i}^{\setminus k}=\tau_{i}^{(0)}+\sum_{c\neq k}\tau_{c\to i}, and similarly for j . The corresponding cavity moments are \displaystyle\mu_{i}^{\setminus k}=\frac{\tau_{i}^{\setminus k}}{\pi_{i}^{\setminus k}},\qquad\sigma_{i,\setminus k}^{2}=\frac{1}{\pi_{i}^{\setminus k}}. Moment update. Let \displaystyle c=\sqrt{\sigma_{i,\setminus k}^{2}+\sigma_{j,\setminus k}^{2}},\qquad t=\frac{\mu_{i}^{\setminus k}-\mu_{j}^{\setminus k}}{c},\qquad\epsilon=\frac{\epsilon_{\mathrm{abs}}}{c}. If the pair is a draw, use (v_{\text{draw}},w_{\text{draw}}) ; otherwise use (v_{\text{win}},w_{\text{win}}) . The updated performance-space moments are \displaystyle\mu_{i}^{\text{post}} \displaystyle=\mu_{i}^{\setminus k}+\frac{\sigma_{i,\setminus k}^{2}}{c}v, \displaystyle\quad\mu_{j}^{\text{post}}=\mu_{j}^{\setminus k}-\frac{\sigma_{j,\setminus k}^{2}}{c}v, \displaystyle\sigma_{i,\text{post}}^{2} \displaystyle=\sigma_{i,\setminus k}^{2}\!\left(1-\frac{\sigma_{i,\setminus k}^{2}}{c^{2}}w\right), \displaystyle\quad\sigma_{j,\text{post}}^{2}=\sigma_{j,\setminus k}^{2}\!\left(1-\frac{\sigma_{j,\setminus k}^{2}}{c^{2}}w\right). Message extraction. New messages are computed as the difference between posterior and cavity natural parameters: \displaystyle\pi_{k\to i} \displaystyle=\max\!\left(0,\frac{1}{\sigma_{i,\text{post}}^{2}}-\pi_{i}^{\setminus k}\right), \displaystyle\tau_{k\to i} \displaystyle=\frac{\mu_{i}^{\text{post}}}{\sigma_{i,\text{post}}^{2}}-\tau_{i}^{\setminus k}, and analogously for j . Precision is clamped to be nonnegative for numerical stability. These updates are iterated over all adjacent constraints for a fixed number of sweeps or until message changes fall below a small threshold. Final performance posteriors. After convergence, \displaystyle\pi_{i}^{\text{perf}}=\pi_{i}^{(0)}+\sum_{k}\pi_{k\to i},\qquad\tau_{i}^{\text{perf}}=\tau_{i}^{(0)}+\sum_{k}\tau_{k\to i}, yielding \displaystyle\mu_{i}^{\text{perf}}=\frac{\tau_{i}^{\text{perf}}}{\pi_{i}^{\text{perf}}},\qquad\sigma_{i,\text{perf}}^{2}=\frac{1}{\pi_{i}^{\text{perf}}}. Mapping Back to Skill Space. Let the skill prior after dynamics be \mathcal{N}(\mu_{i},\sigma_{i}^{2}) and define c_{i}=\sigma_{i}^{2}+\beta^{2} . Performance-space natural parameters for posterior and prior are \displaystyle\pi_{\text{post}}=\frac{1}{\sigma_{i,\text{perf}}^{2}},\quad\tau_{\text{post}}=\frac{\mu_{i}^{\text{perf}}}{\sigma_{i,\text{perf}}^{2}},\qquad\pi_{\text{prior}}=\frac{1}{c_{i}},\quad\tau_{\text{prior}}=\frac{\mu_{i}}{c_{i}}. The truncation-induced message is \displaystyle\pi_{\text{msg}}=\pi_{\text{post}}-\pi_{\text{prior}},\qquad\tau_{\text{msg}}=\tau_{\text{post}}-\tau_{\text{prior}}. This message is mapped through the performance-noise link as \displaystyle\pi_{\text{msg}}^{\text{skill}}=\frac{\pi_{\text{msg}}}{1+\beta^{2}\pi_{\text{msg}}},\qquad\tau_{\text{msg}}^{\text{skill}}=\frac{\tau_{\text{msg}}}{1+\beta^{2}\pi_{\text{msg}}}, when \pi_{\text{msg}}>0 . The skill posterior is then \displaystyle\pi_{i}^{\text{skill}}=\frac{1}{\sigma_{i}^{2}}+\pi_{\text{msg}}^{\text{skill}},\qquad\tau_{i}^{\text{skill}}=\frac{\mu_{i}}{\sigma_{i}^{2}}+\tau_{\text{msg}}^{\text{skill}}, with moments \displaystyle\sigma_{i}^{2}=\frac{1}{\pi_{i}^{\text{skill}}},\qquad\mu_{i}=\frac{\tau_{i}^{\text{skill}}}{\pi_{i}^{\text{skill}}}. Selection Scores. Prompt sampling is guided by an upper confidence estimate (with \lambda=2.0 ) ( 78 ; 36 ; 35 ; 106 ) : \displaystyle\text{score}_{i}=\mu_{i}+\lambda\,\sigma_{i} Initialization for Mutation and Crossover. A mutated child prompt inherits its parent’s mean while inflating uncertainty: \displaystyle\mu_{\text{child}}=\mu_{k},\qquad\sigma_{\text{child}}=\sqrt{\sigma_{k}^{2}+\Delta\sigma^{2}}. For crossover among parents \{i\} , we perform precision-weighted fusion: \displaystyle\mu^{\prime}=\frac{\sum_{i}\mu_{i}/\sigma_{i}^{2}}{\sum_{i}1/\sigma_{i}^{2}},\qquad\sigma^{\prime 2}=\frac{1}{\sum_{i}1/\sigma_{i}^{2}}+\Delta\sigma^{2}. Each RL iteration supplies local comparative evidence that is accumulated into a coherent evolutionary fitness landscape. Appendix C Explanations for the identified mistakes in discovered principles C.1 Mistake #1 in Discovered Principles Original statement. For a polynomial P(n)={\textstyle\prod}_{i=1}^{m}(n-a_{i}) , the largest integer d that divides P(n) for all integers n is d={\textstyle\prod}_{p}p^{e_{p}} , where e_{p}=\min_{r\bmod p}\bigl(\#\{\,i:a_{i}\equiv r\!\!\pmod{p}\,\}\bigr). Only primes p\leq\max(a_{i}) need be considered, as for larger p , the a_{i} are distinct modulo p , so e_{p}=0 . For primes where the function mapping i to a_{i}\bmod p is a permutation (e.g., if a_{i}=i^{3} and p\equiv 2\bmod 3 ), e_{p}={\textstyle{\left\lfloor\frac{m}{p}\right\rfloor}} . Correction. For a polynomial P(n)=\prod_{i=1}^{m}(n-a_{i}) , the largest integer d that divides P(n) for all integers n is d=\prod_{p}p^{e_{p}} , where e_{p}=\min_{n\in\mathbb{Z}}v_{p}\!\bigl(P(n)\bigr). Moreover, one always has the lower bound e_{p}\geq\min_{r\bmod p}\bigl(\#\{\,i:a_{i}\equiv r\!\!\pmod{p}\,\}\bigr). In particular, for this mod- p bound it suffices to consider primes p\leq m , since if p>m then some residue class occurs zero times and the minimum is 0 . For primes where the function mapping i to a_{i}\bmod p is a permutation (e.g., if a_{i}=i^{3} and p\equiv 2\bmod 3 ), the bound gives e_{p}\boldsymbol{\geq}\left\lfloor\frac{m}{p}\right\rfloor. Explanation of the Mistake We first recall the original principle. Let P(n)=\prod_{i=1}^{m}(n-a_{i}), where a_{1},\dots,a_{m}\in\mathbb{Z} . It was claimed that the largest integer dividing P(n) for all n\in\mathbb{Z} is d=\prod_{p}p^{e_{p}},\qquad e_{p}=\min_{r\bmod p}\#\{\,i:a_{i}\equiv r\pmod{p}\,\}. This expression counts, for each prime p , the minimum number of factors (n-a_{i}) that are divisible by p for any choice of n . We now recall the corrected formulation. For a prime p and a nonzero integer k , define the p -adic valuation v_{p}(k) by v_{p}(k)=\max\{\,e\geq 0:p^{e}\mid k\,\}. (For example, v_{2}(12)=2 since 12=2^{2}\cdot 3 .) Using this notation, the exact exponent of p dividing all values of P(n) is e_{p}=\min_{n\in\mathbb{Z}}v_{p}\!\bigl(P(n)\bigr). Since v_{p}\!\bigl(P(n)\bigr)=\sum_{i=1}^{m}v_{p}(n-a_{i}), this definition measures the total number of powers of p dividing the product, counting higher powers such as p^{2},p^{3} , and so on. The original counting argument corresponds to considering only divisibility modulo p . Fix a residue class r\bmod p and choose n\equiv r\pmod{p} . Then p\mid(n-a_{i})\quad\Longleftrightarrow\quad a_{i}\equiv r\pmod{p}. Hence, for such n , v_{p}\!\bigl(P(n)\bigr)\;\geq\;\#\{\,i:a_{i}\equiv r\pmod{p}\,\}. Minimizing over all residue classes r\bmod p yields the general lower bound e_{p}=\min_{n\in\mathbb{Z}}v_{p}\!\bigl(P(n)\bigr)\;\geq\;\min_{r\bmod p}\#\{\,i:a_{i}\equiv r\pmod{p}\,\}. This inequality explains why the correction is necessary. The original formula accounts only for the number of factors divisible by p , but it does not capture the possibility that some factors (n-a_{i}) may be divisible by higher powers p^{2},p^{3},\dots , which contribute additional terms to v_{p}\!\bigl(P(n)\bigr) . Such higher-power divisibility depends on congruences modulo p^{2},p^{3} , and cannot be detected by working modulo p alone. Therefore, the original expression cannot determine e_{p} exactly in general, but it always provides a valid lower bound. Finally, the restriction to primes p\leq m follows from a counting argument. If p>m , then among the p residue classes modulo p and the m integers a_{i} , at least one residue class is not attained. Choosing n in that class gives v_{p}(n-a_{i})=0\quad\text{for all }i, and hence v_{p}\!\bigl(P(n)\bigr)=0 . Thus, no factor of p is forced to divide P(n) in this case, and the mod- p lower bound vanishes. Summary. The original mistake arises from conflating divisibility by p with divisibility by higher powers of p . Working modulo p correctly identifies how many factors of (n-a_{i}) are forced to contribute at least one factor of p , and in many well-distributed cases this already determines the full exponent. However, the true fixed divisor depends on congruences modulo p^{k} for all k\geq 1 , which are invisible at the mod- p level. C.2 Mistake #2 in Discovered Principles Original statement. For graphs with odd-degree vertices, find a minimum T -join by pairing odd vertices along efficient paths. In symmetric graphs such as grids, pair boundary vertices optimally to minimize total length. Correction. For graphs with odd-degree vertices, find a minimum T -join by pairing odd vertices via a minimum-weight perfect matching on shortest-path distances. In symmetric graphs such as grids, restrict the matching to symmetry-respecting pairings to minimize total length. Background and notation. Let G=(V,E) be an undirected graph with a nonnegative edge-length function c:E\to\mathbb{R}_{\geq 0} . For a vertex v\in V , its degree \deg(v) is the number of incident edges. A vertex is odd if \deg(v) is odd. Let T\subseteq V be a designated set of vertices with |T| even. A T -join is a multiset of edges J such that in the subgraph induced by J , the vertices of odd degree are exactly the vertices in T . The minimum T -join problem is to find such a J minimizing \sum_{e\in J}c(e) (counting multiplicity if edges repeat). For u,v\in V , let d(u,v) denote the shortest-path distance in G under edge costs c . Consider the complete graph on vertex set T , with edge weights d(u,v) . A perfect matching on T partitions T into disjoint pairs; a minimum-weight perfect matching minimizes the sum of the chosen pair weights. Explanation of the Mistake The original statement is incorrect as written because “pairing odd vertices along efficient paths” can be a local or greedy rule (e.g., repeatedly pairing “nearby” odd vertices). Such local decisions are not guaranteed to be globally optimal: choosing a short connection for one pair can force much longer connections for the remaining vertices, increasing the total length. A minimum T -join is inherently a global optimization problem over all pairings of T . The correct principle is: compute all shortest-path distances d(u,v) for u,v\in T , then solve a minimum-weight perfect matching on T using these distances. Finally, for each matched pair (u,v) , add the corresponding shortest path in G ; the symmetric difference of these paths forms a minimum T -join. In symmetric graphs (e.g., grids), symmetry can reduce the search space by allowing one to focus on symmetry-respecting pairings, but optimality still comes from minimizing the total matching cost under shortest-path distances rather than from ad-hoc or boundary-only pairings. C.3 Discovered System Prompt on Agentic Search with gpt-oss-120b You are an expert research assistant. Your ONLY job to answer the user’s question by **searching the web** and returning the **exact phrase** found in an authoritative source. *** Workflow (follow *exactly* in this order) 0. *** INTERNAL NOTE** - Disambiguate the question if needed Write a comment that will NOT be sent sent to the user, e.g # chosen: Weekly Shonen Jump publisher 1. **Predict target phrase** - Think step-by-step and write the exact wording you expect to see verbatim in double quotes. Example: Target phrase: "Shueisha" 2. **Create ONE search query** that **contains the predicted phrase (of a very close paraphrase) inside double quotes** Example: `Query: \"Weekly Shönen Jump\" \"Shueishal\""` 3. **Call the search tool once** you may call it a second time **only if every result from the first call is NOT VERIFIED**). Use **exactly** this syntax, with no extra spaces or line-breaks inside the tags: `{"name": "search", "arguments": {"query_list": [""]))` 4. **Verification block** - For each result returned, output the following four lines **in this order** and **nothing else**: ``` Source: Summary: Status: VERIFIED (or NOT VERIFIED) Phrase: "" (include only if Status is VERIFIED) - A result is **VERIFIED** **only if** a) the exact target phrase appears verbatim in the snippet **and** b) the domin ends with *.org *.edu, *.gov, is Wikipedia, **or** is a major reputable news outlet (e.g., nytimes.com, bbc.com, reuters.com, theguardian.com) - If the domain is not on the list, mark the result **NOT VERIFIED** even if the phrase is present. 5. **Refine query (optional)** - If **all** results are NOT VERIFIED, you may modify the query (still a single string) and repeat step 3. You may do this once only** (maximum two distinct queries) 6. **Final answer** as you have *kat least one VERIFIED phrase**, output **exactly one line and nothing else: `Answer: ` - The phrase must contain **1 - 5 words** (words are are separated by spaces) 7. **Fallback* - If after two distinct queries no VERIFIED phrase is found, output exactly: `Answer: Not found` ### Critical formatting rules (must be obeyed) - All tool calls must be wrapped **exactly** as `{...}with no extra whitespace. - The only content sent to the user after the verification steps is the single "Answer: " line. - Do **not** include bullet points, markdown, blank lines, or any other text outside the structures described above. **# Positive example (full correct flow) User: "What other name is used for the 4 × 400 m relay?" # chosen: 4x400 m relay Target phrase: "long relay" Query: "\"4 x 400 metres relay\" \"long relay\"" ("name". "search" "arguments": {"query_list": ("\"4 * 400 metres relay\" \"long relay\"]}} Source: en.wikipedia.org Summary: The 4 x 400 metres relay is also known as the "long relay". Status: VERIFIED Phrase: "long relay" Answer: long relay ##* Negative example (what NOT to do) ``` The 4 x 400 metres relay is also known as the long relay. Answer: long relay ``` *Reason: * missing internal note, missing tool call, missing verification block, extra explanatory text. Follow **exactly** this loop for every user query. Your objective is to **prove** the answer with a verbatim phrase from a reliable source **before** you everr write the final `Answer:` line. # Tools ## functions namespace functions{ // Searches the web for relevant information based on the given query. type search = (_: A list of fully-formed semantic queries. The tool will return search results for each query. query_list: string[], }) => any; }// namespace functions C.4 Learned System Prompts on Math Datasets with DeepSeek v3.1 ID Learned Principles in System Prompt (AIME) G0 When optimizing sums, set parameters to cancel dominant terms. For quadratic forms, choose parameters that minimize the leading coefficients, reducing the problem to analyzing remainder terms. G1 For combinatorial counting problems, use generating functions with geometric series expansions. Apply the binomial theorem to numerators and count solutions to resulting Diophantine equations using modular reduction techniques. Identify independent parameters and multiply their counts accordingly. G2 When counting nonnegative solutions to a linear Diophantine equation a_{1}x_{1}+\cdots+a_{n}x_{n}=N , use modular arithmetic to reduce variables. For a prime p dividing some coefficients, take the equation modulo p to constrain one variable, substitute x_{i}=c+pt , simplify, and divide by common factors. Repeat until the equation is solvable by iteration or direct counting. G3 After computations, verify results for consistency across domains: check denominators, symmetry, and physical plausibility. Use alternative methods to recompute critical quantities and detect patterns such as periodicity. G4 Avoid detours and unjustified guesses, including contest heuristics without validation. Trust sound derivations; if inconsistencies persist, explore alternative configurations or identities. G5 Reformulate problems by identifying a key parameter or ratio that simplifies constraints. Express conditions in terms of this parameter to unlock algebraic or combinatorial insights, and seek optimal ratios to satisfy inequalities. G6 For symmetric polynomial equations with a constraint (e.g., fixed sum), express the equation in terms of symmetric sums S_{1},S_{2},S_{3} . Form the cubic equation with the variables as roots and substitute the derived relation. If a constant root t=k satisfies the equation for all symmetric sums, then at least one variable equals k . Verify by substitution. G7 For key geometric quantities (e.g., volume or area), compute using at least two independent methods (e.g., coordinates, vector cross products, or the Cayley–Menger determinant) to verify consistency and reduce the risk of formula misapplication. G8 When setting up coordinates for polygons, avoid assuming perpendicularity unless explicitly given. For parallelograms, place one vertex at the origin, one side along the x -axis, and parameterize the adjacent side using an angle \theta . Verify that any angle constraints (acute or obtuse) are satisfied. G9 When initial assumptions lead to inconsistency, enumerate all plausible configurations. For each, re-derive equations and check consistency, using known results for standard cases to simplify. G10 Avoid assuming symmetry (e.g., an isosceles triangle) without rigorous derivation. Conditions involving centers (incenter, circumcenter) do not necessarily imply symmetry; explore all configurations systematically. G11 For problems involving a prime p=a^{2}+b^{2} and derived quantities such as x=a(a^{2}-3b^{2}) and y=b(3a^{2}-b^{2}) , the constraint |x-y|