TECHNOLOGY

Prodigy custom streams: a lazy iterator still needs a reproducible source boundary

In this article
THE QUICK TAKE

A lazy stream controls materialization, while source identity, ordering and exclusion determine whether a restarted run repeats the intended work.

Separate streaming from reproducibility

A generator can keep an annotation process from loading a large source into memory all at once. It does not automatically make that source stable. The Prodigy loader guide describes iterable task streams and line-oriented input. For a repeatable annotation run, also identify the source revision, selection rule and order that produced the tasks. Otherwise a restart can read a different population while still using the same recipe and destination dataset.

Keep the task producer inspectable

The custom recipe documentation permits a recipe to return an iterable stream together with interface and storage components. Separate fetching source records from constructing annotation questions. A text record can be valid at the source but become an invalid task if required interface fields are missing. Test the producer on examples with absent optional fields, unusual characters and empty content before connecting it to a long-running annotation session.

Account for ordering and remote pagination

When a generator reads a changing API, new records or modified sort keys can shift page boundaries. A fixed query string is not necessarily a fixed source snapshot. Prefer a documented stable revision or record a selected set of source identities. If the source cannot supply snapshot semantics, state that limitation and preserve the retrieved task stream as a separate artifact when reproducibility is required. This is a property of the source, not something the Python iterator can repair.

Plan a restart around persisted work

The database API distinguishes stored datasets and session records and provides retrieval methods for examples. Decide which persisted annotation history the restarted recipe will exclude. An iterator position in process memory disappears when that process exits; it is different from a source checkpoint and from submitted feedback in storage. Rehearse interruption after a partial session, then inspect which source records and questions reappear.

Preserve what explains the collected data

Keep the recipe configuration, source boundary and selection history with the exported annotations. The guides on WebDataset sample identity and active-learning selection history illustrate related pitfalls. A memory-efficient loader is valuable, but the research result depends on knowing which questions reached reviewers and which answers were actually retained. Treat those observations as distinct from how many records the source offered to the generator.

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