DataLoader: make per-epoch reshuffle the framework default (design Part C item 1)

Open
#447 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
c, python, pytorch

Research direction

Start with initDataLoader and the trainers and PyTorch twins named in the issue, then inspect compare_memory.py, examples/_shared/DETERMINISM.md, and the HAR README caveat. Trace the existing reshuffle configuration and parity checks before updating all listed examples. Done means defaults, logs, compatibility checks, regenerated references, documentation, and parity tolerances are consistent across the C and PyTorch paths.

Written by the indexing model from the issue text.

Description

enhancement

Design follow-up from the batch-size scheduler port (#445, design spec Part C item 1). Leo: "we need to make it the default at some point in time."

Today: initDataLoader defaults reshufflePerEpoch = false (#381 opt-in). Since #445 only the HAR float32 trainer opts in by default (RESHUFFLE=1); train_c_sym.c, train_c_adamw.c, the finetune/continual trainers and the other five examples stay shuffle-once, and only the HAR PyTorch twin mirrors the reshuffle.

Consequence right now: the packed-SYM memory study compares a reshuffling float reference against shuffle-once SYM/AdamW arms (compare_memory.py's "keeps up with FLOAT32" gate, ACC_TOL = 0.01), and a stored float reference re-run with defaults no longer reproduces — see the caveat in examples/har_classifier/README.md. compare_memory._BUDGET_DEFAULTS has no reshuffle key, so the config-compatibility check cannot flag the asymmetry.

Work:

  1. Flip the default in initDataLoader (reshufflePerEpoch = true when shuffle is set); keep dataLoaderSetReshufflePerEpoch as the opt-out.
  2. Add the RESHUFFLE env knob (default 1) to the remaining HAR trainers and the other examples; record reshuffle in every run log.
  3. Make all six PyTorch twins continue the xorshift state per epoch (shuffle_indices_with_state / reshuffle_indices from #445). Note examples/_shared/DETERMINISM.md: the mirror is bit-exact only when nothing else draws from the C global RNG between the shuffles — examples with Dropout or seeded-SR write-back rounding cannot be bit-exact, so their parity tolerances must be re-validated (≥ 10 seeds).
  4. Add "reshuffle": 1 to compare_memory._BUDGET_DEFAULTS and treat a mismatch as code drift; regenerate the memory-study float reference.
  5. Update DETERMINISM.md and the README caveat.

Refs: #381 (opt-in reshuffle), #445 (float trainer default + twin mirror).

Dominant language
C
Stars
2
Forks
3
Avg merge
13h 6m
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from es-ude/OnDeviceTraining

All issues in es-ude/OnDeviceTraining

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.