Skip to content

Read validation shard payloads for variance analysis - #2177

Open
sylvesterkaczmarek wants to merge 1 commit into
openai:mainfrom
sylvesterkaczmarek:fix/read-validation-shards-for-variance-analysis
Open

sylvesterkaczmarek wants to merge 1 commit into
openai:mainfrom
sylvesterkaczmarek:fix/read-validation-shards-for-variance-analysis

Conversation

@sylvesterkaczmarek

@sylvesterkaczmarek sylvesterkaczmarek commented Oct 6, 2026 •

Copy link
Copy Markdown

Problem

The variance-analysis command reads a training shard as raw uint16 values, including its 1024-byte header. This adds 512 metadata-derived token IDs to the sample, displaces validation tokens, and hides out-of-vocabulary values by clipping them. The statistics therefore describe altered input.

Change

Reuse the existing baseline shard reader, then take the same 8192-token prefix. Reject out-of-vocabulary IDs in that prefix instead of rewriting them. Preserve model loading, hooks, variance calculation, command-line arguments, and output structure. No training-script or archived-submission changes.

Validation

  • 14 tests passed. Thirteen fail on unchanged source; the missing-file control passes before and after.
  • Tests exercise main with real synthetic shard and checkpoint files. They cover header exclusion, prefix boundaries, malformed headers, inconsistent lengths, and invalid IDs.
  • An integration case uses a tiny synthetic PyTorch module with real forward hooks, comparing the resulting statistics with an independent NumPy calculation.
  • Syntax/error checks and git diff --check pass.
  • Run python -m pytest tests/test_variance_shard_input.py with the baseline dependencies and pytest installed.

Python 3.12.14, PyTorch 2.14.1, and NumPy 2.5.3 on macOS arm64 CPU. No pretrained weights, external datasets, full training, or GPU evaluation was used. This establishes input fidelity without claiming changes to published results. No dependency changes.

Reproduced against f5c079314c4877fbb0af378c0abade5a8ca33d3a.

Maintenance validation on 6 November 2026

Revalidated synthetic shard payloads, malformed headers, vocabulary bounds and the small forward-hook integration case. No further source changes were needed.

Focused validation at 71dd3580e9eb: 14 CPU tests passed. The combined six-PR checkout passed 121 tests, including the actual PyTorch and MLX CPU implementations. The two baseline scripts remain below 1,500 lines; archived record scripts were not modified.

Python 3.12.14, PyTorch 2.15.0 and SentencePiece 0.2.3 on macOS arm64. Tests used synthetic inputs with external sockets disabled. No pretrained checkpoint, external dataset, GPU training, full validation benchmark or leaderboard measurement was used. There are no hosted test runs on these PR heads. Earlier validation counts above are historical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant