Add rich diagnostics to close the trainee feedback loop#416
Open
blueberryvertigo wants to merge 1 commit intokarpathy:masterfrom
Open
Add rich diagnostics to close the trainee feedback loop#416blueberryvertigo wants to merge 1 commit intokarpathy:masterfrom
blueberryvertigo wants to merge 1 commit intokarpathy:masterfrom
Conversation
The agent was flying blind -- deciding keep/revert based on a single val_bpb scalar. Now train.py writes diagnostics.log after each run with training loss curve, per-position loss buckets, per-head attention patterns (entropy, mean distance, peakiness), and 5 unconditional text samples. program.md updated to instruct the agent to read diagnostics every run with an interpretation guide mapping patterns to architectural hypotheses. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_diag_storeflag, reconstructs attention matrices for a single example, reports per-head entropy, mean attention distance, and peak weight per layerAll diagnostics written to
diagnostics.logafter each run. The existingrun.loggrep workflow is unchanged.program.mdupdated with instructions to read diagnostics every run and an interpretation guide mapping diagnostic patterns (plateaued early, high position loss at late positions, dead attention heads, repetitive samples, etc.) to concrete architectural hypotheses.Motivation
The agent was deciding keep/revert based on a single scalar (val_bpb). It never saw what the model generates, where in the sequence it struggles, whether attention heads are dead or redundant, or whether training was still improving at cutoff. This closes that feedback loop.
Test plan
uv run train.pyand verifydiagnostics.logis produced with all 5 sections_diag_storeis a no-op during training)grepworkflow onrun.logstill worksMade with Cursor