Evolutionary System Prompt Learning for Reinforcement Learning in LLMs
Organizations: Department of Computer Science, University of Toronto · Department of Statistics and Data Science, Northwestern University · Bridgewater AIA Labs
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 BeyondAIME) generalization setting, E-SPL improves RL success rate from 38.8% 45.1% while also outperforming reflective prompt evolution (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: https://github.com/LunjunZhang/E-SPL
Figures & tables
| Mistakes in Learned E-SPL System Prompts | |
|---|---|
| Discovered | For a polynomial , the largest integer that divides for all integers is , where Only primes need be considered, as for larger , the are distinct modulo , so . For primes where the function mapping to is a permutation (e.g., if and ), . |
| Corrected | For a polynomial , the largest integer that divides for all integers is , where Moreover, one always has the lower bound In particular, for this mod- bound it suffices to consider primes , since if then some residue class occurs zero times and the minimum is . For primes where the function mapping to is a permutation (e.g., if and ), the bound gives |
| Discovered | For graphs with odd-degree vertices, find a minimum -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 -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. |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| 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 , use modular arithmetic to reduce variables. For a prime dividing some coefficients, take the equation modulo to constrain one variable, substitute , 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. |
| ID | (Continued) Learned Principles in System Prompt (AIME) |
|---|---|
| G19 | For bipartite grid graphs with residue constraints, first count valid assignments on one part using multinomial coefficients. Then determine the number of valid assignments on the other part, which is often constant due to symmetry. |
| G20 | For problems with equal angles from boundary points to an interior point, use rotations to express the interior point as a rotated vector from each boundary point. Equating these expressions yields solvable relations via spiral similarity. |
| G21 | For tilted polyhedra with given vertex heights and a horizontal water surface, use vector representations. Express heights via dot products with the vertical vector and compute submerged volume by integrating over the unit cube or via geometric dissection. |
| G22 | In modular arithmetic and sums, decompose expressions using residues and periodicity. Apply the Chinese Remainder Theorem for coprime moduli and multiplicativity for square-free cases. |
| G23 | For circle geometry, use power of a point, perpendicular bisectors, and homothety. Exploit symmetry to simplify equations and avoid sign errors. |
| G24 | In symmetric probabilistic problems, use complementary probability and symmetry to reduce cases. Verify that no hidden asymmetries remain and compute failure probabilities carefully. |
| ID | Learned Principles in System Prompt (DAPO) |
|---|---|
| G0 | In symmetric problems, assume an ordering of variables to reduce cases. Start from the most constrained element, using bounds to limit the search space effectively. |
| G1 | When a bound is stated as “does not exceed ,”, default to unless specified otherwise. This resolves common contest-style ambiguity. |
| G2 | For assignment problems with constraints, enumerate valid distributions first. Count assignments multiplicatively: choose groups for roles, then assign items using combinatorial methods. |
| G3 | For subset problems with coprimality conditions, construct maximal invalid sets. Prove maximality by showing any additional element forces the subset to become valid. |
| G4 | For geometric problems with integer coordinates, translate conditions into algebraic equations. Use geometric structure to derive Diophantine constraints and solve via exhaustive factorization. |
| G5 | To verify modular injectivity, factor differences and check that the cofactor is nonzero modulo the modulus. For complex cases, test small primes; derivative-based criteria can be sufficient but are not necessary. |
| ID | Learned Principles in System Prompt (HMMT) |
|---|---|
| G0 | When dealing with geometric constraints, model positions using vectors or coordinates to interpret distances and directions. Exploit symmetry in coordinate placement (e.g., centroid at the origin) only when justified; otherwise, use general orientations with parameters. |
| G1 | Before solving equations or counting problems, express the target in terms of fundamental components (variables, prime factors, or combinatorial elements). For divisibility of polynomials , decompose into prime powers and compute the minimum exponent over all residues of . |
| G2 | When deriving polynomial identities from functional equations, arrange expressions as to maintain consistent signs and avoid coefficient errors. |
| G3 | If a proportionality constant scales all coefficients equally, it cancels in ratios of coefficients. Compute such ratios directly without solving for the constant. |
| G4 | For graphs with odd-degree vertices, find a minimum -join by pairing odd vertices along efficient paths. In symmetric graphs such as grids, pair boundary vertices optimally to minimize total length. |
| G5 | When decomposing angles at a vertex with multiple rays, express unknown angles using auxiliary variables tied to geometric constraints (e.g., isosceles triangles). Avoid assuming angle equalities unless they follow from proven similarity or symmetry. |
| ID | (Continued) Learned Principles in System Prompt (HMMT) |
|---|---|
| G19 | In grid path problems, decompose the grid into diagonals (sets with constant ). Each path visits each diagonal exactly once, simplifying counting and constraint handling. |
| G20 | In an acute triangle, the projection identity holds, but similar-looking expressions need not simplify analogously. Always verify projection formulas using a non-symmetric example. |
| G21 | For placements in symmetric geometric structures, classify positions by symmetry type (corners, edges, faces). Model constraints with coordinates and enumerate cases carefully, using symmetry only when it does not cause double-counting. |
| G22 | For symmetric configurations (e.g., roots of unity), identify the symmetry group preserving the condition. Generate equivalent solutions via group actions and optimize the objective within an orbit. |
| G23 | For sums involving periodic functions, use binary expansions and pairing arguments. If the number of terms is odd, isolate the unpaired term. Validate results with small cases or known identities. |
| G24 | For a chord intersected by circles, place a coordinate along the chord and use feet of perpendiculars from centers as reference points. Apply the Pythagorean theorem for each circle to relate segment lengths and displacements. |
Language Model Self-Improvement
Language model self-improvement studies how models use their own outputs, feedback, and experience to improve with less external supervision.
See all 171 papers