﻿# Seeded sampling after input reordering: verify the selected records, not just the seed

Seeded sampling after input reordering: verify the selected records, not just the seed. A practical data-quality guide with failure mechanisms, validation steps, acceptance evidence and primary references.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/dq-seeded-sampling-input-order-reproducibility/
Language: en

A dataset release repeats the same random seed after compaction changes row order. The sampling code runs unchanged but selects different records, invalidating a claimed matched comparison.

## The mechanism that changes the example

A seed controls a random sequence, not the identity of the population encountered by that sequence. Input ordering, sharding and stable record keys are also part of reproducible selection.



## Define the comparison boundary

Identify the selection unit before discussing reproducibility. Sampling rows, documents or entity groups from the same files produces different populations even if each implementation accepts the same integer seed.

Repeat the operation after shuffling rows and changing file enumeration order while keeping logical records unchanged. If exact matched examples are required, compare stable selected identities and persist that set. A hash-based selection rule can avoid encounter-order dependence only when its key encoding, salt and threshold are fixed and appropriate to the task.

Keep the population manifest alongside the selected manifest. Reusing a selection rule after adding or removing entities does not make the resulting study the same experiment. Report whether continuity means identical records, identical inclusion rules or comparable cohort proportions; those are different claims and require different evidence.

## A constructed test case

Reorder an otherwise identical source table and run the same seeded sampling procedure. Compare selected stable keys. A matched experiment needs identical chosen examples or an explicit declaration that only the sampling distribution was intended to match.

## A reproducible validation procedure

Run the sampler on equivalent reordered inputs. Compare selected stable keys and cohort composition. For comparisons requiring identical examples, persist the selected-key manifest or use a documented order-independent selection method.

Include an unchanged control and a deliberately invalid case. Verify that the checker distinguishes them before testing the complete release.

Exercise the actual preparation path, including later serialization and reload. Limit retained diagnostic content to the evidence required for this comparison.

## Evidence needed for acceptance

Keep the sampling algorithm, seed, population identity and exact selected-key set together.

## Containment and recovery

Stable selection does not guarantee representativeness after the underlying population changes.

Quarantine an invalid release candidate or use an explicit partial-release rule. Preserve the last approved artifact and record corrections without silently rewriting historical inputs.

## Interpretation and references

Implementation references: [Arrow dataset reading and writing](https://arrow.apache.org/docs/python/dataset.html); [Hugging Face Datasets cache identity](https://huggingface.co/docs/datasets/about_cache).

This is a proposed engineering validation, not an executed Retrivium benchmark. Documentation specifies interfaces; dataset acceptance needs its own evidence and must be repeated after relevant dependency changes.

## Related reading

Continue with [GroupKFold versus StratifiedGroupKFold: group isolation and class balance](/journal/data-guide-entity-group-split-design/); [Hugging Face Datasets: choose materialized or iterable processing](/journal/data-guide-hf-datasets-arrow-transformations/). These guides supply adjacent context; the decision in this article remains the specific example-preservation check above.
