TECHNOLOGY

Metaflow foreach results: keep candidate identity separate from task completion timing

In this article
THE QUICK TAKE

Branch position describes a particular expansion; carry an explicit candidate identity so results remain meaningful across scheduling and input changes.

Similar outputs hide a mismatched candidate

A foreach evaluates several model artifacts and returns equally shaped metric dictionaries. A later report attaches display names from a newly sorted candidate list. Every row looks valid, but a score can now be attributed to the wrong model. The problem is lost identity rather than failed computation.

Make each branch output self-describing. Carry the candidate artifact reference and the intended evaluation population with the score. An array position can help reconstruct an individual run, but it should not become the sole identity across changed candidate lists.

Use branch context intentionally

The FlowSpec reference exposes input, index and foreach_stack to describe the current branch. Nested loops have multiple levels of context, which matters when a model loop contains a dataset loop. Flattening those results without preserving both identities creates ambiguous rows.

For this experiment, record model identity and dataset identity explicitly rather than relying on a task identifier to explain their meaning. Keep task identity as execution evidence alongside that semantic pair.

Joining is a data association operation

The flow basics explain foreach tasks and iteration over incoming join inputs. Build the final table from the identities carried by those results. Do not associate rows with labels inferred from observed completion messages or from a separately reconstructed list.

Check uniqueness of the intended model-and-dataset key before ranking. Distributed shard overlap shows the same underlying issue: duplicate or missing logical members can survive plausible aggregate counts.

Concurrency is not a semantic ordering rule

The parallelism guide distinguishes expansion limits from limits on simultaneous tasks. These settings control execution, while model identity should remain independent of how many tasks are active or which finishes quickly.

A slow model is not a different candidate because it completed later. If a retry or larger input changes timing, the report’s associations should still be anchored to explicit artifact references. Scheduling observations are useful diagnostic metadata, not labels for scientific results.

Review alignment before comparing quality

Create deliberately recognizable candidate inputs and inspect the join table after execution. Confirm that names, artifact references and scores remain associated when the input list is reordered or branch durations differ.

For reproducible candidate generation, preserve random-state replay separately. Stable branch identities do not make stochastic training deterministic, but they let a reviewer identify which actual model produced each observed result.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles