LLM pipelines have two competing objectives: accuracy (is the output right?) and cost (how much do the model calls cost?). DocETL has two optimizers for improving them:
A third mechanism needs no setup at all: plan rewrites reorder your pipeline at the start of every run when DocETL can prove the output is unchanged — for example, running a filter before an expensive map so the map only processes rows the filter keeps. On by default.
Recommendation: use MOAR when you can write an evaluation function and can wait — it runs the pipeline many times on data samples, so a search takes tens of minutes. Use a cascade when one expensive filter, resolve, or equijoin dominates your cost; it adds no extra runs. You can use both in the same pipeline. We plan to merge the two into one optimizer.
MOAR's rewrites include decomposing operations (for example, splitting a map over long documents into split → map-per-chunk → reduce), adding gleaning or resolve steps, and changing models. The MOAR Optimizer Guide covers how the search works, writing evaluation functions, and reading the results.
V1 Optimizer Deprecated
The V1 optimizer is deprecated; use MOAR. Existing V1-optimized pipelines continue to work (via method="v1" on the deprecated docetl.api.Pipeline class), but new optimizations should use MOAR.