Skip to content

MOAR Optimizer

The MOAR (Multi-Objective Agentic Rewrites) optimizer explores different ways to optimize your pipeline, finding solutions that balance accuracy and cost.

What is MOAR?

When optimizing pipelines, you trade off cost and accuracy. MOAR explores many different pipeline configurations (like changing models, adding validation steps, combining operations, etc.) and evaluates each one to find the best trade-offs. It returns a frontier of plans that balance cost and accuracy, giving you multiple optimized options to choose from based on your budget and accuracy requirements.

Quick Navigation

When to Use MOAR

Good for

  • Finding cost-accuracy trade-offs across different models
  • When you want multiple optimization options to choose from
  • Custom evaluation metrics specific to your use case
  • Exploring different pipeline configurations automatically

Basic Workflow

  1. Create your pipeline — Define your DocETL pipeline in Python or YAML
  2. Write an evaluation function — Create a Python function to measure accuracy
  3. Run optimization — Call frame.optimize() with your eval function:

    optimized = frame.optimize(eval_fn=evaluate, metric_key="score")
    

    Or via CLI: docetl build pipeline.yaml

  4. Review results — Run the optimized pipeline, or browse the cost-accuracy frontier:

    rows = optimized.collect()           # Execute the optimized pipeline
    
    results = optimized.search_results
    best = results.best()              # Highest accuracy
    cheap = results.cheapest()         # Lowest cost
    print(results.to_df())             # All explored plans
    

Ready to get started? Head to the Getting Started guide.