arXiv:2610.24970cs.LGOct 2026

Manuscript Offprint

arXiv:2610.24970

PRECOCIAL: Pretraining with Code Curriculums via Iterative Search for Accelerated Learning

Edward Gu, Ali Payani, Kevin Ellis

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

Figure 1: PRECOCIAL at a glance. Top: an LLM rewrites a program π\pi (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 ( §\S4.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 ( §\S3).

• 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 2.5×2.5 \times fewer pretraining steps ( §\S4.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 ( §\S4).

References (57)