WorksComputer Science
MetaFORGE: A Meta-Learning Framework for Harness Optimization in Automated Code Generation for Parallel Computing
Abstract
Large language models (LLMs) can generate parallel programs, but their correctness and performance depend strongly on the instructions that guide generation. We present MetaFORGE, an execution-grounded meta-learning framework that iteratively optimizes persistent natural-language skill specifications for MPI C code generation. MetaFORGE combines correctness testing, compiler diagnostics, static-analysis findings, runtime measurements, and rank-level load-imbalance profiles into a scalar reward that drives textual-gradient refinement, while an external memory distills and retrieves reward-supported optimization knowledge across runs. Across six MPI tasks and three workload sizes, MetaFORGE improves static-analysis quality, runtime, and load balance relative to zero-shot generation and generally exceeds the evaluated TextGrad iterative baseline. A model-matched refinement ablation shows that the MetaFORGE advantage persists when its refinement model is reduced to gpt-4o. An expanded retrieval ablation across all 18 task–workload configurations shows consistent runtime benefit and broad static-analysis and load-balance benefit from retrieved context. Leakage-controlled held-out and zero-update experiments further provide evidence that optimization knowledge persists in both the transferred skill and external memory under the evaluated protocol.
Introduction
LLM-based code generation remains difficult because informal or semi-formal requirements often contain ambiguities in intent, assumptions, constraints, performance expectations, and correctness criteria. Requirements engineering has long recognized that software requirements are frequently incomplete or open to multiple interpretations, and that translating them into working systems typically requires trained professionals and iterative processes of analysis, design, implementation, and validation [33]. Although code-trained LLMs have demonstrated strong synthesis capabilities [2], recent work shows that ambiguous or incompletely specified requirements can substantially degrade generated code quality, and that models often fail to detect or resolve such ambiguity without external guidance [28, 6].
These challenges are especially amplified in high-performance parallel programming. MPI programs coordinate distributed processes through explicit communication, so correctness and performance depend on how computation, data, synchronization, and communication are distributed across processes. Errors in decomposition, message ordering, collectives, boundary exchange, or memory layout can cause incorrect results and deadlocks [14, 3, 8, 9, 5, 15, 30]. Many performance issues are also execution-dependent: code may compile and run correctly yet still suffer from communication overhead, root bottlenecks, inefficient decomposition, or rank-level imbalance that emerges only at runtime and scale [11] (Adhianito et al. 2010). Thus, MPI code generation is better viewed as an execution-grounded optimization problem than as one-shot synthesis.
Iterative refinement approaches used by LLMs primarily optimize for functional correctness or unit-test success and rarely incorporate compiler diagnostics, static analysis, runtime profiling, or utilization metrics into a unified optimization objective. Furthermore, they typically discard optimization experience after each task rather than accumulating reusable domain knowledge across tasks.
We present MetaFORGE, an execution-ેણ grounded meta-learning framework for MPI C code generation. Rather than optimizing only an individual generated program, METAFORGE treats the persistent skill specification—the natural-language instructions that condition generation—as an adaptive policy refined within and across tasks. Each candidate program is compiled, tested, statically analyzed, executed, and profiled; the resulting evidence is combined into a reward that penalizes correctness failures, compiler warnings, static-analysis findings, externally measured whole-job runtime, and load imbalance. METAFORGE then converts the diagnostics and reward trends into a textual gradient: a natural-language update signal that identifies measured deficiencies and proposes revisions to the skill. A second model call applies the gradient while preserving unrelated instructions. Figure 1 summarizes this closed-loop process.

Figure 1. MetaFORGE: An automated meta-learning skill-refinement architecture. MetaFORGE optimizes LLM coding skills through execution-grounded feedback. Generated MPI C code is compiled, statically analyzed, executed, and scored using Eq. (1). Diagnostics and reward trends are converted into a textual gradient for skill-prompt rewriting, while iteration artifacts are stored, distilled, indexed, and retrieved as long-term memory, enabling future updates to reuse prior reward-improving strategies.
Beyond within-task skill refinement, METAFORGE integrates automated execution, MPI-aware diagnostics, per-rank runtime profiling, deterministic skill versioning, and persistent external memory. The memory system stores iteration-level evidence and distills reward-improving episodes into compact guidance indexed by MPI constructs, parallel patterns, and observed correctness or performance symptoms. The skill captures broadly applicable generation behavior, whereas memory selectively retrieves more specific optimization experience from prior runs. Because both artifacts are external to the model, the framework supports inspectable cross-task transfer without parameter fine-tuning. MPI therefore serves as a demanding testbed for execution-grounded skill refinement and reusable optimization knowledge in language-model agents.
Our central hypothesis is that execution-grounded refinement of persistent coding skills can improve program correctness, static-analysis quality, runtime performance, and rank-level load balance beyond zero-shot generation and general-purpose textual-gradient refinement. This work makes three contributions. (1) We introduce METAFORGE, an MPI-aware meta-learning harness that optimizes persistent LLM skill specifications using correctness tests, compiler diagnostics, static-analysis findings, externally measured whole-job runtime, and rank-level load-imbalance measurements. Its two-stage refinement procedure converts this execution evidence into an explicit textual gradient and then applies the gradient while preserving unrelated skill instructions. (2) We develop a persistent cross-task memory mechanism that separates detailed iteration episodes from compact, reward-supported optimization lessons. The mechanism distills, indexes, and retrieves prior lessons using MPI constructs, parallel patterns, task characteristics, and observed correctness or performance symptoms. (3) We evaluate METAFORGE across six MPI tasks, three workload sizes, and five independent trials per configuration against zero-shot generation and a TEXTGRAD-based iterative baseline. We additionally conduct retrieval, cross-model, refinement-model, and leave-one-task-out studies to assess memory contribution, model sensitivity, and cross-task persistence.
Related Work
MetaFORGE builds upon prior research in execution-guided code optimization, memory-augmented LLM agents, and HPC performance engineering. This section briefly reviews these areas and highlights the gaps addressed by our framework.
Execution-Grounded Code Optimization
Recent language-model agents have demonstrated the effectiveness of iterative refinement using external feedback. Reflexion [26], SWE-Agent [29], and AutoCodeRover [35] leverage execution results, tool use, and program analysis to improve generated code, while optimization-oriented systems such as Language Agents as Optimizable Graphs [37] and AlphaEvolve [17] further demonstrate the value of performance-driven refinement. TextGrad [31] and related work [12, 32] show that textual feedback can optimize agent behavior without modifying model parameters. However, these approaches primarily target general software-engineering tasks and do not focus on distributed-memory performance optimization. This paper [27] incorporate execution feedback into parallel-program optimization, but optimization experiences remain task-specific rather than reusable across tasks.
Memory-Augmented Agents
External memory and retrieval mechanisms enable language-model agents to accumulate and reuse knowledge across tasks. MemoryBank [36], MemGPT [22], Generative Agents [23], MemInsight [25], and Mem0 [4] demonstrate the benefits of persistent memory for long-horizon reasoning. Retrieval-augmented generation (RAG) [13] and software-engineering systems such as RepoCoder [34] further show that incorporating external knowledge can improve generation quality. Existing approaches primarily retrieve conversational history, documentation, or source code, whereas our work focuses on storing and retrieving optimization knowledge derived from execution feedback, profiling results, and compiler diagnostics.
Performance Analysis and Optimization in HPC
Performance engineering has long relied on execution-grounded analysis to identify bottlenecks in distributed-memory applications. Profiling frameworks such as HPCToolkit [1] and Score-P [11] provide detailed measurements of communication overhead, synchronization behavior, and load imbalance, while correctness-analysis tools such as MUST [8], PARCOACH [16], and LLM-based analysis [24] assist developers in detecting communication and synchronization defects. Although these tools effectively diagnose performance and correctness issues, the resulting optimization experiences are rarely consolidated into reusable knowledge for future optimization tasks. ParaCodex [10] uses a Codex-based autonomous workflow that integrates correctness checking, profiling, and refinement for translating serial CPU kernels to OpenMP GPU-offload kernels and also evaluates CUDA-to-OpenMP offload translation; it is limited to GPU-offload execution scopes and does not reuse previously learned optimization knowledge.
MetaFORGE Harness Design
Figure 1 presents METAFORGE as two coupled optimization loops. The within-run loop repeatedly generates, evaluates, and refines a natural-language skill for the current task. The cross-run loop converts the resulting trajectory into persistent optimization knowledge that can guide later tasks. The framework maintains a current skill , a best-observed skill , an episode store containing iteration-level evidence, a distilled memory store , and an inverted index used for retrieval. This separation between transient episodes and persistent memories allows the harness to preserve detailed execution evidence during refinement while exposing only concise, reward-supported guidance to subsequent model calls. The central design principle is that execution evidence should modify the persistent instructions that condition future generation rather than only repairing the current program. Each candidate is therefore evaluated using correctness, compiler, static-analysis, runtime, and rank-level utilization signals. These signals guide a two-stage textual-gradient update, after which successful optimization guidance is distilled and indexed for reuse. The following subsections describe the evaluator, skill-refinement process, and cross-run memory mechanism.
Framework State and Control Flow
MetaFORGE iteratively optimizes a skill specification, a structured natural-language prompt that guides an LLM-based MPI C code generator. Algorithm 1 summarizes the closed-loop refinement process. Given a task and an initial skill , each iteration generates and evaluates a candidate MPI C program, extracts an MPI-relevant tuple, retrieves matching optimization memories, and updates the skill using execution-grounded textual feedback augmented with the retrieved context. The best skill observed so far is retained, and refinement stops after consecutive iterations without reward improvement.
Execution-Grounded Evaluation
Let denote the skill specification, the fixed task description, and the number of MPI processes. Let denote the externally measured whole-job runtime used in the reward, and let denote the per-rank elapsed times used to compute load imbalance. METAFORGE defines the scalar reward as
Here, and are compiler-warning and static-analysis-warning counts, and is the mean per-rank elapsed time. The normalized load-imbalance coefficient is
The binary variable indicates correctness failure, with if the generated program fails task-specific correctness testing and otherwise.
The coefficient is set large enough that incorrect programs receive a high negative reward and are not selected merely because they reduce warnings, runtime, or imbalance. The remaining coefficients control the relative importance of code quality, runtime, and utilization. Because , values closer to zero indicate better candidates.
For each candidate, the harness executed the compiled program 20 times sequentially without recompilation and retained all repetitions; no initial run was discarded as a warm-up. For execution , the harness measured the elapsed time of the complete mpirun -n 4 <cbinary> invocation externally. The candidate runtime used for reward computation and reported runtime improvement is the arithmetic mean .
Rank-level measurements were collected separately for load-imbalance evaluation. All timing was collected by the harness rather than self-reported by the generated program, preventing generated code from directly manipulating the runtime signal used for evaluation.
The reward serves as a within-task candidate-selection signal rather than as a universal task-normalized measure of program quality. Its terms capture complementary failure modes. Correctness testing prevents invalid programs from being preferred because they execute quickly; compiler and static-analysis findings expose defects that may not appear in task outputs; whole-job runtime measures end-to-end execution cost; and distinguishes poor rank utilization from uniformly slow execution. Absolute raw reward values are not interpreted as directly comparable across tasks because runtime and warning-count scales differ.
Reward-Guided Skill Refinement
Algorithm 1 organizes the METAFORGE refinement process into four stages while maintaining the current skill and the best-performing skill . Lines 1–2 initialize , , the best observed reward , the patience counter , the previous textual gradient , and the episode-identifier list ids before entering the bounded refinement loop. The counter records consecutive non-improving iterations, while ids retains the episodes required for subsequent retrieval and trajectory compression. Lines 3–5 call GENERATE to produce MPI C candidate from the current skill and EVALUATE to obtain the metric vector , diagnostic feedback , and scalar reward ; the algorithm then updates
Algorithm 1 MetaFORGE Skill Meta-Learning Harness
Input: Task , initial skill , limits , process count , retrieval budget , stores , weights , and rewriter
Output: Optimized skill
1: Initialize , , , , , and . 2: for to do 3: ▷ Prompt D.1 4: , which compiles, tests, analyzes, executes, and scores . 5: If , set ; otherwise set . 6: . (Appendix Alg. 3) 7: ; append to ids. 8: break if 9: (Appendix Alg. 6) 10: . 11: ▷ Alg. 2 12: ; ; . 13: end for 14: ▷ § 3.4 and Algorithm 4 15: return
, , and according to whether improves the best reward observed so far, thereby grounding candidate selection in measured correctness, code quality, runtime, and load balance rather than model self-assessment. Lines 6–10 construct the memory-augmented rewrite context: produces the tuple from the current task, candidate, metrics, diagnostics, and previous gradient; preserves the complete episode-level evidence; and and retrieve and format relevant prior optimization experience as context . Line 8 terminates the loop when the patience threshold is reached, avoiding an unnecessary rewrite, whereas Line 10 combines the current execution evidence and retrieved memory into the complete rewrite context . Lines 11–12 call , through rewriter , to diagnose the candidate’s shortcomings and produce an updated skill together with textual gradient ; the algorithm assigns , attaches to the stored episode, and retains it as the rationale for the update and as for the next iteration. Finally, Lines 14–15 compress and index the completed trajectory for future retrieval and return the best-performing skill observed during the run.
Algorithm 2 converts this context into a textual gradient and applies the gradient to rewrite the skill; if no actionable gradient is produced, the current skill is retained. The returned gradient is stored with the episode for later lesson distillation, and after refinement terminates, the accumulated episodes are compressed and indexed for use in subsequent runs. The scalar reward indicates whether the current candidate improved, but it does not specify how the natural-language skill should change. Algorithm 2 addresses this limitation by separating evidence-based diagnosis from skill modification.
Algorithm 2 Skill Rewriting via Textual Gradient: REWRITEVIAGRADIENT
Input: Refinement context and rewriter
Output: Updated skill and textual gradient
1: Unpack into the current skill , task , generated code , metric summary , diagnostics , current and best rewards , and retrieved context . Step 1: Compute textual gradient 2: ▷ Prompt D.2 3: return if Step 2: Apply textual gradient 4: ▷ Prompt D.3 5: return
Algorithm 2 implements the skill update in two intentional stages. Line 1 unpacks the refinement context so that the current skill, task, generated program, diagnostic evidence, metric summary, reward comparison, and retrieved memories remain available to the update procedure. In the diagnostic stage, uses this evidence in Line 2 to identify which skill instructions should change and why. Prompt D.2 in Appendix directs the model to restore correctness when testing fails and otherwise prioritize the largest weighted reward terms. Line 3 provides a conservative stopping condition: if produces no actionable guidance, the current skill is returned unchanged. In the modification stage, applies the textual gradient and retrieved context in Line 4 using Prompt D.3 in Appendix. Separating diagnosis from rewriting makes the proposed change explicit and inspectable before it modifies the persistent skill. Finally, Line 5 returns both the revised skill and the textual gradient; retaining the gradient preserves the rationale for the update so that it can later be attached to the episode and distilled into cross-run memory.
The separation between gradient generation and skill rewriting is deliberate. The first model call performs diagnosis: it compares the current and best-observed metrics, identifies the largest weighted reward terms, and proposes evidence-supported changes. The second call edits the persistent skill using that critique while preserving unrelated instructions. This division prevents diagnostic reasoning from being conflated with unrestricted prompt rewriting and creates an explicit textual artifact that can later be stored and distilled. The refinement context also includes retrieved optimization memories, but those memories remain advisory: the current execution evidence and reward comparison determine whether a retrieved strategy is applicable. The complete textual-gradient and skill-rewrite templates are provided in Prompts D.2 and D.3 in Appendix § 9.
Retrieval-Augmented Optimization Memory
MetaFORGE augments the within-run refinement loop with persistent cross-task memory. In Algorithm 1, the EXTRACTTUPLES step summarizes the current task, generated program, evaluation metrics, diagnostics, and preceding textual gradient using tuples for MPI constructs, parallel patterns, task characteristics, and observed performance or correctness symptoms. The harness stores these tuples together with the skill, generated code, measurements, reward, and refinement evidence as an iteration-level episode.
Before the next skill update, RETRIEVECONTEXT uses the current tuple bundle to identify related, reward-supported lessons from prior runs (see Appendix Algorithm 6), and FORMATCONTEXTBLOCK converts the selected lessons into a compact context block. Algorithm 2 combines this retrieved context with the current execution evidence when producing and applying the textual gradient. Retrieved guidance is therefore advisory: current correctness results, diagnostics, runtime measurements, and reward trends determine whether a previously learned strategy is appropriate.
After the refinement loop terminates, the final step of Algorithm 1 compresses the accumulated trajectory into a persistent memory record (see Appendix Algorithm 4 for details). Reward-improving episodes are prioritized, their textual gradients are distilled into concise, action-oriented guidance, and the resulting lesson is indexed by its aggregated tuples for later retrieval. This separation between detailed episodes and compact memories preserves an auditable execution history without inserting complete programs or execution logs into later prompts.
The COMPRESSANDINDEX procedure, detailed in Appendix Algorithm 4, converts a completed refinement trajectory into compact cross-task memory. It loads the recorded episodes, prioritizes those associated with reward improvement, aggregates their structural, task, performance, and correctness tags, and distills the corresponding textual gradients into concise, reusable guidance. The resulting lesson is stored with its reward improvement and supporting metadata, then indexed by its aggregated tags so that it can be retrieved during subsequent iterations and tasks. When no episode improves the reward, the procedure uses the complete trajectory to ensure that a memory record can still be formed.
Cross-Task Knowledge Persistence
Meta-learning occurs through two complementary persistent artifacts. First, the best-observed natural-language skill can initialize later tasks, allowing general coding and optimization instructions learned during prior refinement to influence generation without additional task-specific updates. Second, the memory store preserves execution-derived lessons independently of the skill, allowing later tasks to retrieve strategies associated with similar MPI constructs, parallel patterns, or performance symptoms. The skill therefore encodes broadly applicable generation behavior, whereas memory provides selective access to more specific optimization experience. Because both artifacts are represented externally in natural language and structured metadata, they can be inspected, transferred, or reused without modifying the underlying model parameters. § 4.4 evaluates these two transfer channels separately.
Evaluation
Experimental Setup
We evaluated MetaFORGE on six MPI C tasks, each at small, medium, and large workload sizes, using five independent trials per task–workload configuration. Primary experiments used gpt-5.1-codex-max through the OpenAI Python API (v2.36.0). Candidate programs were evaluated on a four-node OpenMPI 4.1 cluster. Complete model, trial, compilation, static-analysis, and execution-environment details are provided in Appendices § 6.§ 1 and § 6.§ 3.
We compared MetaFORGE against two baselines. The first was zero-shot Codex generation, in which gpt-5.1-codex-max generated code using an empty skill specification. The second was TEXTGRAD, an iterative skill-refinement baseline based on the unmodified published procedure [31]. Zero-shot Codex provides the reference point for percentage improvements, whereas TEXTGRAD provides the primary iterative-refinement comparison. The METAFORGE and TEXTGRAD conditions shared the initial skill, task specification, code-generation model, retrieval context, iteration budget, patience threshold, and compilation and evaluation pipeline. Each retained its native refinement procedure: METAFORGE used two refinement calls in addition to code generation, whereas TEXTGRAD used its standard three-stage refinement sequence and default backward model. The comparison should therefore be interpreted as an end-to-end method comparison rather than a model-call-matched update-rule ablation. Complete baseline controls, refinement-model settings, and model-call sequences are provided in Appendix § 6.§ 4. We distinguish the controlled variables from the treatment and its measured consequences. The shared generator, initial skill, evaluator, reward function, retrieval configuration, iteration budget, and stopping rule are controlled. The feedback representation and native refinement procedure constitute the algorithmic treatment, whereas realized model-call count and token consumption are measured consequences of those procedures. Refinement-model sensitivity is evaluated separately in § 4.3.
We evaluated correctness using task-specific output checks and measured compiler and static-analysis warnings, externally measured whole-job runtime, rank-level load imbalance, and token consumption. The reward weights were , , , , and . Static-analysis, runtime, and imbalance results report improvement relative to the corresponding no-skill zero-shot program. Trial-level results and complete-run token consumption are reported in Appendix § 7.
Task selection was criterion-driven: the six tasks were selected to span communication topology, load distribution, and dominant performance bottlenecks rather than to maximize application-domain count. The suite includes terminal reductions and gathers, repeated point-to-point halo exchange, repeated collectives, statically balanced and data-dependent workloads, and bottlenecks in floating-point throughput, memory bandwidth, cache locality, load imbalance, and communication latency. Structural overlap is intentional: for example, estimation and Dot Product both terminate in a reduction but stress different computational resources. We therefore characterize the suite as a purposeful but bounded sample of MPI program structures, not a comprehensive survey of MPI applications. The mapping from each task to its dominant parallel structure, communication pattern, performance-limiting resource, and distinctive challenge is summarized in Appendix Table 3.
Overall Results
Table 1 summarizes results across six MPI tasks and three workload sizes. Relative to zero-shot Codex, METAFORGE achieves positive task-average improvements in static-analysis findings, runtime, and load balance for every task. At the task-average level, it exceeds TEXTGRAD on all 18 outcome comparisons—six tasks across three metrics. At the workload level, METAFORGE achieves the larger improvement in 52 of 54 static-analysis, runtime, and load-balance comparisons. The two exceptions are runtime for medium Dot Product and load balance for large Matrix Multiplication.
| Task | MetaFORGE Static | MetaFORGE Runtime | MetaFORGE Balance | MetaFORGE Tokens | TextGrad Static | TextGrad Runtime | TextGrad Balance | TextGrad Tokens |
| calculation | 100.00 | 16.45 | 96.41 | 8232 | 8.89 | 7.30 | 35.38 | 12409 |
| Dot Product | 100.00 | 27.00 | 50.74 | 9106 | 5.18 | 14.84 | 23.59 | 14362 |
| Matrix Multiplication | 57.16 | 87.99 | 47.04 | 15641 | -13.14 | 55.46 | 16.91 | 18032 |
| Mandelbrot Set | 78.47 | 9.32 | 25.29 | 17435 | 6.30 | -0.19 | 0.15 | 16604 |
| Heat Transfer | 63.08 | 82.46 | 51.41 | 21350 | 10.38 | 14.87 | 22.94 | 19375 |
| Distributed PCA | 94.44 | 86.36 | 38.27 | 17966 | 22.32 | 31.75 | 11.64 | 24299 |
Table 1. Task-average results over 15 trials per row (three workloads and five trials per workload). Static-analysis, runtime, and load-balance values are percentage improvements over zero-shot Codex; higher is better. Tokens are mean per-iteration consumption; lower is better. Bold indicates the better value within each method pair.
The results also reveal task-dependent optimization patterns. The largest runtime improvements occur for Matrix Multiplication, Heat Transfer, and Distributed PCA, whereas calculation shows the strongest static-analysis and load-balance improvements. Dot Product adds a memory-bandwidth-sensitive reduction workload: METAFORGE achieves 100.00% task-average static-analysis improvement, 27.00% runtime improvement, and 50.74% load-balance improvement, compared with 5.18%, 14.84%, and 23.59% for TEXTGRAD. Mandelbrot generation produces smaller runtime gains, but METAFORGE remains positive while TEXTGRAD is approximately neutral.
Token consumption presents a mixed tradeoff. METAFORGE uses fewer per-iteration tokens for calculation, Dot Product, Matrix Multiplication, and Distributed PCA, but more for Heat Transfer and Mandelbrot. Because the methods differ in native model-call count and stopping behavior, per-iteration consumption should not be interpreted as complete-run cost. Including Dot Product, METAFORGE uses fewer total tokens in eight of the 18 workload-level comparisons. Detailed workload, trial-level, and complete-run results are provided in Appendix § 7.
Refinement-Model Sensitivity
To test whether the primary comparison is explained by refinement-model capability, we conducted a six-task model-matched ablation. All conditions use the same gpt-5.3-codex generator, seed skill, evaluator, reward, stopping rule, and frozen read-only memory snapshot. METAFORGE-Strong uses gpt-5.3-codex for refinement, METAFORGE-Weak uses gpt-4o, and TEXTGRAD-Native retains its published gpt-4o refinement configuration. Mean within-task ranks were 5.30, 7.30, and 11.40, respectively (lower is better).
Both MetaFORGE variants retain significant best-reward advantages over TEXTGRAD-Native after multiplicity correction, while Strong versus Weak does not reach the corrected threshold. Thus, the advantage persists when MetaFORGE’s refiner is reduced to gpt-4o; the experiment does not establish equivalence between the two MetaFORGE refiners. Full per-task descriptive statistics and experimental controls appear in Appendix § 7.12.
Knowledge Transfer
Our retrieval-context ablation covers all six tasks and all three workload sizes. Across the 18 task–workload configurations, retrieval increases mean static-analysis improvement from 63.34% to 82.19%, runtime improvement from 35.99% to 51.59%, and load-imbalance improvement from 42.27% to 51.03%. Mean per-iteration token consumption decreases from 15,225 to 14,955 tokens (). Runtime improves in all 18 configurations; static-analysis quality improves in 15 with three ties, and load balance improves in 16. Because these are configuration-level means rather than independent trial-level observations, we treat the cross-configuration summaries as descriptive. Full results are reported in Appendix Table 24.
A separate cross-provider ablation on Distributed PCA contrasts Codex and Claude within MetaFORGE. Both improve code quality, runtime, and load balance, but with different tradeoffs: Codex achieves larger runtime gains and lower token use, whereas Claude achieves greater load-balance improvement. We treat these as empirical model-specific behaviors rather than evidence for a hidden mechanism and complete results appear in Appendix Table 26.
The primary six-task evaluation establishes within-task optimization; our evidence for cross-task persistence comes from the held-out and zero-update studies described next, which use gpt-5.3-codex after the primary model became unavailable. A three-task leave-one-task-out study separately evaluates the two persistence mechanisms described in § 3.5. Read-only memory learned exclusively from the two non-held-out tasks improves mean best reward from to for Calculate , from to for Matrix Multiplication, and from to for Mandelbrot Sets ( for each task). Under zero-update evaluation, the transferred skill alone also improves reward for all three tasks (), and every generated program passes correctness testing. Together, these results provide evidence that reusable optimization knowledge is retained in both the skill and external memory under the evaluated protocol. Full protocols, component metrics, and statistical qualifications are provided in Appendix § 7.9 and Appendix § 7.10.
Conclusions
We presented METAFORGE, a meta-learning harness that optimizes persistent natural-language skills for MPI C code generation using execution-grounded feedback and retrieval-augmented memory. Across six tasks, it achieves larger task-average static-analysis, runtime, and load-balance improvements than the evaluated TEXTGRAD baseline, with mixed token-cost tradeoffs. Retrieval improves runtime in all 18 evaluated task–workload configurations, and the model-matched ablation shows that MetaFORGE retains a best-reward advantage when its refiner is reduced to gpt-4o. Held-out and zero-update studies further support cross-task persistence in both the skill and external memory under the evaluated protocol.
Future work will extend METAFORGE beyond MPI C to OpenMP, CUDA, SYCL, and hybrid MPI+X programming, and will investigate task-normalized retrieval signals, automatic reward-weight learning, and task-specification refinement.
Limitations
This study has several limitations. First, the evaluation covers a purposeful but bounded six-task sample of MPI C program structures at one fixed four-rank configuration. It does not cover irregular sparse or graph workloads, unstructured meshes, other process counts, other parallel-programming models, or other hardware platforms. The results therefore should not be interpreted as establishing general performance improvements across MPI or parallel computing broadly.
Second, the primary METAFORGE–TEXTGRAD comparison evaluates the complete end-to-end methods. The model-matched ablation reduces the refinement-model confound, but the methods still differ in native model-call structure and feedback representation. We therefore attribute the primary comparison to the evaluated systems as configured rather than to a single isolated algorithmic component.
Third, the fixed-weight scalar reward is a within-task optimization signal and is not task-normalized. Raw reward magnitudes are not interpreted as directly comparable across tasks. In addition, the retrieval score assigns weight 0.10 to ; because is scale dependent, this term can saturate for large-runtime tasks and underweight useful memories from smaller-scale tasks. This is a limitation of the current cross-task retrieval ranking and motivates task-normalized confidence signals in future work.
Fourth, the held-out transfer study covers three tasks, and Phase 1 produces one transferred skill and memory store per fold that are reused across the evaluation trials. The reported replication therefore estimates variability in held-out generation and adaptation rather than variability from independently repeated meta-training pipelines. Transfer conclusions are consequently conditional on the shared Phase 1 training outcome and the evaluated three-task protocol.
Finally, Codex, Claude, and the evaluated APIs are closed-source commercial systems. Their training data, internal implementations, and future availability are outside researchers’ control. The original model was also deprecated during the study, requiring the later transfer and sensitivity experiments to use the replacement model documented in the appendix. Those later experiments are internally consistent within their own conditions but are not strictly commensurable with the primary experiments conducted using the original model.
Reproducibility Artifacts
Primary Model and Trial Protocol
The primary experiments configured METAFORGE to use OpenAI’s Codex agent with the gpt-5.1-codex-max model through the OpenAI Python API (v2.36.0). We selected gpt-5.1-codex-max because it is designed for agentic coding and long-running software-engineering tasks, making it well suited to METAFORGE’s iterative generation, evaluation, textual-gradient, and skill-rewrite workflow [19 a]. This selection is also consistent with prior evidence that Codex-style models support program synthesis and iterative code refinement [2, 20].
Because code generation and skill rewriting are nondeterministic, each task–workload configuration was evaluated using five independent trials. Each trial used a separate API conversation so that conversational state was not shared across repetitions. The trials therefore represent independent generation and refinement trajectories executed with the same task, workload, model, iteration budget, stopping criterion, and evaluation configuration.
Criterion-Driven Task Selection
The evaluation suite was constructed to vary communication topology, load distribution, and dominant performance bottlenecks rather than to accumulate application domains. Table 3 summarizes the structural criterion contributed by each task. The suite is intended as a purposeful but bounded sample of MPI program structures; it is not intended to represent the full space of MPI applications.
| Task | Dominant parallel structure | Communication pattern | Limiting factor | Distinctive challenge |
| estimation | Naturally parallel integration | Single terminal reduction | Floating-point throughput | Accuracy to under partitioned summation |
| Dot Product | Data-parallel reduction over distributed operands | Single terminal reduction | Memory bandwidth | Distributed initialization without full-vector broadcast |
| Dense Matrix Multiplication | Dense linear algebra, | Operand distribution and result reduction | Cache locality / loop order | Non-divisible dimensions; BLAS prohibited |
| Mandelbrot Set | Irregular, data-dependent workload | Terminal gather of image tiles | Load imbalance | Per-pixel cost varies substantially; static decomposition is ineffective |
| Heat Transfer (Jacobi) | Iterative stencil relaxation | Nearest-neighbor halo exchange every iteration | Communication latency | Ghost-cell correctness and communication/computation behavior over 30,000 iterations |
| Distributed PCA | Multi-phase iterative linear algebra | Repeated collectives nested within power iterations | Collective frequency | Multi-phase pipeline; samples; eigenvector stability |
Table 3. Criterion-driven selection of the six MPI evaluation tasks. Each task was selected to exercise a parallel-programming property not fully represented by the others.
Compilation and Execution Environment
Generated MPI C programs were compiled using mpicc -Wall -Wextra -Wpedantic -O2 -std=c11 with Clang 18.1.3. Static analysis used Clang-Tidy 18.1.3 with the clang-diagnostic-*, clang-analyzer-*, clang-analyzer-optin.mpi.MPI-Checker, mpi-*, bugprone-*, and performance-* check groups.
Runtime evaluation was performed on a four-node OpenMPI 4.1 cluster running Ubuntu Linux. Each node contained an Intel Core i7-8700K processor and 16 GB RAM, connected through switched full-duplex Gigabit Ethernet. Four MPI ranks were used. Rank placement was not explicitly configured, but empirical verification showed one rank per node. CPU affinity was not explicitly controlled, and CPU governor and turbo settings remained at system defaults.
Each candidate program was executed 20 times sequentially without recompilation and no initial execution was discarded as a warm-up. The reported runtime is the mean across the 20 executions. Runtime and rank-level measurements were collected externally by the harness rather than self-reported by generated programs. Compilation, correctness testing, static analysis, runtime measurement, and load-imbalance evaluation were implemented independently of the active refinement backend, ensuring that all evaluated methods used the same program-assessment pipeline. All runtime values reported in the primary results were obtained under this measurement protocol.
Controlled Baseline Configuration
We compared METAFORGE against two baselines: (1) Codex generation using an empty skill specification and (2) the unmodified TEXTGRAD implementation for iterative skill refinement [31]. The METAFORGE and TEXTGRAD conditions used matched code-generation and evaluation configurations. Both began from the same initial skill specification, received the same task specification for each workload, and used gpt-5.1-codex-max to generate candidate programs. Both methods were executed through the same outer optimization loop with the same maximum-iteration budget and a patience-based stopping criterion of eight consecutive non-improving iterations.
Both methods received the same retrieval context. Before each refinement step, the harness queried the shared cross-task memory store and supplied the same top- retrieved records to the active refinement mechanism. The task description, generated source code, compiler diagnostics, and static-analysis findings were likewise provided to both methods. The feedback representations differed according to the native refinement procedures. With −inject-reward-to-gradient enabled, METAFORGE additionally received a numeric comparison of the current and preceding iteration metrics and an explicit decomposition of the weighted reward. The TEXTGRAD loss-evaluation path used qualitative evidence and did not consume either numeric artifact.
The refinement procedures differed in their native sequence of model calls. Each METAFORGE iteration used one call to generate an execution-grounded textual critique and a second call to apply that critique to the skill, resulting in three LLM calls per iteration when code generation is included. In contrast, the unmodified TEXTGRAD implementation performed its standard forward loss-evaluation call, backward textual-gradient call, and textual gradient-descent optimizer call, resulting in four LLM calls per iteration. These differing call counts arise from the algorithms’ respective refinement procedures rather than from different iteration budgets or implementation-specific modifications.
The refinement models also followed the native configuration of each method. METAFORGE used gpt-5.1-codex-max for its critique and skill-rewrite calls, whereas the unmodified TEXTGRAD backward engine used gpt-4o, its default configured model. Thus, the comparison controls the initial skill, code-generation model, task inputs, retrieval context, iteration budget, stopping criterion, and evaluation environment while comparing the complete end-to-end refinement procedures as implemented. The resulting differences in refinement-model configuration and model-call count are properties of the evaluated methods rather than experimentally assigned resource differences.
Experimental Trial Results
Calculate
The calculate task directed Codex to approximate using the summation-of-integrals method. We evaluated three workload sizes, pi_small, pi_medium, and pi_large, using 134,217,728, 268,435,456, and 536,870,912 intervals, respectively. Figure 3 summarizes the effectiveness–cost tradeoff between MetaFORGE and TextGrad, while Table 1 reports the aggregate results across all workloads.
Figure 3. MPI calculation results comparing MetaFORGE and TextGrad ([31]). MetaFORGE achieves higher code-quality, runtime, and load-balance improvements with lower token consumption across small, medium, and large workloads over 15 trials (five trials per workload).
For the calculation task, MetaFORGE outperforms TextGrad across all measured dimensions. MetaFORGE achieves a 100.00% static-analysis improvement compared with 8.89% for TextGrad, indicating a much stronger reduction in static-analysis warnings. It also improves runtime by 16.45%, more than twice TextGrad’s 7.30% improvement, and reduces load imbalance by 96.41% compared with 35.38% for TextGrad. These results show that MetaFORGE produces higher-quality, faster, and better-balanced MPI implementations for numerical integration.
MetaFORGE also achieves these improvements with lower token consumption, consuming 8,232.34 tokens per iteration compared with 12,409.15 for TextGrad. Together, Figure 3 and Table 1 show that MetaFORGE provides a stronger effectiveness–cost tradeoff for MPI computation.
Calculate- Trial-Level Results
Tables 4–6 report the five independent trials for each -calculation workload. Static, runtime, and imbalance columns report percentage improvement over the corresponding no-skill zero-shot baseline; higher values are better, and negative values denote regression. The “Exec. iter.” column counts iterations for which the experimental record contains a measured runtime. The best iteration and reward identify the reward-maximizing candidate observed within each refinement trajectory. Total tokens are summed across the complete trajectory. The final two rows report the arithmetic mean and sample standard deviation of the five trial-level values. Because the tables report the arithmetic mean of trial-level percentages, these values may differ from aggregate percentages computed from pooled raw measurements. Runtime improvements favored MetaFORGE on the small and large workloads (19.27% and 40.08% versus 2.54% and 18.96%), while TextGrad slightly exceeded MetaFORGE on the medium workload (23.03% versus 21.65%). MetaFORGE additionally required fewer tokens per iteration across all workload sizes: 9,506 versus 13,673 tokens for small, 8,050 versus 15,714 for medium, and 9,760 versus 13,699 for large. Overall, MetaFORGE provides a favorable effectiveness–cost tradeoff, achieving substantially better code quality and load balance, competitive or superior runtime performance, and lower token consumption.
Figure 2. Average optimization improvement versus per-iteration token consumption for MetaFORGE and TextGrad across six MPI programming tasks. Across static-analysis quality, runtime, and load-imbalance metrics, MetaFORGE achieves larger improvements at lower per-iteration token cost for most tasks, indicating a favorable per-iteration cost–performance tradeoff relative to TextGrad. MetaFORGE consumes more tokens per iteration for Heat Transfer and Mandelbrot while achieving larger performance improvements. Complete-run token consumption is reported separately in the trial-level results.
Dot Product
We selected the MPI dot product as a canonical data-parallel reduction workload widely used in numerical and scientific computing. Efficient implementations must partition input vectors, compute local partial products, and reduce partial sums while minimizing synchronization and load imbalance. We evaluated three dot product workload sizes: dot_product_small, dot_product_medium, and dot_product_large across five trials each. Table 1 compares MetaFORGE with TextGrad.
MetaFORGE achieved 100.00% static-analysis improvement for all three workloads, compared with 0.00%, 11.11%, and 4.44% for TextGrad. MetaFORGE also produced stronger load-balance improvements of 46.47%, 45.67%, and 60.08%, versus 38.64%, 16.23%, and 15.92% for TextGrad.
Dot-Product Trial-Level Results
Table 7–Table 9 report the five independent trials for each dot-product workload. Static, runtime, and imbalance columns report percentage improvement over the corresponding no-skill zero-shot baseline; higher values are better, and negative values denote regression. The best iteration and reward identify the reward-maximizing candidate observed within each refinement trajectory. Total tokens are summed across the complete trajectory, and tokens per iteration are the corresponding run-normalized values. The final two rows report the arithmetic mean and sample standard deviation of the five trial-level values.
| Trial | Method | Iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 15 | 9 | -1.010 | 100.00 | 92.59 | -20.97 | 137,699 | 9,179.93 |
| 1 | TEXTGRAD | 9 | 1 | -6.086 | 0.00 | 0.00 | 0.00 | 121,053 | 13,450.33 |
| 2 | METAFORGE | 12 | 6 | -1.033 | 100.00 | 15.75 | 84.72 | 106,887 | 8,907.25 |
| 2 | TEXTGRAD | 11 | 3 | -6.091 | 0.00 | 5.19 | 40.50 | 147,317 | 13,392.45 |
| 3 | METAFORGE | 9 | 3 | -1.067 | 100.00 | -2.42 | -4.22 | 78,891 | 8,765.67 |
| 3 | TEXTGRAD | 10 | 1 | -9.091 | 0.00 | 0.00 | 0.00 | 138,189 | 13,818.90 |
| 4 | METAFORGE | 20 | 16 | -1.008 | 100.00 | -19.72 | 93.13 | 210,205 | 10,510.25 |
| 4 | TEXTGRAD | 15 | 7 | -6.058 | 0.00 | 3.66 | 85.72 | 203,936 | 13,595.73 |
| 5 | METAFORGE | 9 | 3 | -1.017 | 100.00 | 10.14 | 79.67 | 91,541 | 10,171.22 |
| 5 | TEXTGRAD | 12 | 4 | -6.038 | 0.00 | 3.84 | 67.00 | 169,306 | 14,108.83 |
| Mean | METAFORGE | 13.0 ± 4.6 | 7.4 ± 5.4 | −1.027 ± 0.024 | 100.00 ± 0.00 | 19.27 ± 43.19 | 46.47 ± 54.45 | 125,045 ± 52,428 | 9,506.86 ± 784.85 |
| ± SD | TEXTGRAD | 11.4 ± 2.3 | 3.2 ± 2.5 | −6.673 ± 1.352 | 0.00 ± 0.00 | 2.54 ± 2.39 | 38.64 ± 38.76 | 155,960 ± 31,972 | 13,673.25 ± 293.89 |
Table 7. Per-trial MPI dot-product results for the small workload.
| Trial | Method | Iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 18 | 12 | -1.009 | 100.00 | 94.19 | 97.88 | 170,530 | 9,473.89 |
| TEXTGRAD | 9 | 1 | -6.024 | 0.00 | 0.00 | 0.00 | 118,939 | 13,215.44 | |
| 2 | METAFORGE | 9 | 3 | -1.042 | 100.00 | -4.23 | -43.91 | 73,766 | 8,196.22 |
| TEXTGRAD | 9 | 1 | -10.161 | 0.00 | 0.00 | 0.00 | 113,276 | 12,586.22 | |
| 3 | METAFORGE | 20 | 20 | -1.007 | 100.00 | 38.16 | 99.45 | 187,252 | 9,362.60 |
| TEXTGRAD | 9 | 1 | -6.050 | 0.00 | 0.00 | 0.00 | 126,684 | 14,076.00 | |
| 4 | METAFORGE | 20 | 20 | -1.008 | 100.00 | 30.97 | 88.60 | 222,474 | 11,123.70 |
| TEXTGRAD | 9 | 1 | -6.038 | 0.00 | 0.00 | 0.00 | 129,981 | 14,442.33 | |
| 5 | METAFORGE | 19 | 13 | -1.122 | 100.00 | 41.31 | 58.38 | 202,290 | 10,646.84 |
| TEXTGRAD | 13 | 5 | -8.022 | 22.22 | 94.79 | 79.61 | 184,273 | 14,174.85 | |
| Mean ± SD | METAFORGE | 17.2 ± 4.7 | 13.6 ± 7.0 | −1.038 ± 0.049 | 100.00 ± 0.00 | 40.08 ± 35.28 | 60.08 ± 60.43 | 171,262 ± 57,765 | 9,760.65 ± 1,154.49 |
| TEXTGRAD | 9.8 ± 1.8 | 1.8 ± 1.8 | −7.259 ± 1.836 | 4.44 ± 9.94 | 18.96 ± 42.39 | 15.92 ± 35.60 | 134,631 ± 28,510 | 13,698.97 ± 773.50 |
Table 9. Per-trial MPI dot-product results for the large workload.
| Trial | Method | Iter. | Exec. iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 12 | 11 | 6 | -1.072 | 100.00 | 7.70 | 97.91 | 89,657 | 7,471.42 |
| 1 | TEXTGRAD | 12 | 12 | 6 | -6.082 | 16.67 | 23.88 | -31.46 | 127,622 | 10,635.17 |
| 2 | METAFORGE | 16 | 15 | 10 | -1.068 | 100.00 | 20.56 | 99.83 | 126,852 | 7,928.25 |
| 2 | TEXTGRAD | 9 | 9 | 3 | -6.083 | 0.00 | 3.55 | 11.03 | 95,055 | 10,561.67 |
| 3 | METAFORGE | 20 | 18 | 14 | -1.070 | 100.00 | 9.98 | 99.89 | 178,765 | 8,938.25 |
| 3 | TEXTGRAD | 8 | 8 | 2 | -6.078 | 16.67 | 21.42 | 98.45 | 87,075 | 10,884.38 |
| 4 | METAFORGE | 20 | 18 | 18 | -1.071 | 100.00 | 33.55 | 90.87 | 208,787 | 10,439.35 |
| 4 | TEXTGRAD | 11 | 11 | 5 | -6.075 | 0.00 | 10.19 | 29.54 | 125,670 | 11,424.55 |
| 5 | METAFORGE | 9 | 9 | 3 | -1.074 | 100.00 | 32.08 | 98.94 | 71,694 | 7,966.00 |
| 5 | TEXTGRAD | 12 | 12 | 6 | -6.079 | 16.67 | -4.40 | 8.60 | 146,711 | 12,225.92 |
| Mean ± SD | METAFORGE | 15.4 ± 4.9 | 14.2 ± 4.1 | 10.2 ± 6.0 | −1.071 ± 0.002 | 100.00 ± 0.00 | 20.77 ± 12.03 | 97.49 ± 3.79 | 135, 151 ± 58, 073 | 8, 548.65 ± 1, 184.41 |
| Mean ± SD | TEXTGRAD | 10.4 ± 1.8 | 10.4 ± 1.8 | 4.4 ± 1.8 | −6.079 ± 0.003 | 10.00 ± 9.13 | 10.93 ± 11.92 | 23.23 ± 47.57 | 116, 427 ± 24, 729 | 11, 146.33 ± 691.85 |
Table 4.
| Trial | Method | Iter. | Exec. iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 10 | 9 | 4 | -1.145 | 100.00 | 12.75 | 93.55 | 72,877 | 7,287.70 |
| 1 | TEXTGRAD | 12 | 11 | 6 | -6.159 | 0.00 | 10.53 | 91.50 | 141,907 | 11,825.58 |
| 2 | METAFORGE | 10 | 9 | 4 | -1.141 | 100.00 | 12.10 | 92.19 | 75,734 | 7,573.40 |
| 2 | TEXTGRAD | 14 | 14 | 8 | -6.160 | 16.67 | 20.58 | 93.19 | 158,231 | 11,302.21 |
| 3 | METAFORGE | 19 | 19 | 19 | -1.139 | 100.00 | 16.30 | 95.37 | 173,519 | 9,132.58 |
| 3 | TEXTGRAD | 17 | 17 | 11 | -6.174 | 16.67 | 11.55 | 87.58 | 204,478 | 12,028.12 |
| 4 | METAFORGE | 12 | 12 | 6 | -1.135 | 100.00 | 7.26 | 83.96 | 97,943 | 8,161.92 |
| 4 | TEXTGRAD | 12 | 12 | 6 | -6.175 | 0.00 | 9.43 | 89.61 | 152,069 | 12,672.42 |
| 5 | METAFORGE | 20 | 18 | 14 | -1.135 | 100.00 | 29.58 | 99.94 | 196,072 | 9,803.60 |
| 5 | TEXTGRAD | 7 | 6 | 1 | -6.345 | 0.00 | 0.00 | 0.00 | 90,611 | 12,944.43 |
| Mean ± SD | METAFORGE | 14.2 ± 4.9 | 13.4 ± 4.8 | 9.4 ± 6.8 | −1.139 ± 0.004 | 100.00 ± 0.00 | 15.60 ± 8.45 | 93.00 ± 5.84 | 123, 229 ± 57, 588 | 8, 391.84 ± 1, 058.72 |
| Mean ± SD | TEXTGRAD | 12.4 ± 3.6 | 12.0 ± 4.1 | 6.4 ± 3.6 | −6.202 ± 0.080 | 6.67 ± 9.13 | 10.42 ± 7.32 | 72.38 ± 40.51 | 149, 459 ± 40, 715 | 12, 154.55 ± 660.07 |
Table 5. Table 5: Per-trial π-calculation results for the medium workload.
Matrix Multiplication
We selected matrix multiplication because matrix-based linear-algebra kernels are widely used in scientific computing and machine-learning workloads, including privacy-preserving computation. For example, this paper [7] study efficient homomorphic-encryption support for sparse matrix–vector multiplication. Dense matrix multiplication also provides a strong MPI benchmark because efficient execution requires numerical correctness, communication-aware decomposition, and balanced work distribution. We evaluated small, medium, and large workloads using non-square matrix dimensions that were not evenly divisible across the four-node execution environment, preventing trivial uniform partitioning. Figure 4 summarizes the effectiveness–cost tradeoff, while Table 1 reports the aggregate results across matrix multiplication workloads.
Figure 4. MPI matrix multiplication results comparing MetaFORGE and TextGrad across 15 trials (five trials per workload). MetaFORGE achieves higher code-quality, runtime, and load-balance improvements.
MetaFORGE outperforms TextGrad across all aggregate metrics. It improves static-analysis quality by 57.16%, whereas TextGrad shows a 13.14% degradation, indicating that MetaFORGE generates cleaner MPI implementations according to static analysis. MetaFORGE also achieves stronger runtime improvement, 87.99% compared with 55.46% for TextGrad, and improves load-balance utilization by 47.04% compared with 16.91%. These gains are achieved with lower per-iteration token consumption, 15,641.22 tokens for MetaFORGE versus 18,031.71 for TextGrad. Together, Figure 4 and Table 1 show that MetaFORGE provides a stronger effectiveness–cost tradeoff for MPI matrix multiplication.
Matrix-Multiplication Trial-Level Results
Tables 10–12 report the five independent trials for each matrix-multiplication workload. Static, runtime, and imbalance columns report percentage improvement over the corresponding no-skill zero-shot baseline; higher values are better, and negative values denote regression. The “Exec. iter.” column counts iterations for which the experimental record contains a measured runtime. The best iteration and reward identify the reward-maximizing candidate observed within each refinement trajectory. Total tokens are summed across the complete trajectory, whereas tokens per iteration are taken from the run-level summary. The final two rows report the arithmetic mean and sample standard deviation of the five trial-level values.
| Trial | Method | Iter. | Exec. iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 10 | 9 | 4 | -1.281 | 100.00 | 5.66 | 99.49 | 65,642 | 6,564.20 |
| 1 | TEXTGRAD | 7 | 7 | 1 | -7.346 | 0.00 | 0.00 | 0.00 | 90,282 | 12,897.43 |
| 2 | METAFORGE | 12 | 11 | 7 | -1.279 | 100.00 | 23.41 | 99.99 | 102,491 | 8,540.92 |
| 2 | TEXTGRAD | 7 | 7 | 1 | -6.477 | 0.00 | 0.00 | 0.00 | 85,579 | 12,225.57 |
| 3 | METAFORGE | 12 | 11 | 6 | -1.330 | 100.00 | 7.16 | 99.70 | 93,851 | 7,820.92 |
| 3 | TEXTGRAD | 7 | 7 | 1 | -6.755 | 0.00 | 0.00 | 0.00 | 94,509 | 13,501.29 |
| 4 | METAFORGE | 11 | 10 | 5 | -1.287 | 100.00 | 3.89 | 94.72 | 81,061 | 7,369.18 |
| 4 | TEXTGRAD | 7 | 5 | 1 | -7.377 | 0.00 | 0.00 | 0.00 | 103,551 | 14,793.00 |
| 5 | METAFORGE | 14 | 14 | 8 | -1.263 | 100.00 | 24.78 | 99.86 | 118,823 | 8,487.36 |
| 5 | TEXTGRAD | 20 | 19 | 15 | -4.435 | 50.00 | 2.75 | 52.69 | 324,311 | 16,215.55 |
| Mean | METAFORGE | 11.8 ± 1.5 | 11.0 ± 1.9 | 6.0 ± 1.6 | −1.288 ± 0.025 | 100.00 ± 0.00 | 12.98 ± 10.22 | 98.75 ± 2.26 | 92,374 ± 20,290 | 7,756.51 ± 825.41 |
| ± SD | TEXTGRAD | 9.6 ± 5.8 | 9.0 ± 5.7 | 3.8 ± 6.3 | −6.478 ± 1.206 | 10.00 ± 22.36 | 0.55 ± 1.23 | 10.54 ± 23.56 | 139,646 ± 103,443 | 13,926.57 ± 1,590.87 |
Table 6.
tbl:6: Per-trial -calculation results for the large workload.
Mandelbrot Sets
We selected Mandelbrot set generation because it is an irregular parallel workload in which each pixel can be computed independently, but the required iteration count varies across the complex plane. Points near the set boundary require more computation than points that diverge quickly, making static row- or block-based decomposition prone to rank-level imbalance. The task also requires correct reconstruction of a high-resolution color image from distributed pixel computations, making indexing, result gathering, and workload distribution central to correctness and performance. Figure 5 summarizes the effectiveness–cost tradeoff, while Table 1 reports the aggregate Mandelbrot results.
Figure 5. Mandelbrot-set generation results comparing METAFORGE and TEXTGRAD across 15 trials (five trials per workload). METAFORGE achieves stronger static-analysis warning reduction, runtime improvement, and load-balance improvement, with modestly higher aggregate per-iteration token consumption.
MetaFORGE outperforms TextGrad across all aggregate optimization metrics. It improves static-analysis quality by 78.47%, compared with 6.30% for TextGrad, and improves runtime by 9.32%, while TextGrad shows a 0.19% runtime degradation. MetaFORGE also improves load-balance by 25.29%, compared with only 0.15% for TextGrad. Although MetaFORGE consumes modestly more tokens per iteration, 17,435.36 versus 16,604.08 for TextGrad, the additional cost yields larger gains in code quality, runtime performance, and utilization. Together, Figure 5 and Table 1 show that MetaFORGE provides stronger optimization gains for MPI Mandelbrot set generation.
Mandelbrot-Set Trial-Level Results
Tables 13–15 report the five independent trials for each Mandelbrot-set workload. Static, runtime, and imbalance columns report percentage improvement over the corresponding no-skill zero-shot baseline; higher values are better, and negative values denote regression. The “Exec. iter.” column counts iterations for which the experimental record contains a measured runtime. The best iteration and reward identify the reward-maximizing candidate observed within each refinement trajectory. Total tokens are summed across the complete trajectory. The final two rows report the arithmetic mean and sample standard deviation of the five trial-level values. Zero-valued and negative improvements are preserved exactly as recorded rather than being treated as missing observations.
Heat Transfer Using Partial Differential Equations
We selected the heat-transfer PDE task because it stresses numerical correctness, domain decomposition, halo exchange, synchronization, and communication efficiency in MPI C. The task requires partitioning a computational grid across ranks, iteratively updating local subdomains, and exchanging boundary values with neighboring ranks. Because stencil solvers progress at the rate of the slowest rank, inefficient decomposition or synchronization can reduce performance or compromise correctness. In this task, Codex was directed to solve the heat-transfer PDE using a Poisson/Laplace iterative method with Jacobi relaxation and to visualize the resulting heat field.
| Trial | Method | Iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 9 | 3 | -1.006 | 100.00 | 11.75 | 99.46 | 76,718 | 8,524.22 |
| TEXTGRAD | 9 | 1 | -6.109 | 0.00 | 0.00 | 0.00 | 135,284 | 15,031.56 | |
| 2 | METAFORGE | 10 | 4 | -1.060 | 100.00 | 95.31 | 16.61 | 85,668 | 8,566.80 |
| TEXTGRAD | 12 | 4 | -6.119 | 44.44 | 91.51 | 6.12 | 180,756 | 15,063.00 | |
| 3 | METAFORGE | 11 | 3 | -1.041 | 100.00 | -7.96 | -25.54 | 70,794 | 6,435.82 |
| TEXTGRAD | 16 | 8 | -9.071 | 11.11 | 23.66 | 75.02 | 257,762 | 16,110.12 | |
| 4 | METAFORGE | 12 | 6 | -1.076 | 100.00 | 21.56 | 64.68 | 108,961 | 9,080.08 |
| TEXTGRAD | 9 | 1 | -6.071 | 0.00 | 0.00 | 0.00 | 152,952 | 16,994.67 | |
| 5 | METAFORGE | 10 | 4 | -1.022 | 100.00 | -12.40 | 73.14 | 76,476 | 7,647.60 |
| TEXTGRAD | 9 | 1 | -7.085 | 0.00 | 0.00 | 0.00 | 138,342 | 15,371.33 | |
| Mean ± SD | METAFORGE | 10.4 ± 1.1 | 4.0 ± 1.2 | −1.041 ± 0.028 | 100.00 ± 0.00 | 21.65 ± 43.47 | 45.67 ± 49.81 | 83,723 ± 15,079 | 8,050.91 ± 1,039.30 |
| TEXTGRAD | 11.0 ± 3.1 | 3.0 ± 3.1 | −6.891 ± 1.291 | 11.11 ± 19.25 | 23.03 ± 39.63 | 16.23 ± 32.97 | 173,019 ± 50,671 | 15,714.14 ± 837.25 |
Table 8. Per-trial MPI dot-product results for the medium workload.
Figure 6 summarizes the effectiveness–cost tradeoff, while Table 1 reports the aggregate heat-transfer results. MetaFORGE outperforms TextGrad across all optimization metrics, improving static-analysis quality by 63.08% compared with 10.38%, runtime by 82.46% compared with 14.87%, and load-balance utilization by 51.41% compared with 22.94%. Although MetaFORGE consumes more tokens per iteration, 21,350.48 versus 19,375.34 for TextGrad, the modest additional cost yields much larger and more consistent gains in code quality, runtime performance, and utilization.
Figure 6. Heat-transfer PDE results comparing MetaFORGE and TextGrad. MetaFORGE achieves stronger code-quality, runtime, and load-balance improvements, with modestly higher token consumption across 15 trials (five trials per workload).
Heat-Transfer PDE Trial-Level Results
Tables 16–18 report the five independent trials for each heat-transfer PDE workload. Static, runtime, and imbalance columns report percentage improvement over the corresponding no-skill zero-shot baseline; higher values are better, and negative values denote regression. The “Exec. iter.” column counts iterations for which the experimental record contains a measured runtime. The best iteration and reward identify the reward-maximizing candidate observed within each refinement trajectory. Total tokens are summed across the complete trajectory. The final two rows report the arithmetic mean and sample standard deviation of the five trial-level values.
Distributed Principal Component Analysis
We selected distributed principal component analysis (PCA) because it is a widely used machine-learning method for dimensionality reduction, feature extraction, noise reduction, and exploratory data analysis. Distributed PCA is also a strong MPI benchmark because it combines several performance-sensitive phases: data decomposition, local statistical computation, global aggregation of feature means and covariance contributions, and iterative eigensolver computation. These phases stress dense numerical computation, collective communication, memory layout, synchronization, and load-balance behavior commonly found in distributed machine-learning workloads.
Figure 9 summarizes the effectiveness–cost tradeoff, while Table 1 reports the aggregate distributed PCA results. MetaFORGE outperforms
Figure 9. Distributed PCA results comparing MetaFORGE and TextGrad. MetaFORGE achieves higher code-quality, runtime, and load-balance improvements with lower per-iteration token consumption across 15 trials (five trials per workload).
| Trial | Method | Iter. | Exec. iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 12 | 4 | 6 | -18.581 | 62.50 | 92.24 | 99.92 | 143,595 | 11,966.25 |
| 1 | TEXTGRAD | 9 | 8 | 1 | -20.634 | 0.00 | 0.00 | 0.00 | 132,627 | 14,736.33 |
| 2 | METAFORGE | 18 | 17 | 12 | -1.000 | 100.00 | 97.45 | 57.28 | 324,435 | 18,024.17 |
| 2 | TEXTGRAD | 10 | 10 | 2 | -132.581 | 3.70 | 1.34 | -254.74 | 176,071 | 17,607.10 |
| 3 | METAFORGE | 20 | 20 | 17 | -9.007 | 100.00 | 92.95 | 88.44 | 353,321 | 17,666.05 |
| 3 | TEXTGRAD | 20 | 19 | 14 | -32.262 | 12.00 | 91.61 | 94.21 | 399,772 | 19,988.60 |
| 4 | METAFORGE | 20 | 20 | 19 | -9.002 | 100.00 | 92.99 | 99.99 | 389,984 | 19,499.20 |
| 4 | TEXTGRAD | 17 | 17 | 9 | -42.036 | -73.68 | 92.59 | 95.55 | 339,845 | 19,990.88 |
| 5 | METAFORGE | 8 | 8 | 2 | -11.722 | 92.31 | 91.84 | -43.81 | 102,665 | 12,833.12 |
| 5 | TEXTGRAD | 15 | 14 | 7 | -20.468 | 57.69 | 92.44 | -48.66 | 274,746 | 18,316.40 |
| Mean ± SD | METAFORGE | 15.6 ± 5.4 | 13.8 ± 7.4 | 11.2 ± 7.2 | −9.862 ± 6.314 | 90.96 ± 16.26 | 93.49 ± 2.26 | 60.37 ± 60.80 | 262, 800 ± 130, 405 | 15, 997.76 ± 3, 369.63 |
| TEXTGRAD | 14.2 ± 4.7 | 13.6 ± 4.6 | 6.6 ± 5.3 | −49.596 ± 47.253 | −0.06 ± 47.21 | 55.60 ± 50.15 | −22.73 ± 143.77 | 264, 612 ± 111, 007 | 18, 127.86 ± 2, 164.62 |
Table 10. Per-trial matrix-multiplication results for the small workload.
TextGrad across all optimization metrics. It achieves a 94.44% static-analysis improvement compared with 22.32% for TextGrad, indicating a much stronger reduction in static-analysis warnings. MetaFORGE also improves runtime by 86.36%, more than twice TextGrad’s 31.75% improvement, demonstrating that its skill rewrites produce more efficient distributed PCA implementations.
MetaFORGE further improves load-balance utilization by 38.27%, compared with 11.64% for TextGrad, a result particularly important for distributed PCA because aggregation and eigensolver phases can amplify rank-level imbalance and synchronization delays. MetaFORGE also reduces per-iteration token consumption, requiring 17,965.56 tokens compared with 24,298.55 for TextGrad. Together, Figure 9 and Table 1 show that MetaFORGE provides a stronger effectiveness–cost profile for distributed PCA, producing higher-quality, faster, and better-balanced MPI code while also reducing token consumption.
Distributed PCA Trial-Level Results
Table 19–Table 21 report the five independent trials for each distributed PCA workload. Static, runtime, and imbalance columns report percentage improvement over the corresponding no-skill zero-shot baseline; higher values are better, and negative values denote regression. The best iteration and reward identify the reward-maximizing candidate observed within each refinement trajectory. Total tokens are the sum of the recorded token use across the trajectory. The final two rows report the arithmetic mean and sample standard deviation of the trial-level values. Because the aggregate percentages are computed from pooled raw measurements, they may differ slightly from the arithmetic mean of the trial-level percentages reported here.
| Trial | Method | Iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 19 | 11 | -2.665 | 100.00 | 66.21 | 68.63 | 303,246 | 15,960.32 |
| TEXTGRAD | 9 | 1 | -22.526 | 0.00 | 0.00 | 0.00 | 215,161 | 23,906.78 | |
| 2 | METAFORGE | 20 | 13 | -2.486 | 100.00 | -3.32 | 92.40 | 315,590 | 15,779.50 |
| TEXTGRAD | 20 | 13 | -14.850 | 45.00 | -21.23 | 99.76 | 497,195 | 24,859.75 | |
| 3 | METAFORGE | 20 | 16 | -1.341 | 100.00 | 83.24 | -45.98 | 363,650 | 18,182.50 |
| TEXTGRAD | 20 | 12 | -10.742 | 65.00 | -29.22 | 10.05 | 445,359 | 22,267.95 | |
| 4 | METAFORGE | 20 | 18 | -1.523 | 100.00 | 98.82 | 97.97 | 373,570 | 18,678.50 |
| TEXTGRAD | 20 | 15 | -9.795 | 50.00 | 49.85 | -106.12 | 511,755 | 25,587.75 | |
| 5 | METAFORGE | 20 | 20 | -1.366 | 100.00 | 99.59 | -152.02 | 367,740 | 18,387.00 |
| TEXTGRAD | 12 | 4 | -8.209 | 63.16 | 84.21 | 4.08 | 291,072 | 24,256.00 | |
| Mean ± SD | METAFORGE | 19.8 ± 0.4 | 15.6 ± 3.6 | −1.876 ± 0.645 | 100.00 ± 0.00 | 68.91 ± 42.62 | 12.20 ± 108.77 | 344, 759 ± 32, 746 | 17, 397.56 ± 1, 407.10 |
| TEXTGRAD | 16.2 ± 5.3 | 9.0 ± 6.1 | −13.225 ± 5.750 | 44.63 ± 26.36 | 16.72 ± 48.69 | 1.55 ± 73.01 | 392, 108 ± 132, 016 | 24, 175.65 ± 1, 242.99 |
Table 19. Per-trial distributed PCA results for the small workload.
| Trial | Method | Iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 14 | 6 | -6.050 | 16.67 | 98.18 | -65.00 | 245,178 | 17,512.71 |
| TEXTGRAD | 12 | 4 | -39.047 | -5.56 | 5.76 | 6.72 | 292,295 | 24,357.92 | |
| 2 | METAFORGE | 19 | 11 | -1.024 | 100.00 | 92.94 | 80.94 | 294,289 | 15,488.89 |
| TEXTGRAD | 9 | 1 | -68.156 | 0.00 | 0.00 | 0.00 | 201,220 | 22,357.78 | |
| 3 | METAFORGE | 20 | 13 | -1.004 | 100.00 | 100.00 | 95.99 | 365,050 | 18,252.50 |
| TEXTGRAD | 9 | 1 | -70.885 | 0.00 | 0.00 | 0.00 | 223,229 | 24,803.22 | |
| 4 | METAFORGE | 20 | 14 | -1.034 | 100.00 | 99.93 | 33.92 | 400,875 | 20,043.75 |
| TEXTGRAD | 9 | 1 | -2167.000 | 0.00 | 0.00 | 0.00 | 259,410 | 28,823.33 | |
| 5 | METAFORGE | 14 | 6 | -1.011 | 100.00 | 62.08 | 99.15 | 255,812 | 18,272.29 |
| TEXTGRAD | 15 | 7 | -13.075 | 25.00 | 99.99 | 24.44 | 412,586 | 27,505.73 | |
| Mean ± SD | METAFORGE | 17.4 ± 3.1 | 10.0 ± 3.8 | −2.024 ± 2.251 | 83.33 ± 37.27 | 90.63 ± 16.21 | 49.00 ± 68.86 | 312, 241 ± 68, 280 | 17, 914.03 ± 1, 644.76 |
| TEXTGRAD | 10.8 ± 2.7 | 2.8 ± 2.7 | −471.633 ± 948.033 | 3.89 ± 12.04 | 21.15 ± 44.15 | 6.23 ± 10.59 | 277, 748 ± 83, 003 | 25, 569.60 ± 2, 583.93 |
Table 21. Per-trial distributed PCA results for the large workload.
Run-Level Token Consumption
Table 23 reports end-to-end token consumption for each completed optimization run. Unlike the per-iteration token values reported in the main results, these totals account for differences in refinement-trajectory length and therefore provide a direct measure of the observed run-level inference cost of each complete method. For every task, workload, and method, the table reports the mean and sample standard deviation across five independent runs. Prompt tokens contain the recorded input-token total, processing tokens contain the recorded model-processing/output total, and total tokens are their sum. Iterations report the number of completed outer-loop iterations, while tokens per iteration retain the corresponding run-normalized measure. Because MetaFORGE and the unmodified TextGrad implementation use different native refinement pipelines and numbers of model calls per iteration, the run-level totals should be interpreted as end-to-end method costs rather than as a model-call-matched ablation.
| Task | Workload | Method | Iterations per run | Prompt tokens | Processing tokens | Total tokens | Tokens per iteration |
| Calculate | small | METAFORGE | 15.4 ± 4.9 | 68,165 ± 32,201 | 66,986 ± 26,256 | 135,151 ± 58,073 | 8,548.65 ± 1,184.41 |
| Calculate | small | TEXTGRAD | 10.4 ± 1.8 | 89,999 ± 18,527 | 26,428 ± 6,563 | 116,427 ± 24,729 | 11,146.33 ± 691.85 |
| Calculate | medium | METAFORGE | 14.2 ± 4.9 | 61,614 ± 34,457 | 61,615 ± 23,171 | 123,229 ± 57,588 | 8,391.84 ± 1,058.72 |
| Calculate | medium | TEXTGRAD | 12.4 ± 3.6 | 115,813 ± 32,393 | 33,647 ± 9,239 | 149,459 ± 40,715 | 12,154.55 ± 660.07 |
| Calculate | large | METAFORGE | 11.8 ± 1.5 | 44,926 ± 10,514 | 47,447 ± 10,223 | 92,374 ± 20,290 | 7,756.51 ± 825.41 |
| Calculate | large | TEXTGRAD | 9.6 ± 5.8 | 108,045 ± 78,573 | 31,601 ± 24,903 | 139,646 ± 103,443 | 13,926.57 ± 1,590.87 |
| Dot Product | small | METAFORGE | 13.0 ± 4.6 | 59,270 ± 31,722 | 65,774 ± 21,640 | 125,045 ± 52,428 | 9,506.86 ± 784.85 |
| Dot Product | small | TEXTGRAD | 11.4 ± 2.3 | 118,035 ± 26,672 | 37,925 ± 5,483 | 155,960 ± 31,972 | 13,673.25 ± 293.89 |
| Dot Product | medium | METAFORGE | 10.4 ± 1.1 | 38,420 ± 8,424 | 45,303 ± 8,868 | 83,723 ± 15,079 | 8,050.91 ± 1,039.30 |
| Dot Product | medium | TEXTGRAD | 11.0 ± 3.1 | 132,867 ± 42,197 | 40,152 ± 8,844 | 173,019 ± 50,671 | 15,714.14 ± 837.25 |
| Dot Product | large | METAFORGE | 17.2 ± 4.7 | 80,225 ± 28,251 | 91,038 ± 30,579 | 171,262 ± 57,765 | 9,760.65 ± 1,154.49 |
| Dot Product | large | TEXTGRAD | 9.8 ± 1.8 | 97,991 ± 21,111 | 36,640 ± 8,021 | 134,631 ± 28,510 | 13,698.97 ± 773.50 |
| Matrix multiplication | small | METAFORGE | 15.6 ± 5.4 | 98,021 ± 47,199 | 164,779 ± 83,286 | 262,800 ± 130,405 | 15,997.76 ± 3,369.63 |
| Matrix multiplication | small | TEXTGRAD | 14.2 ± 4.7 | 177,462 ± 78,398 | 87,150 ± 33,408 | 264,612 ± 111,007 | 18,127.86 ± 2,164.62 |
| Matrix multiplication | medium | METAFORGE | 13.2 ± 5.2 | 83,015 ± 44,263 | 119,744 ± 42,115 | 202,759 ± 86,187 | 15,250.04 ± 616.59 |
| Matrix multiplication | medium | TEXTGRAD | 11.8 ± 4.7 | 142,465 ± 73,524 | 77,486 ± 56,264 | 219,951 ± 129,524 | 17,809.33 ± 2,650.03 |
| Matrix multiplication | large | METAFORGE | 11.6 ± 4.8 | 72,736 ± 48,289 | 114,108 ± 51,734 | 186,844 ± 99,713 | 15,675.86 ± 1,643.55 |
| Matrix multiplication | large | TEXTGRAD | 16.8 ± 1.1 | 208,605 ± 22,330 | 96,596 ± 10,820 | 305,201 ± 27,870 | 18,157.94 ± 929.26 |
| Mandelbrot set | small | METAFORGE | 14.2 ± 4.2 | 94,302 ± 43,642 | 132,798 ± 45,934 | 227,100 ± 88,734 | 15,753.75 ± 1,726.59 |
| Mandelbrot set | small | TEXTGRAD | 11.4 ± 6.5 | 125,950 ± 78,644 | 71,266 ± 53,146 | 197,216 ± 130,201 | 16,932.97 ± 2,928.93 |
| Mandelbrot set | medium | METAFORGE | 14.4 ± 2.3 | 93,944 ± 19,429 | 148,908 ± 22,976 | 242,852 ± 36,425 | 16,954.61 ± 1,870.72 |
| Mandelbrot set | medium | TEXTGRAD | 10.8 ± 5.2 | 127,125 ± 78,074 | 55,362 ± 34,682 | 182,487 ± 112,631 | 16,317.68 ± 1,741.09 |
| Mandelbrot set | large | METAFORGE | 19.4 ± 1.3 | 157,616 ± 20,455 | 223,055 ± 27,376 | 380,672 ± 37,960 | 19,597.72 ± 944.72 |
| Mandelbrot set | large | TEXTGRAD | 10.2 ± 2.3 | 106,788 ± 28,969 | 60,924 ± 10,317 | 167,712 ± 31,132 | 16,561.59 ± 1,015.06 |
| Heat-transfer PDE | small | METAFORGE | 18.8 ± 2.7 | 150,460 ± 33,844 | 258,627 ± 35,237 | 409,087 ± 60,727 | 21,779.34 ± 1,203.64 |
| Heat-transfer PDE | small | TEXTGRAD | 10.2 ± 2.7 | 125,246 ± 50,359 | 81,676 ± 26,602 | 207,102 ± 70,179 | 20,143.61 ± 3,264.18 |
| Heat-transfer PDE | medium | METAFORGE | 20.0 ± 0.0 | 161,722 ± 12,341 | 262,002 ± 17,711 | 423,723 ± 20,131 | 21,186.17 ± 1,006.54 |
| Heat-transfer PDE | medium | TEXTGRAD | 15.8 ± 4.8 | 195,237 ± 68,833 | 116,887 ± 42,802 | 312,124 ± 109,819 | 19,544.75 ± 1,709.91 |
| Heat-transfer PDE | large | METAFORGE | 19.0 ± 1.7 | 150,887 ± 31,678 | 251,045 ± 44,066 | 401,932 ± 71,846 | 21,085.93 ± 2,590.94 |
| Heat-transfer PDE | large | TEXTGRAD | 16.4 ± 3.3 | 186,865 ± 42,367 | 115,760 ± 21,548 | 302,626 ± 62,073 | 18,437.68 ± 258.95 |
| Distributed PCA | small | METAFORGE | 19.8 ± 0.4 | 143,817 ± 14,195 | 200,942 ± 19,032 | 344,759 ± 32,746 | 17,397.56 ± 1,407.10 |
| Distributed PCA | small | TEXTGRAD | 16.2 ± 5.2 | 281,317 ± 100,264 | 110,791 ± 34,134 | 392,108 ± 132,016 | 24,175.65 ± 1,242.99 |
| Distributed PCA | medium | METAFORGE | 19.2 ± 1.8 | 148,068 ± 20,098 | 208,877 ± 26,819 | 356,945 ± 39,455 | 18,585.08 ± 955.18 |
| Distributed PCA | medium | TEXTGRAD | 12.6 ± 4.4 | 205,426 ± 90,007 | 90,275 ± 32,855 | 295,702 ± 122,164 | 23,150.41 ± 1,502.31 |
| Distributed PCA | large | METAFORGE | 17.4 ± 3.1 | 127,305 ± 37,114 | 184,936 ± 32,306 | 312,241 ± 68,280 | 17,914.03 ± 1,644.76 |
| Distributed PCA | large | TEXTGRAD | 10.8 ± 2.7 | 183,786 ± 58,028 | 93,962 ± 27,931 | 277,748 ± 83,003 | 25,569.60 ± 2,583.93 |
Table 23. Run-level optimization cost across five independent trials per workload. Values are mean ± sample standard deviation. Prompt and processing tokens sum to total tokens. Lower token counts indicate lower measured token consumption.
| Trial | Method | Iter. | Exec. iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 15 | 14 | 9 | -32.672 | 33.33 | 92.21 | 87.00 | 222,329 | 14,821.93 |
| 1 | TEXTGRAD | 9 | 8 | 1 | -228.006 | 0.00 | 0.00 | 0.00 | 149,584 | 16,620.44 |
| 2 | METAFORGE | 9 | 9 | 3 | -54.924 | 7.14 | 83.50 | 96.25 | 130,999 | 14,555.44 |
| 2 | TEXTGRAD | 11 | 10 | 3 | -49.596 | -68.42 | 92.15 | 95.64 | 191,867 | 17,442.45 |
| 3 | METAFORGE | 15 | 15 | 9 | -26.961 | 9.09 | 92.76 | 99.89 | 229,347 | 15,289.80 |
| 3 | TEXTGRAD | 9 | 8 | 1 | -52.536 | 0.00 | 0.00 | 0.00 | 146,097 | 16,233.00 |
| 4 | METAFORGE | 7 | 7 | 1 | -39.490 | 0.00 | 0.00 | 0.00 | 107,983 | 15,426.14 |
| 4 | TEXTGRAD | 20 | 18 | 19 | -40.718 | 17.24 | 92.00 | 59.65 | 449,399 | 22,469.95 |
| 5 | METAFORGE | 20 | 19 | 20 | -19.478 | 100.00 | 91.30 | 33.93 | 323,138 | 16,156.90 |
| 5 | TEXTGRAD | 10 | 6 | 2 | -217.332 | 38.89 | 0.10 | 87.48 | 162,808 | 16,280.80 |
| Mean ± SD | METAFORGE | 13.2 ± 5.2 | 12.8 ± 4.8 | 8.4 ± 7.4 | −34.705 ± 13.488 | 29.91 ± 41.14 | 71.95 ± 40.40 | 63.41 ± 44.31 | 202,759 ± 86,187 | 15,250.04 ± 616.59 |
| Mean ± SD | TEXTGRAD | 11.8 ± 4.7 | 10.0 ± 4.7 | 5.2 ± 7.8 | −117.638 ± 96.053 | −2.46 ± 40.19 | 36.85 ± 50.41 | 48.55 ± 46.29 | 219,951 ± 129,524 | 17,809.33 ± 2,650.03 |
Table 11. Per-trial matrix-multiplication results for the medium workload.
| Trial | Method | Iter. | Exec. iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 9 | 9 | 3 | -8.713 | 71.43 | 99.68 | 15.40 | 131,976 | 14,664.00 |
| 1 | TEXTGRAD | 16 | 14 | 8 | -52.336 | 45.95 | 0.97 | -175.08 | 276,971 | 17,310.69 |
| 2 | METAFORGE | 20 | 20 | 20 | -1.021 | 100.00 | 100.00 | 69.32 | 364,294 | 18,214.70 |
| 2 | TEXTGRAD | 18 | 18 | 10 | -67.685 | -66.67 | 92.13 | 85.04 | 309,841 | 17,213.39 |
| 3 | METAFORGE | 9 | 8 | 3 | -20.216 | 50.00 | 99.54 | 2.37 | 147,783 | 16,420.33 |
| 3 | TEXTGRAD | 16 | 16 | 8 | -59.502 | -115.38 | 92.22 | 24.48 | 293,795 | 18,362.19 |
| 4 | METAFORGE | 9 | 9 | 3 | -39.804 | 0.00 | 93.86 | 65.23 | 133,718 | 14,857.56 |
| 4 | TEXTGRAD | 16 | 16 | 8 | -52.789 | 4.55 | 92.33 | 100.00 | 294,897 | 18,431.06 |
| 5 | METAFORGE | 11 | 10 | 5 | -16.347 | 31.58 | 99.50 | -65.64 | 156,450 | 14,222.73 |
| 5 | TEXTGRAD | 18 | 16 | 10 | -57.577 | -52.94 | 92.06 | 90.01 | 350,503 | 19,472.39 |
| Mean ± SD | METAFORGE | 11.6 ± 4.8 | 11.2 ± 5.0 | 6.8 ± 7.4 | −17.220 ± 14.617 | 50.60 ± 38.07 | 98.52 ± 2.61 | 17.34 ± 55.02 | 186,844 ± 99,713 | 15,675.86 ± 1,643.55 |
| Mean ± SD | TEXTGRAD | 16.8 ± 1.1 | 16.0 ± 1.4 | 8.8 ± 1.1 | −57.978 ± 6.234 | −36.90 ± 63.02 | 73.94 ± 40.79 | 24.89 ± 115.64 | 305,201 ± 27,870 | 18,157.94 ± 929.26 |
Table 12. Per-trial matrix-multiplication results for the large workload.
These run-level totals complement the per-iteration results by exposing the combined effects of native model-call count, early stopping, and trajectory length. Accordingly, claims concerning inference efficiency should distinguish between per-iteration token consumption and total tokens required to complete an optimization run.
Ablation Study—MetaFORGE with and without Context Retrieval
Retrieval can expose the skill-refinement process to previously useful optimization knowledge, but it can also introduce irrelevant context or additional prompt cost. We therefore ablated retrieval while leaving the remaining MetaFORGE optimization procedure unchanged. The ablation covers all six MPI tasks and all three workload sizes, yielding 18 task–workload configurations with five independent trials per configuration.
Across the 18 configurations, retrieval increases the unweighted mean static-analysis improvement from 63.34% to 82.19% (+18.85 percentage points), runtime improvement from 35.99% to 51.59% (+15.60 points), and load-imbalance improvement from 42.27% to 51.03% (+8.76 points). Runtime improves in all 18 configurations, static quality improves in 15 with three ties, and load balance improves in 16. Mean token consumption decreases from 15,225 to 14,955 tokens per iteration, a 1.8% reduction, with retrieval using fewer tokens in 9 of 18 configurations. Because these entries are workload-level means rather than independent trial-level observations, these summaries are descriptive rather than inferential tests.
The π task illustrates the task dependence of the effect: both conditions reach 100% static-analysis improvement, while retrieval increases task-average runtime improvement from 8.61% to 16.45%. Figure 7 visualizes this representative case; Table 24 shows that the runtime benefit extends across the complete benchmark suite.
| Task | Workload | With Context: Static | With Context: Runtime | With Context: Imbalance | With Context: Tokens | Without Context: Static | Without Context: Runtime | Without Context: Imbalance | Without Context: Tokens |
| estimation | small | 100.00% | 20.77% | 97.49% | 8549 | 100.00% | 8.22% | 91.52% | 8085 |
| estimation | medium | 100.00% | 15.60% | 93.00% | 8392 | 100.00% | 9.38% | 99.14% | 9547 |
| estimation | large | 100.00% | 12.98% | 98.75% | 7757 | 100.00% | 8.22% | 99.76% | 8949 |
| Dot Product | small | 100.00% | 19.27% | 46.47% | 9506 | 73.22% | 13.68% | 40.89% | 9030 |
| Dot Product | medium | 100.00% | 21.65% | 45.67% | 8051 | 65.15% | 15.80% | 34.71% | 7890 |
| Dot Product | large | 100.00% | 40.08% | 60.08% | 9760 | 71.86% | 10.42% | 19.82% | 11712 |
| Matrix Multiplication | small | 90.96% | 93.49% | 60.37% | 15997 | 54.58% | 57.96% | 47.09% | 17179 |
| Matrix Multiplication | medium | 29.91% | 71.95% | 63.41% | 15250 | 22.43% | 48.93% | 45.66% | 16241 |
| Matrix Multiplication | large | 50.60% | 98.52% | 17.34% | 15675 | 36.44% | 67.98% | 13.35% | 16850 |
| Mandelbrot Set | small | 65.00% | 2.15% | 24.77% | 15753 | 44.20% | 1.52% | 21.79% | 14964 |
| Mandelbrot Set | medium | 73.47% | 14.31% | 30.20% | 16954 | 56.57% | 10.44% | 22.95% | 16276 |
| Mandelbrot Set | large | 96.92% | 11.49% | 20.90% | 19597 | 71.74% | 8.27% | 17.14% | 20380 |
| Heat Transfer | small | 27.94% | 78.18% | 41.23% | 21779 | 20.12% | 56.29% | 33.81% | 21125 |
| Heat Transfer | medium | 87.78% | 96.80% | 51.40% | 21186 | 67.59% | 74.53% | 39.58% | 20762 |
| Heat Transfer | large | 73.52% | 72.39% | 61.61% | 21085 | 55.14% | 52.84% | 48.67% | 21295 |
| Distributed PCA | small | 100.00% | 68.91% | 12.20% | 17397 | 68.00% | 51.14% | 10.01% | 16962 |
| Distributed PCA | medium | 100.00% | 99.45% | 44.67% | 18585 | 71.25% | 80.55% | 35.28% | 18213 |
| Distributed PCA | large | 83.33% | 90.63% | 49.00% | 17914 | 61.83% | 71.59% | 39.69% | 18593 |
Table 24. Effect of retrieval context across all six MPI tasks and three workload sizes. Values are means over five independent trials per task–workload configuration. Higher values are better for static-analysis, runtime, and load-imbalance improvement; lower values are better for per-iteration token consumption. Bold indicates the better value within each pair; ties are bolded for both conditions.

Figure 7. Comparison of MetaFORGE with and without retrieval context memory on the calculation task. Each point represents one optimization trial across all iterations, while diamonds indicate the mean value. The three subfigures report (left) static analysis improvement, (center) runtime improvement, and (right) load imbalance improvement. Incorporating retrieval context consistently improves runtime optimization while maintaining comparable static analysis and load balancing performance.
Held-Out Cross-Task Transfer
We used a leave-one-task-out design to determine whether MetaFORGE learns optimization knowledge that transfers to tasks excluded from skill and memory construction. The transfer pool contained Calculate π, Matrix Multiplication, and Mandelbrot Sets. In each fold, one task and all three of its workload sizes were held out, while the remaining two tasks were processed sequentially during Phase 1. Training began from the same initial skill specification and an empty cross-task memory store. Optimization episodes accumulated in the same memory throughout the fixed training curriculum. The held-out task did not appear in any Phase 1 task specification, skill update, or memory record.
| Trial | Method | Iter. | Exec. iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 13 | 12 | 7 | -25.181 | 73.91 | 2.84 | 14.32 | 203,819 | 15,678.38 |
| TEXTGRAD | 8 | 1 | 3 | -62.261 | 0.00 | 0.00 | 0.00 | 110,732 | 13,841.50 | |
| 2 | METAFORGE | 17 | 16 | 11 | -22.589 | 90.48 | 2.00 | 17.94 | 242,083 | 14,240.18 |
| TEXTGRAD | 6 | 4 | 1 | -41.816 | 0.00 | 0.00 | 0.00 | 102,437 | 17,072.83 | |
| 3 | METAFORGE | 11 | 10 | 5 | -28.757 | 33.33 | 1.51 | 27.61 | 161,096 | 14,645.09 |
| TEXTGRAD | 18 | 14 | 12 | -71.217 | 12.90 | -6.84 | 10.00 | 385,691 | 21,427.28 | |
| 4 | METAFORGE | 20 | 19 | 19 | -20.572 | 100.00 | -0.41 | -28.09 | 372,906 | 18,645.30 |
| TEXTGRAD | 19 | 4 | 13 | -57.602 | 10.00 | 0.56 | -0.10 | 282,484 | 14,867.58 | |
| 5 | METAFORGE | 10 | 10 | 4 | -39.211 | 27.27 | 4.81 | 92.06 | 155,598 | 15,559.80 |
| TEXTGRAD | 6 | 3 | 1 | -42.133 | 0.00 | 0.00 | 0.00 | 104,734 | 17,455.67 | |
| Mean ± SD | METAFORGE | 14.2 ± 4.2 | 13.4 ± 4.0 | 9.2 ± 6.1 | −27.262 ± 7.348 | 65.00 ± 33.09 | 2.15 ± 1.91 | 24.77 ± 43.26 | 227, 100 ± 88, 734 | 15, 753.75 ± 1, 726.59 |
| TEXTGRAD | 11.4 ± 6.5 | 5.2 ± 5.1 | 6.0 ± 6.0 | −55.006 ± 12.864 | 4.58 ± 6.36 | −1.26 ± 3.13 | 1.98 ± 4.48 | 197, 216 ± 130, 201 | 16, 932.97 ± 2, 928.93 |
Table 13. Per-trial Mandelbrot-set results for the small workload.
Phase 1 produced one transferred skill and one populated cross-task memory for each fold. The transferred skill was the best skill retained after the final training stage. Phase 1 was executed once per fold rather than once per evaluation trial. Upon completion, the transferred skill and memory were frozen and reused as the common starting point for all held-out evaluation trials. Figure 8 summarizes the training, freezing, and evaluation procedure.

Figure 8. Held-out cross-task transfer protocol. For each leave-one-task-out fold, METAFORGE is trained sequentially on the two non-held-out tasks across all workload sizes. The resulting transferred skill and cross-task memory are frozen before evaluation. Zero-update transfer isolates knowledge retained in the transferred skill, whereas adaptation transfer evaluates refinement with and without read-only access to the frozen cross-task memory. The held-out task is excluded from all Phase 1 skill updates and memory construction.
We evaluated two complementary forms of transfer. In Phase 2, the zero-update experiment isolated knowledge retained in the transferred skill by comparing it with the initial skill without retrieval, textual-gradient computation, feedback, or rewriting. In Phase 3, the adaptation-transfer experiment refined the transferred skill for a fixed budget of 10 iterations, either with retrieval disabled or with read-only access to the frozen Phase 1 memory. The memory remained unchanged during held-out evaluation, preventing held-out episodes from contaminating subsequent iterations or trials.
For each held-out task, we conducted three stochastic trials at each of the three workload sizes, yielding nine paired observations per task and 27 observations across the complete experiment. The Phase 1 transferred skill and memory were trained once for each fold and reused across its trials. Thus, the trials represent independent stochastic code-generation and rewriting trajectories from a shared training outcome rather than replications based upon independently retrained skills and memories. Furthermore, the per-task analysis pools observations across three workload sizes, despite differences in their computational difficulty. The resulting statistical evidence therefore should be interpreted as conditional on the shared Phase 1 training outcome and the pooled workload design.
Each paired observation compared the retrieval-enabled and retrieval-disabled run for the same held-out task, trial number, and workload size. Both members of a pair therefore shared the same task configuration and differed only in whether cross-task memory retrieval was available. Statistical testing was performed exclusively on the best reward obtained during each run. The held-out study used the same scalar reward definition and weights as Eq. (1). The maximum reward achieved across the 10-iteration adaptation trajectory constituted one run-level observation. Individual iterations were not treated as independent samples because successive skill rewrites were sequentially dependent. This run-level aggregation avoids pseudo-replication, although an unusually strong early iteration may substantially influence the best reward recorded for a run.
We compared paired best rewards using exact, two-sided Wilcoxon signed-rank tests. Runtime and load-imbalance measurements were included only for programs that passed correctness testing; these component metrics were reported descriptively and were not tested separately for statistical significance.
| Trial | Method | Iter. | Exec. iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 12 | 11 | 4 | -11.328 | 80.00 | 60.24 | 86.18 | 218,732 | 18,227.67 |
| 1 | TEXTGRAD | 20 | 16 | 18 | -31.637 | 52.38 | -0.07 | -9.49 | 382,966 | 19,148.30 |
| 2 | METAFORGE | 18 | 18 | 10 | -18.957 | 55.56 | 6.85 | 1.72 | 270,328 | 15,018.22 |
| 2 | TEXTGRAD | 8 | 4 | 1 | -21.224 | 0.00 | 0.00 | 0.00 | 133,101 | 16,637.62 |
| 3 | METAFORGE | 13 | 12 | 5 | -16.544 | 77.27 | 3.88 | 2.50 | 192,676 | 14,821.23 |
| 3 | TEXTGRAD | 8 | 5 | 1 | -32.459 | 0.00 | 0.00 | 0.00 | 127,596 | 15,949.50 |
| 4 | METAFORGE | 15 | 13 | 7 | -12.035 | 100.00 | -3.74 | -6.05 | 279,616 | 18,641.07 |
| 4 | TEXTGRAD | 10 | 4 | 3 | -34.587 | 0.00 | 0.00 | 0.00 | 149,736 | 14,973.60 |
| 5 | METAFORGE | 14 | 9 | 6 | -26.242 | 54.55 | 4.34 | 66.67 | 252,908 | 18,064.86 |
| 5 | TEXTGRAD | 8 | 2 | 1 | -33.633 | 0.00 | 0.00 | 0.00 | 119,035 | 14,879.38 |
| Mean ± SD | METAFORGE | 14.4 ± 2.3 | 12.6 ± 3.4 | 6.4 ± 2.3 | −17.021 ± 6.047 | 73.47 ± 18.97 | 14.31 ± 25.98 | 30.20 ± 42.88 | 242,852 ± 36,425 | 16,954.61 ± 1,870.72 |
| Mean ± SD | TEXTGRAD | 10.8 ± 5.2 | 6.2 ± 5.6 | 4.8 ± 7.4 | −30.708 ± 5.419 | 10.48 ± 23.43 | −0.01 ± 0.03 | −1.90 ± 4.24 | 182,487 ± 112,631 | 16,317.68 ± 1,741.09 |
Table 14. Per-trial Mandelbrot-set results for the medium workload.
| Trial | Method | Iter. | Exec. iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 20 | 18 | 15 | -21.537 | 100.00 | 0.83 | -18.18 | 407,872 | 20,393.60 |
| 1 | TEXTGRAD | 10 | 6 | 3 | -44.490 | 0.00 | 0.00 | 0.00 | 170,111 | 17,011.10 |
| 2 | METAFORGE | 20 | 19 | 20 | -21.091 | 100.00 | 3.10 | 94.00 | 391,483 | 19,574.15 |
| 2 | TEXTGRAD | 14 | 5 | 6 | -44.473 | 19.23 | 3.52 | 1.78 | 220,271 | 15,733.64 |
| 3 | METAFORGE | 20 | 19 | 17 | -11.024 | 100.00 | 50.77 | -1.58 | 413,642 | 20,682.10 |
| 3 | TEXTGRAD | 10 | 0 | 2 | -10010.000 | 0.00 | 0.00 | 0.00 | 152,592 | 15,259.20 |
| 4 | METAFORGE | 17 | 16 | 9 | -25.501 | 84.62 | 2.56 | 27.94 | 319,676 | 18,804.47 |
| 4 | TEXTGRAD | 8 | 4 | 1 | -40.385 | 0.00 | 0.00 | 0.00 | 141,216 | 17,652.00 |
| 5 | METAFORGE | 20 | 19 | 19 | -21.440 | 100.00 | 0.18 | 2.30 | 370,686 | 18,534.30 |
| 5 | TEXTGRAD | 9 | 3 | 1 | -43.604 | 0.00 | 0.00 | 0.00 | 154,368 | 17,152.00 |
| Mean ± SD | METAFORGE | 19.4 ± 1.3 | 18.2 ± 1.3 | 16.0 ± 4.4 | −20.119 ± 5.394 | 96.92 ± 6.88 | 11.49 ± 21.99 | 20.90 ± 44.08 | 380,672 ± 37,960 | 19,597.72 ± 944.72 |
| Mean ± SD | TEXTGRAD | 10.2 ± 2.3 | 3.6 ± 2.3 | 2.6 ± 2.1 | −2,036.590 ± 4,457.272 | 3.85 ± 8.60 | 0.70 ± 1.57 | 0.36 ± 0.79 | 167,712 ± 31,132 | 16,561.59 ± 1,015.06 |
Table 15. Per-trial Mandelbrot-set results for the large workload.
As shown in Table 25, optimization knowledge learned during Phase 1 transferred effectively to previously unseen tasks, and frozen cross-task memory further improved adaptation outcomes. For Calculate , retrieval eliminated the six reported static-analysis warnings, reduced runtime from (0.089) to (0.079) seconds, and reduced load imbalance from (0.0441) to (0.0375). For Matrix Multiplication, retrieval reduced static-analysis warnings from 21 to 9, runtime from (59.643) to (48.167) seconds, and load imbalance from (0.15) to (0.05). The largest static-analysis reduction occurred for Mandelbrot Sets, for which retrieval reduced warnings from 22 to 5, runtime from (7.487) to (5.615) seconds, and load imbalance from (0.20) to (0.08). Compiler diagnostics were unchanged, indicating that the reward improvements primarily resulted from better static quality, runtime performance, and workload balance. Correspondingly, the best reward became substantially less negative for every held-out task. The paired reward differences were statistically significant for each task under exact two-sided Wilcoxon signed-rank tests.
| Held-Out Task | Cross-Task Memory | Warnings ↓ | Runtime (s) ↓ | Load Imb. ↓ | Reward ↑ | Wilcoxon |
| Without | 6 | 0.089 | 0.0441 | -7.24 | 0.0039 | |
| With | 0 | 0.079 | 0.0375 | -1.21 | ||
| Matrix Multiplication | Without | 21 | 59.643 | 0.15 | -141.73 | 0.0039 |
| Matrix Multiplication | With | 9 | 48.167 | 0.05 | -106.63 | |
| Mandelbrot Set | Without | 22 | 7.487 | 0.20 | -38.27 | 0.0039 |
| Mandelbrot Set | With | 5 | 5.615 | 0.08 | -17.35 |
Table 25. Held-out cross-task adaptation with and without retrieval from memory learned exclusively from the two non-held-out training tasks. All other settings are identical. Lower is better for warnings, runtime, and load imbalance; higher is better for reward.
( for all three tasks), providing evidence that optimization knowledge retrieved from other tasks improved held-out adaptation under the evaluated conditions.
OpenAI discontinued access to gpt-5.1-codex-max after the primary METAFORGE experiments but before the held-out cross-task transfer study began. Consequently, the held-out experiment was conducted using gpt-5.3-codex ([21]).
Zero-Update
We conducted a zero-update experiment to isolate cross-task skill transfer from METAFORGE’s iterative adaptation process. For each held-out task, MPI C programs were generated using either the initial skill or the transferred skill, without textual-gradient rewriting, retrieval, feedback, or subsequent skill updates. This setting therefore measures whether knowledge acquired from other tasks improves generation under fixed-skill, zero-shot conditions.
As shown in Table 22, the transferred skill produced better rewards for all three held-out tasks (), while all generated programs passed correctness testing. Compiler warnings remained unchanged, indicating that the gains resulted from reductions in static-analysis warnings, runtime, and load imbalance. For Calculate , the transferred skill eliminated all six static-analysis warnings, reduced runtime from (0.102) to (0.090) seconds, and reduced imbalance from (0.0441) to (0.0375). For Matrix Multiplication, it reduced static warnings from 21 to 9, runtime from (30.133) to (24.705) seconds, and imbalance from (0.15) to (0.05). For Mandelbrot Sets, static warnings decreased from 22 to 5, runtime from (8.330) to (6.248) seconds, and imbalance from (0.20) to (0.08).
| Held-Out Task | Skill | Compiler Warnings | Static Warnings | Runtime (s) | Imbalance | Reward | Wilcoxon |
| Calculate | Initial | 1.000 | 6 | 0.102 | 0.0441 | -7.27 | |
| Transferred | 1.000 | 0 | 0.090 | 0.0375 | -1.24 | 0.0039 | |
| Matrix Multiplication | Initial | 1.000 | 21 | 30.133 | 0.1500 | -82.49 | |
| Transferred | 1.000 | 9 | 24.705 | 0.0500 | -59.49 | 0.0078 | |
| Mandelbrot Sets | Initial | 1.000 | 22 | 8.330 | 0.2000 | -39.96 | |
| Transferred | 1.000 | 5 | 6.248 | 0.0800 | -18.62 | 0.0039 |
Table 22. Zero-update results averaged across trials. All generated programs passed task-specific correctness testing.
| Trial | Method | Iter. | Exec. iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 20 | 17 | 17 | -24.759 | 42.50 | 91.63 | 3.86 | 423,434 | 21,171.70 |
| TEXTGRAD | 14 | 7 | 7 | -35.266 | 10.71 | 66.36 | 37.65 | 275,961 | 19,711.50 | |
| 2 | METAFORGE | 14 | 4 | 6 | -35.469 | 0.00 | 20.69 | 2.24 | 309,170 | 22,083.57 |
| TEXTGRAD | 9 | 2 | 1 | -42.510 | 0.00 | 0.00 | 0.00 | 136,708 | 15,189.78 | |
| 3 | METAFORGE | 20 | 12 | 18 | -22.268 | 39.39 | 95.15 | 1.13 | 453,188 | 22,659.40 |
| TEXTGRAD | 12 | 8 | 4 | -45.201 | 50.00 | 53.24 | -29.38 | 288,915 | 24,076.25 | |
| 4 | METAFORGE | 20 | 16 | 16 | -20.562 | 34.48 | 97.45 | 99.87 | 459,460 | 22,973.00 |
| TEXTGRAD | 8 | 6 | 1 | -44.026 | 0.00 | 0.00 | 0.00 | 173,585 | 21,698.12 | |
| 5 | METAFORGE | 20 | 15 | 15 | -24.722 | 23.33 | 85.99 | 99.06 | 400,181 | 20,009.05 |
| TEXTGRAD | 8 | 1 | 1 | -45.356 | 0.00 | 0.00 | 0.00 | 160,339 | 20,042.38 | |
| Mean ± SD | METAFORGE | 18.8 ± 2.7 | 12.8 ± 5.3 | 14.4 ± 4.8 | −25.556 ± 5.817 | 27.94 ± 17.23 | 78.18 ± 32.43 | 41.23 ± 53.17 | 409, 087 ± 60, 727 | 21, 779.34 ± 1, 203.64 |
| TEXTGRAD | 10.2 ± 2.7 | 4.8 ± 3.1 | 2.8 ± 2.7 | −42.472 ± 4.186 | 12.14 ± 21.67 | 23.92 ± 33.08 | 1.65 ± 23.81 | 207, 102 ± 70, 179 | 20, 143.61 ± 3, 264.18 |
Table 16. Per-trial heat-transfer PDE results for the small workload.
The runtime reductions were approximately (11.8%), (18.0%), and (25.0%) for Calculate , Matrix Multiplication, and Mandelbrot Sets, respectively. Correspondingly, the composite reward improved from (-7.27) to (-1.24), from (-82.49) to (-59.49), and from (-39.96) to (-18.62). These results provide evidence under the evaluated three-task setting that the transferred skill retains useful cross-task optimization knowledge and improves held-out code generation even without retrieval or task-specific adaptation.
Ablation Study—MetaFORGE with Claude vs. Codex
Table 26 reports the cross-model ablation comparing MetaFORGE with gpt-5.1-codex-max and Claude Sonnet 5 (claude-sonnet-5) on the distributed PCA task. Both models benefit from MetaFORGE’s reward-guided skill-refinement process, but they exhibit different optimization profiles.
| Task | Workload | \multicolumn{4}{c | }{MetaFORGE (Codex)} | \multicolumn{4}{c | }{MetaFORGE (Claude)} | ||||
| Static | Runtime | Imbalance | Tokens | Static | Runtime | Imbalance | Tokens | ||
| Distributed PCA | small | 100.00% | 68.91% | 12.20% | 17397 | 100.00% | 29.25% | 60.54% | 38352 |
| Distributed PCA | medium | 100.00% | 99.45% | 44.67% | 18585 | 100.00% | 63.53% | 85.50% | 40210 |
| Distributed PCA | large | 83.33% | 90.63% | 49.00% | 17914 | 100.00% | 73.64% | 75.25% | 42635 |
Table 26. Cross-model ablation on distributed PCA over five trials per workload. Values are mean improvements and per-iteration token consumption. Bold indicates the better result.
Codex provides stronger runtime optimization and lower token consumption, whereas Claude achieves stronger load-balance improvement and slightly better static-analysis improvement on the largest workload.
For code quality, both models achieve 100.00% static-analysis improvement on the small and medium PCA workloads. On the large workload, Claude maintains 100.00% static improvement, while Codex reaches 83.33%. This result suggests that Claude is more consistent at eliminating static-analysis warnings for the most complex PCA configuration. However, the static-analysis advantage does not translate into better runtime performance.
Runtime improvement is higher when MetaFORGE uses Codex on all three Distributed PCA workload sizes. Codex improves runtime by 68.91%, 99.45%, and 90.63% on the small, medium, and large workloads, respectively, compared with 29.25%, 63.53%, and 73.64% for Claude. Thus, within this Distributed PCA experiment, Codex produces the larger runtime improvement at every evaluated workload size.
Claude produces larger load-balance improvements on all three PCA workload sizes. MetaFORGE with Claude improves imbalance by 60.54%, 85.50%, and 75.25%, compared with 12.20%, 44.67%, and 49.00% for Codex. The observed tradeoff is therefore task specific: Codex produces larger runtime gains, whereas Claude produces larger rank-balance gains.
| Trial | Method | Iter. | Exec. iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 20 | 16 | 12 | -26.912 | 38.89 | 96.75 | 65.80 | 399,218 | 19,960.90 |
| TEXTGRAD | 15 | 4 | 8 | -113.356 | 5.88 | 1.86 | -17.99 | 255,631 | 17,042.07 | |
| 2 | METAFORGE | 20 | 18 | 19 | -1.788 | 100.00 | 92.52 | 5.62 | 419,707 | 20,985.35 |
| TEXTGRAD | 17 | 10 | 9 | -108.301 | 65.12 | 2.97 | 1.59 | 334,238 | 19,661.06 | |
| 3 | METAFORGE | 20 | 17 | 17 | -1.409 | 100.00 | 99.50 | 77.85 | 447,410 | 22,370.50 |
| TEXTGRAD | 19 | 11 | 12 | -105.967 | 28.21 | 2.10 | 99.98 | 411,419 | 21,653.63 | |
| 4 | METAFORGE | 20 | 16 | 13 | -3.951 | 100.00 | 97.92 | 37.75 | 411,451 | 20,572.55 |
| TEXTGRAD | 8 | 3 | 1 | -110.317 | 0.00 | 0.00 | 0.00 | 152,006 | 19,000.75 | |
| 5 | METAFORGE | 20 | 15 | 18 | -3.056 | 100.00 | 97.33 | 70.00 | 440,831 | 22,041.55 |
| TEXTGRAD | 20 | 6 | 13 | -108.138 | 25.00 | 1.06 | 99.98 | 407,325 | 20,366.25 | |
| Mean ± SD | METAFORGE | 20.0 ± 0.0 | 16.4 ± 1.1 | 15.8 ± 3.1 | −7.423 ± 10.942 | 87.78 ± 27.33 | 96.80 ± 2.61 | 51.40 ± 29.73 | 423,723 ± 20,131 | 21,186.17 ± 1,006.54 |
| TEXTGRAD | 15.8 ± 4.8 | 6.8 ± 3.6 | 8.6 ± 4.7 | −109.216 ± 2.779 | 24.84 ± 25.54 | 1.60 ± 1.12 | 36.71 ± 58.27 | 312,124 ± 109,819 | 19,544.75 ± 1,709.91 |
Table 17. Per-trial heat-transfer PDE results for the medium workload.
| Trial | Method | Iter. | Exec. iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 20 | 13 | 20 | -12.003 | 70.27 | 99.82 | 17.23 | 463,985 | 23,199.25 |
| TEXTGRAD | 13 | 9 | 5 | -293.298 | 36.84 | 4.26 | 47.24 | 242,217 | 18,632.08 | |
| 2 | METAFORGE | 16 | 9 | 8 | -57.625 | 45.95 | 86.56 | 89.53 | 323,152 | 20,197.00 |
| TEXTGRAD | 20 | 9 | 18 | -304.377 | 11.63 | 4.06 | 10.84 | 369,697 | 18,484.85 | |
| 3 | METAFORGE | 19 | 14 | 11 | -54.421 | 63.64 | 76.82 | 98.95 | 344,715 | 18,142.89 |
| TEXTGRAD | 19 | 7 | 11 | -296.371 | 25.00 | 4.78 | 94.26 | 351,141 | 18,481.11 | |
| 4 | METAFORGE | 20 | 12 | 20 | -36.601 | 100.00 | 10.49 | 2.59 | 391,036 | 19,551.80 |
| TEXTGRAD | 17 | 7 | 9 | -107.932 | -100.00 | 81.00 | 1.29 | 316,198 | 18,599.88 | |
| 5 | METAFORGE | 20 | 14 | 13 | -11.357 | 87.76 | 88.25 | 99.72 | 486,774 | 24,338.70 |
| TEXTGRAD | 13 | 4 | 5 | -315.978 | -2.70 | 1.30 | -1.36 | 233,876 | 17,990.46 | |
| Mean ± SD | METAFORGE | 19.0 ± 1.7 | 12.4 ± 2.1 | 14.4 ± 5.4 | −34.401 ± 22.236 | 73.52 ± 21.05 | 72.39 ± 35.56 | 61.61 ± 47.64 | 401,932 ± 71,846 | 21,085.93 ± 2,590.94 |
| TEXTGRAD | 16.4 ± 3.3 | 7.2 ± 2.0 | 9.6 ± 5.4 | −263.591 ± 87.457 | −5.85 ± 54.67 | 19.08 ± 34.64 | 30.45 ± 40.62 | 302,626 ± 62,073 | 18,437.68 ± 258.95 |
Table 18. Per-trial heat-transfer PDE results for the large workload.
Per-iteration token consumption is also lower for Codex. Across the three workload sizes, Codex requires 17,397–18,585 tokens per iteration, whereas Claude requires 38,352–42,635. On this task, Codex therefore provides the stronger runtime/token tradeoff, while Claude provides stronger imbalance reduction and static-analysis improvement. Overall, Table 26 shows optimization gains with both evaluated model families on Distributed PCA. This single-task cross-provider ablation does not establish model independence.
Refinement-Model Strength Ablation
The primary comparison uses different native refinement models: MetaFORGE uses a stronger reasoning model for critique and rewriting, whereas the published TextGrad configuration uses gpt-4o. To isolate this confound, we performed a model-matched ablation using the same gpt-5.3-codex code generator, seed skill, evaluator, reward function, stopping rule, and frozen read-only memory snapshot in all conditions. MetaFORGE-Strong uses gpt-5.3-codex for refinement, MetaFORGE-Weak uses gpt-4o, and TextGrad-Native retains its published gpt-4o refinement procedure. Each task–method combination was evaluated in five independent trials, yielding 90 runs; all selected programs passed correctness testing.
Both MetaFORGE conditions achieve higher mean best reward than TextGrad-Native on all six tasks. Ranking the 15 observations within each task gives mean ranks of 5.30 for Strong, 7.30 for Weak, and 11.40 for TextGrad-Native, where lower is better. Because trials are independent rather than paired by index, inference uses exact task-stratified permutation tests. The corresponding pairwise test statistics, including exact and Holm-adjusted -values, are reported in Table 2.
| Comparison | rank | Exact | Holm |
| Strong vs. Weak | -1.533 | 0.054 | 0.054 |
| Weak vs. TextGrad | -2.933 | ||
| Strong vs. TextGrad | -3.867 |
Table 2. Exact task-stratified pairwise comparisons of best reward in the refinement-model ablation. For each comparison, ranks are recomputed using only the two methods in that comparison. Therefore, rank is not the arithmetic difference between the three-method mean ranks reported in the text. Negative rank favors the first method. Holm adjustment covers the three comparisons.
Both MetaFORGE conditions retain statistically significant best-reward advantages over TextGrad-Native after multiplicity correction. Strong versus Weak favors the stronger refiner numerically but does not reach the corrected threshold. Token use shows the opposite tradeoff: mean total token consumption across the 30 runs per method is 378,766 for Strong, 155,139 for Weak, and 274,295 for TextGrad-Native. Thus, the model-matched Weak condition uses 43.4% fewer tokens than TextGrad-Native while retaining its significant best-reward advantage. The ablation supports the conclusion that MetaFORGE remains effective when refinement-model capability is reduced, however it does not establish equivalence or model-independence.
| Trial | Method | Iter. | Best iter. | Best reward | Static improv. (%) | Runtime improv. (%) | Balance improv. (%) | Total tokens | Tokens/iteration |
| 1 | METAFORGE | 20 | 16 | -1.006 | 100.00 | 99.95 | 89.39 | 359,794 | 17,989.70 |
| TEXTGRAD | 11 | 3 | -20.848 | 25.00 | -7.88 | 84.89 | 242,432 | 22,039.27 | |
| 2 | METAFORGE | 20 | 20 | -1.034 | 100.00 | 100.00 | 57.63 | 360,697 | 18,034.85 |
| TEXTGRAD | 13 | 5 | -21.388 | -9.09 | 98.16 | 44.28 | 295,752 | 22,750.15 | |
| 3 | METAFORGE | 20 | 16 | -1.024 | 100.00 | 99.99 | -9.17 | 363,838 | 18,191.90 |
| TEXTGRAD | 9 | 1 | -20.858 | 0.00 | 0.00 | 0.00 | 194,512 | 21,612.44 | |
| 4 | METAFORGE | 20 | 16 | -1.140 | 100.00 | 99.95 | 57.83 | 405,276 | 20,263.80 |
| TEXTGRAD | 20 | 15 | -21.509 | 30.43 | 98.55 | 30.30 | 504,622 | 25,231.10 | |
| 5 | METAFORGE | 16 | 8 | -1.114 | 100.00 | 97.84 | 72.38 | 295,122 | 18,445.12 |
| TEXTGRAD | 10 | 2 | -18.551 | 45.83 | 98.06 | -23.84 | 241,191 | 24,119.10 | |
| Mean ± SD | METAFORGE | 19.2 ± 1.8 | 15.2 ± 4.4 | −1.064 ± 0.059 | 100.00 ± 0.00 | 99.55 ± 0.95 | 53.61 ± 37.44 | 356, 945 ± 39, 458 | 18, 585.08 ± 955.18 |
| TEXTGRAD | 12.6 ± 4.4 | 5.2 ± 5.7 | −20.631 ± 1.201 | 18.44 ± 22.56 | 57.38 ± 56.05 | 27.13 ± 41.76 | 295, 702 ± 122, 164 | 23, 150.41 ± 1, 502.31 |
Table 20. Per-trial distributed PCA results for the medium workload.
Note. OpenAI discontinued access to gpt-5.1-codex-max after the main MetaFORGE experiments but before the held-out cross-task transfer study began. We therefore conducted the transfer experiment using gpt-5.3-codex.
| Task | Method | Static warnings | Runtime (s) | Load imbalance | Best reward | Total tokens |
| MetaFORGE-Strong | 2.40 ± 2.30 | 0.0684 ± 0.0083 | −2.542 ± 2.317 | 362,964 ± 47,371 | ||
| MetaFORGE-Weak | 3.00 ± 1.58 | 0.0839 ± 0.0053 | −3.236 ± 1.549 | 80,272 ± 15,303 | ||
| TextGrad-Native | 6.80 ± 1.30 | 0.0900 ± 0.0232 | −7.023 ± 1.369 | 246,120 ± 95,703 | ||
| Dot Product | MetaFORGE-Strong | 3.60 ± 2.30 | 0.0017 ± 0.0010 | −3.729 ± 2.349 | 279,069 ± 58,870 | |
| Dot Product | MetaFORGE-Weak | 3.40 ± 0.89 | 0.0200 ± 0.0099 | −3.514 ± 0.879 | 99,469 ± 34,758 | |
| Dot Product | TextGrad-Native | 8.00 ± 0.71 | 0.0293 ± 0.0074 | −8.133 ± 0.705 | 166,654 ± 21,436 | |
| Matrix Multiplication | MetaFORGE-Strong | 9.40 ± 11.44 | 8.5931 ± 3.1626 | −26.597 ± 15.253 | 454,206 ± 158,701 | |
| Matrix Multiplication | MetaFORGE-Weak | 9.80 ± 7.40 | 8.3543 ± 1.6077 | −26.518 ± 7.449 | 185,205 ± 68,023 | |
| Matrix Multiplication | TextGrad-Native | 21.60 ± 7.57 | 8.7189 ± 1.2054 | −39.045 ± 9.585 | 220,272 ± 58,010 | |
| Mandelbrot | MetaFORGE-Strong | 11.20 ± 7.63 | 3.2669 ± 1.3092 | −17.754 ± 6.876 | 340,144 ± 178,604 | |
| Mandelbrot | MetaFORGE-Weak | 13.60 ± 5.55 | 4.1869 ± 1.4921 | −21.992 ± 7.772 | 187,872 ± 109,963 | |
| Mandelbrot | TextGrad-Native | 16.00 ± 6.20 | 5.6415 ± 0.1285 | −27.300 ± 6.084 | 328,812 ± 141,164 | |
| Heat Transfer | MetaFORGE-Strong | 19.00 ± 9.11 | 47.5152 ± 1.4676 | −114.240 ± 7.066 | 374,454 ± 189,099 | |
| Heat Transfer | MetaFORGE-Weak | 19.60 ± 16.41 | 47.7822 ± 27.3321 | 0.763 ± 1.68 | −116.309 ± 37.961 | 237,836 ± 66,739 |
| Heat Transfer | TextGrad-Native | 23.40 ± 3.05 | 49.2273 ± 1.5946 | −122.073 ± 4.769 | 319,632 ± 110,104 | |
| Distributed PCA | MetaFORGE-Strong | 10.20 ± 4.55 | 50.4811 ± 6.4115 | −111.162 ± 16.976 | 461,760 ± 159,016 | |
| Distributed PCA | MetaFORGE-Weak | 12.20 ± 3.11 | 72.3796 ± 13.5163 | −157.159 ± 28.533 | 140,183 ± 19,748 | |
| Distributed PCA | TextGrad-Native | 20.60 ± 5.46 | 77.7888 ± 24.4503 | −176.378 ± 47.177 | 364,280 ± 103,025 |
Table 27. Refinement-model sensitivity across six MPI tasks. Values are means ± sample standard deviations over five independent trials. Higher (less negative) best reward is better; lower values are better for static-analysis warnings, runtime, load imbalance, and total token consumption.
Memory Algorithms
The following algorithms provide implementation details for context-augmented iteration, tuple extraction, episode compression, lesson distillation, and weighted retrieval. These details are summarized in the main paper in § 3.4.
For tuple extraction, is the keyword set for parallel pattern , is the task vocabulary, and are the performance- and correctness-symptom sets, is the metric predicate for symptom , and contains its diagnostic keywords. During compression, denotes all recorded episodes, the reward-improving subset, and the episodes used to construct memory. The aggregated tags are , the ordered textual gradients are , and , , and denote the distilled headline, actions, and lesson. The resulting memory has reward improvement and identifier . When is empty, all episodes are used so that the memory remains defined. For Algorithm 5, is the minimum candidate-line length, is the maximum number of unique candidate actions retained before summarization, and is the maximum number of actions returned with the distilled lesson. UniqueFirst removes duplicates while preserving first occurrence order.
For Algorithm 4, denotes the episodes loaded from the episode store, and is the Boolean flag recorded for episode indicating whether that episode improved the best-observed reward. Accordingly, denotes the reward-improving subset and the episodes selected for memory construction. For each tuple category , is the union of values in the stored tuple field contributed by the selected episodes. The collection forms the aggregated tag bundle written to memory. The ordered list contains the episodes’ textual gradients, while , , and denote the distilled headline, action list, and lesson. The value is the reward improvement over the first episode, and is the identifier assigned to the resulting memory record.
Algorithm 3 Tuple Extraction
Input: Source , task , metrics , previous textual gradient , diagnostics
Output: Tuple bundle
Identify additional performance symptoms in that are not already in and whose keywords appear in .
Add the identified symptoms to .
return
Algorithm 4 Compress and Index
Input: Episode IDs
Output: Memory ID ; return if empty
Exit and return if is empty.
For each tuple category , set
\hfill Alg. 5
For each tuple category and value , update
return
Algorithm 5 Lesson Distillation
Input: Gradients with selected episodes first; all episodes ; selected episodes ; action limits ; minimum candidate-line length
Output: Headline , actions , lesson
if then
end if
\quad Prompt D.4
return , ,
Algorithm 6 Weighted Context Retrieval
Input: Query tags , retrieval budget
Output: Ranked memories
\quad tag-overlap candidates
return sorted by descending
Prompts Used in MetaFORGE
Code Generation Prompt
Skill Specification
{Skill Text}
Task
{Task Text}
Generate a complete MPI C program implementing the task per the skill specification.
Textual Gradient Prompt
{Previous Skill Specification}
{Task Specification}
{Metric Summary: current and best values for correctness status, compiler warnings, static-analysis warnings, runtime, load imbalance, and reward}
where if correctness testing fails and otherwise.
{Compiler Warnings Text}
{Static Analysis Warnings}
{Generated Code}
Produce the textual gradient for the skill specification above. Prioritize changes that restore correctness when ; otherwise, prioritize changes that reduce the largest weighted reward terms.
Skill Rewrite Prompt
{Previous Skill Definition}
{Computed Textual Gradient}
Rewrite the skill specification applying the gradient’s guidance. Increment the ’version’ field in the formatter by 1.
Output ONLY the updated skill Markdown.
Knowledge Distillation Prompt
The following action lines were extracted from MPI optimization gradients across candidate lines.
Best result achieved in this run:
{Best Candidate reward, compiler stats, static results, and runtime}
Action Lines:
{Action Lines}
Produce a concise summary of actionable recommendations.
Rules:
Preserve specific MPI function names, flags, and data types.
Merge near-duplicates into a single, precise statement.
Resolve contradictions in favor of actions from improving iterations.
Remove vague or non-actionable lines.
Output only the recommendations, one per line, with no bullets, numbering, or extra commentary.
Notation & Tables
| Symbol | Description |
| Skill specification | |
| Fixed task specification | |
| MPI C program at iteration | |
| Compiler-warning count | |
| Static-analysis-warning count | |
| Mean externally measured whole-job runtime over 20 executions | |
| Per-rank elapsed times in used for load imbalance | |
| Load imbalance, | |
| Scalar reward; closer to zero is better | |
| Best observed reward | |
| Textual gradient for skill rewriting | |
| Non-improvement counter | |
| No-improvement limit | |
| Rewriter backend |
Table 28. MetaFORGE notation.
| Symbol | Meaning |
| Tuple bundle: | |
| Query tuple and stored memory entry | |
| Episode and memory stores | |
| Inverted index from tags to memory IDs | |
| Jaccard similarity; | |
| Reward improvement for memory | |
| Age of memory in days | |
| MPI-pattern keyword dictionary | |
| Predicate for performance symptom | |
| MPI task vocabulary | |
| Action-verb lexicon | |
| Performance and correctness symptom sets | |
| Diagnostic keywords for symptom |
Table 29. Context-retrieval notation.
| Component | Weight | Score term |
| MPI construct | 0.25 | |
| Parallel pattern | 0.25 | |
| Performance symptom | 0.20 | |
| Task keyword | 0.15 | |
| Reward confidence | 0.10 | |
| Recency | 0.05 |
Table 30. Context-retrieval scoring weights.
References
- [1]Laksono Adhianto, Sinchan Banerjee, Mike Fagan, Mark Krentel, Gabriel Marin, John Mellor-Crummey, and Nathan R Tallent. 2010. HPCToolkit: Tools for performance analysis of optimized parallel programs. Concurrency and Computation: Practice and Experience, 22(6):685–701.
- [2]Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, and 39 others. 2021. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374.arxiv.org/abs/2107.03374
- [3]Zhenbang Chen, Hengbiao Yu, Xianjin Fu, and Ji Wang. 2020. MPI-SV: a symbolic verifier for MPI programs. In 2020 IEEE/ACM 42nd International Conference on Software Engineering: Companion Proceedings (ICSE-Companion), ICSE ’20, pages 93–96. Association for Computing Machinery.DOI
- [4]Prateek Chhikara, Dev Khant, Saket Aryan, Taranjeet Singh, and Deshraj Yadav. 2025. Mem0: Building production-ready ai agents with scalable long-term memory. In ECAI 2025, volume 413 of Frontiers in Artificial Intelligence and Applications, pages 2993–3000. IOS Press.
- [5]Alexander Droste, Michael Kuhn, and Thomas Ludwig. 2015. MPI-checker: static analysis for MPI. In Proceedings of the Second Workshop on the LLVM Compiler Infrastructure in HPC, LLVM ’15, New York, NY, USA. Association for Computing Machinery.
- [6]Zheng Fang, Dongming Jin, Yihong Dong, Yongmin Li, Kechi Zhang, Zhi Jin, and Ge Li. 2026. ClarifyCodeBench: Evaluating LLMs on clarifying ambiguous requirements for code generation. arXiv:2607.00711.arxiv.org/abs/2607.00711
- [7]Yang Gao, Gang Quan, Wujie Wen, Scott Piersall, Qian Lou, and Liqiang Wang. 2026. Efficient privacy-preserving sparse matrix-vector multiplication using homomorphic encryption. Information Sciences, 739:123180.DOI
- [8]Tobias Hilbrich, Joachim Protze, Martin Schulz, Bronis R. de Supinski, and Matthias S. Muller. 2012. MPI runtime error detection with MUST: Advances in deadlock detection. In SC ’12: Proceedings of the International Conference on High Performance Computing, Networking, Storage and Analysis, pages 1–10.
- [9]Yu Huang, Benjamin Ogles, and Eric Mercer. 2020. A predictive analysis for detecting deadlock in MPI programs. In 2020 35th IEEE/ACM International Conference on Automated Software Engineering (ASE), ASE ’20, pages 18–28, New York, NY, USA. Association for Computing Machinery.DOI
- [10]Erel Kaplan, Tomer Bitan, Lian Ghrayeb, Le Chen, Tom Yotam, Niranjan Hasbani, and Gal Oren. 2026. Para-Codex: A profiling-guided autonomous coding agent for reliable parallel code generation and translation. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 16113–16136, San Diego, California, United States. Association for Computational Linguistics.
- [11]Andreas Knüpfer, Christian Rössel, Dieter an Mey, Scott Biersdorff, Kai Diethelm, Dominic Eschweiler, Markus Geimer, Michael Gerndt, Daniel Lorenz, Allen D. Malony, Wolfgang E. Nagel, Yury Oleynik, Peter Philipp, Pavel Saviankou, Dirk Schmidl, Sameer S. Shende, Ronny Tschüter, Michael Wagner, Bert Wesarg, and Felix Wolf. 2012. Score-P: A joint performance measurement run-time infrastructure for periscope, scalasca, TAU, and vampir. In Tools for High Performance Computing 2011, pages 79–91. Springer.DOI
- [12]Yoonho Lee, Roshen Nair, Qizheng Zhang, Kang-wook Lee, Omar Khattab, and Chelsea Finn. 2026. Meta-Harness: End-to-end optimization of model harnesses. In Conference on Language Modeling (COLM).arxiv.org/abs/2603.28052
- [13]Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. 2020. Retrieval-augmented generation for knowledge-intensive NLP tasks. In Advances in Neural Information Processing Systems, volume 33, pages 9459–9474. Curran Associates, Inc.arxiv.org/abs/2005.11401
- [14]Hongbo Li, Zizhong Chen, and Rajiv Gupta. 2019. Efficient concolic testing of MPI applications. In Proceedings of the 28th International Conference on Compiler Construction, CC 2019, pages 193–204, New York, NY, USA. Association for Computing Machinery.
- [15]Hongbo Li, Sihuan Li, Zachary Benavides, Zizhong Chen, and Rajiv Gupta. 2018. COMPI: Concolic testing for MPI applications. In 2018 IEEE International Parallel and Distributed Processing Symposium (IPDPS), pages 865–874.DOI
- [16]Van Man Nguyen, Emmanuelle Saillard, Julien Jaeger, Denis Barthou, and Patrick Carribault. 2020. PAR-COACH extension for static MPI nonblocking and persistent communication validation. In 2020 IEEE/ACM 4th International Workshop on Software Correctness for HPC Applications, pages 31–39.
- [17]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. 2025. AlphaVolve: A coding agent for scientific and algorithmic discovery. Preprint, arXiv:2506.13131.arxiv.org/abs/2506.13131
- [19]OpenAI. 2025b. GPT-5.1-Codex-Max Model | OpenAI API Documentation. https://developers.openai.com/api/docs/models/gpt-5.1-codex-max. Accessed: 2026-04-23.
- [20]OpenAI. 2025c. Introducing Codex. https://openai.com/index/introducing-codex/. Accessed: 2026-06-11.
- [21]OpenAI. 2026. GPT-5.3-Codex. https://developers.openai.com/api/docs/models/gpt-5.3-codex. Accessed: 2026-07-30, Large language model for agentic coding.
- [22]Charles Packer, Sarah Wooders, Kevin Lin, Vivian Fang, Shishir G. Patil, Ion Stoica, and Joseph E. Gonzalez. 2023. MemGPT: Towards LLMs as operating systems. Preprint, arXiv:2310.08560.arxiv.org/abs/2310.08560
- [23]Joon Sung Park, Joseph O’Brien, Carrie Jun Cai, Meredith Ringel Morris, Percy Liang, and Michael S Bernstein. 2023. Generative agents: Interactive simulacra of human behavior. In Proceedings of the 36th Annual ACM Symposium on User Interface Software and Technology, New York, NY, USA. Association for Computing Machinery.
- [24]Scott Piersall, Yang Gao, Shenyang Liu, and Liqiang Wang. 2026. Improving MPI error detection and repair with large language models and bug references. Journal of Parallel and Distributed Computing, 213:105255.DOI
- [25]Rana Salama, Jason Cai, Michelle Yuan, Anna Currey, Monica Sunkara, Yi Zhang, and Yassine Benjiba. 2025. MemInsight: Autonomous memory augmentation for LLM agents. In Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, pages 33136–33152, Suzhou, China. Association for Computational Linguistics.arxiv.org/abs/2503.21760
- [26]Noah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao. 2023. Reflexion: Language agents with verbal reinforcement learning. Advances in neural information processing systems, 36:8634–8652.arxiv.org/abs/2303.11366
- [27]Anjiang Wei, Allen Nie, Thiago S. F. X. Teixeira, Rohan Yadav, Wonchan Lee, Ke Wang, and Alex Aiken. 2025. Improving parallel program performance with LLM optimizers via agent-system interfaces. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pages 66155–66177. PMLR.arxiv.org/abs/2410.15625
- [28]Di Yang, Xinou Xie, Xiuwen Yang, Ming Hu, Yihao Huang, Yueling Zhang, Weikai Miao, Ting Su, Chengcheng Wan, and Gequang Pu. 2026. Clarity is not assumed: Understanding LLM-based code generation under ambiguous requirements. In Proceedings of the 41st IEEE/ACM International Conference on Automated Software Engineering. Association for Computing Machinery.arxiv.org/abs/2604.21505
- [29]John Yang, Carlos E Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, and Ofir Press. 2024. SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering. In Advances in Neural Information Processing Systems, pages 50528–50652, Red Hook, NY, USA. Curran Associates Inc.arxiv.org/abs/2405.15793
- [30]Hengbiao Yu. 2018. Combining Symbolic Execution and Model Checking to Verify MPI Programs. In 2018 IEEE/ACM 40th International Conference on Software Engineering: Companion (ICSE-Companion), ICSE ’18, pages 527–530, New York, NY, USA. Association for Computing Machinery.arxiv.org/abs/1803.06300
- [31]Mert Yuksekgonul, Federico Bianchi, Joseph Boen, Sheng Liu, Zhi Huang, Carlos Guestrin, and James Zou. 2024. TextGrad: Automatic "Differentiation" via Text. Preprint, arXiv:2406.07496.arxiv.org/abs/2406.07496
- [32]Mert Yuksekgonul, Federico Bianchi, Joseph Boen, Sheng Liu, Pan Lu, Zhi Huang, Carlos Guestrin, and James Zou. 2025. Optimizing generative AI by backpropagating language model feedback. Nature, 639:609–616.DOI
- [33]Mohammad Amin Zadenoori, Jacek Dąbrowski, Waad Alhoshan, Liping Zhao, and Alessio Ferrari. 2025. Large Language Model (LLMs) for Requirements Engineering (RE): A Systematic Literature Review. Preprint, arXiv:2509.11446.arxiv.org/abs/2509.11446
- [34]Fengji Zhang, Bei Chen, Yue Zhang, Jacky Keung, Jin Liu, Daoguang Zan, Yi Mao, Jian-Guang Lou, and Weizhu Chen. 2023. RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generation. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 2471–2484, Singapore. Association for Computational Linguistics.arxiv.org/abs/2303.12570
- [35]Yuntong Zhang, Haifeng Ruan, Zhiyu Fan, and Abhik Roychoudhury. 2024. AutoCodeRover: Autonomous Program Improvement. In Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis, ISSTA 2024, pages 1592–1604, New York, NY, USA. Association for Computing Machinery.arxiv.org/abs/2404.05427
- [36]Wanjun Zhong, Lianghong Guo, Qiqi Gao, He Ye, and Yanlin Wang. 2024. MemoryBank: Enhancing Large Language Models with Long-Term Memory. In Proceedings of the AAAI conference on artificial intelligence, volume 38, pages 19724–19731.arxiv.org/abs/2305.10250
- [37]Mingchen Zhuge, Wenyi Wang, Louis Kirsch, Francisco Faccio, Dmitrii Khizbullin, and Jürgen Schmidhuber. 2024. GPTSwarm: Language agents as optimizable graphs. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 62743–62767. PMLR.arxiv.org/abs/2402.16823





