A wave of recent methods lets LLMs review their past attempts and write better prompts or notes for themselves. This paper brings four of them—TextGrad, GEPA, TF-GRPO, and ACE—together for the first time under the same models, tasks, and evaluation conditions. The conclusion is straightforward: no method wins across every task, and they often fail to beat even simple baselines such as Chain-of-Thought. One variable also emerged as central to when these methods work: how diverse the model’s failure patterns are.
There are two broad ways to adapt an LLM to a particular task. One is to train it by directly updating its parameters through methods such as RLHF, DPO, or GRPO. That is expensive, requiring tens of thousands of preference examples or hundreds of thousands of rollouts. The other leaves the model’s weights alone and steers it by carefully designing the context it receives—instructions, examples, and notes. This is context engineering.
At first, people refined those instructions by hand. Then came the question: what if the LLM itself became the context engineer? Much as people learn by reviewing past experiences, a model could examine an offline collection of attempts—successful and failed trajectories—and extract generalizable instructions or lessons on its own. The paper calls this approach LCE (LLM Context Engineer, or automated context engineering).
The problem is that these methods reported promising results using different models and benchmarks. In the examples cited by the paper, ACE reported gains on agent and financial tasks with DeepSeek-V3.1-671B, while GEPA reported gains on math and multi-hop reasoning with Qwen3-8B and GPT-4.1-mini. Neither the models nor the tasks overlap. That makes it impossible to answer the practical questions: which method is actually better, and when is it useful? The authors build a benchmark with shared conditions to make that comparison possible.
The authors first bring these seemingly different LCE methods into a single framework. Their observation is that automated context engineering always boils down to three stages.
This R-E-C framework makes the differences between the four methods clear.
TextGrad and GEPA therefore refine the system prompt (Sys), while TF-GRPO and ACE accumulate experience (Exp) to expand the context at test time. In human terms, the former keeps rewriting the operations manual; the latter keeps the manual and adds sticky notes with lessons learned.
For comparison, the authors include two simple baselines that require no iterative engineering. CoT prompts the model to “solve the problem step by step.” ICL supplies a few successful trajectories as examples: the authors generate 5 trajectories per training sample to build a pool, then randomly select 3 successful trajectories as examples for each test sample.
The benchmark covers five tasks with different reasoning patterns: mathematical reasoning (MATH500), multi-hop reasoning (HotpotQA), instruction following (IFBench), retrieval (MiddleMatch), and agent tasks (AppWorld). AppWorld requires sustained interaction with apps to complete long-horizon tasks, rather than a single response. Its inclusion tests whether LCE works beyond one-shot answers.
The authors selected three models from different families in the 8B class: Qwen3-8B, Gemma-4-E4B-it, and Ministral-3-8B-Instruct. This avoids relying on a single model family. Each experiment was repeated 5 times using 5 fixed seeds.
It is worth being precise about what this design can and cannot measure. The five tasks cover a broad range of reasoning “patterns”—retrieval, math, multi-hop reasoning, instruction following, and agent behavior—but the main benchmark centers on 8B-class models. Only the scaling experiments extend to sizes such as 32B and 235B. The benchmark’s primary conclusions therefore concern how LCE methods compare on models of roughly similar size. Behavior in much larger models is addressed separately in the scaling analysis.
A key feature of the evaluation is the separation of validation performance from test performance. During training—the context-engineering process—the validation set is used to select a context. That context is then evaluated on the test set. This separation exposes cases where improvements during training fail to generalize.
First, LCE generally works during training and validation. With Qwen3-8B held constant, TF-GRPO, GEPA, and ACE consistently improved validation performance across four tasks. All LCE methods improved validation performance on MiddleMatch and IFBench. The largest gains came on IFBench, where ACE improved by more than 20 points and GEPA by more than 10 points. Gains on MATH500 and HotpotQA were small, however, and TextGrad actually reduced performance on HotpotQA by more than 15 points. The test comparisons therefore retain only the three methods that reliably improved validation performance: TF-GRPO, GEPA, and ACE.
Second, there is no free lunch at test time. Across three model families × five tasks = 15 settings, the best LCE method showed a noticeable improvement over the best baseline in only 7. Requiring statistical significance (p≤0.05) reduces that count to 5. Even within those 5, some gains came from the initial context design rather than from better context produced during training. The paper offers a telling example: on IFBench with Gemma4, GEPA beat CoT by 6.94 points, yet finished 1.22 points below its own initial performance. It appeared to beat the baseline, but the credit belonged to its starting point, not the engineering process. Comparing against a baseline and comparing against a method’s own starting point answer different questions; the two should not be conflated.
Even the cases where LCE won came with conditions. On HotpotQA and MATH500, LCE helped particular models when their baseline performance was lower than that of the other models. On HotpotQA, Min3 had the lowest CoT (23.07) and ICL (27.07) scores among the three models, and ACE improved on its initial performance by 3.13 points. LCE brought no benefit to the other models. The authors speculate that LCE has room to help when a model’s capabilities are not yet being fully used.
Third, larger models do not reverse the failures. The authors independently varied the Reflector, which builds the context, and the Generator, which executes the task, between 8B and 32B. Larger models produced better context on IFBench and MiddleMatch, but sometimes did worse on MATH500 and HotpotQA. A larger Reflector amplified both gains and losses. The same held when scaling from Qwen3-0.6B to 235B-A22B or moving across generations from Qwen1.5-7B to Qwen3.5-9B. Newer generations improved baseline capabilities, but LCE gains showed no consistent trend. GEPA’s gains on HotpotQA, for example, declined across generations, while its large gains on MiddleMatch persisted.
Fourth, this points to an answer to “when does it work?” Across all settings—models, tasks, and methods—LCE’s performance gains were negatively correlated with the diversity of failure modes in the initial rollouts (r=-0.5, p≤0.05). LCE works better when failures fall into a few similar patterns. As failures become more varied, its benefits fade.
The authors measured failure diversity as follows. For each failed reasoning trajectory, they asked an LLM to diagnose the cause and produce a failure-mode description grounded in concrete evidence but generalized beyond the specifics of the case. They then embedded those descriptions using all-mpnet-base-v2 and quantified their diversity with the Vendi Score. This score can be interpreted as the “effective number of distinct samples”; lower values indicate more homogeneous failures. Across tasks, MiddleMatch had the most homogeneous failures, while AppWorld, which requires interaction with apps, had the most diverse.
Two further findings offer useful clues. First, the strength of the negative correlation varied by method. It was significant for GEPA and TF-GRPO, but not for ACE. The authors suggest that when failures are diverse, GEPA’s prompt rewriting and TF-GRPO’s selection or merging of experiences can discard useful knowledge. ACE’s incremental accumulation may preserve that knowledge better, making it less dependent on failure diversity. Second, ICL’s gains were unrelated to diversity. That suggests the relationship depends on the LLM’s process of reflecting on and extracting lessons from failures, rather than on simply supplying successful examples.
The limitation the authors acknowledge goes straight to the heart of the problem. LCE’s main bottleneck is its ability to abstract principled context from heterogeneous failures. If the model cannot extract shared principles from those failures, repeated reflection will not improve the context. The authors observed that the Vendi Score of accumulated experiences barely changed across epochs, which they present as evidence that LCE struggles to distill experiences into shared principles.
The authors also identify another mechanism: some LCE successes come from better adherence to instructions about format, rather than better reasoning. In other words, scores sometimes rise because the model follows the requested format more closely, not because it thinks more effectively. This calls for a distinction between apparent score gains and actual improvements in reasoning ability.
I would add two limitations. Because the main benchmark focuses on 8B-class models, conclusions about very large frontier models should stay within what the scaling experiments suggest. And while using embeddings plus the Vendi Score to quantify failure-mode diversity is clever, how faithfully that number captures the diversity of underlying causes depends on the embedding model and the diagnostic prompt. The authors try to strengthen the analysis with variance decomposition and mixed-effects analysis in the appendix, but correlation (r=-0.5) remains correlation; it does not establish causation. Whether “making failures less diverse” would improve LCE requires further testing.
This study sits between test-time scaling approaches such as CoT, ToT (Tree-of-Thoughts), and ReAct, and the LCE family. CoT, ReAct, and ToT spend additional computation on a single task attempt according to a fixed workflow, but do not learn from an offline history of attempts. As the paper puts it, CoT may help avoid a mistake during one reasoning attempt, yet the same mistake can recur on the next.
LCE methods run optimization loops similar to those used in training-based approaches such as RLHF, DPO, and GRPO, but use textual feedback instead of gradients and update context text instead of parameters. This paper’s contribution is not another LCE method. It compares four previously separate methods under shared conditions (contribution 1), examines scaling across parameter counts and model generations (contribution 2), and uses ablations and case studies to identify what determines when and how they work (contribution 3). By standardizing the evaluation protocol, it provides a cross-check of the original papers’ claims that each method works well in its own setting.
ONTLE provides AI project managers that join client teams on assignment. One of the most appealing capabilities here is “experience memory”: an AI PM records failures and lessons from past projects in its own playbook, then retrieves those notes to give better instructions on the next project. This paper examines a central assumption behind that design.
Consider a concrete scenario. An AI PM reviews delays and failures from 10 projects in the previous quarter and automatically writes operational notes about what to do next time. That is exactly what ACE and TF-GRPO aim to do. Applying this paper’s findings changes how we should approach it. Experience memory offers clear benefits in areas where failures fall into a few recurring patterns—for example, instruction-following failures such as missing report templates, violating rules for tagging responsible owners, or skipping prescribed checklists. This is supported by the fact that MiddleMatch and IFBench, where LCE worked best in the paper, are retrieval and instruction-following tasks with homogeneous failures.
The picture changes when failures vary widely. In typical long-horizon, complex tasks, one project might be delayed by technical debt, another by changing customer requirements, another by staffing gaps, and another by external dependencies. AppWorld has this kind of character. In these settings, automatically accumulated notes rarely improve scores. Useful lessons can even become diluted as more notes are added. ONTLE’s experience memory should therefore begin with a gate that assesses whether a task’s failures are homogeneous or heterogeneous, rather than applying the same approach everywhere. Homogeneous areas can use automatic accumulation; heterogeneous areas can draw on a human PM to extract principles or use more conservative accumulation, such as ACE’s incremental preservation. We also need to measure separately whether memory improves actual judgment or merely compliance with formatting requirements, so that apparent gains do not mislead us.
Instead of having people refine instructions by hand, LCE makes the LLM itself the engineer, automatically extracting and updating generalizable instructions or lessons from past attempts. The key is that optimization happens in text space, without changing the model’s parameters.
It expresses the diversity of a set of samples as the “effective number of distinct samples.” In this paper, the authors embedded failure-mode descriptions and used the score to measure failure diversity. Lower scores mean the failures are more similar. The metric has previously been used to measure things such as the diversity of patterns in generated images.
The paper’s conclusion is that there is no single winner, but there are some tendencies. GEPA and TF-GRPO, which rewrite the entire system prompt, were more likely to lose useful knowledge when failures were diverse, showing a significant negative correlation with diversity. ACE, which accumulates entries incrementally without deleting them, was relatively less dependent on diversity. The safer approach is to first assess how homogeneous the task’s failures are and choose accordingly.
Because LCE selects context based on the validation set, it can overfit to that distribution and transfer poorly to a separate test distribution. A deeper bottleneck is that, when failures are heterogeneous, the model struggles to extract shared principles, leaving its accumulated experience unable to generalize to new cases.
No. It delivered clear benefits on tasks with homogeneous failures, such as the retrieval task MiddleMatch and the instruction-following task IFBench in this paper. The point is that it is not a universal solution. The practical lesson is to measure a task’s failure patterns before adoption and use LCE where it is likely to work.