ML Experimentation Under Autonomy: Inside Meta’s Ranking Engineer Agent
Meta’s advertising stack depends on continuous iteration over large-scale machine learning models serving Facebook, Instagram, Messenger, and WhatsApp. Traditionally, each improvement cycle—forming a hypothesis, designing an experiment, launching training, debugging failures, and analyzing results—has been a manual, sequential process spanning days or weeks. As these models mature, meaningful gains grow harder to find, making the experimentation loop itself a bottleneck.
To address this, Meta built the Ranking Engineer Agent (REA), an autonomous AI agent that drives end-to-end ML experimentation for ads ranking models. In its first production validation across six models, REA-driven iterations doubled average model accuracy over baseline approaches. The productivity shift was equally stark: work that historically required two engineers per model now takes three engineers across eight models, with early adopters increasing their improvement proposals from one to five in the same time frame.
Beyond Session-Bound Assistants
Most AI tools in ML workflows behave as reactive assistants: they draft hypotheses, write config files, or interpret logs on request, but they cannot run an experiment end to end. A human must decide each next step, re-establish context, and shepherd long-running jobs through inevitable failures.
REA is designed for three challenges that block this kind of autonomy:
- Long-horizon, asynchronous autonomy: Training jobs run for hours or days. REA maintains persistent state and memory across multiround workflows spanning days or weeks, without continuous human supervision.
- Diverse, high-quality hypothesis generation: Experiment quality hinges on the hypothesis behind it. REA synthesizes outcomes from historical experiments and frontier ML research to surface configurations unlikely to emerge from a single approach, improving with each iteration.
- Resilient operation under real-world constraints: Infrastructure failures, unexpected errors, and compute budgets cannot halt the agent. REA adapts within predefined guardrails, deferring routine failures rather than escalating them to humans.
A Hibernate-and-Wake Workflow
ML experimentation is a multistage process, not a single task. REA reasons, plans, adapts, and persists across that entire horizon. When the agent launches a training job, it delegates the wait to a background system, shuts down to conserve resources, and automatically resumes where it left off when the job completes. This hibernate-and-wake mechanism enables continuous operation across extended time frames without constant human monitoring.
Meta built REA on its internal Confucius agent framework, designed for complex, multistep reasoning. Confucius provides strong code generation and a flexible SDK for Meta’s internal tooling, including job schedulers, experiment tracking, and codebase navigation.
Hypothesis quality is supported by two systems: a curated historical insights database of past experiments for in-context learning, and an ML research agent that investigates baseline configurations and proposes novel strategies using that same database. Synthesizing both sources yields configurations no single approach would surface; the most impactful improvements to date combined architectural optimizations with training-efficiency techniques.
Three-Phase Plans Within Compute Limits
Before execution, REA proposes a detailed exploration strategy, estimates total GPU compute cost, and confirms the approach with an engineer. A typical multiphase plan proceeds through three stages:
- Validation: Individual hypotheses from different sources are tested in parallel to establish quality baselines.
- Combination: Promising hypotheses are combined to search for synergistic improvements.
- Exploitation: The most promising candidates are explored aggressively within the approved compute budget.
When failures occur—infrastructure issues, unexpected errors, suboptimal results—REA adjusts within guardrails rather than waiting for intervention. It consults a runbook of common failure patterns, applies prioritization logic (excluding jobs with out-of-memory errors or training instability signals like loss explosions), and debugs preliminary infrastructure failures from first principles. Engineers provide periodic oversight, not continuous monitoring.
Safeguards are explicit: REA works only on Meta’s ads ranking model codebase, engineers grant access through preflight checklist reviews, and compute budgets are confirmed up front, with runs halted or paused when thresholds are reached.
Architecture: Planner, Executor, and a Shared Memory

REA comprises two interconnected components—REA Planner and REA Executor—supported by a shared Skill, Knowledge and Tool System providing ML capabilities, historical experiment data, and infrastructure integrations.
Long-horizon autonomy follows the execution flow: an engineer collaborates with the hypothesis generator to build a plan in REA Planner, which exports to REA Executor. The executor runs asynchronous jobs through an agent loop and wait state, entering a wait state during training and resuming with results upon completion.
High-quality hypothesis generation relies on the knowledge flow: as experiments complete, a dedicated logger records outcomes, key metrics, and configurations into a centralized insight database. This persistent memory compounds intelligence over time—the hypothesis generator draws on accumulated successes and failures to propose increasingly sophisticated ideas for each round.
Resilient execution spans both flows: when the executor hits failures, it consults the failure-pattern runbook, applies prioritization logic, and resumes the planner with actionable results—surfacing only strategic decisions to engineers.
Redefining the ML Engineering Role
REA shifts ML development from hands-on experiment execution toward strategic oversight, hypothesis direction, and architectural decision-making. Complex improvements that previously demanded multiple engineers over weeks can now be completed by smaller teams in days. The agent handles iterative mechanics; humans retain final approvals and strategic control.
Privacy, security, and governance remain priorities as Meta continues to refine REA, with ongoing work on specialized fine-tuned models for hypothesis generation, expanded analysis tools, and extension of the approach to new domains.



