How do I optimize a multi-step LLM pipeline for both accuracy and cost, not just one prompt at a time?

Use MOAR, our optimizer for DocETL: it searches over whole-pipeline rewrites with over 30 rewrite rules and a multi-armed bandit, because operators interact and tuning each alone can give a worse plan. Across six workloads, MOAR reached 27% higher accuracy than the next-best optimizer, and matched that optimizer's best accuracy at 55% of its cost.

Sources: Multi-Objective Agentic Rewrites for Unstructured Data Processing (VLDB 2026)

Guide: How to Process Documents with LLMs Cheaply

More questions on this topic

All questions about using AI for data and knowledge work