Multi-Stage Pipelines
Real production workflows are sequences of stages where each stage is an independent save() that produces a versioned dataset. The next stage reads from the previous one with read_dataset(). Each stage is independently checkpointed, versionable, and resumable.
Stage Boundaries
A save() followed by read_dataset() creates a stage boundary:
If Stage 2 fails at 80% completion, checkpoints preserve completed rows. Fix the bug, re-run, and DataChain resumes from where it left off. Stage 1 is skipped entirely because its chain hash matches.
Comparative Evaluation
Run two models on the same dataset, then merge the results:
Each model run is a versioned dataset with full provenance. The comparison dataset tracks which inputs and model versions produced which results.
Cost Tracking
Each stage's LLM cost is visible through aggregate analytics on nested token fields, with no deserialization and no Python runtime:
Why Stages Matter
Single queries work for simple workflows. Multi-stage pipelines build production systems where each step can be independently monitored, rerun, and compared across versions. The pattern: save() to checkpoint, read_dataset() to continue. Each stage deposits a versioned conclusion that the next stage builds on.