Manuscript Offprint
arXiv:2610.24970PRECOCIAL: Pretraining with Code Curriculums via Iterative Search for Accelerated Learning
ABSTRACT
Fully synthetic pretraining data generated by symbolic programs can bootstrap downstream training on naturalistic tasks, such as language modeling, but the generating programs have so far been designed by hand. We introduce PRECOCIAL, a method for automatically optimizing programs that generate synthetic pretraining data. Starting from an initial generator program, an LLM iteratively rewrites the program, and each rewrite is scored by pretraining a randomly-initialized transformer on its data and fine-tuning it on the downstream task. Because every score requires training, PRECOCIAL keeps a single network for the entire search, continuing its pretraining for each accepted program instead of training a new network per candidate, making it significantly more efficient. On four language and code datasets, at a fixed fine-tuning budget, optimized programs reach lower perplexity than hand-designed curricula, published procedural generators, random program mutation and the program the LLM writes in the first iteration of the search, and reach the same perplexity as the hand-designed curricula with 9–33% fewer fine-tuning steps. PRECOCIAL also ends with lower perplexity than FunSearch and AlphaEvolve, which train a new network for every candidate, at the same number of evaluations and a lower cost. We also observe that an optimized program generator from one domain transfers to datasets in other domains. Additionally, optimized programs allow for better downstream performance on four different reasoning and problem-solving tasks.
1 INTRODUCTION
Large Language Models (LLMs) begin as randomly-initialized transformer networks before pretraining on masses of human data. Must training begin as a randomly-initialized blank slate? Biological learning suggests otherwise. From birth, wildebeests can run and spiders can weave webs, drawing only on their genetic endowment: a compact discrete code (DNA) prewires useful behaviors and biases. Analogously, here we set out to discover compact symbolic programs which prime a randomly-initialized transformer with useful inductive biases, which we call pretraining programs.
Previous work explores two families of pretraining programs: procedures which directly generate weights and biases (Stanley et al., 2009; Barabási et al., 2023), and programs which generate synthetic data (Zhang et al., 2025; Jiang et al., 2026) for “pre-pretraining.” Both families could be fruitful, but synthetic data is presently more practical and better-aligned with modern LLM pipelines, and so we adopt it here (Figure 1). Recent work suggests that such pretraining programs can improve both the sample and computational complexity of downstream learning: first training on cellular automata, formal languages, or logical inferences then accelerates downstream learning in natural language, visual reasoning, program source code, and more (Zhang et al., 2025; Hu et al., 2025; Jiang et al., 2026; Wu et al., 2021; Lee et al., 2026). In all of this work the program is designed by hand. This prior literature naturally suggests our core research question: how could a pretraining program be learned, synthesized, evolved, or automatically improved? This question also has immediate implications for synthetic training data more broadly, as synthetic post-training has become an important way of teaching language models to reason (Trinh et al., 2024; Zhao et al., 2025).

Figure 1: PRECOCIAL at a glance. Top: an LLM rewrites a program (here, part of the program kept for WikiText-103) whose data pretrains one transformer, continued across rewrites; a fine-tuned copy scores each rewrite. Programs transfer between tasks ( 4.4). Bottom, from the runs of Tables 2 and 5: WikiText-103 validation perplexity by fine-tuning budget, solve rates, and the Sokoban puzzle of Figure 3.
To learn a pretraining program, we assume a collection of downstream datasets, such as natural language corpora or reasoning problems. These downstream tasks define an objective for pretraining programs, because we can measure how well a program's synthetic data equips the learner to tackle downstream data. Optimizing this objective is challenging for two reasons: the program search space is discrete, and scoring a single program is expensive, since it requires pretraining a transformer on the program's data and then fine-tuning it on the downstream task. LLM-guided program search such as FunSearch and AlphaEvolve (Romera-Paredes et al., 2024; Novikov et al., 2025) score each candidate independently, which is only affordable when the evaluation is cheap. Here, it would mean pretraining a transformer from scratch for every candidate.
To address these challenges we introduce PRECOCIAL (PREtraining with COde Curriculums via Iterative search for Accelerated Learning), a method for synthesizing and optimizing pretraining programs. An LLM rewrites the program, each rewrite is scored by training on its data, and a rewrite is kept only if it improves the downstream objective. To make each score cheap, PRECOCIAL keeps a single network for the whole search: every accepted program continues pretraining the network where the previous one left off, while a rejected program rolls back the checkpoint (Section 3.2). Our goal is not to show that pretraining programs can help downstream tasks, which is already well-established. Instead, our primary goal is to evaluate whether such pretraining programs can be automatically optimized for a dataset of interest, and whether such optimization transfers across datasets. This paper makes the following contributions:
• Algorithm. PRECOCIAL: LLM-guided search over pretraining programs whose fitness is the downstream performance of a network trained on the program’s data ( 3).
• Efficient continual pretraining. PRECOCIAL maintains a single model that is continuously pretrained across candidate programs. At a fixed fine-tuning budget this is both cheaper and better than training a fresh model per candidate (i.e. naive application of FunSearch/AlphaEvolve): PRECOCIAL ends with lower perplexity than both while using fewer pretraining steps ( 4.3).
• Empirical validation. On four language and code datasets, optimized programs reach lower perplexity than every other source of a curriculum we test (hand-written, procedural, random mutation, the LLM’s first-iteration program) at every fine-tuning budget we measure, and they transfer to unseen datasets. At a 10k-step fine-tuning budget, PRECOCIAL wins on all four reasoning and problem-solving tasks, and a Blocksworld search that never sees the task does as well as one that does ( 4).
LLM-guided program search. FunSearch (Romera-Paredes et al., 2024) and AlphaEvolve (Novikov et al., 2025) use LLMs as mutation operators over programs, maintaining populations selected by black-box fitness, and are applied where a candidate is scored by running it. PRE-COCIAL uses the same LLM-as-mutator paradigm, but its fitness requires training a network. We therefore search over about ten candidates rather than thousands, keep one continually pretrained network across them, and compare against both methods at the same budget.
Learning to generate training data. Generative Teaching Networks (Such et al., 2020) learn a neural data generator by meta-gradients; Montessori-Instruct (Li et al., 2025) trains a teacher LLM on instruction data using a student's data influence; DataEvolve (Mi et al., 2026) evolves curation strategies for natural pretraining data with trained models as fitness; CADEvolve (Elistratov et al., 2026) evolves data-generating programs selected by validity checks; and Eurekaverse (Liang et al., 2024) has an LLM write training environments scored by a reinforcement learner. Most closely related, self-play pretraining (Cowsik et al., 2026) trains a transformer by reinforcement learning to write programs for a universal Turing machine whose outputs lie at the frontier of what a learner can learn, with no natural data. PRECOCIAL differs in two ways: it optimizes for downstream tasks, whereas self-play is unsupervised, and it yields one compact program that describes the pretraining distribution, whereas in self-play that distribution is defined by the weights of the generator network. Our work is also related to meta-learning (Finn et al., 2017) and learned data augmentation (Ho et al., 2019). We are not aware of prior work that searches over programs that generate pre-pretraining data with the downstream performance of a network trained on that data as the fitness.
3 METHODS
Given a downstream dataset , our goal is to arrive upon a data generating program whose outputs prime a transformer to do well on that dataset, and potentially generalise to unseen downstream tasks as well. Each downstream dataset comprises train/val/test splits and a scoring metric, . We view each data generating program as defining a distribution over token sequences, and also view a downstream training split as a distribution over token sequences. We write for the parameters of a transformer which is first trained on , then , etc. Using this notation, we seek a program optimising
where approximates the true objective (which uses ) on the validation data, ensuring that test data is never seen during program search. We represent programs in Python. Our transformers are standard autoregressive models, except that we use byte-level tokenisation: tokenisers are constructed from massive human data, and a key part of our problem statement is to arrive upon a pretrained state without massive human data.
Figure 1 summarises the method; Figure 4 and Algorithm 1 in Appendix A give it with the notation of this section and as pseudocode.
Initial program. An important choice is the starting point of the search. We construct a hand-written program by taking the union of existing synthetic pretraining paradigms from the recent literature
Table 1: Elements of the hand-written program (28 rules).
| Tier | Rules | Literature source / rationale |
|---|---|---|
| 1. Hierarchical | dyck1/2, dyck_shuf, nest1--3 | Bracket tracking, recursive composition (Hu et al., 2025) |
| 2. Cellular automata | ca_rule | Edge-of-chaos rules maximise transfer (Zhang et al., 2025) |
| 3. Sequence ops | sort, reverse, union, inter, copy, dedup | Set and sequence primitives (Wu et al., 2021) |
| 4. Reasoning | deduct, induct, abduct | Three modes of primitive inference (Wu et al., 2021) |
| 5. SCAN-style | twice, thrice, after, around | Compositional commands (Lake & Baroni, 2018) |
| 6. Procedural/CFG | cfg, arith, mod, swap, pair | CFG derivations and arithmetic (Jiang et al., 2026) |
| 7. State tracking | stack, fsm, counter | Push/pop and FSM; persistent memory (Lee et al., 2026) |
(Table 1); it serves as a strong baseline. Programs follow a fixed generator contract (Appendix C): each emits streams of abstract ASCII symbols, tagged with the rule that produced them; English words are rejected by a validation step.
3.1 LLM-GUIDED SEARCH FOR PRETRAINING PROGRAMS
Following AlphaEvolve and others, PRECOCIAL generates variants of a program via LLM prompting and keeps the best under . In the first iteration of the search, the LLM writes a program from the generator contract, which lists the rule families of Table 1, and a sample of downstream data. We call this the first-iteration program; it reflects the LLM's prior, before feedback from training, and of the data in these programs comes from the rules of . At each subsequent round the LLM receives the current accepted program, its objective value and the best so far, the validation curves of the last two candidates, 300 bytes of downstream training data, and returns a complete rewritten program: it may reweight, remove, rewrite or invent rules freely (Appendix D). The rewrite is scored by Eq. 1. It is accepted if , the best value so far; otherwise the search reverts to the last accepted program.
3.2 CONTINUAL PRETRAINING ACROSS CANDIDATES
Our objective function is very expensive to evaluate, requiring both pretraining and fine-tuning. This is in stark contrast to most program synthesis problems, where evaluation is so fast that even guess-and-check strategies are often viable (Li et al., 2022; Schkufza et al., 2013). After running this expensive evaluation, a naive approach would throw away hard-won pretrained parameters before generating and evaluating another program, as FunSearch and AlphaEvolve do when each candidate is scored independently. Instead, PRECOCIAL continues pretraining the same model from the last accepted checkpoint with each new program: the first program pretrains a randomly initialized network for steps, and every later candidate continues it for steps. A rejected candidate's steps are discarded, so the network always reflects the accepted programs only. This can be viewed as a form of continual learning, but also of curriculum learning: the system gradually enriches the pretraining program, with each program resuming where the previous one left off. With , and ten candidates, a search performs 60k pretraining steps, against 150k for a fresh 15k-step network per candidate.
Comparison to FunSearch and AlphaEvolve. Both maintain a population of programs from which parents are sampled; PRECOCIAL is a single chain. We implement both as published, with a fresh network trained for every candidate, at the same budget of ten evaluations (Appendix B).
4 EXPERIMENTS
4.1 SETUP
Downstream datasets. Language and code: TinyStories (Eldan & Li, 2023) (short narrative stories), WikiText-103 (Merity et al., 2017) (encyclopedia articles), CodeParrot (CodeParrot, 2022) (Python source code) and CodeSearchNet (Husain et al., 2019) (Python functions), with 10k training documents each (TinyStories: 7,818 stories of at most 512 characters), byte-encoded as raw text, and test sets from held-out data (Appendix E). Reasoning and problem solving: Blocksworld with 9 to 12 blocks, a standard benchmark of reasoning about actions for language models (Valmeekam et al., 2023) (input: a PDDL problem; output: a plan, solved if replaying it in a simulator reaches the goal); the 8-puzzle (states 10–20 moves from the goal); Sokoban (7×7, two boxes); and Countdown
Table 2: Language and code under matched pretraining: test perplexity after a 10k-step fine-tune (lower is better), mean ± SD over 9 runs. Last column: difference from PRECOCIAL over the four datasets (positive: PRECOCIAL lower; 36 paired runs), p in parentheses; bold: p < .05. Rounds of one search: the first iteration is round 0, PRECOCIAL the program after round 9, and the bottom row the program after round 5.
| Pretraining | WikiText-103 | TinyStories | CodeParrot | CodeSearchNet | Δ vs PRECOCIAL |
|---|---|---|---|---|---|
| PRECOCIAL | 5.284±.126 | 2.810±.081 | 3.207±.092 | 3.996±.177 | - |
| First iteration | 5.455±.044 | 2.875±.018 | 3.293±.032 | 4.295±.453 | +0.155 (<.001) |
| Random mutation | 5.471±.041 | 2.877±.032 | 3.306±.042 | 4.205±.117 | +0.140 (<.001) |
| Procedural | 5.688±.074 | 2.942±.025 | 3.388±.051 | 4.766±.581 | +0.371 (<.001) |
| Hand-written (π0) | 5.466±.033 | 2.887±.028 | 3.298±.024 | 4.495±.546 | +0.212 (<.001) |
| No pretraining | 5.595±.045 | 2.932±.061 | 3.204±.015 | 5.511±.416 | +0.486 (<.001) |
| PRECOCIAL after round 5 | 5.296±.106 | 2.814±.063 | 3.227±.133 | 4.077±.131 | +0.029 (.069) |
with four numbers (Gandhi et al., 2024). Each has 5,000 training problems (Blocksworld 10,000) and is scored by an exact checker on 500 test problems (Blocksworld 200), with greedy decoding.
Model training. We use small 0.69M-parameter GPT-2 models (3 layers, 4 heads, 128-dimensional embeddings) with byte-level tokenization and a 512-byte context (1,024 for Blocksworld), optimised with AdamW. A search runs rounds with and steps on 2,000 synthetic streams per round. Each candidate is fine-tuned for up to 10k steps with early stopping and is validation perplexity (on the answer tokens, for the puzzles). The LLM is Claude Sonnet 4 (Anthropic, 2025). The 10k-step budget and the ten rounds were set once and used unchanged for every dataset, task and baseline (Appendix B).
Baselines. All share the architecture and training budget. Hand-written trains on (Table 1). Procedural trains on the published generators of Jiang et al. (2026). First iteration trains on the first-iteration program (Section 3.1), the LLM's program before any search, to tell whether the LLM or the optimization drives the improvement. Random mutation runs the same loop with the LLM replaced by random edits of that program (reweight all rules, remove one, or duplicate one). No pretraining fine-tunes a randomly initialized network.
Matched pretraining. Comparing methods at the end of optimization would be confounded: a rejected candidate is rolled back, so runs accumulate different amounts of pretraining (15k to 55k steps across our runs). We therefore compare curricula under matched pretraining: the best program of PRECOCIAL and of every baseline pretrains a fresh network for exactly 60k steps, then gets the same fine-tuning and test: test perplexity after a 10k-step fine-tune for language, the exact checker after a 10k-step fine-tune for puzzles (Appendix B). Section 4.3, which compares search procedures, evaluates the network each search produces. We report mean ± SD over runs and two-sided t-tests on paired differences.
4.2 LANGUAGE AND CODE: SEARCH AGAINST EVERY OTHER SOURCE OF A CURRICULUM
Table 2 compares PRECOCIAL with every other way of obtaining a curriculum. At the 10k-step budget PRECOCIAL has the lowest test perplexity of any curriculum on all four datasets, and it is level with no pretraining only on CodeParrot (3.207 against 3.204). Pooled over the four datasets, it improves on the first-iteration program by 0.155 (lower in 30 of 36 paired runs), on random mutation by 0.140 (32 of 36), on the hand-written program by 0.212 (31 of 36) and on procedural pretraining by 0.371 (36 of 36), all with . Since the first-iteration and random-mutation baselines start from the same program as the search, the gain over them is due to the LLM-guided search loop. Program quality improves over the rounds: under matched pretraining the program kept after round 5 already beats the first-iteration program (round 0) by 0.126 (; 28 of 36), and the last four rewrites add a further 0.029 (). On every dataset round 9 beats round 5, which beats round 0. Without matched pretraining, at the end of the ten-round loop, PRECOCIAL is again lowest on every dataset (Appendix F.2). Figure 2 plots the search itself.
Across fine-tuning budgets (Figure 5 in Appendix F), PRECOCIAL is ahead of all four alternative curricula at every budget from 2k to 20k steps, significantly so against every baseline at every budget (Table 7). The lead is largest early, 0.78–1.55 perplexity at 2k steps, and narrows to 0.06–0.14 by 20k steps. Searching therefore buys downstream learning speed. Measured in fine-tuning steps, as Hu et al. (2025) and Jiang et al. (2026) do, PRECOCIAL reaches its 2k-step perplexity with 57%,

PRECOCIAL
First iteration
Random mutation
Hand-written
Figure 2: The search objective over rounds: validation perplexity of each round's candidate, mean over 3 seeds. PRECOCIAL improves over the rounds and separates from the baselines on three of the four datasets; on CodeSearchNet every method's trajectory is noisy, and the kept program is the best round, not the last.
Table 3: PRECOCIAL against FunSearch and AlphaEvolve baselines which pretrain a fresh network for every program, at the same budget of ten evaluations. Test perplexity after a 10k-step fine-tune (lower is better), mean ± SD over 3 seeds. Δ: difference from PRECOCIAL pooled over the two datasets (positive: PRECOCIAL lower; 6 paired runs), p in parentheses; bold: p < .05. Last two columns: synthetic pretraining steps and GPU-hours of one search (ten evaluations, RTX A6000). Bottom row: PRECOCIAL itself with a fresh network per candidate. Every row tests the network its own search produces (no matched pretraining); the PRECOCIAL row is an independent repeat of the ten-round loop of Table 9.
| Search | WikiText-103 | CodeSearchNet | Δ vs PRECOCIAL | Pretraining steps | GPU-h |
|---|---|---|---|---|---|
| PRECOCIAL | 5.151±.201 | 4.167±.149 | - | 60,000 | 0.71 |
| FunSearch | 5.553±.041 | 4.227±.360 | +0.231 (.152) | 150,000 | 0.88 |
| AlphaEvolve | 5.496±.127 | 4.414±.167 | +0.296 (.037) | 150,000 | 0.85 |
| PRECOCIAL with a fresh network per candidate | 5.507±.128 | 4.299±.399 | +0.244 (.055) | 150,000 | 0.85 |
67% and 80% of the steps that no pretraining, procedural pretraining and the hand-written program need, and its 10k-step perplexity with 83%, 80% and 89% (medians over 36 runs; Table 8).
4.3 PRECOCIAL AGAINST FUNSEARCH AND ALPHAEVOLVE
Naive application of FunSearch and AlphaEvolve to this setting would score every candidate on a network pretrained from scratch for it, whereas PRECOCIAL continues one network across the whole search (Section 3.2). We run all three at the same budget of ten evaluations on WikiText-103 and CodeSearchNet, three seeds each, with everything else identical, including the GPU type (Table 3). Table 3 shows the result. PRECOCIAL ends with lower test perplexity than both methods on both datasets: averaged over the two, 0.231 below FunSearch (; lower in 4 of 6 paired runs) and 0.296 below AlphaEvolve (; 5 of 6). It is also cheaper. FunSearch and AlphaEvolve pretrain each of the ten candidates from random initialisation for steps, 150k steps in total, whereas PRECOCIAL pretrains one network for 15k steps and continues it by for each later candidate, 60k in total. Fine-tuning is identical, so PRECOCIAL uses and less GPU time per search, for about the same LLM bill; fine-tuning the candidates is the largest part of every search, so the saving is modest here, and it grows with the number of candidates and with model size (Appendix L). The continued network is what makes the difference: run with a fresh network for every candidate, PRECOCIAL itself ends 0.244 perplexity higher (; 5 of 6). Part of the gain is that the continued network accumulates more pretraining (up to 60k steps, against 15k for each fresh network), a benefit obtained at lower cost.
4.4 TRANSFER TO UNSEEN DATASETS
Does a program optimized for one dataset help others? We take the network pretrained on the WikiText-103 program of PRECOCIAL and of each baseline (matched pretraining) and fine-tune it on TinyStories, CodeParrot and CodeSearchNet for 10k steps, with no further search (Table 4).
The program optimized for WikiText-103 transfers well to TinyStories and CodeParrot, where it is the best curriculum and within 0.008 perplexity of a program optimized on the target itself, and
Table 4: Transfer: networks pretrained on programs obtained for WikiText-103, fine-tuned for 10k steps on a different dataset with no further search (matched pretraining). Test perplexity, mean ± SD over 9 runs (3 searches × 3 training seeds); last column pooled over the three targets (27 paired runs; positive: PRECOCIAL lower). Bottom row: the program PRECOCIAL found when searching on the target itself (Table 2).
| WikiText-103 program | TinyStories | CodeParrot | CodeSearchNet | Δ vs PRECOCIAL |
|---|---|---|---|---|
| PRECOCIAL | 2.804±.070 | 3.215±.067 | 4.279±.508 | - |
| First iteration | 2.897±.031 | 3.322±.024 | 4.363±.227 | +0.095 (.058) |
| Random mutation | 2.888±.038 | 3.320±.039 | 4.655±.665 | +0.188 (.120) |
| Procedural | 2.944±.014 | 3.406±.022 | 4.620±.424 | +0.224 (.011) |
| Hand-written (π0) | 2.868±.016 | 3.309±.017 | 4.228±.032 | +0.035 (.550) |
| No pretraining | 2.915±.058 | 3.204±.017 | 5.632±.327 | +0.484 (.002) |
| Optimized on the target | 2.810±.081 | 3.207±.092 | 3.996±.177 |
Table 5: Reasoning and problem solving from scratch, matched pretraining (each curriculum pretrains a fresh network for 60k steps; every method then gets the same 10k-step fine-tune). Test solve rate by an exact checker, mean ± SD over 9 runs (Blocksworld) or 6 runs (others). Bottom rows: seed-paired difference, p in parentheses; bold: p < .05. No pretraining: 6 training seeds, not paired.
| Pretraining | Blocksworld (9–12 blocks) | 8-puzzle | Sokoban | Countdown |
|---|---|---|---|---|
| PRECOCIAL | 0.216±.254 | 0.246±.028 | 0.086±.030 | 0.161±.012 |
| First iteration | 0.053±.158 | 0.156±.077 | 0.013±.006 | 0.156±.014 |
| Hand-written (π0) | 0.019±.040 | 0.172±.035 | 0.019±.013 | 0.136±.019 |
| No pretraining | 0.000±.000 | 0.014±.011 | 0.007±.003 | 0.056±.039 |
| PRECOCIAL – hand-written | +0.196 (.033) | +0.073 (.005) | +0.067 (.002) | +0.025 (.025) |
| PRECOCIAL – first iteration | +0.163 (.060) | +0.090 (.036) | +0.073 (.003) | +0.005 (.104) |
less well to CodeSearchNet. Pooled over the three targets it beats procedural pretraining (+0.224, p=.011; 25 of 27 paired runs) and no pretraining (+0.484, p=.002), is ahead of the first-iteration program (+0.095, p=.058) and random mutation (+0.188, p=.12), and is level with the hand-written program (+0.035, p=.55). Transfer even crosses domains (Appendix F.3). The programs optimized on Blocksworld and Sokoban (Section 4.5) do as well on the four language datasets as the programs optimized on those datasets themselves (within 0.017 and 0.003 perplexity, ), and in the other direction the WikiText-103 program solves more problems than the hand-written program on all four reasoning tasks, though no single difference is significant. These tasks and language have nothing in common at the task level, so this only makes sense if what transfers is the same structural skill (nesting, sequence operations, state tracking) rather than anything task-specific.
4.5 REASONING AND PROBLEM SOLVING FROM SCRATCH
Do optimized programs help a small model learn tasks that require multi-step reasoning and problem solving? Each task has three optimized programs (one per search seed), each trained with several training seeds: three for Blocksworld (9 runs per method) and two for the others (6 runs per method).
Optimized programs beat the hand-written curriculum on all four tasks at the 10k-step fine-tuning budget (Table 5): Sokoban +0.067 (p=.002), the 8-puzzle +0.073 (p=.005), Countdown +0.025 (p=.025) and Blocksworld +0.196 (p=.033), ahead in every paired run on the first three. Blocksworld is all-or-nothing: across the 33 runs of Table 5 every model that reaches a test perplexity below 1.04 solves some problems and every model above it solves none (Appendix J), and 6 of 9 runs of the optimized programs land below that line, against 1 of 9 for the first-iteration program and 2 of 9 for the hand-written program (Figure 8 in Appendix J). At this budget a network with no synthetic pretraining learns almost nothing on the three tasks whose answer is a sequence of moves (solve rates 0.000 on Blocksworld, 0.014 on the 8-puzzle and 0.007 on Sokoban).
The search loop matters, not only the LLM's prior. Every search starts from the first-iteration program, so comparing against it isolates what the rounds of search add. The optimized programs beat it significantly on Sokoban (+0.073, p=.003) and the 8-puzzle (+0.090, p=.036), and lead it on Blocksworld (+0.163, p=.06). On Sokoban the first-iteration program is no better than the hand-written program, so the whole gain there comes from search. Countdown is the exception: its first-iteration program is already close to the optimized program (+0.005, p=.10). The search adds

Figure 3: One test puzzle per task, and the start, middle and end of the plan each method's network writes for it, replayed by the task's exact checker; below each row, the checker's verdict. Networks trained as in Table 5 with training seed 64. Universal prior: pretrained on the outputs of random programs, as in Grau-Moya et al. (2024). Green marks a tile, box or block in its goal position; in Sokoban the dot is the player and a red square marks the cell an illegal move tries to enter.
most where the LLM’s first guess at a curriculum is poor, and little where that guess, like , already covers the task.
What the plans look like. Figure 3 shows plans written by one network of each method. On these puzzles the PRECOCIAL network reaches the goal, while every other network either makes an illegal move or ends its plan short of the goal. Solve rates are in Table 5, and Appendix K gives the rule and the full plans.
4.6 WHAT THE LLM WRITES
Every program is a weighted set of named rules, each generating one kind of sequence. We classify rules by name into content types (Appendix M) and measure, for each task, the share of synthetic data coming from rules of the type that matches the task.
The LLM writes task-specific rules beyond the human-written . For example: precond and state_trans for Blocksworld, grid_move and sokoban_push for the move puzzles, arith_precedence for Countdown, func_def and tryCatch for code. The first-iteration programs contain almost none of this (0.0–8.4% of the data; Table 21 in Appendix M); the share grows over the rounds of search (Figure 12) to 3.3–22.8%.
But task-specific content is not what the search selects for. Comparing, within each task and round, the candidates the search accepted with those it rejected, accepted candidates carry no more task-matching data (+2.2 points, stratified permutation test p=.35, 162 candidates). A direct test agrees. We re-ran the Blocksworld search with the downstream data hidden from the LLM, which then sees only its programs and their scores: it wrote no planning rules at all (0 of 298 added rules), yet under matched pretraining its programs solve as many problems as those of the search that sees the task (0.196 against 0.216, p=.82, 9 runs each). Much of what the search keeps is general structure: the 28 generic rules of (nesting, sequence operations and state tracking, among others), which any byte-level sequence model can use, still produce 43–74% of the kept programs' data, down from 80–89% in the first-iteration programs. This may explain why programs transfer across domains (Section 4.4): the puzzle programs that transfer best to language, Blocksworld and Sokoban, carry the least task-specific data (3.3% and 12.3% of their kept programs, against 22.5% and 22.8% for the 8-puzzle and Countdown), though four programs are too few to be sure.
5 DISCUSSION
We set out to ask whether a pretraining program can be optimized automatically, and at a fixed fine-tuning budget our answer is yes. An LLM that rewrites a generator program, scored by training a small network on the program's data, finds programs that beat the hand-written curriculum, published procedural generators, random mutation and its own first-iteration program on four language and code datasets, and that beat the hand-written curriculum on four reasoning and problem-solving tasks. The programs improve steadily over the rounds of search, and they transfer to datasets they were not optimized on, in part even across domains.
What makes the search work. Our results point to the trained model rather than the LLM's knowledge of the task. On Blocksworld a search that never sees the task does as well as one that does, and across tasks the programs the search accepts carry no more task-specific content than those it rejects. The LLM is still not interchangeable with random edits: random mutation, which cannot write new rules, falls short of it on language. Our reading is that the LLM's job is to propose varied, valid programs, including kinds of data the current program lacks, and that scoring each proposal on a trained network is what decides which of them help. The same view accounts for transfer: much of what survives is general structure that any sequence model can use.
Evaluating candidates when fitness requires training. Because every score requires training, how candidates are evaluated matters as much as how they are proposed. Continuing one network across candidates, instead of training a fresh network for each as FunSearch and AlphaEvolve do, is both cheaper and better at a fixed budget.
When is this useful? Like other synthetic pretraining papers, the benefit we measure is efficiency: the optimized programs reach a given perplexity in fewer fine-tuning steps (Table 8), and their lead is largest with the least downstream data (Appendix G). PRECOCIAL is therefore aimed at settings where downstream data is scarce and no more human data is available, since synthetic data costs nothing to sample. And because programs transfer, a search can be run once and its program reused on related datasets.
Connection to epiplexity. Epiplexity is the structural information that a computationally bounded learner can extract from data, estimated by the area under its loss curve above the final loss (Finzi et al., 2026). A pretraining program is a compact source of it, and PRECOCIAL produces new epiplexity at every iteration: each rewrite gives the continued network new structure to learn, so its pretraining loss rises at 32 of the 36 round boundaries of the language searches and falls again within every round (Figure 7), and the search keeps the rewrites whose new structure helps downstream. Across the 26 programs of this paper, the epiplexity a fresh 0.69M network extracts goes with lower WikiText-103 perplexity (Spearman , ) while the final pretraining loss does not, and the optimized programs carry more of it than their first-iteration programs in all three WikiText-103 searches (Appendix I).
Limitations and future work. Our models are small (0.15M–3.36M parameters, Appendix G): across that range the head start grows with the model but is spent sooner, so the lead at a fixed budget shrinks with size. Larger models, larger downstream datasets and longer searches were beyond our compute budget. Each task used three searches of ten evaluations with a single LLM (Claude Sonnet 4), so smaller effects remain unresolved, and the task-hidden test was run on Blocksworld only. Mixing different datasets together, and mixing the discovered pretraining data into fine-tuning, may improve results further, especially for already pretrained models such as Llama or Qwen, where replaying synthetic data could keep the model from forgetting what it has learned.
AI USE STATEMENT
In this work, the method itself uses a generative AI model: Claude Sonnet 4 writes and rewrites the data generating programs during search (Section 3). We also used generative AI tools to implement experiment code, run and analyse experiments, and assist in writing and editing the paper. All
AI-assisted code, analyses and text were reviewed by the authors; every number in the paper is computed by a script from the raw run logs. We take responsibility for the final content of this work, including text, claims and artifacts produced with the aid of generative AI.
ETHICS STATEMENT
This work trains small models on public datasets (TinyStories, WikiText-103, CodeParrot and CodeSearchNet) and on procedurally generated puzzles; it involves no human subjects or personal data, and the synthetic pretraining data consists only of abstract symbols (Appendix C).
REPRODUCIBILITY STATEMENT
The model, optimiser, search schedule and evaluation protocol are specified in Section 4.1 and Appendix B; the generator contract and prompt in Appendices C and D; dataset sources and splits in Appendix E. Code, all optimized programs and the script that computes every table from the run logs will be released.
REFERENCES
Anthropic. System card: Claude Opus 4 & Claude Sonnet 4. https://www.anthropic.com/claude-4-system-card, 2025.
Dániel L. Barabási, Taliesin Beynon, Ádám Katona, and Nicolas Perez-Nieves. Complex computation from developmental priors. Nature Communications, 14(1):2226, 2023.
CodeParrot. CodeParrot clean python dataset. https://huggingface.co/datasets/codeparrot/codeparrot-clean-train, 2022.
Aditya Cowsik, Kfir Dolev, Michael Y. Li, G. Bruno De Luca, Nourya Cohen, Noah D. Goodman, and Yoav Levine. Self-play pretraining with zero data. arXiv preprint arXiv:2609.30063, 2026.
Ronen Eldan and Yuanzhi Li. TinyStories: How small can language models be and still speak coherent English? arXiv preprint arXiv:2305.07759, 2023.
Maksim Elistratov, Marina Barannikov, Gregory Ivanov, Valentin Khrulkov, Anton Konushin, Andrey Kuznetsov, and Dmitrii Zhemchuzhnikov. CADEvolve: Creating realistic CAD via program evolution. arXiv preprint arXiv:2602.16317, 2026.
Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning (ICML), 2017.
Marc Finzi, Shikai Qiu, Yiding Jiang, Pavel Izmailov, J. Zico Kolter, and Andrew Gordon Wilson. From entropy to epiplexity: Rethinking information for computationally bounded intelligence. arXiv preprint arXiv:2601.03220, 2026.
Kanishk Gandhi, Denise Lee, Gabriel Grand, Muxin Liu, Winson Cheng, Archit Sharma, and Noah D. Goodman. Stream of search (SoS): Learning to search in language. arXiv preprint arXiv:2404.03683, 2024.
Jordi Grau-Moya, Tim Genewein, Marcus Hutter, Laurent Orseau, Grégoire Delétang, Elliot Catt, Anian Ruoss, Li Kevin Wenliang, Christopher Mattern, Matthew Aitchison, and Joel Veness. Learning universal predictors. In International Conference on Machine Learning (ICML), 2024.
Kaiming He, Ross Girshick, and Piotr Dollár. Rethinking ImageNet pre-training. In IEEE/CVF International Conference on Computer Vision (ICCV), 2019.
Danny Hernandez, Jared Kaplan, Tom Henighan, and Sam McCandlish. Scaling laws for transfer. arXiv preprint arXiv:2102.01293, 2021.
Daniel Ho, Eric Liang, Ion Stoica, Pieter Abbeel, and Xi Chen. Population based augmentation: Efficient learning of augmentation policy schedules. In International Conference on Machine Learning (ICML), 2019.
Michael Y. Hu, Jackson Petty, Chuan Shi, William Merrill, and Tal Linzen. Between circuits and Chomsky: Pre-pretraining on formal languages imparts linguistic biases. In Annual Meeting of the Association for Computational Linguistics (ACL), 2025.
Hamel Husain, Ho-Hsiang Wu, Tiferet Gazit, Miltiadis Allamanis, and Marc Brockschmidt. CodeSearchNet challenge: Evaluating the state of semantic code search. arXiv preprint arXiv:1909.09436, 2019.
Liangze Jiang, Zachary Shinnick, Anton van den Hengel, Hemanth Saratchandran, and Damien Teney. Procedural pretraining: Warming up language models with abstract data. arXiv preprint arXiv:2601.21725, 2026.
Brenden M. Lake and Marco Baroni. Generalization without systematicity: On the compositional skills of sequence-to-sequence recurrent networks. In International Conference on Machine Learning (ICML), 2018.
Dan Lee, Seungwook Han, Akarsh Kumar, and Pulkit Agrawal. Training language models via neural cellular automata. arXiv preprint arXiv:2603.10055, 2026.
Xiaochuan Li, Zichun Yu, and Chenyan Xiong. Montessori-instruct: Generate influential training data tailored for student learning. In International Conference on Learning Representations (ICLR), 2025.
Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Rémi Leblond, Tom Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, Thomas Hubert, Peter Choy, Cyprien de Masson d'Autume, Igor Babuschkin, Xinyun Chen, Po-Sen Huang, Johannes Welbl, Sven Gowal, Alexey Cherepanov, James Molloy, Daniel J. Mankowitz, Esme Sutherland Robson, Pushmeet Kohli, Nando de Freitas, Koray Kavukcuoglu, and Oriol Vinyals. Competition-level code generation with AlphaCode. Science, 378(6624):1092–1097, 2022.
William Liang, Sam Wang, Hung-Ju Wang, Osbert Bastani, Dinesh Jayaraman, and Yecheng Jason Ma. Eurekaverse: Environment curriculum generation via large language models. In Conference on Robot Learning (CoRL), 2024.
Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In International Conference on Learning Representations (ICLR), 2017.
Tiantian Mi, Dongming Shan, Zhen Huang, Yiwei Qin, Muhang Xie, Yuxuan Qiao, Yixiu Liu, Chenyang Zhou, and Pengfei Liu. Data Darwinism part II: DataEvolve – AI can autonomously evolve pretraining data curation. arXiv preprint arXiv:2603.14420, 2026.
Alexander Novikov, Ngân Vũ, Marvin Eisenberger, Emilien Dupont, Po-Sen Huang, Adam Zsolt Wagner, Sergey Shirobokov, Borislav Kozlovskii, Francisco J. R. Ruiz, Abbas Mehrabian, M. Pawan Kumar, Abigail See, Swarat Chaudhuri, George Holland, Alex Davies, Sebastian Nowozin, Pushmeet Kohli, and Matej Balog. AlphaEvolve: A coding agent for scientific and algorithmic discovery. arXiv preprint arXiv:2506.13131, 2025.
Isabel Papadimitriou and Dan Jurafsky. Learning music helps you read: Using transfer to study linguistic structure in language models. In Conference on Empirical Methods in Natural Language Processing (EMNLP), 2020.
Bernardino Romera-Paredes, Mohammadamin Barekatain, Alexander Novikov, Matej Balog, M. Pawan Kumar, Emilien Dupont, Francisco J. R. Ruiz, Jordan S. Ellenberg, Pengming Wang, Omar Fawzi, Pushmeet Kohli, and Alhussein Fawzi. Mathematical discoveries from program search with large language models. Nature, 625:468–475, 2024.
Eric Schkufza, Rahul Sharma, and Alex Aiken. Stochastic superoptimization. In International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), 2013.
Zachary Shinnick, Liangze Jiang, Hemanth Saratchandran, Damien Teney, and Anton van den Hengel. Can you learn to see without images? Procedural warm-up for vision transformers. arXiv preprint arXiv:2511.13945, 2025.
Kenneth O. Stanley, David B. D'Ambrosio, and Jason Gauci. A hypercube-based encoding for evolving large-scale neural networks. Artificial Life, 15(2):185–212, 2009.
Felipe Petroski Such, Aditya Rawal, Joel Lehman, Kenneth O. Stanley, and Jeff Clune. Generative teaching networks: Accelerating neural architecture search by learning to generate synthetic training data. In International Conference on Machine Learning (ICML), 2020.
Trieu H. Trinh, Yuhuai Wu, Quoc V. Le, He He, and Thang Luong. Solving olympiad geometry without human demonstrations. Nature, 625:476–482, 2024.
Karthik Valmeekam, Matthew Marquez, Alberto Olmo, Sarath Sreedharan, and Subbarao Kambhampati. PlanBench: An extensible benchmark for evaluating large language models on planning and reasoning about change. In Advances in Neural Information Processing Systems (NeurIPS), Datasets and Benchmarks Track, 2023.
Yuhuai Wu, Markus N. Rabe, Wenda Li, Jimmy Ba, Roger B. Grosse, and Christian Szegedy. LIME: Learning inductive bias for primitives of mathematical reasoning. In International Conference on Machine Learning (ICML), 2021.
Shiyang Zhang, Aakash Patel, Syed A. Rizvi, Nianchen Liu, Sizhuang He, Amin Karbasi, Emanuele Zappala, and David van Dijk. Intelligence at the edge of chaos. In International Conference on Learning Representations (ICLR), 2025.
Andrew Zhao, Yiran Wu, Yang Yue, Tong Wu, Quentin Xu, Yang Yue, Matthieu Lin, Shenzhi Wang, Qingyun Wu, Zilong Zheng, and Gao Huang. Absolute zero: Reinforced self-play reasoning with zero data. arXiv preprint arXiv:2505.03335, 2025.
A ALGORITHM

accept: next candidate continues pretraining reject: roll back to
Figure 4: PRECOCIAL. The LLM rewrites the generator program; the rewrite is scored by continuing to pretrain the one network kept for the whole search, fine-tuning a copy on and evaluating it on . An improvement is accepted; otherwise both the program and the network are rolled back to the last accepted state.
Algorithm 1 PRECOCIAL
Require: Downstream data D, LLM, rounds K, steps ,
1:
2:
3: ;
4: for do
5:
6:
7:
8: if then
9: end if
10: end for
11: return
▷ first iteration
▷ rewrite the accepted program
▷ resume the one network
▷ with early stopping
▷ accept
▷ otherwise roll back to
B FURTHER EXPERIMENTAL SETUP DETAILS
Model. Vocabulary 260 (256 bytes + PAD/BOS/EOS/SEP), 3 layers, 4 attention heads, 128-dimensional embedding, 512-position context (1,024 for Blocksworld), 0.69M parameters. All weights are randomly initialised; embeddings are not reinitialised between pretraining and fine-tuning.
Pretraining. 2,000 streams per round, 50 sentences per stream, truncated to the context length. Round 0: 15,000 steps from scratch; later rounds: 5,000 continued steps from the last accepted checkpoint. A ten-round search therefore performs 60,000 pretraining steps, and its kept network carries between 15,000 and 60,000 of them, depending on how many rounds were accepted. Batch size 8, AdamW, learning rate , gradient clipping at 1.0.
Fine-tuning. Up to 10,000 steps, learning rate , batch size 8, early stopping with patience 5 evaluations every 500 steps; the checkpoint with the lowest validation perplexity is tested. A second, longer fine-tune of the kept pretrained network (early stopping with patience 10; every run continued well past 20k steps) supplies the validation curve from which we read the best perplexity reached within each fine-tuning budget from 2k to 20k steps (Figures 5 and 6, Appendix F). For the puzzles the loss and the perplexity are computed on the answer tokens only.
Choice of budgets. A search evaluates ten candidates, each with its own pretraining and fine-tuning, so each evaluation must be short. We fine-tune for 10k steps (about eight passes over a 10k-document training set at batch size 8), which keeps a ten-candidate search under one GPU-hour on the 0.69M model (Appendix L). It is a budget, not convergence: validation perplexity is still falling at 10k steps in 96% of the fine-tunes run during our searches. Because the search's fitness is measured at this budget, results at 10k steps evaluate exactly what the search optimizes; Figure 5 and Table 7 report 2k to 20k steps as well. Ten rounds keep the LLM cost near $1 per search, and the program kept after round 5 already captures most of the gain (Table 2), so more rounds would add little. Both values were set once, before the experiments reported here, and used unchanged for every dataset, task, baseline and model size.
Search. Ten rounds; a candidate is accepted if its validation perplexity is no worse than the best so far (tolerance 0), and otherwise both the program and the pretrained checkpoint are rolled back. The LLM (Claude Sonnet 4 via the OpenRouter API) samples the first-iteration program at temperature 0.9 and rewrites at temperature 0.7. FunSearch uses 4 islands and prompts with the best programs of one island; AlphaEvolve uses one database, fitness-proportional parent sampling and 2 inspiration programs per prompt. As published, both pretrain a fresh network from random initialisation for every candidate (15,000 steps, then the fine-tuning above). All three methods make one LLM call per evaluation, plus a retry whenever a returned program fails validation.
Matched pretraining. For every comparison of curricula (Tables 2, 5 and 4), the kept program of PRECOCIAL and of every baseline pretrains a fresh network for exactly 60,000 steps on 2,000 streams, followed by the fine-tuning above. For language, each of the three kept programs per method (one per search seed) is trained with three training seeds, the search seed and two others, giving 9 runs per cell of Tables 2 and 4; no pretraining uses the same nine training seeds, and runs are paired by training seed. Blocksworld is fine-tuned for the full 10,000 steps without early stopping: its validation perplexity plateaus early, and patience-5 stopping ends fine-tuning at 1,000 to 3,500 steps, above the perplexity at which plans start to succeed (Appendix J).
C GENERATOR PROGRAM SPECIFICATION
The generator contract requires programs to define:
def generate_stream(num_sentences: int) -> List[Tuple[str, str]]: """Returns list of (rule_name, content_string) pairs. content_string must use only abstract ASCII symbols."""
All content strings are drawn from the following vocabulary: uppercase letters (A–Z), digits (0–9), brackets (() []<>{}), operators (+-*/=/^%~), separators (|; , .!@#$ ), and arrows (->, =>). English words and multi-character token names are forbidden by a validation step that checks for common English words before accepting any generated program. The rule name returned with each content string tags the stream and is used for the rule analysis (Section 4.6).
D PROMPT STRUCTURE
First iteration. The LLM is asked to design synthetic pretraining data for a small GPT-2 model whose transformer layers (not its token embeddings' meaning) will transfer to the downstream task, and receives the generator contract, which lists the rule families of Table 1 with their literature justifications, the task type, and 500 bytes of downstream training data.
Each later round. The prompt contains, in order: (1) the round number and a note that the network is continued from the previous round rather than retrained; (2) the current validation perplexity and the best so far; (3) the validation perplexity along the fine-tuning curves of the current and previous candidates; (4) 300 bytes of downstream training data; (5) the current program in a Python code fence; (6) the generator contract; and (7) the instruction: add any number of new rule types, remove any rules that are unhelpful, and modify existing generators and their weights, with no cap on the size of the change (the prompt notes, as information only, that large distribution shifts can cause forgetting in a continually trained network). The LLM returns the complete program. For the task-hidden ablation (Section 4.6) the downstream sample is replaced by a notice that it is withheld.
E DATASETS
Table 6: Dataset splits. Language and code datasets are byte-encoded as raw text with no filtering at training time beyond truncation to the context. Puzzles are generated with fixed seeds, with a reference answer that is optimal for the move puzzles; any answer the checker accepts counts as solved. The first 200 of 1,000 test problems, decoded greedily.
| Dataset | Train | Val | Test | Source / checker |
|---|---|---|---|---|
| TinyStories | 7,818 | 868 | 155 | HF train / validation, ≤512 characters |
| WikiText-103 | 10,000 | 1,111 | 1,241 | HF train / HF test (raw) |
| CodeParrot | 10,000 | 2,499 | 2,499 | codeparrot-clean-train, held-out tail |
| CodeSearchNet | 10,000 | 1,000 | 1,000 | Python functions, held out |
| Blocksworld (9–12 blocks) | 10,000 | 1,000 | 200 | PDDL; plan replayed in a simulator |
| 8-puzzle | 5,000 | 200 | 500 | 10–20 moves from the goal; reach it |
| Sokoban (7×7, 2 boxes) | 5,000 | 200 | 500 | push both boxes onto targets |
| Countdown (4 numbers) | 5,000 | 200 | 500 | each number once; equals the target |
F ADDITIONAL RESULTS
F.1 EVERY FINE-TUNING BUDGET

Figure 5: Perplexity above PRECOCIAL at each fine-tuning budget, pooled over the four datasets under matched pretraining (best validation perplexity within the budget; mean ± s.e.m. over 36 paired runs; logarithmic axes). PRECOCIAL is ahead of every other curriculum at every budget shown; the lead is largest at small budgets and narrows as fine-tuning proceeds. See also Table 7.
Table 7: Matched pretraining: perplexity above PRECOCIAL within each fine-tuning budget, pooled over the four datasets, 36 paired runs; in parentheses; bold: . Each entry is the best validation perplexity reached within the budget along a single long fine-tuning run. These are the values plotted in Figure 5; they differ slightly from the 10k-step column of Table 2, which is the test perplexity of a separate 10k-step fine-tune.
| Baseline | 2k | 5k | 10k | 20k |
|---|---|---|---|---|
| First iteration | +0.786 (<.001) | +0.504 (<.001) | +0.162 (<.001) | +0.081 (.032) |
| Random mutation | +0.800 (<.001) | +0.501 (<.001) | +0.134 (<.001) | +0.058 (.006) |
| Procedural | +1.554 (<.001) | +0.915 (<.001) | +0.353 (<.001) | +0.137 (<.001) |
| Hand-written () | +0.784 (<.001) | +0.540 (<.001) | +0.140 (<.001) | +0.059 (.005) |
| No pretraining | +1.685 (<.001) | +0.900 (<.001) | +0.476 (<.001) | +0.307 (.001) |
Table 8: Fine-tuning steps saved, matched pretraining. For each budget , the share of a baseline's fine-tuning steps that PRECOCIAL needs to reach the same validation perplexity: divided by the steps the baseline needs to reach the best perplexity PRECOCIAL attains within steps, median over the 36 runs (4 datasets × 9). Lower means a larger saving. Curves are evaluated every 500 steps.
| Baseline | 2k | 5k | 10k | 20k |
|---|---|---|---|---|
| First iteration | 80% | 83% | 91% | 93% |
| Random mutation | 80% | 91% | 91% | 94% |
| Procedural | 67% | 74% | 80% | 82% |
| Hand-written () | 80% | 83% | 89% | 91% |
| No pretraining | 57% | 77% | 83% | 83% |
F.2 THE TEN-ROUND LOOP WITHOUT MATCHED PRETRAINING
The tables below evaluate each method with the network its own ten-round loop produced, instead of retraining its kept program on a fresh network. Methods then differ in accumulated pretraining: the kept checkpoints carry 42,500 pretraining steps on average for PRECOCIAL against 37,100–38,800 for the baselines. PRECOCIAL is lowest on every dataset, and every pooled difference is significant.
Table 9: End of the ten-round loop: test perplexity after a 10k-step fine-tune, mean ± SD over 3 seeds; last column pooled over the four datasets (positive: PRECOCIAL lower).
| Pretraining | WikiText-103 | TinyStories | CodeParrot | CodeSearchNet | Δ vs PRECOCIAL |
|---|---|---|---|---|---|
| PRECOCIAL | |||||
| First iteration | |||||
| Random mutation | |||||
| Procedural | |||||
| Hand-written () | |||||
| No pretraining |
Table 10: Transfer with the networks produced by the WikiText-103 loops (no matched pretraining): test perplexity after a 10k-step fine-tune on the target, mean ± SD over 3 seeds; last column pooled over the three targets.
| WikiText-103 program | TinyStories | CodeParrot | CodeSearchNet | Δ vs PRECOCIAL |
|---|---|---|---|---|
| PRECOCIAL | ||||
| First iteration | ||||
| Random mutation | ||||
| Procedural | ||||
| Hand-written () | ||||
| No pretraining | ||||
| Optimized on the target |
F.3 TRANSFER ACROSS DOMAINS
Here the programs cross between language and puzzles, with matched pretraining and no further search. Table 11 pretrains on the program optimized for each puzzle (Section 4.5) and fine-tunes on the four language datasets; Table 12 pretrains on the program optimized for WikiText-103 and fine-tunes on the four puzzles, with the same training seeds as in Table 5. Programs optimized on Blocksworld and Sokoban are level with programs optimized on the language datasets themselves and ahead of the hand-written program in 9 and 12 of 12 runs; the 8-puzzle and Countdown programs transfer less well. In the other direction the WikiText-103 program solves more problems than the hand-written program on every puzzle, but no single difference is significant, and it stays slightly below the program optimized on each task.
Table 11: Puzzle programs on language: test perplexity after a 10k-step fine-tune, mean SD over 3 seeds (matched pretraining). Last two columns: pooled difference over the four datasets (12 seed-paired runs; positive: the puzzle program lower), in parentheses. First row: the program optimized on each language dataset itself, with the same three seeds (a subset of the nine runs of Table 2).
| Pretraining | WikiText-103 | TinyStories | CodeParrot | CodeSearchNet | vs hand-written | vs optimized on target |
|---|---|---|---|---|---|---|
| Optimized on the target | ||||||
| Blocksworld program | +0.280 (.052) | +0.017 (.687) | ||||
| 8-puzzle program | +0.086 (.561) | -0.177 (.107) | ||||
| Sokoban program | +0.260 (.082) | -0.003 (.960) | ||||
| Countdown program | +0.063 (.728) | -0.200 (.224) | ||||
| Hand-written () | ||||||
| No pretraining |
Table 12: The WikiText-103 program on the puzzles: test solve rate after a 10k-step fine-tune, mean SD over 9 runs (Blocksworld) or 6 (others), matched pretraining; the other rows are those of Table 5. Bottom rows: differences paired by training seed (positive: the WikiText-103 program solves more), in parentheses.
| Pretraining | Blocksworld (9–12 blocks) | 8-puzzle | Sokoban | Countdown |
|---|---|---|---|---|
| Optimized on the task | ||||
| Optimized on WikiText-103 | ||||
| Hand-written () | ||||
| No pretraining | ||||
| WikiText-103 program – hand-written | +0.139 (.101) | +0.035 (.590) | +0.050 (.052) | +0.012 (.371) |
| WikiText-103 program – optimized on the task | -0.057 (.312) | -0.038 (.532) | -0.016 (.598) | -0.013 (.233) |
G MODEL SIZE AND DOWNSTREAM DATA SIZE
Both sweeps use WikiText-103 with raw text and evaluate the network each method's ten-round loop produced (as in Appendix F.2, not matched pretraining). Every model size runs the same search schedule on 2,000 synthetic streams per round.
Model size. Table 13 repeats the WikiText-103 comparison at 0.15M, 0.69M and 3.36M parameters, and Figure 6 follows the lead over no pretraining across fine-tuning budgets. The head start is larger for larger models but comes earlier: at its peak a network with no synthetic pretraining trails PRECOCIAL by 1.44 perplexity at 0.15M (after 5k fine-tuning steps), 2.83 at 0.69M (after 2k) and 3.56 at 3.36M (after 1k). A larger model also closes the gap sooner, so at the 10k-step budget of Table 13 the lead shrinks with size: over the hand-written curriculum it falls from 1.445 to 0.196 and 0.098 perplexity, and over no pretraining from 1.248 to 0.273 and 0.195. With three seeds none of these differences is significant on its own (p between .076 and .351). The synthetic budget is the same for every size, so larger models receive less synthetic data per parameter; whether a curriculum scaled with the model keeps the lead is untested.
Table 13: Model size sweep, WikiText-103 documents: test perplexity after a 10k-step fine-tune, mean SD over 3 seeds. Last two columns: seed-paired differences (positive: PRECOCIAL lower), in parentheses.
| Parameters | PRECOCIAL | Hand-written () | No pretraining | PRECOCIAL – hand | PRECOCIAL – none |
|---|---|---|---|---|---|
| 0.15M | 8.254±.746 | 9.699±.885 | 9.502±.069 | +1.445 (.093) | +1.248 (.110) |
| 0.69M | 5.312±.146 | 5.508±.082 | 5.585±.055 | +0.196 (.112) | +0.273 (.076) |
| 3.36M | 4.063±.126 | 4.161±.097 | 4.258±.038 | +0.098 (.351) | +0.195 (.110) |

Figure 6: Head start by model size on WikiText-103: perplexity of a network with no synthetic pretraining minus PRECOCIAL's, at each fine-tuning budget (best validation perplexity reached within the budget, mean over 3 seeds; above 0: PRECOCIAL is ahead). Larger models reach a larger lead, earlier, and close the gap sooner. The two smallest pretrained networks start behind (at 500 steps, and also at 1k for 0.15M).
Downstream data. Table 14 varies the number of fine-tuning documents for the 0.69M model. The lead is largest with the least data: at , PRECOCIAL is ahead of the hand-written curriculum by 0.213 perplexity () and of no pretraining by 0.410 (), the only significant differences in the sweep. At larger the lead is smaller and does not change monotonically with (0.041, 0.196 and 0.053 over the hand-written curriculum at 5k, 10k and 20k), so we claim no trend beyond the smallest .
Table 14: Downstream data sweep on WikiText-103, 0.69M model: test perplexity after a 10k-step fine-tune, mean SD over 3 seeds. is the number of fine-tuning documents; is the main experiment (Table 9). Last two columns: seed-paired differences (positive: PRECOCIAL lower), in parentheses; bold: .
| N | PRECOCIAL | Hand-written (π0) | No pretraining | PRECOCIAL – hand | PRECOCIAL – none |
|---|---|---|---|---|---|
| 2,000 | 5.454±.058 | 5.667±.033 | 5.863±.066 | +0.213 (.040) | +0.410 (.024) |
| 5,000 | 5.531±.056 | 5.572±.080 | 5.647±.016 | +0.041 (.650) | +0.116 (.102) |
| 10,000 | 5.312±.146 | 5.508±.082 | 5.585±.055 | +0.196 (.112) | +0.273 (.076) |
| 20,000 | 5.450±.085 | 5.503±.040 | 5.587±.022 | +0.053 (.460) | +0.137 (.157) |
H PRETRAINING LOSS DURING THE SEARCH
Figure 2 (Section 4.2) shows what the search does round by round, and Figure 7 what the network sees while it happens.

— PRECOCIAL — First iteration — Random mutation — Hand-written
Figure 7: Pretraining loss during the search, concatenated over rounds (mean over 3 seeds); the axis is thousands of pretraining steps. From round 1 on, PRECOCIAL sits above the first-iteration and random-mutation baselines (in round 0 all three train on the same first-iteration program) and spikes at each round boundary, where the next candidate changes the data, yet reaches the best downstream perplexity (Table 9).
In Figure 7, from round 1 on PRECOCIAL’s pretraining loss is higher than that of the first-iteration and random-mutation baselines on all four datasets, and in the last round it is also higher than the hand-written program’s on three of them (on WikiText-103 the hand-written program ends with the highest pretraining loss of any method), while PRECOCIAL’s downstream perplexity is the lowest everywhere. Part of the gap is mechanical: the first-iteration and hand-written programs show the network the same distribution in every round, and random mutation only reweights, drops or duplicates the first-iteration program’s rules, whereas an LLM rewrite can add new kinds of data. This is also what produces the sawtooth: PRECOCIAL’s loss rises at 32 of its 36 round boundaries. We therefore report the pattern without claiming that the optimized data is intrinsically harder to fit; separating “harder data” from “newer data” would need a run that replays the optimized programs in a fixed order.
I EPIPLEXITY OF THE PROGRAMS
We estimate the epiplexity of a program’s data with the prequential estimate of Finzi et al. (2026). A fresh 0.69M network, with the architecture and optimiser of our experiments, makes a single pass over 40,000 newly generated streams of the program (5,000 steps of 8 streams, each truncated to 512 tokens), so that no stream is seen twice. Before each update we record the mean per-token loss on the batch; after the pass we measure the loss on 500 held-out streams of the same program, which estimates its time-bounded entropy. The epiplexity estimate is , the area between the loss curve and the final loss, in nats per token summed over steps. Table 15 gives and for the 26 programs of this paper. Across them, more epiplexity goes with lower WikiText-103 test perplexity after matched pretraining and a 10k-step fine-tune (Spearman , ; the perplexity of the run whose training seed is the program’s search seed, or the mean of three runs for the hand-written and procedural programs), whereas does not predict perplexity (, ). The optimized WikiText-103 programs carry more epiplexity than their first-iteration programs in all three searches (1659 against 1590, 1459 against 1397 and 1396 against 1293), and every group of LLM-written programs carries more on average than the hand-written and procedural programs. Epiplexity separates these broad sources of programs better than it ranks the programs of one search: the program kept after round 5 has more epiplexity than the final program in two of the three WikiText-103 searches, although the final programs reach lower perplexity (Table 2).
Table 15: Epiplexity (nats per token summed over steps) and final held-out loss (nats per token) of each program’s synthetic data, measured with a fresh 0.69M network making one pass over 40,000 fresh streams. Mean and range over the programs of a group; all programs except the last group come from the WikiText-103 searches.
| Programs | n | Epiplexity S | Range of S | H |
|---|---|---|---|---|
| Hand-written () | 1 | 1115 | 1115 | 0.986 |
| Procedural | 1 | 843 | 843 | 0.859 |
| First iteration | 3 | 1427 | 1293–1590 | 0.981 |
| Random mutation | 3 | 1380 | 1285–1557 | 0.974 |
| PRECOCIAL after round 5 | 3 | 1579 | 1233–1798 | 0.990 |
| PRECOCIAL | 3 | 1505 | 1396–1659 | 0.943 |
| Optimized on a puzzle (4 tasks × 3) | 12 | 1456 | 1044–1884 | 1.039 |
J DETAILS OF THE REASONING AND PROBLEM-SOLVING TASKS
Table 16: Reasoning and problem solving, matched pretraining: final test perplexity on the answer tokens, mean ± SD (same runs as Table 5). Bottom rows: seed-paired difference in perplexity, positive when PRECO-CIAL is lower.
| Pretraining | Blocksworld | 8-puzzle | Sokoban | Countdown |
|---|---|---|---|---|
| PRECOCIAL | ||||
| First iteration | ||||
| Hand-written () | ||||
| No pretraining | ||||
| PRECOCIAL – hand-written (ppl, + = PRECOCIAL lower) | ||||
| PRECOCIAL – first iteration (ppl, + = PRECOCIAL lower) |

Figure 8: Every matched-pretraining run of Table 5 (dots; bars: means). On Blocksworld the solve rate is nearly all-or-nothing: it is a step function of the test perplexity the fine-tuned model reaches (Table 17), so single runs sit at zero or well above it.
Blocksworld is nearly all-or-nothing. A plan is about 30 actions (31 on average for our test problems) and every action must be legal and correct, so a model either produces whole correct plans often or almost never. Across the 33 Blocksworld runs of Table 5 the solve rate is a step function of the test perplexity the fine-tuned model reaches (Table 17; Spearman over 33 runs, ): all 9 runs below 1.04 solve some problems (0.015 to 0.635) and all 24 runs above it solve none, with no run in between. This is why single Blocksworld runs sit either at zero or far above it (Figure 8), and why we use 9 runs per method there. Table 16 gives the perplexities behind those solve rates.
Table 17: Blocksworld: mean solve rate of the 33 runs of Table 5, grouped by final test perplexity.
| Test perplexity | <1.01 | 1.01–1.03 | 1.03–1.05 | ≥1.05 |
|---|---|---|---|---|
| Runs | 5 | 2 | 2 | 24 |
| Mean solve rate | 0.463 | 0.095 | 0.043 | 0.000 |
K THE PLANS OF FIGURE 3
The networks of Figure 3 were trained for the figure with the protocol of Table 5: each method's matched-pretrained network is fine-tuned on the task with training seed 64, and its greedy plan for every test puzzle is replayed by the task's exact checker. Besides the methods of Table 5, the figure shows a universal prior: a network pretrained with the same model and budget on the outputs of random programs for a Brainfuck-like universal machine, our reimplementation after Grau-Moya et al. (2024). The puzzle shown for each task is chosen by a fixed rule, not by hand: among the test puzzles that the PRECOCIAL network solves (119 of 500 for the 8-puzzle, 43 of 500 for Sokoban and 82 of 200 for Blocksworld), keep those solved by the fewest of the other networks trained for the figure, and take the first in test-set order. The other networks are those shown and four more pretrained on reimplementations of published synthetic data (procedural generators, Dyck languages, cellular automata and LIME-style tasks), and for Blocksworld also random mutation; for every task the fewest is zero, and 38, 21 and 20 puzzles qualify. Figures 9–11 show six evenly spaced states of each plan. Table 18 gives the solve rates of these networks over three training seeds; they are separate runs from those of Table 5.
Table 18: Test solve rate of the networks trained for Figure 3, mean ± SD over training seeds 64, 65 and 66 (the figure shows seed 64).
| Pretraining | 8-puzzle | Sokoban | Blocksworld |
|---|---|---|---|
| PRECOCIAL | 0.237±.003 | 0.073±.014 | 0.137±.237 |
| First iteration | 0.143±.120 | 0.014±.014 | 0.007±.012 |
| Hand-written (π0) | 0.192±.074 | 0.037±.026 | 0.000±.000 |
| No pretraining | 0.021±.014 | 0.010±.002 | 0.000±.000 |
| Universal prior | 0.154±.053 | 0.049±.006 | 0.000±.000 |
| start | |||
|---|---|---|---|
| PRECOCIAL solved in 18 moves | 1 | 8 | |
| 7 | 3 | 4 | |
| 6 | 5 | 2 |
| 1 | 3 | 8 |
|---|---|---|
| 7 | 4 | 2 |
| 6 | 5 |
move 4
| 1 | 3 | 8 |
|---|---|---|
| 4 | 2 | |
| 7 | 6 | 5 |
move 7
| 1 | 3 | |
|---|---|---|
| 4 | 2 | 8 |
| 7 | 6 | 5 |
move 11
| 1 | 2 | 3 |
|---|---|---|
| 4 | 8 | 5 |
| 7 | 6 |
end
move 14
| 1 | 2 | 3 |
|---|---|---|
| 4 | 5 | 6 |
| 7 | 8 |
move 18
| First iteration legal, goal not reached |
| 1 | 8 | |
|---|---|---|
| 7 | 3 | 4 |
| 6 | 5 | 2 |
| 1 | 8 | 4 |
|---|---|---|
| 7 | 5 | 3 |
| 6 | 2 |
move 3
| 1 | 8 | 4 |
|---|---|---|
| 5 | 3 | |
| 7 | 6 | 2 |
move 6
| 1 | 8 | 4 |
|---|---|---|
| 5 | 3 | 2 |
| 7 | 6 |
move 11
| 1 | 8 | 4 |
|---|---|---|
| 3 | 2 | 6 |
| 5 | 7 |
move 14
| Hand-written legal, goal not reached |
| 1 | 8 | |
|---|---|---|
| 7 | 3 | 4 |
| 6 | 5 | 2 |
| 1 | 8 | 4 |
|---|---|---|
| 7 | 3 | 2 |
| 6 | 5 |
move 3
| 1 | 8 | 4 |
|---|---|---|
| 3 | 2 | |
| 7 | 6 | 5 |
move 6
| 1 | 4 | 2 |
|---|---|---|
| 3 | 8 | |
| 7 | 6 | 5 |
move 11
| 1 | 4 | 2 |
|---|---|---|
| 6 | 8 | |
| 3 | 7 | 5 |
move 14
| 1 | 4 | 2 |
|---|---|---|
| 6 | 8 | 5 |
| 3 | 7 |
move 16
| No pretraining legal, goal not reached |
| 1 | 8 | |
|---|---|---|
| 7 | 3 | 4 |
| 6 | 5 | 2 |
| 1 | 8 | 4 |
|---|---|---|
| 7 | 3 | 2 |
| 6 | 5 |
move 3
| 1 | 8 | 4 |
|---|---|---|
| 7 | 8 | 2 |
| 6 | 3 | 5 |
move 6
| 1 | 4 | 2 |
|---|---|---|
| 7 | 5 | |
| 6 | 8 | 3 |
move 10
| 1 | 4 | |
|---|---|---|
| 7 | 5 | 2 |
| 6 | 8 | 3 |
move 13
| 1 | 5 | 4 |
|---|---|---|
| 7 | 2 | 3 |
| 6 | 8 |
move 16
| Universal prior legal, goal not reached |
| 1 | 8 | |
|---|---|---|
| 7 | 3 | 4 |
| 6 | 5 | 2 |
| 1 | 8 | 4 |
|---|---|---|
| 7 | 3 | 2 |
| 6 | 5 |
move 4
| 1 | 8 | 4 |
|---|---|---|
| 3 | 2 | |
| 7 | 6 | 5 |
move 7
| 1 | 2 | 8 |
|---|---|---|
| 3 | 4 | |
| 7 | 6 | 5 |
move 11
| 1 | 2 | 8 |
|---|---|---|
| 3 | 4 | 5 |
| 7 | 6 |
move 14
| 1 | 2 | 8 |
|---|---|---|
| 4 | 5 | 6 |
| 3 | 7 |
move 18
Figure 9: The 8-puzzle of Figure 3: six evenly spaced states of each network's plan.
| start | |
|---|---|
| PRECOCIAL solved in 9 moves | |

move 2

move 4

move 5

move 5

move 7

move 9
| First iteration illegal move at step 5 |
move 1
move 2
move 3
move 4
move 4
move 4
| Hand-written illegal move at step 6 |
move 1
move 2
move 3
move 4
move 5
move 5
| No pretraining legal, goal not reached |
move 2
move 4
move 5
move 6
move 8
move 10
| Universal prior legal, goal not reached |
move 2
move 4
move 5
move 6
move 7
move 9
Figure 10: The Sokoban puzzle of Figure 3: six evenly spaced states of each network's plan. The dot is the player; a red square marks the cell the illegal move tries to enter.

Figure 11: The Blocksworld puzzle of Figure 3 (9 blocks): six evenly spaced states of each network's plan; the block above the stacks is the one in the hand.
L COST
Table 19: Cost of one search with ten candidates on the 0.69M model: WikiText-103 and CodeSearchNet, 3 seeds each (6 searches per row), all on RTX A6000 GPUs. The five time columns are GPU-hours of one search and add up to the total (up to rounding). How to read each column is explained below the table.
| Search | Pretraining steps | GPU-hours per search | LLM calls | API cost | Test ppl | ||||
|---|---|---|---|---|---|---|---|---|---|
| Pretrain | Fine-tune | LLM | Other | Total | |||||
| PRECOCIAL (one network) | 60,000 | 0.14 | 0.37 | 0.17 | 0.02 | 10.8 | $1.20 | 4.659 | |
| FunSearch (network per candidate) | 150,000 | 0.36 | 0.37 | 0.12 | 0.02 | 9.0 | $1.10 | 4.890 | |
| AlphaEvolve (network per candidate) | 150,000 | 0.35 | 0.36 | 0.12 | 0.02 | 9.3 | $1.08 | 4.955 | |
Reading Table 19. Each row is one way of running a search that evaluates ten candidate programs. Pretraining steps is the number of synthetic pretraining steps summed over the whole search, not a fine-tuning budget: PRECOCIAL pretrains one network for 15k steps for the first candidate and continues it for 5k steps for each of the nine later ones (15k + 9×5k = 60k), whereas FunSearch and AlphaEvolve as published pretrain a fresh network for 15k steps for each of the ten candidates (10×15k = 150k). The five time columns split one search into synthetic pretraining; fine-tuning the ten candidates for up to 10k steps each, which is identical under both protocols; waiting for the LLM; everything else (generating the synthetic data, evaluation and bookkeeping); and their total, mean ± SD over the six searches. LLM calls counts every call, including retries of programs that failed validation, and API cost prices them at Claude Sonnet 4 rates. Test ppl is the test perplexity of the program each search kept after a 10k-step fine-tune, averaged over the six searches (three on each dataset). One network cuts pretraining time by 59–61%, but fine-tuning is unchanged and takes 42–53% of a search, so the total falls by 17.1–19.5%.
Longer searches and larger models (projection). From the WikiText-103 searches of Appendix G (3 per model size, RTX A6000), one candidate costs 0.039 GPU-h of fine-tuning at 0.69M parameters and 0.067 at 3.36M, one LLM call 0.015, and everything else 0.003, while synthetic pretraining costs 2.54 GPU-h (0.69M) and 5.07 (3.36M) per million steps. With one network a search of n candidates pretrains 15k + 5k (n-1) steps; with a fresh network per candidate, 15k n. Table 20 multiplies these rates out. These are projections, not runs. At ten candidates they reproduce the measured one-network searches (0.73 against 0.71 GPU-h at 0.69M, 1.15 against 1.18 at 3.36M), but they predict a 24% saving at 0.69M against the 17–20% measured in Table 19, so they overstate the saving somewhat. The saving grows with the number of candidates and with model size, because pretraining is a larger share of each candidate's cost for a larger model.
Table 20: Projected GPU-hours of one search, with one network continued across candidates (“one”) and with a fresh network per candidate (“fresh”), from the per-candidate rates above. Last column: synthetic pretraining steps summed over the search, one vs fresh.
| Candidates | 0.69M model | 3.36M model | Pretraining steps (one vs fresh) | ||||
|---|---|---|---|---|---|---|---|
| one | fresh | saving | one | fresh | saving | ||
| 10 | 0.73 | 0.95 | 24% | 1.15 | 1.61 | 28% | 60,000 vs 150,000 |
| 100 | 7.03 | 9.54 | 26% | 11.1 | 16.1 | 31% | 510,000 vs 1,500,000 |
| 1,000 | 70.0 | 95.4 | 27% | 110 | 161 | 31% | 5,010,000 vs 15,000,000 |
M RULE CLASSIFICATION
Rules are classified by keyword matching on their names, which are the LLM's own and usually say what the rule does: planning (e.g. pddl, plan, action, state, precond, grid, move, puzzle, sokoban), arithmetic (arith, expr, math, fraction, make24), code syntax (func, class_def, import, method, param, tryCatch), list and string operations, logic, cellular automata, and formal structure (nest, dyck, tree, cfg, stack); a name takes the first matching type in a fixed order. The share of a type is its fraction of the synthetic data generated in a round, by volume. The classifier is a keyword map, so single percentages are approximate; the script that assigns every name is released with the code.
| Task | First iter. | All cand. | Kept | |
|---|---|---|---|---|
| Blocksworld | 0.0 | |||
| 8-puzzle | 0.0 | |||
| Sokoban | 0.0 | |||
| Countdown | 3.6 | |||
| CodeParrot | 0.0 | |||
| CodeSearchNet | 0.0 |
Table 21: Share of synthetic data (%) from rules of the task-matching type (Figure 12), mean ± SD over three searches: in , the first-iteration program, all candidates of rounds 0–9, and the kept program.

Figure 12: Task-matching share by search round, mean ± SD over three searches: planning rules for Blocksworld, the 8-puzzle and Sokoban, arithmetic for Countdown, code syntax for code.