-
Notifications
You must be signed in to change notification settings - Fork 535
Fail closed on Puzzletron correctness failures #2114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
j-rausch
wants to merge
6
commits into
feature/puzzletron_v2
Choose a base branch
from
ptv2-sanity-correctness
base: feature/puzzletron_v2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+921
−257
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e6dfc02
Fail closed on Puzzletron sanity failures
j-rausch dab1cbd
Clarify Puzzletron sanity qualification
j-rausch 7ca3cd2
Move Puzzletron sanity details into guide
j-rausch 5ebbf95
Fix Puzzletron sanity review findings
j-rausch 39ed844
Keep sort sanity finalization distributed
j-rausch cc70a2a
Propagate sort summary write failures
j-rausch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| # Sorting, width ranking, and slicing sanity | ||
|
|
||
| Puzzletron uses separate sanity checks to answer two different questions: | ||
|
|
||
| 1. Did sorting and slicing preserve the intended model operation? | ||
| 2. Did the importance ranking produce a better reduced candidate than its | ||
| controls? | ||
|
|
||
| The first question is about implementation correctness. The second is about | ||
| ranking quality. Keeping them separate helps diagnose a failed campaign and | ||
| lets an acceptance plan decide how strict ranking quality must be. | ||
|
|
||
| ## Sorting and slicing mental model | ||
|
|
||
| Width pruning makes selected model dimensions smaller, such as hidden channels, | ||
| attention heads, expert widths, or state-space dimensions. Puzzletron first | ||
| scores the relative importance of the units in each supported dimension. It | ||
| then permutes every coupled tensor into the same importance order so that a | ||
| prefix of the sorted dimension represents a reduced-width candidate. At full | ||
| width, sorting is only a permutation and must not change model behavior. | ||
|
|
||
| A **dynamic slice** runs a reduced candidate from the resident full-size sorted | ||
| teacher. Runtime hooks or views select only the requested prefix without first | ||
| writing a smaller checkpoint. A **physical slice**, also called physical | ||
| materialization, actually removes the excluded tensor rows, columns, heads, or | ||
| groups and updates the model config. The physical model is the exportable | ||
| ground truth for the dynamic path. | ||
|
|
||
| For example, reducing hidden width from 4096 to 3072 does not mean truncating | ||
| one weight matrix. Puzzletron must select the same 3072 channel identities | ||
| across every coupled embedding, residual, normalization, and projection | ||
| dimension. Sorting first moves the chosen identities into a common prefix; | ||
| slicing then applies that prefix consistently throughout the model. | ||
|
|
||
| ## Compared views | ||
|
|
||
| The width sanity stages compare four views of one target width: | ||
|
|
||
| | View | Meaning | | ||
| |---|---| | ||
| | Activation-sorted | Keep the prefix that the importance scores rank highest. This is the candidate whose ranking quality is being tested. | | ||
| | Original-order | Keep the same-sized prefix in the teacher's original order. Some artifacts retain the legacy method key `random`, but this control is deterministic and is not a seeded-random permutation. | | ||
| | Reverse-sorted | Keep the prefix ranked least important. This is a negative control for the importance ordering. | | ||
| | Physical | Rewrite the config and tensors as a smaller standalone model using the same target geometry as the activation-sorted candidate. | | ||
|
|
||
| ## Measured values | ||
|
|
||
| Each comparison uses the same axis, layer, target width, model revision, and | ||
| input samples. Depending on the diagnostic configuration, the measured values | ||
| can include: | ||
|
|
||
| - replacement loss or language-model loss; | ||
| - hidden-state cosine distance, mean squared error, or mean absolute error; | ||
| - output-distribution KL divergence; and | ||
| - token top-k accuracy or consistency. | ||
|
|
||
| Loss, distance, error, and divergence metrics are lower-is-better. Accuracy and | ||
| consistency metrics are higher-is-better. The artifact records the metric, | ||
| direction, compared methods, observed degradation or difference, and allowed | ||
| tolerance so a finding can be traced to measured evidence. | ||
|
|
||
| ## Width-ranking misses | ||
|
|
||
| For the same axis, layer, target width, samples, and metric, width sanity asks | ||
| whether the activation-sorted candidate is at least as good as the original | ||
| and reverse controls within the configured comparison tolerance. A ranking | ||
| miss occurs when the activation-sorted value is worse than a control by more | ||
| than that tolerance. | ||
|
|
||
| For example, if lower loss is better and the activation-sorted loss is `2.10` | ||
| while the original control is `2.00` with tolerance `0.01`, the degradation is | ||
| `0.10` and the check reports a ranking miss. This means the importance ordering | ||
| did not demonstrate the expected quality benefit for that case. It does not by | ||
| itself prove that sorting or slicing produced an invalid model. | ||
|
|
||
| ## Equivalence failures | ||
|
|
||
| Equivalence checks compare two routes that are intended to represent the same | ||
| model operation: | ||
|
|
||
| - Sort sanity compares the full-width teacher with full-width sorted and | ||
| reverse-sorted teachers. These permutations must preserve behavior within | ||
| descriptor-owned tolerances. | ||
| - Slicing sanity compares a dynamic slice with a physically materialized model | ||
| for the same axis, layers, target value, batch, and model revision. It checks | ||
| loss, output shape, and output tensor differences using explicit absolute and | ||
| relative tolerances. | ||
|
|
||
| An equivalence failure means those supposedly identical routes disagree beyond | ||
| their declared tolerance. Downstream measurements from the dynamic candidate | ||
| can no longer be assumed to describe the exportable physical checkpoint, so | ||
| the corresponding sanity stage fails unconditionally. | ||
|
|
||
| ## Stage completion and qualification | ||
|
|
||
| Puzzletron currently records correctness failures and ranking-quality findings | ||
| through the same sanity-stage result, but they have different default effects: | ||
|
|
||
| | Result | Current stage behavior | | ||
| |---|---| | ||
| | Sort or slicing equivalence failure | Always fails the stage and is reported as a correctness error. | | ||
| | Width-ranking miss | Records a quality warning. By default the stage may complete successfully with `passed: false`. | | ||
| | Width-ranking miss with strict warning policy | Fails the stage when `sanity.fail_on_warnings` is enabled. | | ||
|
|
||
| Enable strict warning handling with: | ||
|
|
||
| ```yaml | ||
| sanity: | ||
| fail_on_warnings: true | ||
| ``` | ||
|
|
||
| This setting changes stage-completion policy; it does not reclassify a ranking | ||
| miss as an implementation-correctness error. | ||
|
|
||
| Campaign or release qualification is a separate policy decision. The current | ||
| code does not emit a distinct `qualification_blocked` state. Before treating a | ||
| campaign as accepted, define which ranking controls must pass, the metrics and | ||
| directions, sample counts, tolerances, covered axes and target widths, and the | ||
| aggregation rule. A stage-level quality warning may therefore remain | ||
| non-correctness evidence while still blocking scientific or release | ||
| acceptance. | ||
|
|
||
| For the broader pipeline design, see the | ||
| [semantic validation gates](v2_architecture.md#semantic-validation-gates). | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.