Foundation-model data preparation often expands one input into a variable number of records and still needs to preserve lineage, order, completion, and failure semantics. RayOrch is a programming model and distributed execution engine for these lineage-controlled, multi-grain dataflows. It combines compile-time validation with runtime tracking of parent-child relationships, ordered result assembly, and parent-scoped failures, and provides Ray-based execution for large-scale document and video processing. On H20 GPUs, RayOrch achieves up to 15.14x speedup for MinerU workloads from 4 to 64 GPUs and 7.82x for video workloads from 8 to 64 GPUs, reducing end-to-end time compared with Ray Data, Daft, and Docling.