The neural notebook
← All chapters

IV-55 / Part XIV · Fine-Tuning and Alignment

Pretraining, Fine-Tuning and Transfer

Derive two real pretraining updates and a two-output adaptation step, compare prepared and fresh starts, and separate held-out transfer from a dictionary's perfect training fit.

Review the ideas this chapter uses

Suppose we have already adjusted a small model to produce one pair of numbers, and now we want a different pair. Should we keep its adjusted weights or start again from zero? We can answer for one small, completely specified example by calculating both paths. We will also construct a lookup table that gets every training answer right while failing to improve any held-out answer.

Learning objective: Compare which model parameters, data and objectives change in adaptation.

Pretraining means updating parameters on an earlier task before adaptation. Fine-tuning means making further parameter updates for the new task. Transfer is the effect of carrying the earlier parameters into that new task. A prepared start can help, hurt or make no difference; the word “pretrained” alone does not settle the comparison.

In IV-52 — Language-Model Training Steps and Batches, a tiny language model supplied fixed features to a trainable text-class readout. Its objective was next-token cross-entropy, a penalty based on the known next token’s probability. Here we deliberately use regression, predicting two numerical values. Our two fixed ReLU features and four adjustable readout weights make every update manageable by hand. There are no tokens, probabilities, softmax or language-model training in this example. We do not learn the hidden features or differentiate a whole neural network.

For matrix shapes, review II.9 — Matrix × vector and II.10 — Matrix × matrix as composition. For why training and held-out examples have different jobs, review III-04 — Training, Validation, Testing and Generalization. III-07 — Linear Regression and III-09 — Gradient Descent for Linear Regression connect squared-error regression to gradient descent. The prerequisite IV-52 — Language-Model Training Steps and Batches supplies the earlier distinction between a diagnostic gradient and an actual parameter replacement.

Compute it yourself

Pretraining, Fine-Tuning and Transfer

Learn one simple numeric task, then ask the same small network to do a related task. Compare adapting weights that the lab actually prepared with learning the new task from zero. A lookup table provides a third comparison: perfect training fit can coexist with unadapted held-out predictions.

Change PRE updates, ADAPT updates, ADAPT scope or ADAPT η. PRE always starts at zero and uses η=0.5. The tables read the saved computation, including all final evaluations; inspection selectors only choose which saved details to show.

fineTunedValidationLoss0.08418624420301057
freshValidationLoss0.13904571533203125
memorizerValidationLoss0.11825338006019592
trainableAdaptParameters4
Exact starting inputs for this saved calculation

fineTunedValidationLoss 0.08418624420301057. freshValidationLoss 0.13904571533203125. memorizerValidationLoss 0.11825338006019592. trainableAdaptParameters 4. Set up a small transfer experiment with two output numbers. Pretraining first learns one numeric target rule. Fine-tuning then changes the desired outputs and updates either all readout entries or just the diagonal. A fresh run supplies a comparison with the same adaptation data and optimizer. These are fixed features with a learned readout, not language-model token probabilities.

Set up a small transfer experiment with two output numbers

W:[2,2]; phi:[2,1]; prediction=W phi:[2,1]; PRE eta=0.5; ADAPT eta=eta; scope0:4 enabled, scope1:2 enabled

Pretraining first learns one numeric target rule. Fine-tuning then changes the desired outputs and updates either all readout entries or just the diagonal. A fresh run supplies a comparison with the same adaptation data and optimizer. These are fixed features with a learned readout, not language-model token probabilities.

Saved inputs

preUpdates
2
updates
1
scope
0
eta
0.5

Saved outputs

storedParameters
4
trainableAdaptParameters
4
fixedFeatures
2
outputsPerSample
2
trainSamples
4
validationSamples
4
preEta
0.5

First learn PRE; then compare the same ADAPT objective

Whole current case: preUpdates=2, updates=1, scope=0, η=0.5. PRE always uses η=0.5 and all four weights. There are 4 stored weights and 4 enabled ADAPT weights. Every raw edit starts the complete experiment again from zero.

A parameter is a stored number that learning can change. A readout multiplies fixed features by those parameters to predict outputs. PRE (pretraining) first learns to copy two features. ADAPT (adaptation or fine-tuning) asks for a new target pair; the prepared cohort (comparison group) starts with the actual final PRE weights, while fresh starts at zero. Their data, loss rule, update count, scope and ADAPT η agree.

PRE objective only: every saved stage and weight
Cohort / stage / next actionW00W01W10W11Train meanHeld-out mean
pre 0 / then update00000.31250.15625
pre 1 / then update0.15625000.156250.222473144531250.111236572265625
pre 2 / final diagnostic only0.2880859375000.28808593750.158381760120391850.07919088006019592

PRE targets are [φPlus,φMinus]. Its loss measures feature copying. A smaller PRE loss and a larger ADAPT loss can describe the same W because the targets differ. The next table changes targets to [φPlus+φMinus/2,−φPlus/2+φMinus] for both cohorts.

ADAPT objective: every saved prepared and fresh stage and weight
Cohort / stage / next actionW00W01W10W11Train meanHeld-out mean
adapt 0 / then update0.2880859375000.28808593750.236506760120391850.11825338006019592
adapt 1 / final diagnostic only0.3993225097656250.078125-0.0781250.3993225097656250.168372488406021150.08418624420301057
fresh 0 / then update00000.3906250.1953125
fresh 1 / final diagnostic only0.156250.078125-0.0781250.156250.27809143066406250.13904571533203125
Whole current root: final ADAPT comparison
MethodADAPT training meanADAPT held-out meanInitialization / prediction rule
Prepared adaptation0.168372488406021150.08418624420301057Copy actual final PRE W, then 1 ADAPT steps
Fresh adaptation0.27809143066406250.13904571533203125Positive-zero W, then 1 ADAPT steps
Constructed memorizer00.11825338006019592Copy training labels on hits; saved unadapted PRE predictions on misses

P=2: the prepared start copies genuinely evaluated PRE weights. U=1: each ADAPT cohort performs this many requested transitions. A positive η can be too small to change a stored weight after rounding. Counts alone do not imply strict improvement.

Inspecting Adaptation from actual pretraining, stage 0, sample train0, coordinate W00. These selectors only read the saved root; they preserve the raw controls, trace cursor and graded answers.

Selected trace: setup. Matching operations below are marked current; the trace cursor and local inspection are independent.

adapt stage 0: inputs, both outputs and losses

φ (phi) names a feature column: φPlus=max(0,x), φMinus=max(0,−x). ReLU means keeping a positive part and replacing a negative part by zero. W is a 2×2 matrix: rows select output 0 or 1, columns select φPlus or φMinus. Here W=[0.2880859375, 0, 0, 0.2880859375] in row-major order 00,01,10,11. W:[2,2] times φ:[2,1] gives prediction:[2,1], with four products and two sums, no bias or softmax.

adapt stage 0: all eight samples, targets, predictions and losses
Sample / rolexφPlusφMinusPRE target 0PRE target 1ADAPT target 0ADAPT target 1Prediction 0Prediction 1Current-task sample loss
train0 / training-101010.5100.28808593750.37841081619262695
train1 / training-0.500.500.50.250.500.144042968750.09460270404815674
train2 / training0.50.500.500.5-0.250.1440429687500.09460270404815674
train3 / training110101-0.50.288085937500.37841081619262695
validation0 / held out-0.7500.7500.750.3750.7500.2160644531250.21285608410835266
validation1 / held out-0.2500.2500.250.1250.2500.0720214843750.023650676012039185
validation2 / held out0.250.2500.2500.25-0.1250.07202148437500.023650676012039185
validation3 / held out0.750.7500.7500.75-0.3750.21606445312500.21285608410835266

Current task: ADAPT transformed targets. A target is the desired numeric answer; an error is prediction minus target. Each sample loss is error0²/2 + error1²/2. Add four saved sample losses in order from +0, then divide by 4 to get each dataset mean. Sum the two output half-losses before averaging samples; do not divide the sum of sample losses by 8. Training rows alone drive gradients; held-out rows only evaluate W.

All eight forwards: every product and sum at the saved W
adapt stage 0: four products and two output sums per sample
SampleW00 × φPlusW01 × φMinusW10 × φPlusW11 × φMinusPrediction 0Prediction 1
train00000.288085937500.2880859375
train10000.1440429687500.14404296875
train20.144042968750000.144042968750
train30.28808593750000.28808593750
validation00000.21606445312500.216064453125
validation10000.07202148437500.072021484375
validation20.0720214843750000.0720214843750
validation30.2160644531250000.2160644531250
All eight two-output losses and both ordered means
adapt stage 0: targets, errors, squares, halves and sample sums
Sampletarget0target1error0error1square0square1half0half1sampleLoss
train00.51-0.5-0.71191406250.250.50682163238525390.1250.253410816192626950.37841081619262695
train10.250.5-0.25-0.355957031250.06250.126705408096313480.031250.063352704048156740.09460270404815674
train20.5-0.25-0.355957031250.250.126705408096313480.06250.063352704048156740.031250.09460270404815674
train31-0.5-0.71191406250.50.50682163238525390.250.253410816192626950.1250.37841081619262695
validation00.3750.75-0.375-0.5339355468750.1406250.28508716821670530.07031250.142543584108352660.21285608410835266
validation10.1250.25-0.125-0.1779785156250.0156250.031676352024078370.00781250.0158381760120391850.023650676012039185
validation20.25-0.125-0.1779785156250.1250.031676352024078370.0156250.0158381760120391850.00781250.023650676012039185
validation30.75-0.375-0.5339355468750.3750.28508716821670530.1406250.142543584108352660.07031250.21285608410835266

adapt_stage_0_mean_0: Average four saved sample losses in their original order

sum starts at +0; sum0=initialSum+loss0; sum1=sum0+loss1; sum2=sum1+loss2; sum3=sum2+loss3; mean=sum3/4

Dataset zero is training; dataset one is held-out validation. Both means are computed independently from their saved sample losses. Validation never contributes a gradient. This ordered average does not divide each output error by eight.

Saved inputs
dataset
0
initialSum
0
divisor
4
loss0
0.37841081619262695
loss1
0.09460270404815674
loss2
0.09460270404815674
loss3
0.37841081619262695
Saved outputs
sum0
0.37841081619262695
sum1
0.4730135202407837
sum2
0.5676162242889404
sum3
0.9460270404815674
mean
0.23650676012039185

adapt_stage_0_mean_1: Average four saved sample losses in their original order

sum starts at +0; sum0=initialSum+loss0; sum1=sum0+loss1; sum2=sum1+loss2; sum3=sum2+loss3; mean=sum3/4

Dataset zero is training; dataset one is held-out validation. Both means are computed independently from their saved sample losses. Validation never contributes a gradient. This ordered average does not divide each output error by eight.

Saved inputs
dataset
1
initialSum
0
divisor
4
loss0
0.21285608410835266
loss1
0.023650676012039185
loss2
0.023650676012039185
loss3
0.21285608410835266
Saved outputs
sum0
0.21285608410835266
sum1
0.23650676012039185
sum2
0.26015743613243103
sum3
0.4730135202407837
mean
0.11825338006019592
Selected sample: actual feature construction, forward and loss operands

data_0: Prepare the two fixed features and both target pairs

negatedX=-x; phiPlus=max(0,x); phiMinus=max(0,negatedX); preTarget0=phiPlus; preTarget1=phiMinus; scaledMinus=0.5*phiMinus; adaptTarget0=phiPlus+scaledMinus; scaledPlus=-0.5*phiPlus; adaptTarget1=scaledPlus+phiMinus

A feature is a number supplied to the readout. These ReLU features keep the positive and negative parts of the input separate. Pretraining asks for the features themselves; adaptation changes the desired two outputs. The first four authored inputs train the readout and the last four only evaluate it. Features and targets are prepared once.

Saved inputs
sample
0
training
1
x
-1
positiveZero
0
positiveHalf
0.5
negativeHalf
-0.5
Saved outputs
negatedX
1
phiPlus
0
phiMinus
1
preTarget0
0
preTarget1
1
scaledMinus
0.5
adaptTarget0
0.5
scaledPlus
-0
adaptTarget1
1

adapt_stage_0_forward_0: Read out two numbers from the same fixed feature column

product00=w00*phiPlus; product01=w01*phiMinus; product10=w10*phiPlus; product11=w11*phiMinus; prediction0=product00+product01; prediction1=product10+product11

W has two output rows and two feature columns. Multiplying W:[2,2] by phi:[2,1] gives a two-number column. All four products and both sums are performed, including zero products. Every sample in this evaluation uses these same four weights, with no bias or softmax.

Saved inputs
sample
0
x
-1
phiPlus
0
phiMinus
1
w00
0.2880859375
w01
0
w10
0
w11
0.2880859375
Saved outputs
product00
0
product01
0
product10
0
product11
0.2880859375
prediction0
0
prediction1
0.2880859375

adapt_stage_0_loss_0: Measure the two output errors for one sample

error0=prediction0-target0; error1=prediction1-target1; square0=error0*error0; square1=error1*error1; half0=square0/2; half1=square1/2; sampleLoss=half0+half1

Each output is a scalar regression value, so its signed error is a difference of numbers. Squaring makes either error direction costly. Add the two half-losses to obtain one sample loss; the later average counts four samples, not eight output coordinates.

Saved inputs
sample
0
task
1
prediction0
0
prediction1
0.2880859375
target0
0.5
target1
1
divisor
2
Saved outputs
error0
-0.5
error1
-0.7119140625
square0
0.25
square1
0.5068216323852539
half0
0.125
half1
0.25341081619262695
sampleLoss
0.37841081619262695

Why the gradient can exist for a frozen weight

A mathematical gradient G tells how the underlying real training mean changes for a small weight change. For W[o,i], o names an output and i a feature. Differentiating error²/2 gives error, then multiplying by the prediction’s derivative gives error[o]×φ[i]. Sum these contributions over four training rows and divide by 4. Features stay fixed, so this is a smooth quadratic in W even though ReLU as a function of x has a corner.

adapt stage 0: four mathematical and effective gradients
CoordinateSaved WEnabledMathematical GEffective G
W000.28808593751-0.22247314453125-0.22247314453125
W0101-0.15625-0.15625
W10010.156250.15625
W110.28808593751-0.22247314453125-0.22247314453125

Enabled=1 selects the mathematical derivative; enabled=0 selects effective +0. A disabled weight can still have a nonzero mathematical derivative. PRE always enables all four; diagonal ADAPT freezes cross weights W01/W10. Frozen means preserve the old stored value, including a nonzero value or −0; it never means force the weight to zero.

adapt stage 0: four training contributions to W00
Training rowError for selected outputSelected fixed featureError × featureOrdered running sum
train0-0.50-00
train1-0.250-00
train2-0.355957031250.5-0.177978515625-0.177978515625
train3-0.71191406251-0.7119140625-0.889892578125

Final running sum / 4 = -0.22247314453125 for W00. Four row contributions here become sixteen products across all four coordinates, even at a final diagnostic stage.

adapt update 1: four proposals from the same old W
Coordinateoldmathematicaleffectiveenableddeltaproposedcommitted
W000.2880859375-0.22247314453125-0.222473144531251-0.1112365722656250.3993225097656250.399322509765625
W010-0.15625-0.156251-0.0781250.0781250.078125
W1000.156250.1562510.078125-0.078125-0.078125
W110.2880859375-0.22247314453125-0.222473144531251-0.1112365722656250.3993225097656250.399322509765625

η (eta) is the step size: delta=η×effective, proposed=old−delta. Compute these for all four coordinates from the same old W; enabled coordinates commit their proposals and frozen coordinates commit their exact old words. Publish all four together, then evaluate the new state. This selected cohort uses η=0.5.

Selected coordinate proposal and simultaneous commit

adapt_update_1_coordinate_0: Propose one weight change from the same old state

delta=eta*effective; proposed=old-delta; committed=enabled==1?proposed:old

Subtracting a positive gradient lowers a weight; subtracting a negative one raises it. Every coordinate gets a real multiplication and subtraction, including frozen coordinates. A frozen weight keeps its exact old value and zero sign. All proposals use the unchanged old weights and saved gradients.

Saved inputs
coordinate
0
old
0.2880859375
mathematical
-0.22247314453125
effective
-0.22247314453125
enabled
1
eta
0.5
Saved outputs
delta
-0.111236572265625
proposed
0.399322509765625
committed
0.399322509765625

adapt_update_1_commit: Publish all four proposed coordinates together

nextWeights=[committed0,committed1,committed2,committed3]

This simultaneous publication completes one optimizer step. No coordinate update changes a gradient used for another coordinate. A later stage evaluates the resulting weights again; its final diagnostic gradient causes no additional step.

Saved inputs
old0
0.2880859375
old1
0
old2
0
old3
0.2880859375
Saved outputs
weight0
0.399322509765625
weight1
0.078125
weight2
-0.078125
weight3
0.399322509765625
Exact initialization, mask selection and stage boundary

adapt_initial: Copy the actual prepared readout into adaptation

weights=[sourceWeight0,sourceWeight1,sourceWeight2,sourceWeight3]; enabled=mask

These source weights are the genuinely evaluated final PRE weights. Copy every value exactly before any adaptation. The two target columns now change to ADAPT while inputs, fixed features and the squared-error loss form stay the same.

Saved inputs
cohort
1
task
1
requestedUpdates
1
eta
0.5
sourceWeight0
0.2880859375
sourceWeight1
0
sourceWeight2
0
sourceWeight3
0.2880859375
mask0
1
mask1
1
mask2
1
mask3
1
Saved outputs
weight0
0.2880859375
weight1
0
weight2
0
weight3
0.2880859375
enabled0
1
enabled1
1
enabled2
1
enabled3
1

adapt_stage_0_gradient_0: Differentiate one readout coordinate using training errors

contribution_j=error_j*feature_j; sum starts at +0 and adds contributions in training-row order; mathematical=sum3/4

A gradient says how the training mean changes when one weight changes slightly. For this linear readout, a weight changes its output in proportion to its feature, giving error times feature. Average the four training contributions. Compute every coordinate even when adaptation will freeze it; final-stage gradients are observations, not extra updates.

Saved inputs
coordinate
0
output
0
feature
0
initialSum
0
divisor
4
error0
-0.5
feature0
0
error1
-0.25
feature1
0
error2
-0.35595703125
feature2
0.5
error3
-0.7119140625
feature3
1
Saved outputs
contribution0
-0
sum0
0
contribution1
-0
sum1
0
contribution2
-0.177978515625
sum2
-0.177978515625
contribution3
-0.7119140625
sum3
-0.889892578125
mathematical
-0.22247314453125

adapt_stage_0_mask: Choose which derivatives the optimizer may use

effective_i=enabled_i==1?mathematical_i:+0

The mathematical derivative describes the loss even for a frozen weight. The effective derivative is the optimizer input: retain that derivative for an enabled weight and select positive zero otherwise. This is a conditional choice, not multiplication by a mask.

Saved inputs
positiveZero
0
mathematical0
-0.22247314453125
enabled0
1
mathematical1
-0.15625
enabled1
1
mathematical2
0.15625
enabled2
1
mathematical3
-0.22247314453125
enabled3
1
Saved outputs
effective0
-0.22247314453125
effective1
-0.15625
effective2
0.15625
effective3
-0.22247314453125

adapt_stage_0_stats: Save this evaluated state and whether an update follows

diagnosticOnly=(stage==requestedUpdates); hasNextUpdate=(stage<requestedUpdates); losses belong to this same saved W

Stage zero is evaluated before any step. Each later point follows a real simultaneous update and a fresh eight-sample evaluation. At the final requested stage, retain all four gradients for inspection but perform no additional optimizer step. Only actual evaluated points appear in the trajectory.

Saved inputs
cohort
1
task
1
stage
0
requestedUpdates
1
weight0
0.2880859375
weight1
0
weight2
0
weight3
0.2880859375
trainHalfMSE
0.23650676012039185
validationHalfMSE
0.11825338006019592
Saved outputs
trainHalfMSE
0.23650676012039185
validationHalfMSE
0.11825338006019592
diagnosticOnly
0
hasNextUpdate
1

A lookup can fit training without adapting held-out predictions

The memorizer is an explicit dictionary, not another trained network. Store each of the four training x keys with its two ADAPT targets. On a matching input, copy that label pair; on a miss, copy the same sample’s already saved final-PRE predictions. No new neural forward, gradient or SGD step is called. There are 12 extra numeric dictionary slots plus 4 already retained prepared weights; this is no measured byte or time claim.

Memorizer: four actual dictionary rows
Training key index jxADAPT target 0ADAPT target 1
0-10.51
1-0.50.250.5
20.50.5-0.25
311-0.5
Memorizer: all eight selections and physical source indices
SamplematchsourceKindsourceSamplesourceIndex0sourceIndex1source0source1prediction0prediction1
train0000120.510.51
train1101450.250.50.250.5
train2202780.5-0.250.5-0.25
train330310111-0.51-0.5
validation0-1148900.21606445312500.216064453125
validation1-115101100.07202148437500.072021484375
validation2-11612130.07202148437500.0720214843750
validation3-11714150.21606445312500.2160644531250

match=−1 means no key matched. sourceKind=0 means dictionary, whose actual [4,3] storage includes x: targets are at 3j+1 and 3j+2, not 2j and 2j+1. sourceKind=1 means the saved prepared prediction array [8,2]: sample s has positions 2s and 2s+1. sourceSample identifies j on a hit and s on a miss. source0/source1 are copied to prediction0/prediction1. The selector record includes matchedDictionary operands only on a hit; it never invents zeros for a missing pair.

All 32 key comparisons, including after a match
Memorizer: all 32 comparisons and first-match decisions
Sample / key indexxkeyXequaloldMatchmatch
train0 / 0-1-11-10
train0 / 1-1-0.5000
train0 / 2-10.5000
train0 / 3-11000
train1 / 0-0.5-10-1-1
train1 / 1-0.5-0.51-11
train1 / 2-0.50.5011
train1 / 3-0.51011
train2 / 00.5-10-1-1
train2 / 10.5-0.50-1-1
train2 / 20.50.51-12
train2 / 30.51022
train3 / 01-10-1-1
train3 / 11-0.50-1-1
train3 / 210.50-1-1
train3 / 3111-13
validation0 / 0-0.75-10-1-1
validation0 / 1-0.75-0.50-1-1
validation0 / 2-0.750.50-1-1
validation0 / 3-0.7510-1-1
validation1 / 0-0.25-10-1-1
validation1 / 1-0.25-0.50-1-1
validation1 / 2-0.250.50-1-1
validation1 / 3-0.2510-1-1
validation2 / 00.25-10-1-1
validation2 / 10.25-0.50-1-1
validation2 / 20.250.50-1-1
validation2 / 30.2510-1-1
validation3 / 00.75-10-1-1
validation3 / 10.75-0.50-1-1
validation3 / 20.750.50-1-1
validation3 / 30.7510-1-1

Start oldMatch at −1. At every key compare x==keyX, then retain the first matching index. All four comparisons occur even after a hit; coherent duplicate keys at the helper boundary would still select the first one. The fixed data has 4 matches and 4 misses.

Memorizer losses for all eight selected pairs and both means
Memorizer: all eight ADAPT losses from selected predictions
Sampletarget0target1error0error1square0square1half0half1sampleLoss
train00.510000000
train10.250.50000000
train20.5-0.250000000
train31-0.50000000
validation00.3750.75-0.375-0.5339355468750.1406250.28508716821670530.07031250.142543584108352660.21285608410835266
validation10.1250.25-0.125-0.1779785156250.0156250.031676352024078370.00781250.0158381760120391850.023650676012039185
validation20.25-0.125-0.1779785156250.1250.031676352024078370.0156250.0158381760120391850.00781250.023650676012039185
validation30.75-0.375-0.5339355468750.3750.28508716821670530.1406250.142543584108352660.07031250.21285608410835266

memorizer_mean_0: Average four saved sample losses in their original order

sum starts at +0; sum0=initialSum+loss0; sum1=sum0+loss1; sum2=sum1+loss2; sum3=sum2+loss3; mean=sum3/4

Dataset zero is training; dataset one is held-out validation. Both means are computed independently from their saved sample losses. Validation never contributes a gradient. This ordered average does not divide each output error by eight.

Saved inputs
dataset
0
initialSum
0
divisor
4
loss0
0
loss1
0
loss2
0
loss3
0
Saved outputs
sum0
0
sum1
0
sum2
0
sum3
0
mean
0

memorizer_mean_1: Average four saved sample losses in their original order

sum starts at +0; sum0=initialSum+loss0; sum1=sum0+loss1; sum2=sum1+loss2; sum3=sum2+loss3; mean=sum3/4

Dataset zero is training; dataset one is held-out validation. Both means are computed independently from their saved sample losses. Validation never contributes a gradient. This ordered average does not divide each output error by eight.

Saved inputs
dataset
1
initialSum
0
divisor
4
loss0
0.21285608410835266
loss1
0.023650676012039185
loss2
0.023650676012039185
loss3
0.21285608410835266
Saved outputs
sum0
0.21285608410835266
sum1
0.23650676012039185
sum2
0.26015743613243103
sum3
0.4730135202407837
mean
0.11825338006019592
Selected memorizer sample: scan, branch-specific operands and loss

memorizer_dictionary: Copy four training keys and their two desired outputs

dictionary_j=[trainX_j,adaptTarget0_j,adaptTarget1_j], j=0..3

This explicit lookup stores four keys and eight target values, twelve extra numeric slots. It is a constructed counterexample, not a neural network trained by gradient descent. Its fallback will reuse the already saved prepared predictions.

Saved inputs
dataX0
-1
dataTarget0_0
0.5
dataTarget0_1
1
dataX1
-0.5
dataTarget1_0
0.25
dataTarget1_1
0.5
dataX2
0.5
dataTarget2_0
0.5
dataTarget2_1
-0.25
dataX3
1
dataTarget3_0
1
dataTarget3_1
-0.5
Saved outputs
key0
-1
target0_0
0.5
target0_1
1
key1
-0.5
target1_0
0.25
target1_1
0.5
key2
0.5
target2_0
0.5
target2_1
-0.25
key3
1
target3_0
1
target3_1
-0.5

memorizer_scan_0: Compare this input with every stored training key

match starts at -1; for key0..3: equal=(x==keyX); match=(oldMatch==-1 and equal==1)?keyIndex:oldMatch

Perform all four equality comparisons even after finding a match. Keep the first matching index; minus one means none. The fixed eight inputs have four training matches and four held-out misses. If a caller supplies duplicate coherent keys, the first match still wins.

Saved inputs
sample
0
x
-1
noMatch
-1
key0
-1
key1
-0.5
key2
0.5
key3
1
Saved outputs
equal0
1
match0
0
equal1
0
match1
0
equal2
0
match2
0
equal3
0
match3
0

memorizer_select_0: Copy a matched target pair or this sample's saved prepared pair

sourceKind=match==-1?1:0; sourceSample=match==-1?sample:match; sourceIndex0=match==-1?2*sample:3*match+1; sourceIndex1=sourceIndex0+1; source0=match==-1?prepared0:matchedDictionary0; source1=match==-1?prepared1:matchedDictionary1; prediction0=source0; prediction1=source1

Source zero is the dictionary target pair at the first matching training index: in the stored [4,3] dictionary, flat positions 3*match+1 and 3*match+2 skip its x key. Source one is the saved prepared-network prediction at this same sample, at flat positions 2*sample and 2*sample+1 before adaptation. Copy both output values without another neural forward. A perfect lookup fit on training keys says nothing about the missing inputs.

Saved inputs
sample
0
match
0
prepared0
0
prepared1
0.2880859375
matchedDictionary0
0.5
matchedDictionary1
1
Saved outputs
sourceKind
0
sourceSample
0
sourceIndex0
1
sourceIndex1
2
source0
0.5
source1
1
prediction0
0.5
prediction1
1

memorizer_loss_0: Measure the two output errors for one sample

error0=prediction0-target0; error1=prediction1-target1; square0=error0*error0; square1=error1*error1; half0=square0/2; half1=square1/2; sampleLoss=half0+half1

Each output is a scalar regression value, so its signed error is a difference of numbers. Squaring makes either error direction costly. Add the two half-losses to obtain one sample loss; the later average counts four samples, not eight output coordinates.

Saved inputs
sample
0
task
1
prediction0
0.5
prediction1
1
target0
0.5
target1
1
divisor
2
Saved outputs
error0
0
error1
0
square0
0
square1
0
half0
0
half1
0
sampleLoss
0

Actual dictionary training mean=0; held-out mean=0.11825338006019592. The held-out fallback keeps the unadapted prepared ADAPT mean=0.11825338006019592, irrespective of the fine-tuning steps. Zero training loss follows from the actual selected-label subtractions, and does not imply the ADAPT rule was learned on missing keys.

Count evaluations, updates and dictionary work separately

Whole current root: actual work and record counts
QuantityActual count
Fixed feature maps (once)8
Feature negations8
ReLU max selections16
PRE target copies16
ADAPT target half-scalings16
ADAPT target additions16
Prepared weight copies4
PRE evaluated stages3
Prepared ADAPT evaluated stages2
Fresh ADAPT evaluated stages2
Total network stages S7
Network sample forwards56
Forward products224
Forward output sums112
Gradient batches (including final diagnostics)7
Coordinate gradient contractions28
Training rows in gradient batches (4S)28
Coordinate-by-row gradient multiplications (16S)112
Completed optimizer batches K4
Rows used by optimizer batches16
All-coordinate proposal records16
Enabled-coordinate commits16
Final diagnostic gradient batches3
Loss sample evaluations (networks plus memorizer)64
Component errors128
Error squares128
Half-loss divisions128
Two-output half-loss sums64
Ordered loss accumulation additions64
Dataset mean divisions16
Dictionary key comparisons32
Dictionary prediction selections8
Dictionary matches4
Dictionary misses4
Extra numeric dictionary slots12
Retained prepared weights4
Extra memorizer neural forwards0
Memorizer gradient batches0
Memorizer optimizer batches0
Saved operation frames228
Saved tensors100

P means preUpdates and U means updates per ADAPT cohort. K=P+2U counts transitions; S=K+3 counts evaluated states because each of the three cohorts also evaluates its start. Each state computes eight forwards, four training rows and sixteen gradient products. There are four proposals per transition regardless of scope, three final diagnostic batches without updates, and independent dictionary losses without new network forwards. At η=0 these requested operations still count. These are algorithmic counts, not hardware speed or throughput.

Whole-root final summary and saved work-copy operands

finish: Compare the final adaptation results and the lookup counterexample

report actual final losses and completed work; final diagnostics add no optimizer steps; dictionary comparisons add no neural forwards

Prepared and fresh losses measure the same ADAPT rule after the same number of adaptation steps. The dictionary can obtain zero training error by copying labels while keeping unadapted predictions on held-out misses. Counts describe this small algorithm, not elapsed time, memory bytes or a general benefit of pretraining.

Saved inputs
preUpdates
2
updates
1
scope
0
eta
0.5
trainableAdaptParameters
4
fineTunedValidationLoss
0.08418624420301057
freshValidationLoss
0.13904571533203125
memorizerValidationLoss
0.11825338006019592
fineTunedTrainLoss
0.16837248840602115
freshTrainLoss
0.2780914306640625
memorizerTrainLoss
0
featureMaps
8
featureNegations
8
featureMaxSelections
16
preTargetCopies
16
adaptTargetScalings
16
adaptTargetAdditions
16
preparedWeightCopies
4
pretrainingStages
3
preparedAdaptStages
2
freshAdaptStages
2
stageCount
7
forwardSampleEvaluations
56
forwardProducts
224
forwardSums
112
gradientBatches
7
gradientContractions
28
gradientRowContributions
28
gradientProducts
112
optimizerBatches
4
usedForUpdateRows
16
storedCoordinateUpdateRecords
16
enabledCoordinateUpdates
16
finalDiagnosticBatches
3
lossSampleEvaluations
64
lossComponentErrors
128
lossSquares
128
lossHalfDivisions
128
lossOutputSums
64
orderedLossAdditions
64
datasetMeanDivisions
16
memorizerComparisons
32
memorizerSelections
8
memorizerMatches
4
memorizerMisses
4
dictionaryExtraSlots
12
retainedPreparedWeights
4
memorizerForwardEvaluations
0
memorizerGradientBatches
0
memorizerOptimizerBatches
0
Saved outputs
fineTunedValidationLoss
0.08418624420301057
freshValidationLoss
0.13904571533203125
memorizerValidationLoss
0.11825338006019592
fineTunedTrainLoss
0.16837248840602115
freshTrainLoss
0.2780914306640625
memorizerTrainLoss
0
featureMaps
8
featureNegations
8
featureMaxSelections
16
preTargetCopies
16
adaptTargetScalings
16
adaptTargetAdditions
16
preparedWeightCopies
4
pretrainingStages
3
preparedAdaptStages
2
freshAdaptStages
2
stageCount
7
forwardSampleEvaluations
56
forwardProducts
224
forwardSums
112
gradientBatches
7
gradientContractions
28
gradientRowContributions
28
gradientProducts
112
optimizerBatches
4
usedForUpdateRows
16
storedCoordinateUpdateRecords
16
enabledCoordinateUpdates
16
finalDiagnosticBatches
3
lossSampleEvaluations
64
lossComponentErrors
128
lossSquares
128
lossHalfDivisions
128
lossOutputSums
64
orderedLossAdditions
64
datasetMeanDivisions
16
memorizerComparisons
32
memorizerSelections
8
memorizerMatches
4
memorizerMisses
4
dictionaryExtraSlots
12
retainedPreparedWeights
4
memorizerForwardEvaluations
0
memorizerGradientBatches
0
memorizerOptimizerBatches
0
Default worked mathematics: preparation, adaptation and comparison

This fixed hand case is preUpdates=2, updates=1, scope=0, η=1/2. Fractions here explain the default; the tables above always use the current saved root. At PRE stage 0, W is zero. For x=−1, φ=[0,1]ᵀ, prediction=[0,0], target=[0,1], errors=[0,−1], squares=[0,1], halves=[0,1/2], sample loss=1/2. Training sample losses in order are [1/2,1/8,1/8,1/2]. Starting at +0 gives partial sums 1/2,5/8,3/4,5/4; divide by 4 to obtain 5/16.

Initially G00=(0+0−1/4−1)/4=−5/16 and G11=(−1−1/4+0+0)/4=−5/16; cross derivatives are zero. Subtracting ηG gives first PRE diagonal 5/32. Its diagonal derivative is (5/16)(5/32−1)=−135/512, so the second step gives 5/32+135/1024=295/1024. All eight rows are evaluated at each of these actual stages; no historical trained weights are supplied.

Now change targets to Tφ with T=[[1,1/2],[−1/2,1]]. At x=−1, compute scaledMinus=(1/2)×1=1/2, target0=0+1/2=1/2, scaledPlus=(−1/2)×0=−0, target1=−0+1=1. Prepared prediction=[0,295/1024], errors=[−1/2,−729/1024]. Squares are [1/4,531441/1048576], halves [1/8,531441/2097152], sum 793585/2097152. The ±1/2 samples have one quarter of this loss; the four-sample mean is 3967925/16777216.

Prepared initial G in 00,01,10,11 order is [−3645/16384,−5/32,+5/32,−3645/16384]. For G00 the negative-x products are −0; positive rows contribute −729/4096 and −729/1024, giving sum −3645/4096 then /4. Full fine-tuning subtracts half of each G: W=[13085/32768,5/64,−5/64,13085/32768]. At x=−1 the four products are [0,5/64,−0,13085/32768]; predictions=[5/64,13085/32768], errors=[−27/64,−19683/32768]. Their squares are [729/4096,387420489/1073741824], halves [729/8192,387420489/2147483648], sum 578523465/2147483648. Ordered averaging of the four losses gives 2892617325/17179869184; held-out mean is 2892617325/34359738368.

Fresh initial ADAPT G=[−5/16,−5/32,+5/32,−5/16]. One η=1/2 step gives [5/32,5/64,−5/64,5/32], training mean 18225/65536 and held-out 18225/131072. Prepared diagonal-only scope instead keeps its old cross weights and has training mean 3279279725/17179869184, held-out 3279279725/34359738368. The dictionary’s four hits copy exact ADAPT labels, giving zero training error; its four misses keep the unadapted prepared validation mean 3967925/33554432.

For four feature rows F:[4,2], predictions are F Wᵀ:[4,2]; the transpose turns the single-sample column equation into row-batch storage. The feature Gram matrix H=FᵀF/4 summarizes average feature products. Training has H=diag(5/16,5/16). For target matrix A (I for PRE or T for ADAPT), G=(W−A)H and real Ltrain=(5/32)Σ(Woi−Aoi)². This explains why each full η=1/2 step contracts the residual by 27/32. These identities explain the ordered sample arithmetic; they do not replace it with a second numeric engine.

What this held-out grid can tell us

All eight inputs lie on the same two feature rays: [positive,0] or [0,positive]. Validation merely changes magnitudes. Its Gram matrix is 5I/32, half of training’s 5I/16 (I is the 2×2 identity). For any fixed W and either homogeneous matrix target, real Lvalidation=Ltrain/2. The two means are nevertheless computed independently and can round in represented arithmetic. This relationship does not apply to the dictionary’s lookup rule. It tests neither new directions, nonlinear target rules, a distribution nor population generalization.

The saved decimals are round-trip representations of binary64 values; −0 is kept visible. Separate products, sums and divisions can round. A scoped exact centered-gradient identity at η=+0.5 covers PRE stages and only ADAPT stage 0 or the first updated state on enabled coordinates, with h=2⁻¹²; it gives no blanket exactness promise for later ADAPT stages or arbitrary η. No finite-difference experiment runs in this view.

Pretraining changes the starting weights; fine-tuning changes selected weights for a new target rule; held-out loss evaluates inputs excluded from gradients. The memorizer shows why training fit alone is insufficient. This two-output regression lab trains a fixed-feature readout, unlike IV-52’s token cross-entropy; it establishes no universal transfer benefit, LLM training result, cognition, safety or alignment claim. IV-56 next asks how an additive low-rank change can adapt a readout; in this tiny 2×2 case factorization does not automatically save trainable parameters.

Inspect all stored values, text metadata and tensor storage

Every scalar output, including flattened operation outputs

Exact text evidence from the same record

These are the stored values, shown without display rounding. Each tensor names its axes, dtype and display precision. Empty arrays are omitted rather than padded.

Data

Sample=8 × DataField=7 · float64 · precision 8 · Actual once-prepared authored inputs, features and both target pairs in texts.dataFields order; first four training, last four validation.

Zero-based storage indexStored value
0-1
10
21
30
41
50.5
61
7-0.5
80
90.5
100
110.5
120.25
130.5
140.5
150.5
160
170.5
180
190.5
20-0.25
211
221
230
241
250
261
27-0.5
28-0.75
290
300.75
310
320.75
330.375
340.75
35-0.25
360
370.25
380
390.25
400.125
410.25
420.25
430.25
440
450.25
460
470.25
48-0.125
490.75
500.75
510
520.75
530
540.75
55-0.375

AdaptMask

Output=2 × Feature=2 · int32 · precision 0 · Actual scope-dependent ADAPT selectors in row-major W order; PRE always enables all four coordinates.

Zero-based storage indexStored value
01
11
21
31

pre_InitialWeights

Output=2 × Feature=2 · float64 · precision 8 · Actual cohort initialization: PRE/fresh copy authored positive zeros; prepared ADAPT copies the saved final-PRE weight words.

Zero-based storage indexStored value
00
10
20
30

pre_stage_0_Weights

Output=2 × Feature=2 · float64 · precision 8 · Detached actual same-state W, row-major 00,01,10,11; arbitrary finite represented weights are permitted.

Zero-based storage indexStored value
00
10
20
30

pre_stage_0_Predictions

Sample=8 × Output=2 · float64 · precision 8 · Actual two-output predictions from all four products and both sums per sample, with the same W for all eight rows.

Zero-based storage indexStored value
00
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150

pre_stage_0_Forward

Sample=8 × ForwardField=6 · float64 · precision 8 · Actual product00,product01,product10,product11,prediction0,prediction1; no zero-product shortcut.

Zero-based storage indexStored value
00
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
210
220
230
240
250
260
270
280
290
300
310
320
330
340
350
360
370
380
390
400
410
420
430
440
450
460
470

pre_stage_0_Loss

Sample=8 × LossField=9 · float64 · precision 8 · Actual target0,target1,error0,error1,square0,square1,half0,half1,sampleLoss in sample order; each sample loss sums both output half-losses.

Zero-based storage indexStored value
00
11
20
3-1
40
51
60
70.5
80.5
90
100.5
110
12-0.5
130
140.25
150
160.125
170.125
180.5
190
20-0.5
210
220.25
230
240.125
250
260.125
271
280
29-1
300
311
320
330.5
340
350.5
360
370.75
380
39-0.75
400
410.5625
420
430.28125
440.28125
450
460.25
470
48-0.25
490
500.0625
510
520.03125
530.03125
540.25
550
56-0.25
570
580.0625
590
600.03125
610
620.03125
630.75
640
65-0.75
660
670.5625
680
690.28125
700
710.28125

pre_stage_0_Reductions

Dataset=2 × DatasetSample=4 × ReductionField=3 · float64 · precision 8 · Actual saved loss, oldSum, sum for each ordered four-sample reduction, training then validation, each initialized at floating positive zero.

Zero-based storage indexStored value
00.5
10
20.5
30.125
40.5
50.625
60.125
70.625
80.75
90.5
100.75
111.25
120.28125
130
140.28125
150.03125
160.28125
170.3125
180.03125
190.3125
200.34375
210.28125
220.34375
230.625

pre_stage_0_Means

Dataset=2 · float64 · precision 8 · Actual independent training and validation means; each divides its own ordered four-sample sum by floating four.

Zero-based storage indexStored value
00.3125
10.15625

pre_stage_0_GradientRows

Coordinate=4 × TrainSample=4 × GradientRowField=5 · float64 · precision 8 · Actual error,feature,contribution,oldSum,sum in coordinate-major then training-row order; each contraction starts at floating positive zero.

Zero-based storage indexStored value
00
10
20
30
40
50
60
70
80
90
10-0.5
110.5
12-0.25
130
14-0.25
15-1
161
17-1
18-0.25
19-1.25
200
211
220
230
240
250
260.5
270
280
290
30-0.5
310
32-0
330
340
35-1
360
37-0
380
390
40-1
410
42-0
430
440
45-0.5
460
47-0
480
490
500
510.5
520
530
540
550
561
570
580
590
60-1
611
62-1
630
64-1
65-0.5
660.5
67-0.25
68-1
69-1.25
700
710
720
73-1.25
74-1.25
750
760
770
78-1.25
79-1.25

pre_stage_0_MathematicalGradient

Output=2 × Feature=2 · float64 · precision 8 · All four actual derivatives of the current training objective; the final cohort stage is diagnostic only.

Zero-based storage indexStored value
0-0.3125
10
20
3-0.3125

pre_stage_0_EffectiveGradient

Output=2 × Feature=2 · float64 · precision 8 · Actual conditional mathematical-gradient or floating-positive-zero selection, in row-major W order.

Zero-based storage indexStored value
0-0.3125
10
20
3-0.3125

pre_stage_0_Mask

Output=2 × Feature=2 · int32 · precision 0 · Actual numeric zero-or-one selectors in row-major W order; integer values select effective gradients, never rescale features.

Zero-based storage indexStored value
01
11
21
31

pre_stage_0_Stats

StageField=4 · float64 · precision 8 · Actual training mean,validation mean,diagnosticOnly,hasNextUpdate in texts.stageFields order; last two positions are integer VALUE selectors.

Zero-based storage indexStored value
00.3125
10.15625
20
31

pre_update_1_Update

Coordinate=4 × UpdateField=7 · float64 · precision 8 · Actual old,mathematical,effective,enabled,delta,proposed,committed; enabled is an integer VALUE in this mixed float table. Frozen commits copy the old word, including nonzero values and negative zero.

Zero-based storage indexStored value
00
1-0.3125
2-0.3125
31
4-0.15625
50.15625
60.15625
70
80
90
101
110
120
130
140
150
160
171
180
190
200
210
22-0.3125
23-0.3125
241
25-0.15625
260.15625
270.15625

pre_stage_1_Weights

Output=2 × Feature=2 · float64 · precision 8 · Detached actual same-state W, row-major 00,01,10,11; arbitrary finite represented weights are permitted.

Zero-based storage indexStored value
00.15625
10
20
30.15625

pre_stage_1_Predictions

Sample=8 × Output=2 · float64 · precision 8 · Actual two-output predictions from all four products and both sums per sample, with the same W for all eight rows.

Zero-based storage indexStored value
00
10.15625
20
30.078125
40.078125
50
60.15625
70
80
90.1171875
100
110.0390625
120.0390625
130
140.1171875
150

pre_stage_1_Forward

Sample=8 × ForwardField=6 · float64 · precision 8 · Actual product00,product01,product10,product11,prediction0,prediction1; no zero-product shortcut.

Zero-based storage indexStored value
00
10
20
30.15625
40
50.15625
60
70
80
90.078125
100
110.078125
120.078125
130
140
150
160.078125
170
180.15625
190
200
210
220.15625
230
240
250
260
270.1171875
280
290.1171875
300
310
320
330.0390625
340
350.0390625
360.0390625
370
380
390
400.0390625
410
420.1171875
430
440
450
460.1171875
470

pre_stage_1_Loss

Sample=8 × LossField=9 · float64 · precision 8 · Actual target0,target1,error0,error1,square0,square1,half0,half1,sampleLoss in sample order; each sample loss sums both output half-losses.

Zero-based storage indexStored value
00
11
20
3-0.84375
40
50.7119140625
60
70.35595703125
80.35595703125
90
100.5
110
12-0.421875
130
140.177978515625
150
160.0889892578125
170.0889892578125
180.5
190
20-0.421875
210
220.177978515625
230
240.0889892578125
250
260.0889892578125
271
280
29-0.84375
300
310.7119140625
320
330.35595703125
340
350.35595703125
360
370.75
380
39-0.6328125
400
410.40045166015625
420
430.200225830078125
440.200225830078125
450
460.25
470
48-0.2109375
490
500.04449462890625
510
520.022247314453125
530.022247314453125
540.25
550
56-0.2109375
570
580.04449462890625
590
600.022247314453125
610
620.022247314453125
630.75
640
65-0.6328125
660
670.40045166015625
680
690.200225830078125
700
710.200225830078125

pre_stage_1_Reductions

Dataset=2 × DatasetSample=4 × ReductionField=3 · float64 · precision 8 · Actual saved loss, oldSum, sum for each ordered four-sample reduction, training then validation, each initialized at floating positive zero.

Zero-based storage indexStored value
00.35595703125
10
20.35595703125
30.0889892578125
40.35595703125
50.4449462890625
60.0889892578125
70.4449462890625
80.533935546875
90.35595703125
100.533935546875
110.889892578125
120.200225830078125
130
140.200225830078125
150.022247314453125
160.200225830078125
170.22247314453125
180.022247314453125
190.22247314453125
200.244720458984375
210.200225830078125
220.244720458984375
230.4449462890625

pre_stage_1_Means

Dataset=2 · float64 · precision 8 · Actual independent training and validation means; each divides its own ordered four-sample sum by floating four.

Zero-based storage indexStored value
00.22247314453125
10.111236572265625

pre_stage_1_GradientRows

Coordinate=4 × TrainSample=4 × GradientRowField=5 · float64 · precision 8 · Actual error,feature,contribution,oldSum,sum in coordinate-major then training-row order; each contraction starts at floating positive zero.

Zero-based storage indexStored value
00
10
20
30
40
50
60
70
80
90
10-0.421875
110.5
12-0.2109375
130
14-0.2109375
15-0.84375
161
17-0.84375
18-0.2109375
19-1.0546875
200
211
220
230
240
250
260.5
270
280
290
30-0.421875
310
32-0
330
340
35-0.84375
360
37-0
380
390
40-0.84375
410
42-0
430
440
45-0.421875
460
47-0
480
490
500
510.5
520
530
540
550
561
570
580
590
60-0.84375
611
62-0.84375
630
64-0.84375
65-0.421875
660.5
67-0.2109375
68-0.84375
69-1.0546875
700
710
720
73-1.0546875
74-1.0546875
750
760
770
78-1.0546875
79-1.0546875

pre_stage_1_MathematicalGradient

Output=2 × Feature=2 · float64 · precision 8 · All four actual derivatives of the current training objective; the final cohort stage is diagnostic only.

Zero-based storage indexStored value
0-0.263671875
10
20
3-0.263671875

pre_stage_1_EffectiveGradient

Output=2 × Feature=2 · float64 · precision 8 · Actual conditional mathematical-gradient or floating-positive-zero selection, in row-major W order.

Zero-based storage indexStored value
0-0.263671875
10
20
3-0.263671875

pre_stage_1_Mask

Output=2 × Feature=2 · int32 · precision 0 · Actual numeric zero-or-one selectors in row-major W order; integer values select effective gradients, never rescale features.

Zero-based storage indexStored value
01
11
21
31

pre_stage_1_Stats

StageField=4 · float64 · precision 8 · Actual training mean,validation mean,diagnosticOnly,hasNextUpdate in texts.stageFields order; last two positions are integer VALUE selectors.

Zero-based storage indexStored value
00.22247314453125
10.111236572265625
20
31

pre_update_2_Update

Coordinate=4 × UpdateField=7 · float64 · precision 8 · Actual old,mathematical,effective,enabled,delta,proposed,committed; enabled is an integer VALUE in this mixed float table. Frozen commits copy the old word, including nonzero values and negative zero.

Zero-based storage indexStored value
00.15625
1-0.263671875
2-0.263671875
31
4-0.1318359375
50.2880859375
60.2880859375
70
80
90
101
110
120
130
140
150
160
171
180
190
200
210.15625
22-0.263671875
23-0.263671875
241
25-0.1318359375
260.2880859375
270.2880859375

pre_stage_2_Weights

Output=2 × Feature=2 · float64 · precision 8 · Detached actual same-state W, row-major 00,01,10,11; arbitrary finite represented weights are permitted.

Zero-based storage indexStored value
00.2880859375
10
20
30.2880859375

pre_stage_2_Predictions

Sample=8 × Output=2 · float64 · precision 8 · Actual two-output predictions from all four products and both sums per sample, with the same W for all eight rows.

Zero-based storage indexStored value
00
10.2880859375
20
30.14404296875
40.14404296875
50
60.2880859375
70
80
90.216064453125
100
110.072021484375
120.072021484375
130
140.216064453125
150

pre_stage_2_Forward

Sample=8 × ForwardField=6 · float64 · precision 8 · Actual product00,product01,product10,product11,prediction0,prediction1; no zero-product shortcut.

Zero-based storage indexStored value
00
10
20
30.2880859375
40
50.2880859375
60
70
80
90.14404296875
100
110.14404296875
120.14404296875
130
140
150
160.14404296875
170
180.2880859375
190
200
210
220.2880859375
230
240
250
260
270.216064453125
280
290.216064453125
300
310
320
330.072021484375
340
350.072021484375
360.072021484375
370
380
390
400.072021484375
410
420.216064453125
430
440
450
460.216064453125
470

pre_stage_2_Loss

Sample=8 × LossField=9 · float64 · precision 8 · Actual target0,target1,error0,error1,square0,square1,half0,half1,sampleLoss in sample order; each sample loss sums both output half-losses.

Zero-based storage indexStored value
00
11
20
3-0.7119140625
40
50.5068216323852539
60
70.25341081619262695
80.25341081619262695
90
100.5
110
12-0.35595703125
130
140.12670540809631348
150
160.06335270404815674
170.06335270404815674
180.5
190
20-0.35595703125
210
220.12670540809631348
230
240.06335270404815674
250
260.06335270404815674
271
280
29-0.7119140625
300
310.5068216323852539
320
330.25341081619262695
340
350.25341081619262695
360
370.75
380
39-0.533935546875
400
410.2850871682167053
420
430.14254358410835266
440.14254358410835266
450
460.25
470
48-0.177978515625
490
500.03167635202407837
510
520.015838176012039185
530.015838176012039185
540.25
550
56-0.177978515625
570
580.03167635202407837
590
600.015838176012039185
610
620.015838176012039185
630.75
640
65-0.533935546875
660
670.2850871682167053
680
690.14254358410835266
700
710.14254358410835266

pre_stage_2_Reductions

Dataset=2 × DatasetSample=4 × ReductionField=3 · float64 · precision 8 · Actual saved loss, oldSum, sum for each ordered four-sample reduction, training then validation, each initialized at floating positive zero.

Zero-based storage indexStored value
00.25341081619262695
10
20.25341081619262695
30.06335270404815674
40.25341081619262695
50.3167635202407837
60.06335270404815674
70.3167635202407837
80.38011622428894043
90.25341081619262695
100.38011622428894043
110.6335270404815674
120.14254358410835266
130
140.14254358410835266
150.015838176012039185
160.14254358410835266
170.15838176012039185
180.015838176012039185
190.15838176012039185
200.17421993613243103
210.14254358410835266
220.17421993613243103
230.3167635202407837

pre_stage_2_Means

Dataset=2 · float64 · precision 8 · Actual independent training and validation means; each divides its own ordered four-sample sum by floating four.

Zero-based storage indexStored value
00.15838176012039185
10.07919088006019592

pre_stage_2_GradientRows

Coordinate=4 × TrainSample=4 × GradientRowField=5 · float64 · precision 8 · Actual error,feature,contribution,oldSum,sum in coordinate-major then training-row order; each contraction starts at floating positive zero.

Zero-based storage indexStored value
00
10
20
30
40
50
60
70
80
90
10-0.35595703125
110.5
12-0.177978515625
130
14-0.177978515625
15-0.7119140625
161
17-0.7119140625
18-0.177978515625
19-0.889892578125
200
211
220
230
240
250
260.5
270
280
290
30-0.35595703125
310
32-0
330
340
35-0.7119140625
360
37-0
380
390
40-0.7119140625
410
42-0
430
440
45-0.35595703125
460
47-0
480
490
500
510.5
520
530
540
550
561
570
580
590
60-0.7119140625
611
62-0.7119140625
630
64-0.7119140625
65-0.35595703125
660.5
67-0.177978515625
68-0.7119140625
69-0.889892578125
700
710
720
73-0.889892578125
74-0.889892578125
750
760
770
78-0.889892578125
79-0.889892578125

pre_stage_2_MathematicalGradient

Output=2 × Feature=2 · float64 · precision 8 · All four actual derivatives of the current training objective; the final cohort stage is diagnostic only.

Zero-based storage indexStored value
0-0.22247314453125
10
20
3-0.22247314453125

pre_stage_2_EffectiveGradient

Output=2 × Feature=2 · float64 · precision 8 · Actual conditional mathematical-gradient or floating-positive-zero selection, in row-major W order.

Zero-based storage indexStored value
0-0.22247314453125
10
20
3-0.22247314453125

pre_stage_2_Mask

Output=2 × Feature=2 · int32 · precision 0 · Actual numeric zero-or-one selectors in row-major W order; integer values select effective gradients, never rescale features.

Zero-based storage indexStored value
01
11
21
31

pre_stage_2_Stats

StageField=4 · float64 · precision 8 · Actual training mean,validation mean,diagnosticOnly,hasNextUpdate in texts.stageFields order; last two positions are integer VALUE selectors.

Zero-based storage indexStored value
00.15838176012039185
10.07919088006019592
21
30

pre_StageMetrics

Stage=3 × Dataset=2 · float64 · precision 8 · Only actual cohort stages zero through its requested update count; training then independently computed validation mean.

Zero-based storage indexStored value
00.3125
10.15625
20.22247314453125
30.111236572265625
40.15838176012039185
50.07919088006019592

pre_StageWeights

Stage=3 × Coordinate=4 · float64 · precision 8 · Only actual evaluated cohort weights in row-major 00,01,10,11 order; final weights have a real final evaluation.

Zero-based storage indexStored value
00
10
20
30
40.15625
50
60
70.15625
80.2880859375
90
100
110.2880859375

adapt_InitialWeights

Output=2 × Feature=2 · float64 · precision 8 · Actual cohort initialization: PRE/fresh copy authored positive zeros; prepared ADAPT copies the saved final-PRE weight words.

Zero-based storage indexStored value
00.2880859375
10
20
30.2880859375

adapt_stage_0_Weights

Output=2 × Feature=2 · float64 · precision 8 · Detached actual same-state W, row-major 00,01,10,11; arbitrary finite represented weights are permitted.

Zero-based storage indexStored value
00.2880859375
10
20
30.2880859375

adapt_stage_0_Predictions

Sample=8 × Output=2 · float64 · precision 8 · Actual two-output predictions from all four products and both sums per sample, with the same W for all eight rows.

Zero-based storage indexStored value
00
10.2880859375
20
30.14404296875
40.14404296875
50
60.2880859375
70
80
90.216064453125
100
110.072021484375
120.072021484375
130
140.216064453125
150

adapt_stage_0_Forward

Sample=8 × ForwardField=6 · float64 · precision 8 · Actual product00,product01,product10,product11,prediction0,prediction1; no zero-product shortcut.

Zero-based storage indexStored value
00
10
20
30.2880859375
40
50.2880859375
60
70
80
90.14404296875
100
110.14404296875
120.14404296875
130
140
150
160.14404296875
170
180.2880859375
190
200
210
220.2880859375
230
240
250
260
270.216064453125
280
290.216064453125
300
310
320
330.072021484375
340
350.072021484375
360.072021484375
370
380
390
400.072021484375
410
420.216064453125
430
440
450
460.216064453125
470

adapt_stage_0_Loss

Sample=8 × LossField=9 · float64 · precision 8 · Actual target0,target1,error0,error1,square0,square1,half0,half1,sampleLoss in sample order; each sample loss sums both output half-losses.

Zero-based storage indexStored value
00.5
11
2-0.5
3-0.7119140625
40.25
50.5068216323852539
60.125
70.25341081619262695
80.37841081619262695
90.25
100.5
11-0.25
12-0.35595703125
130.0625
140.12670540809631348
150.03125
160.06335270404815674
170.09460270404815674
180.5
19-0.25
20-0.35595703125
210.25
220.12670540809631348
230.0625
240.06335270404815674
250.03125
260.09460270404815674
271
28-0.5
29-0.7119140625
300.5
310.5068216323852539
320.25
330.25341081619262695
340.125
350.37841081619262695
360.375
370.75
38-0.375
39-0.533935546875
400.140625
410.2850871682167053
420.0703125
430.14254358410835266
440.21285608410835266
450.125
460.25
47-0.125
48-0.177978515625
490.015625
500.03167635202407837
510.0078125
520.015838176012039185
530.023650676012039185
540.25
55-0.125
56-0.177978515625
570.125
580.03167635202407837
590.015625
600.015838176012039185
610.0078125
620.023650676012039185
630.75
64-0.375
65-0.533935546875
660.375
670.2850871682167053
680.140625
690.14254358410835266
700.0703125
710.21285608410835266

adapt_stage_0_Reductions

Dataset=2 × DatasetSample=4 × ReductionField=3 · float64 · precision 8 · Actual saved loss, oldSum, sum for each ordered four-sample reduction, training then validation, each initialized at floating positive zero.

Zero-based storage indexStored value
00.37841081619262695
10
20.37841081619262695
30.09460270404815674
40.37841081619262695
50.4730135202407837
60.09460270404815674
70.4730135202407837
80.5676162242889404
90.37841081619262695
100.5676162242889404
110.9460270404815674
120.21285608410835266
130
140.21285608410835266
150.023650676012039185
160.21285608410835266
170.23650676012039185
180.023650676012039185
190.23650676012039185
200.26015743613243103
210.21285608410835266
220.26015743613243103
230.4730135202407837

adapt_stage_0_Means

Dataset=2 · float64 · precision 8 · Actual independent training and validation means; each divides its own ordered four-sample sum by floating four.

Zero-based storage indexStored value
00.23650676012039185
10.11825338006019592

adapt_stage_0_GradientRows

Coordinate=4 × TrainSample=4 × GradientRowField=5 · float64 · precision 8 · Actual error,feature,contribution,oldSum,sum in coordinate-major then training-row order; each contraction starts at floating positive zero.

Zero-based storage indexStored value
0-0.5
10
2-0
30
40
5-0.25
60
7-0
80
90
10-0.35595703125
110.5
12-0.177978515625
130
14-0.177978515625
15-0.7119140625
161
17-0.7119140625
18-0.177978515625
19-0.889892578125
20-0.5
211
22-0.5
230
24-0.5
25-0.25
260.5
27-0.125
28-0.5
29-0.625
30-0.35595703125
310
32-0
33-0.625
34-0.625
35-0.7119140625
360
37-0
38-0.625
39-0.625
40-0.7119140625
410
42-0
430
440
45-0.35595703125
460
47-0
480
490
500.25
510.5
520.125
530
540.125
550.5
561
570.5
580.125
590.625
60-0.7119140625
611
62-0.7119140625
630
64-0.7119140625
65-0.35595703125
660.5
67-0.177978515625
68-0.7119140625
69-0.889892578125
700.25
710
720
73-0.889892578125
74-0.889892578125
750.5
760
770
78-0.889892578125
79-0.889892578125

adapt_stage_0_MathematicalGradient

Output=2 × Feature=2 · float64 · precision 8 · All four actual derivatives of the current training objective; the final cohort stage is diagnostic only.

Zero-based storage indexStored value
0-0.22247314453125
1-0.15625
20.15625
3-0.22247314453125

adapt_stage_0_EffectiveGradient

Output=2 × Feature=2 · float64 · precision 8 · Actual conditional mathematical-gradient or floating-positive-zero selection, in row-major W order.

Zero-based storage indexStored value
0-0.22247314453125
1-0.15625
20.15625
3-0.22247314453125

adapt_stage_0_Mask

Output=2 × Feature=2 · int32 · precision 0 · Actual numeric zero-or-one selectors in row-major W order; integer values select effective gradients, never rescale features.

Zero-based storage indexStored value
01
11
21
31

adapt_stage_0_Stats

StageField=4 · float64 · precision 8 · Actual training mean,validation mean,diagnosticOnly,hasNextUpdate in texts.stageFields order; last two positions are integer VALUE selectors.

Zero-based storage indexStored value
00.23650676012039185
10.11825338006019592
20
31

adapt_update_1_Update

Coordinate=4 × UpdateField=7 · float64 · precision 8 · Actual old,mathematical,effective,enabled,delta,proposed,committed; enabled is an integer VALUE in this mixed float table. Frozen commits copy the old word, including nonzero values and negative zero.

Zero-based storage indexStored value
00.2880859375
1-0.22247314453125
2-0.22247314453125
31
4-0.111236572265625
50.399322509765625
60.399322509765625
70
8-0.15625
9-0.15625
101
11-0.078125
120.078125
130.078125
140
150.15625
160.15625
171
180.078125
19-0.078125
20-0.078125
210.2880859375
22-0.22247314453125
23-0.22247314453125
241
25-0.111236572265625
260.399322509765625
270.399322509765625

adapt_stage_1_Weights

Output=2 × Feature=2 · float64 · precision 8 · Detached actual same-state W, row-major 00,01,10,11; arbitrary finite represented weights are permitted.

Zero-based storage indexStored value
00.399322509765625
10.078125
2-0.078125
30.399322509765625

adapt_stage_1_Predictions

Sample=8 × Output=2 · float64 · precision 8 · Actual two-output predictions from all four products and both sums per sample, with the same W for all eight rows.

Zero-based storage indexStored value
00.078125
10.399322509765625
20.0390625
30.1996612548828125
40.1996612548828125
5-0.0390625
60.399322509765625
7-0.078125
80.05859375
90.29949188232421875
100.01953125
110.09983062744140625
120.09983062744140625
13-0.01953125
140.29949188232421875
15-0.05859375

adapt_stage_1_Forward

Sample=8 × ForwardField=6 · float64 · precision 8 · Actual product00,product01,product10,product11,prediction0,prediction1; no zero-product shortcut.

Zero-based storage indexStored value
00
10.078125
2-0
30.399322509765625
40.078125
50.399322509765625
60
70.0390625
8-0
90.1996612548828125
100.0390625
110.1996612548828125
120.1996612548828125
130
14-0.0390625
150
160.1996612548828125
17-0.0390625
180.399322509765625
190
20-0.078125
210
220.399322509765625
23-0.078125
240
250.05859375
26-0
270.29949188232421875
280.05859375
290.29949188232421875
300
310.01953125
32-0
330.09983062744140625
340.01953125
350.09983062744140625
360.09983062744140625
370
38-0.01953125
390
400.09983062744140625
41-0.01953125
420.29949188232421875
430
44-0.05859375
450
460.29949188232421875
47-0.05859375

adapt_stage_1_Loss

Sample=8 × LossField=9 · float64 · precision 8 · Actual target0,target1,error0,error1,square0,square1,half0,half1,sampleLoss in sample order; each sample loss sums both output half-losses.

Zero-based storage indexStored value
00.5
11
2-0.421875
3-0.600677490234375
40.177978515625
50.3608134472742677
60.0889892578125
70.18040672363713384
80.26939598144963384
90.25
100.5
11-0.2109375
12-0.3003387451171875
130.04449462890625
140.09020336181856692
150.022247314453125
160.04510168090928346
170.06734899536240846
180.5
19-0.25
20-0.3003387451171875
210.2109375
220.09020336181856692
230.04449462890625
240.04510168090928346
250.022247314453125
260.06734899536240846
271
28-0.5
29-0.600677490234375
300.421875
310.3608134472742677
320.177978515625
330.18040672363713384
340.0889892578125
350.26939598144963384
360.375
370.75
38-0.31640625
39-0.45050811767578125
400.1001129150390625
410.20295756409177557
420.05005645751953125
430.10147878204588778
440.15153523956541903
450.125
460.25
47-0.10546875
48-0.15016937255859375
490.0111236572265625
500.02255084045464173
510.00556182861328125
520.011275420227320865
530.016837248840602115
540.25
55-0.125
56-0.15016937255859375
570.10546875
580.02255084045464173
590.0111236572265625
600.011275420227320865
610.00556182861328125
620.016837248840602115
630.75
64-0.375
65-0.45050811767578125
660.31640625
670.20295756409177557
680.1001129150390625
690.10147878204588778
700.05005645751953125
710.15153523956541903

adapt_stage_1_Reductions

Dataset=2 × DatasetSample=4 × ReductionField=3 · float64 · precision 8 · Actual saved loss, oldSum, sum for each ordered four-sample reduction, training then validation, each initialized at floating positive zero.

Zero-based storage indexStored value
00.26939598144963384
10
20.26939598144963384
30.06734899536240846
40.26939598144963384
50.3367449768120423
60.06734899536240846
70.3367449768120423
80.40409397217445076
90.26939598144963384
100.40409397217445076
110.6734899536240846
120.15153523956541903
130
140.15153523956541903
150.016837248840602115
160.15153523956541903
170.16837248840602115
180.016837248840602115
190.16837248840602115
200.18520973724662326
210.15153523956541903
220.18520973724662326
230.3367449768120423

adapt_stage_1_Means

Dataset=2 · float64 · precision 8 · Actual independent training and validation means; each divides its own ordered four-sample sum by floating four.

Zero-based storage indexStored value
00.16837248840602115
10.08418624420301057

adapt_stage_1_GradientRows

Coordinate=4 × TrainSample=4 × GradientRowField=5 · float64 · precision 8 · Actual error,feature,contribution,oldSum,sum in coordinate-major then training-row order; each contraction starts at floating positive zero.

Zero-based storage indexStored value
0-0.421875
10
2-0
30
40
5-0.2109375
60
7-0
80
90
10-0.3003387451171875
110.5
12-0.15016937255859375
130
14-0.15016937255859375
15-0.600677490234375
161
17-0.600677490234375
18-0.15016937255859375
19-0.7508468627929688
20-0.421875
211
22-0.421875
230
24-0.421875
25-0.2109375
260.5
27-0.10546875
28-0.421875
29-0.52734375
30-0.3003387451171875
310
32-0
33-0.52734375
34-0.52734375
35-0.600677490234375
360
37-0
38-0.52734375
39-0.52734375
40-0.600677490234375
410
42-0
430
440
45-0.3003387451171875
460
47-0
480
490
500.2109375
510.5
520.10546875
530
540.10546875
550.421875
561
570.421875
580.10546875
590.52734375
60-0.600677490234375
611
62-0.600677490234375
630
64-0.600677490234375
65-0.3003387451171875
660.5
67-0.15016937255859375
68-0.600677490234375
69-0.7508468627929688
700.2109375
710
720
73-0.7508468627929688
74-0.7508468627929688
750.421875
760
770
78-0.7508468627929688
79-0.7508468627929688

adapt_stage_1_MathematicalGradient

Output=2 × Feature=2 · float64 · precision 8 · All four actual derivatives of the current training objective; the final cohort stage is diagnostic only.

Zero-based storage indexStored value
0-0.1877117156982422
1-0.1318359375
20.1318359375
3-0.1877117156982422

adapt_stage_1_EffectiveGradient

Output=2 × Feature=2 · float64 · precision 8 · Actual conditional mathematical-gradient or floating-positive-zero selection, in row-major W order.

Zero-based storage indexStored value
0-0.1877117156982422
1-0.1318359375
20.1318359375
3-0.1877117156982422

adapt_stage_1_Mask

Output=2 × Feature=2 · int32 · precision 0 · Actual numeric zero-or-one selectors in row-major W order; integer values select effective gradients, never rescale features.

Zero-based storage indexStored value
01
11
21
31

adapt_stage_1_Stats

StageField=4 · float64 · precision 8 · Actual training mean,validation mean,diagnosticOnly,hasNextUpdate in texts.stageFields order; last two positions are integer VALUE selectors.

Zero-based storage indexStored value
00.16837248840602115
10.08418624420301057
21
30

adapt_StageMetrics

Stage=2 × Dataset=2 · float64 · precision 8 · Only actual cohort stages zero through its requested update count; training then independently computed validation mean.

Zero-based storage indexStored value
00.23650676012039185
10.11825338006019592
20.16837248840602115
30.08418624420301057

adapt_StageWeights

Stage=2 × Coordinate=4 · float64 · precision 8 · Only actual evaluated cohort weights in row-major 00,01,10,11 order; final weights have a real final evaluation.

Zero-based storage indexStored value
00.2880859375
10
20
30.2880859375
40.399322509765625
50.078125
6-0.078125
70.399322509765625

fresh_InitialWeights

Output=2 × Feature=2 · float64 · precision 8 · Actual cohort initialization: PRE/fresh copy authored positive zeros; prepared ADAPT copies the saved final-PRE weight words.

Zero-based storage indexStored value
00
10
20
30

fresh_stage_0_Weights

Output=2 × Feature=2 · float64 · precision 8 · Detached actual same-state W, row-major 00,01,10,11; arbitrary finite represented weights are permitted.

Zero-based storage indexStored value
00
10
20
30

fresh_stage_0_Predictions

Sample=8 × Output=2 · float64 · precision 8 · Actual two-output predictions from all four products and both sums per sample, with the same W for all eight rows.

Zero-based storage indexStored value
00
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150

fresh_stage_0_Forward

Sample=8 × ForwardField=6 · float64 · precision 8 · Actual product00,product01,product10,product11,prediction0,prediction1; no zero-product shortcut.

Zero-based storage indexStored value
00
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
210
220
230
240
250
260
270
280
290
300
310
320
330
340
350
360
370
380
390
400
410
420
430
440
450
460
470

fresh_stage_0_Loss

Sample=8 × LossField=9 · float64 · precision 8 · Actual target0,target1,error0,error1,square0,square1,half0,half1,sampleLoss in sample order; each sample loss sums both output half-losses.

Zero-based storage indexStored value
00.5
11
2-0.5
3-1
40.25
51
60.125
70.5
80.625
90.25
100.5
11-0.25
12-0.5
130.0625
140.25
150.03125
160.125
170.15625
180.5
19-0.25
20-0.5
210.25
220.25
230.0625
240.125
250.03125
260.15625
271
28-0.5
29-1
300.5
311
320.25
330.5
340.125
350.625
360.375
370.75
38-0.375
39-0.75
400.140625
410.5625
420.0703125
430.28125
440.3515625
450.125
460.25
47-0.125
48-0.25
490.015625
500.0625
510.0078125
520.03125
530.0390625
540.25
55-0.125
56-0.25
570.125
580.0625
590.015625
600.03125
610.0078125
620.0390625
630.75
64-0.375
65-0.75
660.375
670.5625
680.140625
690.28125
700.0703125
710.3515625

fresh_stage_0_Reductions

Dataset=2 × DatasetSample=4 × ReductionField=3 · float64 · precision 8 · Actual saved loss, oldSum, sum for each ordered four-sample reduction, training then validation, each initialized at floating positive zero.

Zero-based storage indexStored value
00.625
10
20.625
30.15625
40.625
50.78125
60.15625
70.78125
80.9375
90.625
100.9375
111.5625
120.3515625
130
140.3515625
150.0390625
160.3515625
170.390625
180.0390625
190.390625
200.4296875
210.3515625
220.4296875
230.78125

fresh_stage_0_Means

Dataset=2 · float64 · precision 8 · Actual independent training and validation means; each divides its own ordered four-sample sum by floating four.

Zero-based storage indexStored value
00.390625
10.1953125

fresh_stage_0_GradientRows

Coordinate=4 × TrainSample=4 × GradientRowField=5 · float64 · precision 8 · Actual error,feature,contribution,oldSum,sum in coordinate-major then training-row order; each contraction starts at floating positive zero.

Zero-based storage indexStored value
0-0.5
10
2-0
30
40
5-0.25
60
7-0
80
90
10-0.5
110.5
12-0.25
130
14-0.25
15-1
161
17-1
18-0.25
19-1.25
20-0.5
211
22-0.5
230
24-0.5
25-0.25
260.5
27-0.125
28-0.5
29-0.625
30-0.5
310
32-0
33-0.625
34-0.625
35-1
360
37-0
38-0.625
39-0.625
40-1
410
42-0
430
440
45-0.5
460
47-0
480
490
500.25
510.5
520.125
530
540.125
550.5
561
570.5
580.125
590.625
60-1
611
62-1
630
64-1
65-0.5
660.5
67-0.25
68-1
69-1.25
700.25
710
720
73-1.25
74-1.25
750.5
760
770
78-1.25
79-1.25

fresh_stage_0_MathematicalGradient

Output=2 × Feature=2 · float64 · precision 8 · All four actual derivatives of the current training objective; the final cohort stage is diagnostic only.

Zero-based storage indexStored value
0-0.3125
1-0.15625
20.15625
3-0.3125

fresh_stage_0_EffectiveGradient

Output=2 × Feature=2 · float64 · precision 8 · Actual conditional mathematical-gradient or floating-positive-zero selection, in row-major W order.

Zero-based storage indexStored value
0-0.3125
1-0.15625
20.15625
3-0.3125

fresh_stage_0_Mask

Output=2 × Feature=2 · int32 · precision 0 · Actual numeric zero-or-one selectors in row-major W order; integer values select effective gradients, never rescale features.

Zero-based storage indexStored value
01
11
21
31

fresh_stage_0_Stats

StageField=4 · float64 · precision 8 · Actual training mean,validation mean,diagnosticOnly,hasNextUpdate in texts.stageFields order; last two positions are integer VALUE selectors.

Zero-based storage indexStored value
00.390625
10.1953125
20
31

fresh_update_1_Update

Coordinate=4 × UpdateField=7 · float64 · precision 8 · Actual old,mathematical,effective,enabled,delta,proposed,committed; enabled is an integer VALUE in this mixed float table. Frozen commits copy the old word, including nonzero values and negative zero.

Zero-based storage indexStored value
00
1-0.3125
2-0.3125
31
4-0.15625
50.15625
60.15625
70
8-0.15625
9-0.15625
101
11-0.078125
120.078125
130.078125
140
150.15625
160.15625
171
180.078125
19-0.078125
20-0.078125
210
22-0.3125
23-0.3125
241
25-0.15625
260.15625
270.15625

fresh_stage_1_Weights

Output=2 × Feature=2 · float64 · precision 8 · Detached actual same-state W, row-major 00,01,10,11; arbitrary finite represented weights are permitted.

Zero-based storage indexStored value
00.15625
10.078125
2-0.078125
30.15625

fresh_stage_1_Predictions

Sample=8 × Output=2 · float64 · precision 8 · Actual two-output predictions from all four products and both sums per sample, with the same W for all eight rows.

Zero-based storage indexStored value
00.078125
10.15625
20.0390625
30.078125
40.078125
5-0.0390625
60.15625
7-0.078125
80.05859375
90.1171875
100.01953125
110.0390625
120.0390625
13-0.01953125
140.1171875
15-0.05859375

fresh_stage_1_Forward

Sample=8 × ForwardField=6 · float64 · precision 8 · Actual product00,product01,product10,product11,prediction0,prediction1; no zero-product shortcut.

Zero-based storage indexStored value
00
10.078125
2-0
30.15625
40.078125
50.15625
60
70.0390625
8-0
90.078125
100.0390625
110.078125
120.078125
130
14-0.0390625
150
160.078125
17-0.0390625
180.15625
190
20-0.078125
210
220.15625
23-0.078125
240
250.05859375
26-0
270.1171875
280.05859375
290.1171875
300
310.01953125
32-0
330.0390625
340.01953125
350.0390625
360.0390625
370
38-0.01953125
390
400.0390625
41-0.01953125
420.1171875
430
44-0.05859375
450
460.1171875
47-0.05859375

fresh_stage_1_Loss

Sample=8 × LossField=9 · float64 · precision 8 · Actual target0,target1,error0,error1,square0,square1,half0,half1,sampleLoss in sample order; each sample loss sums both output half-losses.

Zero-based storage indexStored value
00.5
11
2-0.421875
3-0.84375
40.177978515625
50.7119140625
60.0889892578125
70.35595703125
80.4449462890625
90.25
100.5
11-0.2109375
12-0.421875
130.04449462890625
140.177978515625
150.022247314453125
160.0889892578125
170.111236572265625
180.5
19-0.25
20-0.421875
210.2109375
220.177978515625
230.04449462890625
240.0889892578125
250.022247314453125
260.111236572265625
271
28-0.5
29-0.84375
300.421875
310.7119140625
320.177978515625
330.35595703125
340.0889892578125
350.4449462890625
360.375
370.75
38-0.31640625
39-0.6328125
400.1001129150390625
410.40045166015625
420.05005645751953125
430.200225830078125
440.25028228759765625
450.125
460.25
47-0.10546875
48-0.2109375
490.0111236572265625
500.04449462890625
510.00556182861328125
520.022247314453125
530.02780914306640625
540.25
55-0.125
56-0.2109375
570.10546875
580.04449462890625
590.0111236572265625
600.022247314453125
610.00556182861328125
620.02780914306640625
630.75
64-0.375
65-0.6328125
660.31640625
670.40045166015625
680.1001129150390625
690.200225830078125
700.05005645751953125
710.25028228759765625

fresh_stage_1_Reductions

Dataset=2 × DatasetSample=4 × ReductionField=3 · float64 · precision 8 · Actual saved loss, oldSum, sum for each ordered four-sample reduction, training then validation, each initialized at floating positive zero.

Zero-based storage indexStored value
00.4449462890625
10
20.4449462890625
30.111236572265625
40.4449462890625
50.556182861328125
60.111236572265625
70.556182861328125
80.66741943359375
90.4449462890625
100.66741943359375
111.11236572265625
120.25028228759765625
130
140.25028228759765625
150.02780914306640625
160.25028228759765625
170.2780914306640625
180.02780914306640625
190.2780914306640625
200.30590057373046875
210.25028228759765625
220.30590057373046875
230.556182861328125

fresh_stage_1_Means

Dataset=2 · float64 · precision 8 · Actual independent training and validation means; each divides its own ordered four-sample sum by floating four.

Zero-based storage indexStored value
00.2780914306640625
10.13904571533203125

fresh_stage_1_GradientRows

Coordinate=4 × TrainSample=4 × GradientRowField=5 · float64 · precision 8 · Actual error,feature,contribution,oldSum,sum in coordinate-major then training-row order; each contraction starts at floating positive zero.

Zero-based storage indexStored value
0-0.421875
10
2-0
30
40
5-0.2109375
60
7-0
80
90
10-0.421875
110.5
12-0.2109375
130
14-0.2109375
15-0.84375
161
17-0.84375
18-0.2109375
19-1.0546875
20-0.421875
211
22-0.421875
230
24-0.421875
25-0.2109375
260.5
27-0.10546875
28-0.421875
29-0.52734375
30-0.421875
310
32-0
33-0.52734375
34-0.52734375
35-0.84375
360
37-0
38-0.52734375
39-0.52734375
40-0.84375
410
42-0
430
440
45-0.421875
460
47-0
480
490
500.2109375
510.5
520.10546875
530
540.10546875
550.421875
561
570.421875
580.10546875
590.52734375
60-0.84375
611
62-0.84375
630
64-0.84375
65-0.421875
660.5
67-0.2109375
68-0.84375
69-1.0546875
700.2109375
710
720
73-1.0546875
74-1.0546875
750.421875
760
770
78-1.0546875
79-1.0546875

fresh_stage_1_MathematicalGradient

Output=2 × Feature=2 · float64 · precision 8 · All four actual derivatives of the current training objective; the final cohort stage is diagnostic only.

Zero-based storage indexStored value
0-0.263671875
1-0.1318359375
20.1318359375
3-0.263671875

fresh_stage_1_EffectiveGradient

Output=2 × Feature=2 · float64 · precision 8 · Actual conditional mathematical-gradient or floating-positive-zero selection, in row-major W order.

Zero-based storage indexStored value
0-0.263671875
1-0.1318359375
20.1318359375
3-0.263671875

fresh_stage_1_Mask

Output=2 × Feature=2 · int32 · precision 0 · Actual numeric zero-or-one selectors in row-major W order; integer values select effective gradients, never rescale features.

Zero-based storage indexStored value
01
11
21
31

fresh_stage_1_Stats

StageField=4 · float64 · precision 8 · Actual training mean,validation mean,diagnosticOnly,hasNextUpdate in texts.stageFields order; last two positions are integer VALUE selectors.

Zero-based storage indexStored value
00.2780914306640625
10.13904571533203125
21
30

fresh_StageMetrics

Stage=2 × Dataset=2 · float64 · precision 8 · Only actual cohort stages zero through its requested update count; training then independently computed validation mean.

Zero-based storage indexStored value
00.390625
10.1953125
20.2780914306640625
30.13904571533203125

fresh_StageWeights

Stage=2 × Coordinate=4 · float64 · precision 8 · Only actual evaluated cohort weights in row-major 00,01,10,11 order; final weights have a real final evaluation.

Zero-based storage indexStored value
00
10
20
30
40.15625
50.078125
6-0.078125
70.15625

memorizer_Dictionary

TrainKey=4 × DictionaryField=3 · float64 · precision 8 · Actual copied training x,adaptTarget0,adaptTarget1; four keys plus eight target values, twelve extra numeric slots.

Zero-based storage indexStored value
0-1
10.5
21
3-0.5
40.25
50.5
60.5
70.5
8-0.25
91
101
11-0.5

memorizer_Comparisons

Sample=8 × TrainKey=4 × ComparisonField=5 · float64 · precision 8 · Actual x,keyX,equal,oldMatch,match for all 32 comparisons; equal and both match columns are integer VALUE positions in this mixed float table.

Zero-based storage indexStored value
0-1
1-1
21
3-1
40
5-1
6-0.5
70
80
90
10-1
110.5
120
130
140
15-1
161
170
180
190
20-0.5
21-1
220
23-1
24-1
25-0.5
26-0.5
271
28-1
291
30-0.5
310.5
320
331
341
35-0.5
361
370
381
391
400.5
41-1
420
43-1
44-1
450.5
46-0.5
470
48-1
49-1
500.5
510.5
521
53-1
542
550.5
561
570
582
592
601
61-1
620
63-1
64-1
651
66-0.5
670
68-1
69-1
701
710.5
720
73-1
74-1
751
761
771
78-1
793
80-0.75
81-1
820
83-1
84-1
85-0.75
86-0.5
870
88-1
89-1
90-0.75
910.5
920
93-1
94-1
95-0.75
961
970
98-1
99-1
100-0.25
101-1
1020
103-1
104-1
105-0.25
106-0.5
1070
108-1
109-1
110-0.25
1110.5
1120
113-1
114-1
115-0.25
1161
1170
118-1
119-1
1200.25
121-1
1220
123-1
124-1
1250.25
126-0.5
1270
128-1
129-1
1300.25
1310.5
1320
133-1
134-1
1350.25
1361
1370
138-1
139-1
1400.75
141-1
1420
143-1
144-1
1450.75
146-0.5
1470
148-1
149-1
1500.75
1510.5
1520
153-1
154-1
1550.75
1561
1570
158-1
159-1

memorizer_Selections

Sample=8 × SelectionField=9 · float64 · precision 8 · Actual match,sourceKind,sourceSample,sourceIndex0,sourceIndex1,source0,source1,prediction0,prediction1; first five columns are integer VALUE positions. Source zero indexes target columns at 3*match+1 and 3*match+2 in the flat stored Dictionary:[4,3]; source one indexes 2*sample and 2*sample+1 in the flat saved prepared Predictions:[8,2].

Zero-based storage indexStored value
00
10
20
31
42
50.5
61
70.5
81
91
100
111
124
135
140.25
150.5
160.25
170.5
182
190
202
217
228
230.5
24-0.25
250.5
26-0.25
273
280
293
3010
3111
321
33-0.5
341
35-0.5
36-1
371
384
398
409
410
420.216064453125
430
440.216064453125
45-1
461
475
4810
4911
500
510.072021484375
520
530.072021484375
54-1
551
566
5712
5813
590.072021484375
600
610.072021484375
620
63-1
641
657
6614
6715
680.216064453125
690
700.216064453125
710

memorizer_Predictions

Sample=8 × Output=2 · float64 · precision 8 · Actual selected two-output values; no new neural forward, gradient or optimizer step.

Zero-based storage indexStored value
00.5
11
20.25
30.5
40.5
5-0.25
61
7-0.5
80
90.216064453125
100
110.072021484375
120.072021484375
130
140.216064453125
150

memorizer_Matches

Sample=8 · int32 · precision 0 · Actual first matching training-key index or minus one for every sample; fixed data gives four matches and four misses.

Zero-based storage indexStored value
00
11
22
33
4-1
5-1
6-1
7-1

memorizer_Loss

Sample=8 × LossField=9 · float64 · precision 8 · Actual target0,target1,error0,error1,square0,square1,half0,half1,sampleLoss in sample order; each sample loss sums both output half-losses.

Zero-based storage indexStored value
00.5
11
20
30
40
50
60
70
80
90.25
100.5
110
120
130
140
150
160
170
180.5
19-0.25
200
210
220
230
240
250
260
271
28-0.5
290
300
310
320
330
340
350
360.375
370.75
38-0.375
39-0.533935546875
400.140625
410.2850871682167053
420.0703125
430.14254358410835266
440.21285608410835266
450.125
460.25
47-0.125
48-0.177978515625
490.015625
500.03167635202407837
510.0078125
520.015838176012039185
530.023650676012039185
540.25
55-0.125
56-0.177978515625
570.125
580.03167635202407837
590.015625
600.015838176012039185
610.0078125
620.023650676012039185
630.75
64-0.375
65-0.533935546875
660.375
670.2850871682167053
680.140625
690.14254358410835266
700.0703125
710.21285608410835266

memorizer_Reductions

Dataset=2 × DatasetSample=4 × ReductionField=3 · float64 · precision 8 · Actual saved loss, oldSum, sum for each ordered four-sample reduction, training then validation, each initialized at floating positive zero.

Zero-based storage indexStored value
00
10
20
30
40
50
60
70
80
90
100
110
120.21285608410835266
130
140.21285608410835266
150.023650676012039185
160.21285608410835266
170.23650676012039185
180.023650676012039185
190.23650676012039185
200.26015743613243103
210.21285608410835266
220.26015743613243103
230.4730135202407837

memorizer_Means

Dataset=2 · float64 · precision 8 · Actual independent training and validation means; each divides its own ordered four-sample sum by floating four.

Zero-based storage indexStored value
00
10.11825338006019592

Check your understanding

Use the inputs stated in each question. Live questions use the current calculation. Each option pairs a value or conclusion with its mechanism. Editing a raw input, resetting or selecting a trace step clears graded answers; local inspection selectors preserve them.

1. In this lab, what changes when the prepared network moves from PRE to ADAPT?
2. Fixed case: preUpdates=1, updates=0, scope=0, η=1/2 (PRE η is also fixed at 1/2). At PRE stage 1, W=diag(5/32,5/32). For x=−1, what are the prediction, sample loss and four-sample row-batch prediction shape?
3. Fixed case: preUpdates=2, updates=1, scope=1, η=1/2. Prepared ADAPT starts at W=[295/1024,0,0,295/1024] with mathematical gradient [−3645/16384,−5/32,+5/32,−3645/16384]. What is the simultaneous committed W in row-major order?
4. Current whole saved root: preUpdates=2, updates=1, scope=0, η=0.5 (PRE η=0.5). Final ADAPT validation: prepared=0.08418624420301057, fresh=0.13904571533203125, memorizer=0.11825338006019592; train: prepared=0.16837248840602115, fresh=0.2780914306640625, memorizer=0. Saved stages=7, optimizer batches=4, gradient rows=28, gradient products=112. Which reading is justified? Local inspection does not change this case.
5. Fixed case: preUpdates=2, updates=1, scope=0, η=1/2. The dictionary has ADAPT training loss 0 and validation loss 3967925/33554432, while fine-tuned validation is 2892617325/34359738368. What does the lookup demonstrate?

Exactly five graded questions use the saved calculation. Fixed cases name all four raw inputs; the live question uses the complete current root. Inspection preserves answers; raw edits, reset and trace navigation clear answers. The chapter’s source panels explain the corresponding Python calculation.

Follow the saved experiment

The default case requests two PRE updates, one ADAPT update per comparison group, full ADAPT scope and ADAPT learning rate 1/21/2. PRE always starts from zero, trains all four weights and uses its own fixed rate 1/21/2. Editing a raw input starts the complete calculation again, including PRE; it does not continue from the locally inspected weights. There is no text input in this lab.

Raw fieldControl labelPermitted valuesDefault
preUpdates (PP)PRE updates from zero (learning rate fixed at 0.5)Integers 0–32
updates (UU)ADAPT updates (each of prepared and fresh)Integers 0–31
scopeADAPT scope (PRE always trains all four weights)0: train W00, W01, W10 and W11; 1: train W00 and W11, freeze old cross weights0
eta (η\eta)ADAPT learning rate η (eta; from 0 to 2)Any finite number in [0,2]0.5

The four summary cards report fineTunedValidationLoss, freshValidationLoss, memorizerValidationLoss and trainableAdaptParameters. The first three measure the final ADAPT objective for prepared, fresh and lookup predictions; the fourth counts enabled ADAPT weights. They do not report the locally selected stage. The separate table PRE objective only: every saved stage and weight reports the earlier feature-copy task. Use ADAPT objective: every saved prepared and fresh stage and weight and Whole current root: final ADAPT comparison to compare the new task fairly.

Four further selectors inspect already saved evidence. Cohort (inspection only) starts at option 1, prepared ADAPT; Evaluated stage (inspection only) starts at stage 0, before its first fine step. Sample (inspection only) starts at train0 (x=−1x=-1); Readout coordinate (inspection only) starts at W00. Cohorts 0, 1 and 2 are PRE, prepared ADAPT and fresh ADAPT. Samples 0–3 train; 4–7 are held out. Coordinate options follow W00, W01, W10, W11. Stage options run from 0 through that cohort’s requested update count, with its last stage marked final diagnostic.

Inspection changes neither raw inputs nor the calculation, trace cursor or graded answers. Each local index is bounded to the new saved domain before any stage or tensor lookup. If stage 3 is selected and you reduce its update count to 0, inspection reads stage 0 immediately. The remembered stage choice may reappear when the larger domain returns. Reset example restores the four raw defaults and trace start; choose prepared cohort and stage 0 explicitly when returning to this walkthrough, because local inspection has its own state.

At the default prepared stage 0, open Selected sample: actual feature construction, forward and loss operands. For train0 it shows the once-computed features, the copied PRE weights, and the new ADAPT error calculation derived below. Then read the four mathematical/effective gradients, the selected coordinate’s four training contributions, and adapt update 1: four proposals from the same old W. Select stage 1 to inspect the evaluated committed result: it has diagnostic gradients and no outgoing proposal table. The lookup tables separately expose all dictionary rows, all eight selections, all 32 comparisons and all eight losses, including source indices and copied operands.

Previous step, Next step and Calculation step navigate the saved operation sequence; this trace selection is independent of local inspection. Matching operations in an open evidence disclosure are marked current. Raw edits, reset and trace navigation clear graded answers. The four inspection selectors preserve answers. Invalid raw drafts show an explicit reason and remove the unavailable results and questions until corrected. A very small positive rate can round a proposed change away; a requested step does not guarantee numerical movement or a strict loss decrease. Positive and negative zero remain visible as different stored words.

Open Inspect all stored values, text metadata and tensor storage for every scalar output, complete text evidence, tensor axes, dtype, display precision and flat storage index. The named table regions can receive keyboard focus and scroll horizontally; the same numbers and operation descriptions are available as text. The five corrective questions appear only inside the lab. Their fixed cases state all four inputs, while the live question reads the entire current calculation independently of inspection.

What we keep and what we change

A sample is one input and its target answer. A feature is a number computed from that input. A readout combines features into outputs. A parameter is a stored model number that an update may replace. A target is the answer against which we compare a prediction; it is not another prediction.

Here the scalar input is xx. “Scalar” means one number. The feature column is

ϕ(x)=[ϕ+(x)ϕ−(x)]=[max⁡(0,x)max⁡(0,−x)].\phi(x)=\begin{bmatrix}\phi_+(x)\\\phi_-(x)\end{bmatrix} =\begin{bmatrix}\max(0,x)\\\max(0,-x)\end{bmatrix}.

The symbol ϕ\phi names the feature function. ReLU, the rectified linear unit, keeps a positive argument and replaces a negative argument with zero. At x=−1/2x=-1/2, the two arguments are −1/2-1/2 and +1/2+1/2, so the feature column is (0,1/2)T(0,1/2)^T. The superscript TT means transpose: writing the pair across the page and transposing makes it a column. At positive inputs only ϕ+\phi_+ is nonzero; at negative inputs only ϕ−\phi_- is nonzero. Neither feature is adjustable.

IngredientPRE: earlier taskADAPT: new task
Inputs and featuresFour fixed training inputs and four held-out inputs; fixed ϕ\phiThe same inputs and features
TargetsCopy the two feature valuesMix them by the explicit rule below
Stored parametersFour readout weights, starting at positive zeroFour weights, copied from final PRE or freshly zeroed
Loss formSum two output half-squared errors, then average four samplesThe same form, against ADAPT targets
Updated coordinatesAll fourAll four, or only the two diagonal coordinates
Learning rateFixed 1/21/2Chosen η\eta; default 1/21/2

The earlier and later objectives have the same formula but different targets. Even at identical weights they are different functions. Compare prepared and fresh starts on the ADAPT objective; comparing a PRE loss with an ADAPT loss would mix the task change into the initialization comparison.

Four weights, two output rows

Let WW be the weight matrix, and y^\widehat y the prediction column. A hat marks a prediction rather than a target:

W=[W00W01W10W11],y^=Wϕ=[W00ϕ++W01ϕ−W10ϕ++W11ϕ−].W=\begin{bmatrix}W_{00}&W_{01}\\W_{10}&W_{11}\end{bmatrix},\qquad \widehat y=W\phi =\begin{bmatrix}W_{00}\phi_++W_{01}\phi_-\\W_{10}\phi_++W_{11}\phi_-\end{bmatrix}.

Indices start at zero. The first index of WoiW_{oi} chooses output row oo; the second chooses feature column ii. Feature index 0 means plus, and index 1 means minus. There is no bias or extra constant term. Each sample requires four products followed by two row sums, including products whose numerical value is zero.

QuantityShapeAxes and meaning
ϕ\phi[2,1]Feature, singleton column
WW[2,2]Output, Feature
y^\widehat y and target yy[2,1]Output, singleton column
Stored flat weights[4]W00,W01,W10,W11W_{00},W_{01},W_{10},W_{11}, row-major order
Training feature rows FF[4,2]Sample, Feature; row jj is ϕ(xj)T\phi(x_j)^T
Batch predictions FWTFW^T[4,2]Sample, Output

“Row-major” means store the first row before the second row. A batch places samples in rows, so its multiplication uses WTW^T: [4,2] times [2,2] gives [4,2]. This is the transpose of the single-sample calculation, not a silent switch in what the weights mean. A tensor is an array with named axes; the names tell us what each index selects.

Eight authored samples and two actual target rules

These inputs and rules are authored teaching data. They are nonrandom, not observations from a population. Training uses −1,−1/2,1/2,1-1,-1/2,1/2,1 in that order. Validation uses −3/4,−1/4,1/4,3/4-3/4,-1/4,1/4,3/4 in that order. No validation error enters a gradient.

PRE copies the features: yPRE=(ϕ+,ϕ−)Ty^{\mathrm{PRE}}=(\phi_+,\phi_-)^T. ADAPT uses the fixed target matrix

T=[11/2−1/21],yADAPT=Tϕ.T=\begin{bmatrix}1&1/2\\-1/2&1\end{bmatrix},\qquad y^{\mathrm{ADAPT}}=T\phi.

TT specifies the target rule; it is not the adjustable WW. Construct ADAPT targets by computing (1/2)ϕ−(1/2)\phi_-, adding it to ϕ+\phi_+, computing (−1/2)ϕ+(-1/2)\phi_+, then adding it to ϕ−\phi_-. Those are two half-scalings and two additions per sample. PRE simply copies two features; it does not need a fictitious identity-matrix computation.

SplitInput xxPositive feature ϕ+\phi_+Negative feature ϕ−\phi_-PRE y0y_0PRE y1y_1ADAPT y0y_0ADAPT y1y_1
Train 0−101011/21
Train 1−1/201/201/21/41/2
Train 21/21/201/201/2−1/4
Train 3110101−1/2
Validation 0−3/403/403/43/83/4
Validation 1−1/401/401/41/81/4
Validation 21/41/401/401/4−1/8
Validation 33/43/403/403/4−3/8

Each numerical data row has seven fields: input, two features, two PRE targets, two ADAPT targets. The split label in this table is explanatory. Features and targets are prepared once for all three training paths. Changing the task chooses target columns; it does not regenerate features or change the held-out inputs.

The loss: sum two outputs, average four samples

Write ejo=y^jo−yjoe_{jo}=\widehat y_{jo}-y_{jo} for the signed error of output oo on sample jj. The index jj selects one of the four samples in the split being evaluated. For one sample, compute each error, each square and each half before adding the outputs:

ℓj=ej022+ej122,Ltrain=ℓ0+ℓ1+ℓ2+ℓ34.\ell_j=\frac{e_{j0}^2}{2}+\frac{e_{j1}^2}{2},\qquad L_{\mathrm{train}}=\frac{\ell_0+\ell_1+\ell_2+\ell_3}{4}.

ℓ\ell names a sample loss and LL a dataset mean. Validation has the identical reduction over its own four losses. This chapter’s two-output half-MSE is the mean over samples of the sum of two output half-losses. We divide by 4, not 8. Averaging eight output coordinates would define a different loss and halve every gradient.

The ordered calculation starts a sum at floating positive zero, adds the four saved sample losses in row order, then divides once by 4. It evaluates all eight samples using the same weights before any replacement. Validation is independently computed from its own predictions, not filled in by halving a training result.

For example, at fresh zero weights on ADAPT, x=−1x=-1 predicts (0,0)(0,0) against (1/2,1)(1/2,1). Its errors are (−1/2,−1)(-1/2,-1), squares (1/4,1)(1/4,1), halves (1/8,1/2)(1/8,1/2), and sample loss 5/85/8. At x=−1/2x=-1/2 everything scales by half before squaring, giving halves (1/32,1/8)(1/32,1/8) and sample loss 5/325/32. The four training losses are (5/8,5/32,5/32,5/8)(5/8,5/32,5/32,5/8); running sums are 20/32,25/32,30/32,50/3220/32,25/32,30/32,50/32. Their mean is 25/6425/64.

Why all four derivatives have an error times a feature

A gradient collects the derivatives of a loss with respect to its parameters. A derivative tells us the local loss change per small parameter change. Gradient descent subtracts a scaled gradient: moving opposite that local slope is the reason for the minus sign. A learning rate sets the scale of that subtraction. Here a full training batch means all four training samples, with no stochastic sample selection.

For one output, the chain rule differentiates half the squared error, then the error, then the prediction. The target and features stay fixed:

∂(ejo2/2)∂ejo=ejo,∂ejo∂y^jo=1.\frac{\partial(e_{jo}^2/2)}{\partial e_{jo}}=e_{jo},\qquad \frac{\partial e_{jo}}{\partial\widehat y_{jo}}=1.

Only its own output row depends on a weight. Thus all four chains, including the other output’s zero contribution, are

∂ℓj/∂W00=ej0⋅1⋅ϕ+(xj)+ej1⋅1⋅0,∂ℓj/∂W01=ej0⋅1⋅ϕ−(xj)+ej1⋅1⋅0,∂ℓj/∂W10=ej0⋅1⋅0+ej1⋅1⋅ϕ+(xj),∂ℓj/∂W11=ej0⋅1⋅0+ej1⋅1⋅ϕ−(xj).\begin{aligned} \partial\ell_j/\partial W_{00}&=e_{j0}\cdot1\cdot\phi_+(x_j)+e_{j1}\cdot1\cdot0,\\ \partial\ell_j/\partial W_{01}&=e_{j0}\cdot1\cdot\phi_-(x_j)+e_{j1}\cdot1\cdot0,\\ \partial\ell_j/\partial W_{10}&=e_{j0}\cdot1\cdot0+e_{j1}\cdot1\cdot\phi_+(x_j),\\ \partial\ell_j/\partial W_{11}&=e_{j0}\cdot1\cdot0+e_{j1}\cdot1\cdot\phi_-(x_j). \end{aligned}

The computed contractions need only the surviving error-feature products; those extra zero terms explain the calculus, not additional numerical operations. Define Goi=∂Ltrain/∂WoiG_{oi}=\partial L_{\mathrm{train}}/\partial W_{oi}. For each coordinate, multiply its four training errors by its feature, accumulate in training order from positive zero, and divide by 4:

Goi=14∑j=03ejoϕi(xj).G_{oi}=\frac14\sum_{j=0}^{3}e_{jo}\phi_i(x_j).

The summation symbol means add the terms for the indicated indices. There is no derivative of a validation loss in GG, and no derivative of ReLU with respect to a learned hidden weight: there is no such learned weight here.

First actually prepare the model: PRE stages 0, 1 and 2

A stage is an evaluated weight state; an update is a transition to a new state. Two updates require three evaluations: before either update, after the first, and after the second. PRE always starts with four positive-zero weights, uses all four coordinates, and has learning rate 1/21/2.

At PRE stage 0 every prediction is zero. For the four training rows, output errors are (0,−1),(0,−1/2),(−1/2,0),(−1,0)(0,-1),(0,-1/2),(-1/2,0),(-1,0). Applying the four chains gives these ordered products:

CoordinateFour error-feature productsRunning sumsDivide last sum by 4
000,0,−1/4,−10,0,-1/4,-10,0,−1/4,−5/40,0,-1/4,-5/4−5/16-5/16
010,0,0,00,0,0,00,0,0,00,0,0,000
100,0,0,00,0,0,00,0,0,00,0,0,000
11−1,−1/4,0,0-1,-1/4,0,0−1,−5/4,−5/4,−5/4-1,-5/4,-5/4,-5/4−5/16-5/16

The tables use rational zero; signed floating zero is discussed below. Subtracting half the gradient produces

W1PRE=[0−(1/2)(−5/16)0−(1/2)00−(1/2)00−(1/2)(−5/16)]=[5/32005/32].W^{\mathrm{PRE}}_1=\begin{bmatrix}0-(1/2)(-5/16)&0-(1/2)0\\0-(1/2)0&0-(1/2)(-5/16)\end{bmatrix} =\begin{bmatrix}5/32&0\\0&5/32\end{bmatrix}.

At stage 1, x=−1x=-1 has four forward products (5/32)⋅0,0⋅1,0⋅0,(5/32)⋅1(5/32)\cdot0,0\cdot1,0\cdot0,(5/32)\cdot1 in coordinate order 00,01,10,11. Row sums give (0,5/32)(0,5/32); subtracting (0,1)(0,1) gives (0,−27/32)(0,-27/32). The squares are (0,729/1024)(0,729/1024), the halves (0,729/2048)(0,729/2048), and the sample loss is 729/2048729/2048. At magnitude 1/21/2 the active error is −27/64-27/64, its square 729/4096729/4096, and its half 729/8192729/8192. The positive inputs exchange which output carries that error.

The second update must use stage 1 errors. Its diagonal products and sums are

G00=(0+0−27/128−27/32)/4=−135/512,G11=(−27/32−27/128+0+0)/4=−135/512.\begin{aligned} G_{00}&=(0+0-27/128-27/32)/4=-135/512,\\ G_{11}&=(-27/32-27/128+0+0)/4=-135/512. \end{aligned}

Their four running sums are respectively (0,0,−27/128,−135/128)(0,0,-27/128,-135/128) and (−27/32,−135/128,−135/128,−135/128)(-27/32,-135/128,-135/128,-135/128). Both off-diagonal product lists and sums are zero. Therefore each diagonal becomes

532−12(−135512)=1601024+1351024=2951024,W2PRE=2951024I.\frac5{32}-\frac12\left(-\frac{135}{512}\right) =\frac{160}{1024}+\frac{135}{1024}=\frac{295}{1024},\qquad W^{\mathrm{PRE}}_2=\frac{295}{1024}I.

II is the two-by-two identity matrix: diagonal entries 1 and off-diagonal entries 0. The final PRE error magnitude per unit input is 1−295/1024=729/10241-295/1024=729/1024. Its square is 531441/1048576531441/1048576. We evaluate this final state and its gradient; that diagnostic does not cause a third pretraining update.

PRE stageDiagonal weightsTraining meanValidation meanEach diagonal gradient
005/165/165/325/32−5/16-5/16
15/325/323645/163843645/163843645/327683645/32768−135/512-135/512
2295/1024295/10242657205/167772162657205/167772162657205/335544322657205/33554432−3645/16384-3645/16384

These fractions are hand-derived consequences of the updates, not weights or losses to insert as canned program inputs. For a third allowed PRE update, the same subtraction gives diagonal 13085/3276813085/32768.

Complete sample arithmetic without hiding the repeated rows

A shared calculation lets us inspect every sample at each default state. In this paragraph aa is a diagonal weight, bb the upper-right weight, and the lower-left weight is −b-b in real arithmetic. Write t=0t=0 for PRE or t=1/2t=1/2 for ADAPT, d=1−ad=1-a for the diagonal shortfall and c=t−bc=t-b for the cross-output shortfall. The input magnitude is v=∣x∣v=|x|, a nonnegative number.

At a negative input, features are (0,v)(0,v). The four forward products are (a⋅0,bv,(−b)⋅0,av)(a\cdot0,bv,(-b)\cdot0,av); row sums give (bv,av)(bv,av). Targets are (tv,v)(tv,v); errors are (−cv,−dv)(-cv,-dv); squares are (c2v2,d2v2)(c^2v^2,d^2v^2); halves are (c2v2/2,d2v2/2)(c^2v^2/2,d^2v^2/2). At a positive input the products are (av,b⋅0,−bv,a⋅0)(av,b\cdot0,-bv,a\cdot0), predictions (av,−bv)(av,-bv), targets (v,−tv)(v,-tv), errors (−dv,+cv)(-dv,+cv), and the two square/half columns exchange places.

Define S=d2+c2S=d^2+c^2, the sum of the two squared shortfalls, and B=S/8B=S/8, the loss at magnitude 1/21/2. These symbols only abbreviate the hand table. The actual loss computation still forms both squares and halves before summing.

StateDiagonal weight aaCross weight bbDiagonal shortfall ddCross shortfall ccSquared diagonal shortfall d2d^2Squared cross shortfall c2c^2Squared-shortfall sum S=d2+c2S=d^2+c^2
PRE 00010101
PRE 15/325/32027/3227/320729/1024729/10240729/1024729/1024
PRE 2295/1024295/10240729/1024729/10240531441/1048576531441/10485760531441/1048576531441/1048576
Prepared ADAPT 0295/1024295/10240729/1024729/10241/21/2531441/1048576531441/1048576262144/1048576262144/1048576793585/1048576793585/1048576
Prepared ADAPT 1, full13085/3276813085/327685/645/6419683/3276819683/3276827/6427/64387420489/1073741824387420489/1073741824191102976/1073741824191102976/1073741824578523465/1073741824578523465/1073741824
Fresh ADAPT 00011/21/211/41/45/45/4
Fresh ADAPT 1, full5/325/325/645/6427/3227/3227/6427/642916/40962916/4096729/4096729/40963645/40963645/4096

Use each row above in the following eight-row table. It explicitly gives the squared magnitudes, halves, losses and running sums for both splits; “negative” and “positive” select the error ordering just derived. This supplies all samples at PRE 1/PRE 2 and at both ADAPT starts and first full fine steps.

SampleSideInput magnitude vvSquared magnitude v2v^2Half-square pairSample lossSplit running loss sum
Train 0Negative11(c2/2,d2/2)(c^2/2,d^2/2)S/2=4BS/2=4B4B4B
Train 1Negative1/21/21/41/4(c2/8,d2/8)(c^2/8,d^2/8)S/8=BS/8=B5B5B
Train 2Positive1/21/21/41/4(d2/8,c2/8)(d^2/8,c^2/8)S/8=BS/8=B6B6B
Train 3Positive11(d2/2,c2/2)(d^2/2,c^2/2)S/2=4BS/2=4B10B10B
Validation 0Negative3/43/49/169/16(9c2/32,9d2/32)(9c^2/32,9d^2/32)9S/32=9B/49S/32=9B/49B/49B/4
Validation 1Negative1/41/41/161/16(c2/32,d2/32)(c^2/32,d^2/32)S/32=B/4S/32=B/410B/410B/4
Validation 2Positive1/41/41/161/16(d2/32,c2/32)(d^2/32,c^2/32)S/32=B/4S/32=B/411B/411B/4
Validation 3Positive3/43/49/169/16(9d2/32,9c2/32)(9d^2/32,9c^2/32)9S/32=9B/49S/32=9B/420B/420B/4

Divide each split’s final running sum by 4: training mean 5S/165S/16 and validation mean 5S/325S/32. For example, PRE 1 uses B=729/8192B=729/8192; PRE 2 uses B=531441/8388608B=531441/8388608. Prepared ADAPT 0 uses B=793585/8388608B=793585/8388608 and prepared ADAPT 1 uses B=578523465/8589934592B=578523465/8589934592. Fresh ADAPT 0 uses B=5/32B=5/32 and fresh ADAPT 1 uses B=3645/32768B=3645/32768. Every fraction in the state-loss tables follows from these individual losses and ordered sums.

The same d,cd,c values also specify every intermediate gradient contraction at these states, including the final diagnostics. Each list below uses only the four training rows. Substitute a state row’s d,cd,c; for example PRE 2 uses 729/1024,0729/1024,0, whereas prepared ADAPT 0 uses 729/1024,1/2729/1024,1/2. This table is real-arithmetic shorthand; the numerical calculation retains each signed-zero product as well.

CoordinateFour error-feature productsFour running sums from positive zeroFinal sum /4
000,0,−d/4,−d0,0,-d/4,-d0,0,−d/4,−5d/40,0,-d/4,-5d/4−5d/16-5d/16
01−c,−c/4,0,0-c,-c/4,0,0−c,−5c/4,−5c/4,−5c/4-c,-5c/4,-5c/4,-5c/4−5c/16-5c/16
100,0,c/4,c0,0,c/4,c0,0,c/4,5c/40,0,c/4,5c/4+5c/16+5c/16
11−d,−d/4,0,0-d,-d/4,0,0−d,−5d/4,−5d/4,−5d/4-d,-5d/4,-5d/4,-5d/4−5d/16-5d/16

Change the task; compare two honest starts

The prepared ADAPT path starts from an exact separate copy of the final PRE weights. Fine-tuning must not mutate that saved PRE state. The fresh ADAPT path starts from four positive-zero weights. Both paths use the same ADAPT labels, learning rate and parameter mask. They are two separately computed training paths, not an earlier and later stage of one path.

At the default prepared start, x=−1x=-1 still predicts (0,295/1024)(0,295/1024) but now targets (1/2,1)(1/2,1). Its errors are (−1/2,−729/1024)(-1/2,-729/1024), not the PRE errors. Their squares are (1/4,531441/1048576)(1/4,531441/1048576), halves (1/8,531441/2097152)(1/8,531441/2097152), and sum 793585/2097152793585/2097152.

Sample inputPrediction (y^0,y^1)(\widehat y_0,\widehat y_1)Error (e0,e1)(e_0,e_1)
−1(0,295/1024)(0,295/1024)(−1/2,−729/1024)(-1/2,-729/1024)
−1/2(0,295/2048)(0,295/2048)(−1/4,−729/2048)(-1/4,-729/2048)
1/2(295/2048,0)(295/2048,0)(−729/2048,+1/4)(-729/2048,+1/4)
1(295/1024,0)(295/1024,0)(−729/1024,+1/2)(-729/1024,+1/2)
−3/4(0,885/4096)(0,885/4096)(−3/8,−2187/4096)(-3/8,-2187/4096)
−1/4(0,295/4096)(0,295/4096)(−1/8,−729/4096)(-1/8,-729/4096)
1/4(295/4096,0)(295/4096,0)(−729/4096,+1/8)(-729/4096,+1/8)
3/4(885/4096,0)(885/4096,0)(−2187/4096,+3/8)(-2187/4096,+3/8)

For the default prepared start, the four complete training gradient contractions are

CoordinateFour products in train orderFour running sumsGradient after /4
000,0,−729/4096,−729/10240,0,-729/4096,-729/10240,0,−729/4096,−3645/40960,0,-729/4096,-3645/4096−3645/16384-3645/16384
01−1/2,−1/8,0,0-1/2,-1/8,0,0−1/2,−5/8,−5/8,−5/8-1/2,-5/8,-5/8,-5/8−5/32-5/32
100,0,+1/8,+1/20,0,+1/8,+1/20,0,+1/8,+5/80,0,+1/8,+5/8+5/32+5/32
11−729/1024,−729/4096,0,0-729/1024,-729/4096,0,0−729/1024,−3645/4096,−3645/4096,−3645/4096-729/1024,-3645/4096,-3645/4096,-3645/4096−3645/16384-3645/16384

For the fresh start substitute diagonal shortfall 1 for 729/1024729/1024: the 00 products become (0,0,−1/4,−1)(0,0,-1/4,-1) and the 11 products (−1,−1/4,0,0)(-1,-1/4,0,0), with the PRE-0 running sums already shown. The 01 and 10 lists stay exactly as in this table. Thus fresh ADAPT’s initial gradient is (−5/16,−5/32,+5/32,−5/16)(-5/16,-5/32,+5/32,-5/16), in row-major order.

One fine step: old weights first, simultaneous replacement

An optimizer is the rule that turns a gradient and settings into replacement parameters. We use the SGD (stochastic gradient descent) update rule, but here each step uses the whole fixed four-sample batch, with no random sampling. Thus the example’s parameter updates are deterministic.

A mask is a four-entry list telling us which coordinates may change. Full adaptation uses (1,1,1,1)(1,1,1,1). Diagonal adaptation uses (1,0,0,1)(1,0,0,1). “Diagonal” means positions 00 and 11. The mask applies to both ADAPT paths; PRE always enables all four.

For each coordinate let moim_{oi} be its 0-or-1 mask value. Distinguish the mathematical gradient GG, the effective gradient GeffG^{\mathrm{eff}}, the subtracted change Δ\Delta, a proposed weight WpropW^{\mathrm{prop}} and the committed new weight WnewW^{\mathrm{new}}:

Goieff={Goimoi=1+0moi=0,Δoi=ηGoieff,Woiprop=Woiold−Δoi,Woinew={Woipropmoi=1Woioldmoi=0.\begin{aligned} G^{\mathrm{eff}}_{oi}&=\begin{cases}G_{oi}&m_{oi}=1\\+0&m_{oi}=0,\end{cases}\\ \Delta_{oi}&=\eta G^{\mathrm{eff}}_{oi},\qquad W^{\mathrm{prop}}_{oi}=W^{\mathrm{old}}_{oi}-\Delta_{oi},\\ W^{\mathrm{new}}_{oi}&=\begin{cases}W^{\mathrm{prop}}_{oi}&m_{oi}=1\\W^{\mathrm{old}}_{oi}&m_{oi}=0.\end{cases} \end{aligned}

All four gradients come from the same old matrix. Calculate all four proposals before publishing any new coordinate. Using an already updated row to calculate another derivative would implement a different algorithm. Even frozen coordinates retain their mathematical gradient and proposal arithmetic. Freezing means copying the old stored value, including its sign if it is zero; it does not mean replacing a nonzero value with zero.

At default η=1/2\eta=1/2, full prepared adaptation gives:

CoordinateOldMathematical = effective gradientUpdate amount Δ=(1/2)G\Delta=(1/2)GProposal = committed new weight
00295/1024295/1024−3645/16384-3645/16384−3645/32768-3645/32768(9440+3645)/32768=13085/32768(9440+3645)/32768=13085/32768
010−5/32-5/32−5/64-5/645/645/64
100+5/32+5/32+5/64+5/64−5/64-5/64
11295/1024295/1024−3645/16384-3645/16384−3645/32768-3645/3276813085/3276813085/32768

Fresh full adaptation subtracts (−5/32,−5/64,+5/64,−5/32)(-5/32,-5/64,+5/64,-5/32) from four zeros, yielding

W1prepared=[13085/327685/64−5/6413085/32768],W1fresh=[5/325/64−5/645/32].W^{\mathrm{prepared}}_1=\begin{bmatrix}13085/32768&5/64\\-5/64&13085/32768\end{bmatrix},\qquad W^{\mathrm{fresh}}_1=\begin{bmatrix}5/32&5/64\\-5/64&5/32\end{bmatrix}.

For a concrete prepared fine1 forward at x=−1x=-1, products are (0,5/64,0,13085/32768)(0,5/64,0,13085/32768) and predictions (5/64,13085/32768)(5/64,13085/32768). Errors are (−27/64,−19683/32768)(-27/64,-19683/32768); squares (729/4096,387420489/1073741824)(729/4096,387420489/1073741824); halves (729/8192,387420489/2147483648)(729/8192,387420489/2147483648). Aligning the half denominators gives sample loss 578523465/2147483648578523465/2147483648. At x=+1x=+1, prediction is (13085/32768,−5/64)(13085/32768,-5/64); errors are (−19683/32768,+27/64)(-19683/32768,+27/64) and the half columns exchange. All remaining magnitudes use the eight-row arithmetic table.

For fresh fine1 at x=−1x=-1, prediction is (5/64,5/32)(5/64,5/32); errors (−27/64,−27/32)(-27/64,-27/32); squares (729/4096,729/1024)(729/4096,729/1024); halves (729/8192,729/2048)(729/8192,729/2048); sample loss 3645/81923645/8192. Scaling by 1/21/2, 3/43/4 or 1/41/4 before squaring supplies its other samples.

The final fine1 gradient is still computed. The same four product chains with prepared d=19683/32768,c=27/64d=19683/32768,c=27/64 give row-major (−98415/524288,−135/1024,+135/1024,−98415/524288)(-98415/524288,-135/1024,+135/1024,-98415/524288). Fresh fine1 gives (−135/512,−135/1024,+135/1024,−135/512)(-135/512,-135/1024,+135/1024,-135/512). These are diagnostics, not instructions for an unrequested second fine step.

ADAPT path and stageTraining meanValidation mean
Prepared initial, before fine-tuning3967925/167772163967925/167772163967925/335544323967925/33554432
Fresh initial, before fine-tuning25/6425/6425/12825/128
Prepared full fine12892617325/171798691842892617325/171798691842892617325/343597383682892617325/34359738368
Fresh full fine118225/6553618225/6553618225/13107218225/131072
Prepared diagonal-only fine13279279725/171798691843279279725/171798691843279279725/343597383683279279725/34359738368
Fresh diagonal-only fine14925/163844925/163844925/327684925/32768

For diagonal-only adaptation, both diagonals take the same steps as above. Cross-coordinate mathematical gradients are still ∓5/32\mp5/32 initially, but effective gradients and default deltas are positive zero; proposals are old minus zero, and commits copy the old zero words. Prepared fine1 then has d=19683/32768,c=1/2d=19683/32768,c=1/2. Its SS is (387420489+268435456)/1073741824=655855945/1073741824(387420489+268435456)/1073741824=655855945/1073741824. Fresh diagonal fine1 has d=27/32,c=1/2d=27/32,c=1/2, so S=(729+256)/1024=985/1024S=(729+256)/1024=985/1024. The sample table and its /4 reductions produce the two diagonal-only means above. The unchanged cross shortfall explains the remaining error; the loss did not become insensitive to those weights merely because we froze them.

This particular earlier task prepares both diagonal coefficients in a direction useful for this particular later task. Both paths spend the same number of fine updates; only the prepared path spends the additional PRE updates. Lower final prepared loss is evidence about these target rules and this budget, not a universal benefit or a fair claim of lower total compute.

Zero counts and zero learning rates have different meanings

The four raw inputs, in order, are preUpdates, updates, scope, eta. Their default values are 2, 1, 0, 0.5. The first two are integer update counts from 0 through 3; scope 0 means all four ADAPT coordinates and scope 1 means the two diagonals. Eta is a finite ADAPT learning rate from 0 through 2. PRE’s learning rate remains 1/21/2.

With preUpdates=0, PRE stage 0 is evaluated but no pretraining happens. Prepared and fresh then start numerically alike; calling that case “benefit from pretraining” would be false. With updates=0, each ADAPT path evaluates its initial state and gradient but makes no fine transition. With eta=0 and positive updates, all requested transitions, proposals, commits and subsequent evaluations still occur, though weight magnitudes do not move. Both +0 and -0 rates follow the actual multiplication/subtraction schedule; enabled zero signs can depend on those operations, while frozen entries copy their exact old words. Eta must be valid even when updates=0.

A subnormal is a representable nonzero floating-point number very close to zero, below the normal exponent range. A positive subnormal eta can be valid yet produce changes that underflow to zero or round away when subtracted from an old weight. The same can happen to some changes at larger rates when the change is small relative to the old number. Read the saved deltas, proposals and losses rather than treating a positive rate or a nonzero update count as proof of progress. A numerically unchanged final matrix does not remove the intervening operations from the record.

Invalid counts, invalid scope and out-of-range finite eta are invalid inputs, rather than requests to clamp to a nearby case. The object must supply exactly the four own data fields; accessors, extra fields and missing fields are rejected. Their descriptors are all captured before their values are consumed. All four values must then be actual finite numbers before any numerical-domain test: a later nonfinite eta takes precedence over an earlier finite out-of-range count. Booleans and numeric strings are not numbers at this boundary. A zero count does not excuse an invalid unused value. Only local inspection indices are bounded to available saved evidence; raw model inputs are never silently clamped.

Count work without calling it a speed measurement

Let PP be preUpdates and UU be updates. The three paths evaluate (P+1)+(U+1)+(U+1)=P+2U+3(P+1)+(U+1)+(U+1)=P+2U+3 network states and perform P+2UP+2U optimizer transitions. Each evaluated state computes all eight two-output forwards and four training gradient contractions. Each transition retains four coordinate proposals, even when two coordinates are frozen.

At the default P=2,U=1P=2,U=1, that means seven state evaluations, four optimizer transitions, 56 sample forwards, seven gradient batches and 16 coordinate proposals. The three final evaluations have diagnostic gradients but no outgoing update. The full-mask case commits 16 enabled-coordinate updates; diagonal scope commits 8 PRE coordinates plus 4 ADAPT coordinates, for 12. There are always four stored weights per path; “two trainable” does not mean two stored.

Each state uses 32 forward multiplications and 16 row additions; 16 error subtractions, 16 squares, 16 divisions by 2 and eight sample-loss additions; eight loss-accumulator additions and two mean divisions; and 16 gradient products, 16 gradient-accumulator additions and four gradient divisions. Each transition uses four eta multiplications and four proposal subtractions before conditional commits. Feature preparation occurs once for eight samples, not once per stage. These are arithmetic counts, not elapsed time, memory bytes, energy, processor instructions or a performance benchmark. Displaying a final diagnostic does not authorize counting an additional training step.

In the stored counters, gradientRowContributions counts the four training rows per gradient batch, so it is 4S4S for S=P+2U+3S=P+2U+3 saved network states. gradientProducts counts their reuse across four coordinates, so it is 16S16S. At the default these are 28 training-row uses and 112 error-feature multiplications, respectively. Dictionary losses add eight loss evaluations and two means, but no gradient rows, gradient products or neural forwards.

How the complete saved record is organized

The defined result has five fields in order: status, outputs, steps, tensors, texts. Each operation step contains id, label, equation, explanation, inputs, outputs; each tensor contains id, shape, axes, dtype, values, provenance, precision. An unavailable result instead has status, code, reason. There is no extra hidden evaluation field in the public result.

The numerical evaluation helper’s TransferEvaluation has eight fields: weights, predictions, trainHalfMSE, validationHalfMSE, mathematicalGradient, effectiveGradient, mask, tensors. Its ten evaluation tensors supply the detailed arithmetic; they are not ten extra scalar return fields. The wrapper adds stage boundaries, trajectories and the whole-experiment comparisons.

There are 76 scalar summaries, beginning with the four visible cards, followed by one alias for every operation output, in operation order. An alias is the step ID, an underscore and its output name; for example adapt_stage_0_gradient_0_mathematical copies that saved gradient. Inputs do not receive these aliases. Copied initialization weights and masks, stage statistics and final metrics retain their actual source operands in the corresponding step inputs. The copies are evidence, not another training step.

Let K=P+2UK=P+2U and S=K+3S=K+3. Counting the source’s actual groups gives 112+29K112+29K operation frames, 52+12K52+12K tensors and 904+174K904+174K scalar outputs including all aliases. At default K=4K=4, this is 228 frames, 100 tensors and 1,600 outputs. At P=U=3P=U=3, K=9K=9, it is 373 frames, 160 tensors and 2,470 outputs. Every defined case has 35 text entries. These are manual source inventories, not measured run results; the saved inspector exposes the computed record when the lab is used.

A dictionary gets training perfect and transfers nothing here

Now construct a different predictor. Store the four training inputs as exact keys and their two ADAPT targets as values. On an exact key match, copy its stored target pair. On a miss, copy the same sample’s saved final PRE prediction, before adaptation. The fallback therefore remains unadapted even if the separate fine-tuning paths have taken more steps.

For each of the eight inputs compare all four keys, in order, including after finding a match. Select the first matching index, or −1-1 if none matches. Our fixed keys are distinct; the first-match rule also makes the selection policy explicit. In the following table T/F means the result of each equality comparison, not a probability.

InputCompare −1Compare −1/2Compare 1/2Compare 1Match indexSelected prediction at default PRE 2
−1TFFF0Stored target (1/2,1)(1/2,1)
−1/2FTFF1Stored target (1/4,1/2)(1/4,1/2)
1/2FFTF2Stored target (1/2,−1/4)(1/2,-1/4)
1FFFT3Stored target (1,−1/2)(1,-1/2)
−3/4FFFF−1Saved PRE prediction (0,885/4096)(0,885/4096)
−1/4FFFF−1Saved PRE prediction (0,295/4096)(0,295/4096)
1/4FFFF−1Saved PRE prediction (295/4096,0)(295/4096,0)
3/4FFFF−1Saved PRE prediction (885/4096,0)(885/4096,0)

That is 32 key comparisons, eight pair selections, four matches and four misses. The dictionary adds four numeric keys and eight target scalars: 12 extra numeric slots, alongside the four already retained prepared weights. This is not a byte count. There is no new neural forward, gradient or SGD step in this lookup procedure. Copying a saved prediction does not run the model again.

The source indices refer to the arrays actually stored. A dictionary row is [x,adaptTarget0,adaptTarget1], with three fields. For matching training-key index jj, its two targets occupy flat indices 3j+13j+1 and 3j+23j+2; using 2j2j would address different fields. The saved PRE prediction array has two fields per sample, so a miss for sample ss copies 2s2s and 2s+12s+1. sourceKind=0 selects the dictionary and sourceKind=1 the same-sample saved PRE pair; sourceSample identifies jj or ss, respectively. All eight computed fields—source kind, source sample, both indices, both source values and both prediction copies—are selection outputs. Matched-target input operands exist only on hits. A miss has no invented zero target pair. If coherent duplicate keys are supplied to the reusable helper, all four comparisons still occur and the first match wins.

Compute losses from the selected predictions. On training inputs both errors are target minus the identical target: their squares, halves and sum are zero, so all four running loss sums and the final training mean are zero. For validation, the errors are exactly the four saved prepared-initial ADAPT errors shown earlier. With C=793585/33554432C=793585/33554432, their losses are (9C,C,C,9C)(9C,C,C,9C), running sums (9C,10C,11C,20C)(9C,10C,11C,20C), and mean 5C=3967925/335544325C=3967925/33554432.

The dictionary therefore has zero training loss while retaining the unadapted prepared validation loss. The full fine-tuned prepared network has nonzero training loss and a lower validation loss. This counterexample disproves the inference “perfect training fit guarantees improvement on held-out inputs.” It does not prove every memorizer behaves alike, nor that our finite validation set detects every possible kind of memorization. The dictionary is explicitly constructed from training answers, not described as a network trained by SGD.

Why these held-out results are unusually easy to predict

A feature ray here is one nonnegative feature direction with varying magnitude. All positive inputs lie on (v,0)(v,0); all negative inputs lie on (0,v)(0,v). The validation grid merely chooses different vv on those same two rays. It contains no new feature direction and tests no new nonlinear rule.

On each training ray, the sum of squared magnitudes is 1+(1/2)2=5/41+(1/2)^2=5/4. On each validation ray it is (3/4)2+(1/4)2=10/16=5/8(3/4)^2+(1/4)^2=10/16=5/8, exactly half as much. Since every fixed-weight prediction and both target rules scale linearly with vv, every squared error scales with v2v^2. Both splits divide by four. Consequently, for any fixed WW on either of these homogeneous target tasks,

Lvalidation=12Ltrainin exact real arithmetic.L_{\mathrm{validation}}=\frac12L_{\mathrm{train}}\quad\text{in exact real arithmetic}.

This relation is a property of the authored geometry, not evidence that validation examples improved the weights. It need not hold for the dictionary: its key-dependent selection changes the prediction rule between training matches and validation misses. It also should not be imposed as a floating-point assignment; independently ordered rounded computations for arbitrary eta can differ slightly from an exact half relation.

These four held-out inputs check behavior between selected magnitudes on known rays. They do not constitute a sampled test population, independent test set, uncertainty estimate, safety evaluation or evidence about production language-model cognition. Reusing them to choose settings would also make them part of model selection, as explained in III-04 — Training, Validation, Testing and Generalization and III-35 — Cross-Validation and Hyperparameter Tuning. No universal transfer, generalization, alignment or safety claim follows.

Optional matrix explanation of the loss and update

The Gram matrix H=FTF/4H=F^TF/4 averages feature outer products. An outer product ϕϕT\phi\phi^T is a two-by-two matrix with entry ϕiϕk\phi_i\phi_k. Because one feature is zero in every sample, off-diagonal entries vanish. The two training diagonal entries are (1+1/4)/4=5/16(1+1/4)/4=5/16, so Htrain=(5/16)IH_{\mathrm{train}}=(5/16)I; validation gives Hvalidation=(5/32)IH_{\mathrm{validation}}=(5/32)I.

Let AA mean the target matrix, either II for PRE or TT for ADAPT, and E=W−AE=W-A the residual matrix. The squared Frobenius norm ∥E∥F2\|E\|_F^2 means the sum of the squares of its four entries. Then

Ltrain=532∥W−A∥F2,G=(W−A)Htrain=516(W−A).L_{\mathrm{train}}=\frac5{32}\|W-A\|_F^2,\qquad G=(W-A)H_{\mathrm{train}}=\frac5{16}(W-A).

This matrix shorthand checks the four explicit chains; it does not replace their actual ordered reductions. With learning rate η\eta, each enabled coordinate’s residual is multiplied in real arithmetic by 1−5η/161-5\eta/16. A frozen coordinate’s residual stays unchanged. At the fixed PRE rate 1/21/2, the factor is q=27/32q=27/32, and after ss PRE steps the diagonal is ps=1−qsp_s=1-q^s. Here ss counts completed PRE updates and psp_s names that diagonal value. It explains p1=5/32p_1=5/32, p2=295/1024p_2=295/1024 and p3=13085/32768p_3=13085/32768.

For ADAPT from a PRE diagonal pp, the initial shortfalls are d=1−p,c=1/2d=1-p,c=1/2. A full fine step at 1/21/2 multiplies both by qq; a diagonal-only step multiplies only dd. This yields the loss comparisons above. These recurrences describe this particular quadratic objective; changing features, labels or loss changes the derivation.

Optional numerical limits: rational equality and signed floating words

A binary64 floating-point number has a 53-bit significant precision. A dyadic fraction has a power-of-two denominator; sufficiently small dyadic operations can be exact in binary64, but being dyadic alone is not enough. Ordered sums, representable endpoints and numerator widths matter. Rational zero also forgets a distinction binary64 retains: positive and negative zero have different stored words.

For example, prepared ADAPT’s negative output-0 errors multiplied by the inactive positive feature produce negative zero in the first two 00 gradient products. Accumulation starts at positive zero; later nonzero terms give the negative gradient already derived. In PRE, off-diagonal gradient sums end at positive zero under round-to-nearest-even, although some individual products can be negative zero. The hand tables display rational zeros and do not claim every displayed zero has the same word. Frozen weights and all saved copies must retain their actual words. Eta negative zero must also survive input capture; it is not permission to cancel requested transitions.

A prior, narrowly scoped central-difference derivation uses h=2−12h=2^{-12}, perturbing a weight while keeping features and targets fixed. The central difference is [L(W+hEoi)−L(W−hEoi)]/(2h)[L(W+hE_{oi})-L(W-hE_{oi})]/(2h), where EoiE_{oi} is a matrix with 1 only at that coordinate. The derivative comparison covers only eta positive 1/21/2, PRE stages 0 through PP, and prepared/fresh ADAPT stages 0 through min⁡(1,U)\min(1,U), for enabled coordinates. PRE enables all four. This is a mathematical scope, not a report that any check ran.

For PRE old stage ss, the parameter grid exponent is n=5sn=5s. For the first prepared ADAPT transition it is n=max⁡(5P,1)n=\max(5P,1); for the fresh transition it is n=1n=1, not 0. Quarter-valued training targets require that extra bit. Fresh fine1 therefore needs a 2−62^{-6} grid, and the prepared next grid is 2−max⁡(5P+5,6)2^{-\max(5P+5,6)}, at worst 2−202^{-20}. The largest selected weight is 517135/1048576517135/1048576, below 1/21/2.

On that scope the corrected prior proof bounds endpoint errors on the 2−222^{-22} grid with magnitude below 2, square numerators below 2462^{46}, ordered two-output/four-sample loss numerators below 2492^{49} and endpoint-mean difference numerators below 2502^{50}. The endpoints are distinct, and the quadratic’s exact central difference has zero truncation residual. Applying this argument to a source record still requires the complete central record, actual shared data, endpoint helper returns and ordered primitive identities, plus a separate signed-word argument. It is not a shortcut to verifying only final scalar losses.

No exact finite-difference or zero-rounding claim is extended to arbitrary eta or ADAPT stages 2 and 3. Those cases need their full independent primitive-rounding evidence. No numerical check, Python execution, runtime comparison or browser validation is claimed by this manuscript.

Read the complete saved tensor shapes

The tables below name every tensor family in the actual calculation. A shape lists axis lengths in the same order as the axis names. Values are flat, with the last axis changing fastest. E means a saved evaluation prefix such as adapt_stage_0; C means pre, adapt or fresh; Q means an actual update prefix such as adapt_update_1. For a cohort, NN is its own number of evaluated stages: P+1P+1 for PRE or U+1U+1 for either ADAPT path.

Tensor ID or familyShapeNamed axes, in orderStored meaning
Data[8,7]Sample, DataFieldx, phiPlus, phiMinus, preTarget0, preTarget1, adaptTarget0, adaptTarget1; training first
AdaptMask[2,2]Output, FeatureActual scope-selected ADAPT mask
C_InitialWeights[2,2]Output, FeatureFour exact copied starting weights
E_Stats[4]StageFieldtrainHalfMSE, validationHalfMSE, diagnosticOnly, hasNextUpdate
C_StageMetrics[N,2]Stage, DatasetEvery actual stage’s training and validation mean
C_StageWeights[N,4]Stage, CoordinateEvery actual stage’s W00, W01, W10, W11
Q_Update[4,7]Coordinate, UpdateFieldold, mathematical, effective, enabled, delta, proposed, committed; only where an update exists

Each evaluation supplies these ten tensors, in the listed order. The shared loss families also appear in the memorizer, whose predictions come from selection rather than a forward calculation.

Evaluation tensorShapeNamed axes, in orderField or coordinate order
E_Weights[2,2]Output, FeatureW00, W01, W10, W11
E_Predictions[8,2]Sample, OutputOutput 0, output 1 for each sample
E_Forward[8,6]Sample, ForwardFieldproduct00, product01, product10, product11, prediction0, prediction1
E_Loss[8,9]Sample, LossFieldtarget0, target1, error0, error1, square0, square1, half0, half1, sampleLoss
E_Reductions[2,4,3]Dataset, DatasetSample, ReductionFieldTraining then validation; loss, oldSum, sum for each row
E_Means[2]DatasetTraining mean, validation mean
E_GradientRows[4,4,5]Coordinate, TrainSample, GradientRowFielderror, feature, contribution, oldSum, sum; coordinate-major, then training-row order
E_MathematicalGradient[2,2]Output, FeatureAll four mathematical derivatives in W order
E_EffectiveGradient[2,2]Output, FeatureMathematical value if enabled; positive zero otherwise
E_Mask[2,2]Output, FeatureFour numeric zero-or-one selectors
Memorizer tensorShapeNamed axes, in orderField order
memorizer_Dictionary[4,3]TrainKey, DictionaryFieldx, adaptTarget0, adaptTarget1
memorizer_Comparisons[8,4,5]Sample, TrainKey, ComparisonFieldx, keyX, equal, oldMatch, match
memorizer_Selections[8,9]Sample, SelectionFieldmatch, sourceKind, sourceSample, sourceIndex0, sourceIndex1, source0, source1, prediction0, prediction1
memorizer_Predictions[8,2]Sample, OutputThe two actually selected prediction copies
memorizer_Matches[8]SampleFirst matching key index or −1
memorizer_Loss[8,9]Sample, LossFieldSame nine loss fields as the evaluation table, on ADAPT targets
memorizer_Reductions[2,4,3]Dataset, DatasetSample, ReductionFieldTraining then validation; loss, oldSum, sum
memorizer_Means[2]DatasetIndependently computed training and validation means

AdaptMask, each evaluation’s Mask, and memorizer Matches use int32 with display precision 0. Every other tensor uses float64 with display precision 8. Precision describes presentation; it does not round the stored values. Integer positions within mixed float tables still denote decisions or indices: Update column 3 (enabled), Stats positions 2–3, Comparisons columns 2–4, and Selections columns 0–4, all counted from zero. They are not measured floating quantities. Arithmetic values, source copies, products, accumulators and frozen weights retain their binary64 words, including negative zero. Raw P/U/scope are discrete integer values; eta is a floating word.

Tensor order starts with Data and AdaptMask, then visits PRE, prepared ADAPT and fresh ADAPT. For each cohort it stores InitialWeights; at each stage it stores the ten evaluation tensors, Stats and an Update only if another stage follows; its two trajectory tensors come last. The eight memorizer tensors follow all three cohorts. The largest single tensor is Comparisons, with 160 cells; many separate tensors do not form one oversized tensor. The inspector’s provenance states where every family came from.

Python from the same ordered operations

The following panels display both complete actual reference files, helper first and wrapper second. They are imported as source text from the repository, including comments and explicit checks. The two adjacent files form the project-source closure; Python’s standard library and NumPy are their dependencies. They import no earlier chapter mechanism or independent mathematical authority. Displaying source does not establish Python execution, self-check, cross-language comparison or rendered-page validation results.

First, storage and scalar mechanisms: transfer_reference.py

Start at raw_state. It captures exactly four dictionary entries, rejects booleans and nonfinite values before testing any field’s domain, then normalizes count/selectors to integers and eta to a float. A huge finite Python integer is tested against its domain before any float conversion can overflow. DEFAULT_IV55 is a read-only mapping with P=2, U=1, scope=0, eta=0.5; callers request a detached default using dict(DEFAULT_IV55).

fixed_data() creates NumPy float64 storage for the eight inputs and eight-by-seven data. Its scalar loop computes negative x, the two max selections, PRE copies and the two scaled/additive ADAPT targets, retaining each construction operand. _evaluate stores W as two output rows and two feature columns. It explicitly multiplies all four weight-feature pairs before either output sum for each sample. NumPy supplies storage; no BLAS contraction, dot product, matrix multiplication operator or NumPy reduction silently changes the arithmetic schedule.

Next, _losses forms both errors, both squares, both halves and their sample sum. _mean starts at floating positive zero and saves the old sum and new sum at each of four additions before dividing by 4. _evaluate then contracts each coordinate’s four training error-feature products, retaining old sums, new sums and the final division. Only after all mathematical derivatives does it select each effective derivative. evaluate_transfer is the guarded reusable entry point; its richer internal evidence is later serialized into the public step/tensor record.

_sgd first builds four proposals from the saved old weights, then publishes the conditional commits. transfer_sgd checks dense arrays, finite values, mask/eta domains and exact effective-gradient word consistency. A disabled entry requires effective positive zero and keeps its old word even if old is nonzero or negative zero. _memorize scans all four keys per input, retains the first match, uses the physical three-field dictionary indices or the two-field saved-prediction indices, and calls the same loss routine on the selected pairs. memorize_transfer guards that entry point. These helpers accept structurally valid finite ambient arrays; they do not certify that caller-supplied features, targets or gradients came from this experiment.

Finally, _cohort evaluates stages 0 through the requested count and performs a transition only when another stage follows. mechanics_experiment(value) builds PRE at fixed 0.5, copies its actual final weights for prepared ADAPT, runs fresh ADAPT from positive zero with the same new task/settings, and supplies saved final-PRE predictions to the lookup. Its detached internal evidence is mutable Python data; changing a returned copy cannot change another saved copy. This evidence packet is not the public result.

Read the complete executable Python / NumPy source

This is the actual reference file, imported directly from the repository. Comments explain each operation. It is provided for later execution; no validation run is claimed.

"""IV55 canonical scalar mechanisms — SOURCE ONLY, ALL EXECUTION UNRUN.

The independent numerical FIRST is retained; the owner-adopted public inventory
is bound by adjacent iv55.py. NumPy stores arrays; Python float primitives do
all arithmetic in declared order, without BLAS, reductions or implicit checks.
"""
from copy import deepcopy
import math
import struct
import sys
from types import MappingProxyType

import numpy as np

RAW_KEYS = ("preUpdates", "updates", "scope", "eta")
DEFAULT_IV55 = MappingProxyType(dict(preUpdates=2, updates=1, scope=0, eta=0.5))


class NumericalFault(ValueError):
    """Only known input/numerical faults become public unavailable records."""

    def __init__(self, code, reason):
        super().__init__(reason)
        self.code = code


def _number(value, label):
    # Arbitrary-size ints are finite; inspect domains before converting to float.
    if type(value) not in (int, float) or (type(value) is float and not math.isfinite(value)):
        raise NumericalFault("NONFINITE", f"{label} must be an actual finite number.")
    return value


def _finite(value, label):
    if not math.isfinite(value):
        raise NumericalFault("NONFINITE", f"{label} must be finite.")
    return value


def raw_state(value):
    """Capture exact dict data, check ALL finite types, then policy domains."""
    if type(value) is not dict:
        raise NumericalFault("INVALID_INPUT", "state must be a plain object.")
    if len(value) != 4 or any(type(key) is not str for key in value) or set(value) != set(RAW_KEYS):
        raise NumericalFault("INVALID_INPUT", "state must have exactly preUpdates, updates, scope, eta as own fields.")
    saved = {key: value[key] for key in RAW_KEYS}
    for key in RAW_KEYS:
        _number(saved[key], key)
    for key in RAW_KEYS[:2]:
        if not 0 <= saved[key] <= 3 or int(saved[key]) != saved[key]:
            raise NumericalFault("INVALID_INPUT", f"{key} must be an integer from 0 to 3.")
    if saved["scope"] not in (0, 1):
        raise NumericalFault("INVALID_INPUT", "scope must be numeric 0 or 1.")
    if not 0.0 <= saved["eta"] <= 2.0:
        raise NumericalFault("INVALID_INPUT", "eta must be between 0 and 2.")
    return dict(preUpdates=int(saved["preUpdates"]), updates=int(saved["updates"]),
                scope=int(saved["scope"]), eta=float(saved["eta"]))


def _vector(value, size, label):
    """Capture every shape before any number or domain consumption."""
    if type(value) is not list:
        raise NumericalFault("INVALID_INPUT", f"{label} must be a dense ordinary array.")
    if len(value) != size:
        raise NumericalFault("SHAPE_MISMATCH", f"{label} requires exactly {size} entries.")
    return value[:]


def _data(value):
    return [_vector(row, 7, f"data[{i}]") for i, row in enumerate(_vector(value, 8, "data"))]


def _numbers(groups):
    for label, values in groups:
        for i, value in enumerate(values):
            _number(value, f"{label}[{i}]")


def _binary64(groups):
    for label, values in groups:
        for value in values:
            if not -sys.float_info.max <= value <= sys.float_info.max:
                raise NumericalFault("NONFINITE", f"{label} requires representable finite binary64 values.")
    return [[float(value) for value in values] for _, values in groups]


def _mask(values):
    for i, value in enumerate(values):
        if value not in (0, 1):
            raise NumericalFault("INVALID_INPUT", f"mask[{i}] must be numeric 0 or 1.")
    return [int(value) for value in values]


def _word(value):
    return struct.pack(">d", value)


def fixed_data():
    """Prepare the fixed features and both target pairs once, before cohorts."""
    xs = np.array([-1.0, -0.5, 0.5, 1.0, -0.75, -0.25, 0.25, 0.75], dtype=np.float64)
    matrix = np.empty((8, 7), dtype=np.float64)
    construction = []
    for i in range(8):
        x = float(xs[i])
        negative = _finite(-x, "negated x")
        plus, minus = max(0.0, x), max(0.0, negative)
        scaled_minus = _finite(0.5 * minus, "scaled negative feature")
        adapt0 = _finite(plus + scaled_minus, "adaptation target 0")
        scaled_plus = _finite(-0.5 * plus, "scaled positive feature")
        adapt1 = _finite(scaled_plus + minus, "adaptation target 1")
        matrix[i] = [x, plus, minus, plus, minus, adapt0, adapt1]
        construction.append(dict(x=x, negativeX=negative, zero=0.0,
                                 phiPlus=plus, phiMinus=minus, preTarget0=plus,
                                 preTarget1=minus, positiveScale=0.5, negativeScale=-0.5,
                                 scaledMinus=scaled_minus, adaptTarget0=adapt0,
                                 scaledPlus=scaled_plus, adaptTarget1=adapt1))
    return dict(data=matrix.tolist(), construction=construction)


def _mean(values):
    total, additions = 0.0, []
    for i, value in enumerate(values):
        old = total
        total = _finite(old + value, "dataset loss sum")
        additions.append(dict(index=i, old=old, value=value, total=total))
    mean = _finite(total / 4.0, "dataset mean")
    return dict(initialSum=0.0, additions=additions, sum=total, divisor=4.0, mean=mean)


def _losses(predictions, data, task):
    rows = []
    target_start = 3 if task == 0 else 5
    for i in range(8):
        p0, p1 = predictions[2 * i:2 * i + 2]
        t0, t1 = data[i][target_start:target_start + 2]
        e0 = _finite(p0 - t0, "output 0 error")
        e1 = _finite(p1 - t1, "output 1 error")
        s0 = _finite(e0 * e0, "output 0 square")
        s1 = _finite(e1 * e1, "output 1 square")
        h0 = _finite(s0 / 2.0, "output 0 half-loss")
        h1 = _finite(s1 / 2.0, "output 1 half-loss")
        sample_loss = _finite(h0 + h1, "sample loss")
        components = [dict(prediction=p0, target=t0, error=e0, square=s0, divisor=2.0, half=h0),
                      dict(prediction=p1, target=t1, error=e1, square=s1, divisor=2.0, half=h1)]
        rows.append(dict(components=components, sampleLoss=sample_loss))
    # Both datasets independently reduce four SAVED sums of two output halves.
    train = _mean([rows[i]["sampleLoss"] for i in range(4)])
    validation = _mean([rows[i]["sampleLoss"] for i in range(4, 8)])
    return dict(rows=rows, train=train, validation=validation)


def _evaluate(weights, data, task, mask):
    """Scalar W:[2,2] times phi:[2,1]; batch storage uses explicit row samples."""
    stored = np.array(weights, dtype=np.float64).reshape((2, 2))
    features = np.array([[row[1], row[2]] for row in data], dtype=np.float64)
    predictions, forwards = [], []
    for i in range(8):
        products = []
        for o in range(2):
            for feature in range(2):
                left, right = float(stored[o, feature]), float(features[i, feature])
                product = _finite(left * right, f"forward product {o}{feature}")
                products.append(dict(weight=left, feature=right, product=product))
        # All four products precede the two sums, just as in the adopted source.
        prediction0 = _finite(products[0]["product"] + products[1]["product"], "prediction 0")
        prediction1 = _finite(products[2]["product"] + products[3]["product"], "prediction 1")
        values = [prediction0, prediction1]
        predictions.extend(values)
        forwards.append(dict(products=products, predictions=values))
    losses = _losses(predictions, data, task)
    mathematical, effective, gradients = [], [], []
    for o in range(2):
        for feature in range(2):
            total, contributions = 0.0, []
            for i in range(4):
                error = losses["rows"][i]["components"][o]["error"]
                phi = float(features[i, feature])
                product = _finite(error * phi, "gradient contribution")
                old = total
                total = _finite(old + product, "gradient sum")
                contributions.append(dict(sample=i, error=error, feature=phi, product=product,
                                          old=old, total=total))
            gradient = _finite(total / 4.0, "mathematical gradient")
            mathematical.append(gradient)
            gradients.append(dict(initialSum=0.0, contributions=contributions,
                                  sum=total, divisor=4.0, mathematical=gradient))
    # Mathematical contractions complete before the conditional optimizer mask.
    for i, gradient in enumerate(gradients):
        used = mathematical[i] if mask[i] else 0.0
        effective.append(used)
        gradient.update(enabled=mask[i], effective=used)
    return dict(weights=weights[:], task=task, mask=mask[:], forwards=forwards,
                predictions=predictions, losses=losses, gradients=gradients,
                trainHalfMSE=losses["train"]["mean"],
                validationHalfMSE=losses["validation"]["mean"],
                mathematicalGradient=mathematical, effectiveGradient=effective)


def evaluate_transfer(weights_value, data_value, task_value, mask_value):
    """Accept ambient finite arrays; numerical coherence remains caller-owned."""
    weights = _vector(weights_value, 4, "weights")
    data = _data(data_value)
    mask = _vector(mask_value, 4, "mask")
    groups = [("weights", weights), *[(f"data[{i}]", row) for i, row in enumerate(data)],
              ("task", [task_value]), ("mask", mask)]
    _numbers(groups)
    if task_value not in (0, 1):
        raise NumericalFault("INVALID_INPUT", "task must be numeric 0 or 1.")
    mask = _mask(mask)
    converted = _binary64(groups)
    return _evaluate(converted[0], converted[1:9], int(task_value), mask)


def _sgd(weights, mathematical, effective, mask, eta):
    rows, proposals = [], []
    for i in range(4):
        delta = _finite(eta * effective[i], "SGD delta")
        proposed = _finite(weights[i] - delta, "SGD proposed")
        proposals.append(proposed)
        rows.append(dict(old=weights[i], mathematical=mathematical[i],
                         effective=effective[i], enabled=mask[i], eta=eta,
                         delta=delta, proposed=proposed))
    # All proposals precede publication. A frozen coordinate copies its OLD WORD.
    committed = [proposals[i] if mask[i] else weights[i] for i in range(4)]
    for i in range(4):
        rows[i]["committed"] = committed[i]
    return dict(weights=committed, coordinates=rows)


def transfer_sgd(weights_value, mathematical_value, effective_value, mask_value, eta_value):
    weights = _vector(weights_value, 4, "weights")
    mathematical = _vector(mathematical_value, 4, "mathematical")
    effective = _vector(effective_value, 4, "effective")
    mask = _vector(mask_value, 4, "mask")
    groups = [("weights", weights), ("mathematical", mathematical), ("effective", effective),
              ("mask", mask), ("eta", [eta_value])]
    _numbers(groups)
    mask = _mask(mask)
    if not 0.0 <= eta_value <= 2.0:
        raise NumericalFault("INVALID_INPUT", "eta must be between 0 and 2.")
    weights, mathematical, effective, _, eta = _binary64(groups)
    eta = eta[0]
    for i in range(4):
        expected = mathematical[i] if mask[i] else 0.0
        if _word(effective[i]) != _word(expected):
            raise NumericalFault("INVALID_INPUT", f"effective[{i}] must match the conditional mathematical gradient.")
    return _sgd(weights, mathematical, effective, mask, eta)


def _memorize(data, prepared_predictions):
    # The actual dictionary has x,target0,target1 columns, hence physical stride3.
    dictionary = [[data[i][0], data[i][5], data[i][6]] for i in range(4)]
    keys = [row[0] for row in dictionary]
    targets = [row[1:3] for row in dictionary]
    predictions, matches, selections = [], [], []
    for i in range(8):
        comparisons, first = [], -1
        for k in range(4):
            equal = data[i][0] == dictionary[k][0]
            old = first
            if equal and first == -1:
                first = k
            comparisons.append(dict(keyIndex=k, x=data[i][0], key=dictionary[k][0],
                                    equal=int(equal), oldMatch=old, match=first))
        kind, source_row = (0, first) if first >= 0 else (1, i)
        index0 = 3 * first + 1 if first >= 0 else 2 * i
        source = dictionary[first][1:3] if first >= 0 else prepared_predictions[2 * i:2 * i + 2]
        predictions.extend(source)
        matches.append(first)
        selections.append(dict(sample=i, comparisons=comparisons, match=first,
                               dictionary=int(first >= 0), sourceRow=source_row,
                               sourceKind=kind, sourceIndex0=index0, sourceIndex1=index0 + 1,
                               sourceValues=source[:], prediction=source[:]))
    losses = _losses(predictions, data, 1)
    return dict(keys=keys, targets=targets, dictionary=dictionary,
                preparedPredictions=prepared_predictions[:], predictions=predictions,
                matches=matches, selections=selections, losses=losses,
                trainHalfMSE=losses["train"]["mean"], validationHalfMSE=losses["validation"]["mean"])


def memorize_transfer(data_value, prepared_predictions_value):
    data = _data(data_value)
    predictions = _vector(prepared_predictions_value, 16, "preparedPredictions")
    groups = [*[(f"data[{i}]", row) for i, row in enumerate(data)], ("preparedPredictions", predictions)]
    _numbers(groups)
    converted = _binary64(groups)
    return _memorize(converted[:8], converted[8])


def _cohort(start, data, task, mask, updates, eta):
    stages, transitions, weights = [], [], start[:]
    for stage in range(updates + 1):
        evaluated = _evaluate(weights, data, task, mask)
        evaluated["stage"] = stage
        evaluated["diagnosticOnly"] = int(stage == updates)
        stages.append(evaluated)
        if stage < updates:
            transition = _sgd(weights, evaluated["mathematicalGradient"], evaluated["effectiveGradient"], mask, eta)
            transitions.append(transition)
            weights = transition["weights"][:]
    return dict(initialWeights=start[:], task=task, mask=mask[:], eta=eta,
                stages=stages, transitions=transitions)


def mechanics_experiment(value):
    """Real PRE, copied-prepared ADAPT, fresh ADAPT and saved-prediction lookup."""
    state = raw_state(value)
    prepared_data = fixed_data()
    data = prepared_data["data"]
    pre = _cohort([0.0, 0.0, 0.0, 0.0], data, 0, [1, 1, 1, 1], state["preUpdates"], 0.5)
    pre_final = pre["stages"][-1]
    copied = pre_final["weights"][:]
    mask = [1, 1, 1, 1] if state["scope"] == 0 else [1, 0, 0, 1]
    prepared = _cohort(copied, data, 1, mask, state["updates"], state["eta"])
    fresh = _cohort([0.0, 0.0, 0.0, 0.0], data, 1, mask, state["updates"], state["eta"])
    memorizer = _memorize(data, pre_final["predictions"])
    return deepcopy(dict(state=state, data=data, construction=prepared_data["construction"],
                         preparedCopy=dict(sourceWeights=pre_final["weights"][:], weights=copied[:]),
                         pre=pre, prepared=prepared, fresh=fresh, memorizer=memorizer))

Second, the full public record and command line: iv55.py

iv55.py loads its sibling using the wrapper’s own file path. Its literal prose and tensor metadata explain the retained arithmetic. _loss_records, _evaluation_records, _update_records, _cohort_records and _memorizer_records arrange the already computed evidence into ordered steps and tensors; they do not substitute hand fractions for a trajectory. Stage statistics copy the actual evaluated means, and the finish step retains the actual metric/work copies as inputs and outputs.

The public entry point is derive_iv55(value). It returns the ordered five-field defined result described above, or the three-field unavailable record for a known NumericalFault. It does not fill missing raw fields. Scalar summaries precede all once-only operation-output aliases, and texts include the truthful P=0 prepared label. A known shape, domain or numerical fault becomes data; unexpected program errors propagate. Ordinary derivation and import call no self-checks.

strict_json(source) rejects duplicate object keys, nonstandard NaN/Infinity constants, malformed syntax and extra JSON content. Its integer parser preserves a literal JSON -0 as negative floating zero. A syntactically valid exponent such as 1e999 instead reaches numeric validation and is unavailable as nonfinite. The zero-argument run() reads command-line arguments itself: no argument uses dict(DEFAULT_IV55); one JSON argument completely replaces the raw state; - reads that replacement from standard input. Missing fields in {} are an error, not a request for defaults.

The following are examples to use from the Book IV project root. Keep both source files adjacent and provide NumPy in that Python environment.

# Default whole result: P=2, U=1, scope=0, eta=0.5.
python3 code/python/p14/iv55.py

# Full replacement, with no adaptation transitions.
python3 code/python/p14/iv55.py '{"preUpdates":2,"updates":0,"scope":1,"eta":0.5}'

# The same full-replacement interface through stdin; retain negative-zero eta.
python3 code/python/p14/iv55.py - <<'JSON'
{"preUpdates":0,"updates":1,"scope":0,"eta":-0}
JSON

# Explicit checks only.
python3 code/python/p14/iv55.py --self-check

Normal defined queries and known unavailable queries both print JSON and return exit status 0. More than one argument prints usage to standard error and returns 2. The single special argument --self-check deliberately calls source_self_check() outside the parse/query catches. The ordinary JSON-parsing catch surrounds only strict_json and catches only ValueError; it does not surround semantic evaluation, serialization or checks. Unexpected semantic failures, parser resource failures such as OverflowError/RecursionError, and assertion failures escape instead of being disguised as ordinary unavailable inputs.

The explicit check aggregator requires assertions enabled and calls eight leaves in order: check_raw_guards, check_hand_anchors, check_helper_guards_and_words, check_memorizer, check_controls_and_structure, check_public_record, check_query_check_isolation, check_cli_boundary. The final two distinguish ordinary default/JSON/stdin queries from deliberate self-check execution. They are authored checks. Their presence in the panel is source evidence, not a passing result.

Read the complete executable Python / NumPy source

This is the actual reference file, imported directly from the repository. Comments explain each operation. It is provided for later execution; no validation run is claimed.

"""IV55 complete canonical public record — SOURCE ONLY, ALL EXECUTION UNRUN.

Adjacent NumPy storage and scalar mechanisms supply actual retained operands.
This file binds the owner-adopted ordered root, steps, aliases, tensors and texts.
Project closure: exactly iv55.py and adjacent transfer_reference.py.
Import and ordinary queries never run self-checks; explicit --self-check does.
"""
import importlib.util
from pathlib import Path

_spec = importlib.util.spec_from_file_location(
    "_p14_iv55_transfer_reference", Path(__file__).resolve().with_name("transfer_reference.py"))
if _spec is None or _spec.loader is None:
    raise ImportError("Cannot load adjacent transfer_reference.py")
_reference = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_reference)

DEFAULT_IV55 = _reference.DEFAULT_IV55
NumericalFault = _reference.NumericalFault
raw_state = _reference.raw_state
fixed_data = _reference.fixed_data
evaluate_transfer = _reference.evaluate_transfer
transfer_sgd = _reference.transfer_sgd
memorize_transfer = _reference.memorize_transfer
mechanics_experiment = _reference.mechanics_experiment


def _same_words(actual, expected):
    assert len(actual) == len(expected)
    for left, right in zip(actual, expected):
        assert type(left) is float and type(right) is float
        assert _reference._word(left) == _reference._word(right)


def _expect_fault(code, operation, *args):
    try:
        operation(*args)
    except NumericalFault as fault:
        assert fault.code == code
    else:
        raise AssertionError(f"Expected {code}")


def check_raw_guards():
    """Finite-before-domain precedence, bool rejection and inactive raw controls."""
    default = dict(DEFAULT_IV55)
    assert tuple(raw_state(default)) == ("preUpdates", "updates", "scope", "eta")
    for bad in (None, [], (), {**default, "extra": 0}, {key: default[key] for key in default if key != "eta"}):
        _expect_fault("INVALID_INPUT", raw_state, bad)
    class DictSubclass(dict):
        pass
    _expect_fault("INVALID_INPUT", raw_state, DictSubclass(default))
    for key in default:
        for bad in (True, False, None, "0", float("nan"), float("inf"), -float("inf")):
            _expect_fault("NONFINITE", raw_state, {**default, key: bad})
        _expect_fault("INVALID_INPUT", raw_state, {**default, key: 10 ** 400})
    for key in ("preUpdates", "updates"):
        for bad in (-1, 4, 0.5):
            _expect_fault("INVALID_INPUT", raw_state, {**default, key: bad})
    for key, bad in (("scope", 2), ("eta", -0.5), ("eta", 2.5)):
        _expect_fault("INVALID_INPUT", raw_state, {**default, key: bad})
    # A late nonfinite wins over an earlier finite-domain defect (even huge int).
    for bad in (4, 10 ** 400):
        _expect_fault("NONFINITE", raw_state, {**default, "preUpdates": bad, "eta": float("nan")})
    _expect_fault("INVALID_INPUT", raw_state, dict(preUpdates=0, updates=0, scope=0, eta=3.0))
    negative_zero = raw_state(dict(preUpdates=0, updates=0, scope=1, eta=-0.0))
    _same_words([negative_zero["eta"]], [-0.0])
    for p in range(4):
        for u in range(4):
            for scope in (0, 1):
                for eta in (0.0, -0.0, 0.5, 2.0):
                    state = raw_state(dict(preUpdates=p, updates=u, scope=scope, eta=eta))
                    assert state["preUpdates"] == p and state["updates"] == u and state["scope"] == scope
                    _same_words([state["eta"]], [eta])


def check_hand_anchors():
    """Literal dyadic expectations derived on paper, never fed to the mechanism."""
    result = mechanics_experiment(dict(DEFAULT_IV55))
    assert result["data"] == [
        [-1.0, 0.0, 1.0, 0.0, 1.0, 0.5, 1.0],
        [-0.5, 0.0, 0.5, 0.0, 0.5, 0.25, 0.5],
        [0.5, 0.5, 0.0, 0.5, 0.0, 0.5, -0.25],
        [1.0, 1.0, 0.0, 1.0, 0.0, 1.0, -0.5],
        [-0.75, 0.0, 0.75, 0.0, 0.75, 0.375, 0.75],
        [-0.25, 0.0, 0.25, 0.0, 0.25, 0.125, 0.25],
        [0.25, 0.25, 0.0, 0.25, 0.0, 0.25, -0.125],
        [0.75, 0.75, 0.0, 0.75, 0.0, 0.75, -0.375],
    ]
    pre = result["pre"]["stages"]
    for stage, diagonal in zip(pre, (0.0, 5.0 / 32.0, 295.0 / 1024.0)):
        _same_words(stage["weights"], [diagonal, 0.0, 0.0, diagonal])
    assert pre[0]["trainHalfMSE"] == 5.0 / 16.0
    assert pre[1]["trainHalfMSE"] == 3645.0 / 16384.0
    assert pre[2]["trainHalfMSE"] == 2657205.0 / 16777216.0
    prepared = result["prepared"]["stages"]
    _same_words(prepared[0]["mathematicalGradient"],
                [-3645.0 / 16384.0, -5.0 / 32.0, 5.0 / 32.0, -3645.0 / 16384.0])
    _same_words(prepared[1]["weights"],
                [13085.0 / 32768.0, 5.0 / 64.0, -5.0 / 64.0, 13085.0 / 32768.0])
    _same_words([row["product"] for row in prepared[0]["gradients"][0]["contributions"]],
                [-0.0, -0.0, -729.0 / 4096.0, -729.0 / 1024.0])
    assert prepared[0]["trainHalfMSE"] == 3967925.0 / 16777216.0
    assert prepared[1]["trainHalfMSE"] == 2892617325.0 / 17179869184.0
    assert prepared[1]["validationHalfMSE"] == 2892617325.0 / 34359738368.0
    fresh = result["fresh"]["stages"]
    assert fresh[0]["trainHalfMSE"] == 25.0 / 64.0
    _same_words(fresh[1]["weights"], [5.0 / 32.0, 5.0 / 64.0, -5.0 / 64.0, 5.0 / 32.0])
    assert fresh[1]["trainHalfMSE"] == 18225.0 / 65536.0
    assert fresh[1]["validationHalfMSE"] == 18225.0 / 131072.0
    diagonal = mechanics_experiment({**dict(DEFAULT_IV55), "scope": 1})["prepared"]["stages"][-1]
    _same_words(diagonal["weights"], [13085.0 / 32768.0, 0.0, 0.0, 13085.0 / 32768.0])
    assert diagonal["trainHalfMSE"] == 3279279725.0 / 17179869184.0
    assert diagonal["validationHalfMSE"] == 3279279725.0 / 34359738368.0
    p3 = mechanics_experiment(dict(preUpdates=3, updates=0, scope=0, eta=0.5))
    _same_words(p3["pre"]["stages"][-1]["weights"],
                [13085.0 / 32768.0, 0.0, 0.0, 13085.0 / 32768.0])


def check_helper_guards_and_words():
    """Ambient states, OLD WORD frozen entries, representability and errors."""
    data, mask, zeros = fixed_data()["data"], [1, 1, 1, 1], [0.0, 0.0, 0.0, 0.0]
    _expect_fault("SHAPE_MISMATCH", evaluate_transfer, zeros[:3], data, 0, mask)
    _expect_fault("SHAPE_MISMATCH", evaluate_transfer, zeros, data[:7], 0, mask)
    _expect_fault("INVALID_INPUT", evaluate_transfer, zeros, data, 2, mask)
    _expect_fault("INVALID_INPUT", evaluate_transfer, zeros, data, 10 ** 400, mask)
    _expect_fault("INVALID_INPUT", evaluate_transfer, zeros, data, 0, [1, 2, 1, 1])
    _expect_fault("INVALID_INPUT", evaluate_transfer, zeros, data, 0, [1, 10 ** 400, 1, 1])
    _expect_fault("NONFINITE", evaluate_transfer, zeros, data, 2, [1, True, 1, 1])
    _expect_fault("NONFINITE", evaluate_transfer, [10 ** 400, 0.0, 0.0, 0.0], data, 0, mask)
    _expect_fault("NONFINITE", evaluate_transfer, [float.fromhex("0x1.fffffffffffffp+1023"), 0.0, 0.0, 0.0], data, 0, mask)
    _expect_fault("INVALID_INPUT", transfer_sgd, zeros, zeros, [-0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0], 0.5)
    _expect_fault("INVALID_INPUT", transfer_sgd, zeros, [1.0] * 4, zeros, mask, 0.5)
    _expect_fault("NONFINITE", transfer_sgd, zeros, zeros, zeros, [2, 1, 1, 1], float("nan"))
    _expect_fault("INVALID_INPUT", transfer_sgd, zeros, zeros, zeros, mask, 10 ** 400)
    _expect_fault("INVALID_INPUT", transfer_sgd, zeros, zeros, zeros, [1, 10 ** 400, 1, 1], 0.5)
    signed = transfer_sgd(zeros, [-0.0, 0.0, 0.0, 0.0], [-0.0, 0.0, 0.0, 0.0], mask, -0.0)
    _same_words([signed["coordinates"][0]["mathematical"], signed["coordinates"][0]["effective"]], [-0.0, -0.0])
    _same_words([signed["coordinates"][0]["eta"], signed["coordinates"][0]["delta"]], [-0.0, 0.0])
    _expect_fault("INVALID_INPUT", transfer_sgd, zeros, [-0.0, 0.0, 0.0, 0.0], zeros, mask, 0.5)
    for eta in (0.0, -0.0, 0.5, 2.0):
        old, mathematical, frozen_mask = [1.25, -0.0, -2.5, 0.0], [2.0, -1.0, 3.0, 0.0], [0, 0, 0, 0]
        transition = transfer_sgd(old, mathematical, zeros, frozen_mask, eta)
        _same_words(transition["weights"], old)
        for i, row in enumerate(transition["coordinates"]):
            _same_words([row["old"], row["committed"], row["effective"]], [old[i], old[i], 0.0])
            _same_words([row["delta"]], [eta * 0.0])
    mixed = transfer_sgd([1.0, 2.0, -0.0, 4.0], [1.0, -2.0, 3.0, 4.0],
                         [1.0, 0.0, 0.0, 4.0], [1, 0, 0, 1], 0.5)
    _same_words(mixed["weights"], [0.5, 2.0, -0.0, 2.0])
    ambient = evaluate_transfer([1.0, 2.0, 3.0, 4.0], data, 1, [0, 0, 0, 0])
    _same_words(ambient["effectiveGradient"], zeros)
    assert any(value != 0.0 for value in ambient["mathematicalGradient"])
    # No origin/coherence assertion: shape-correct ambient rows remain accepted.
    ambient_data = [row[:] for row in data]
    ambient_data[0] = [3.0, 2.0, 3.0, 0.5, -0.5, 1.25, -1.25]
    assert evaluate_transfer([1.0, 2.0, 3.0, 4.0], ambient_data, 1, mask)["predictions"][:2] == [8.0, 18.0]
    captured = evaluate_transfer(zeros, data, 0, mask)
    data[0][1], zeros[0], mask[0] = 123.0, 123.0, 0
    assert captured["weights"][0] == 0.0 and captured["mask"][0] == 1
    assert captured["forwards"][0]["products"][0]["feature"] == 0.0


def check_memorizer():
    result = mechanics_experiment(dict(DEFAULT_IV55))
    memo, pre = result["memorizer"], result["pre"]["stages"][-1]
    assert memo["matches"] == [0, 1, 2, 3, -1, -1, -1, -1]
    assert sum(len(row["comparisons"]) for row in memo["selections"]) == 32
    assert len(memo["keys"]) + sum(len(pair) for pair in memo["targets"]) == 12
    assert memo["trainHalfMSE"] == 0.0
    assert memo["validationHalfMSE"] == 3967925.0 / 33554432.0
    _same_words(memo["preparedPredictions"], pre["predictions"])
    _same_words(memo["predictions"][8:], pre["predictions"][8:])
    for i in range(4):
        _same_words(memo["predictions"][2 * i:2 * i + 2], result["data"][i][5:7])
    data, saved = fixed_data()["data"], [-0.0, 0.0] * 8
    _expect_fault("SHAPE_MISMATCH", memorize_transfer, data, saved[:15])
    _expect_fault("NONFINITE", memorize_transfer, data, [True] + saved[1:])
    _expect_fault("NONFINITE", memorize_transfer, data, [10 ** 400] + saved[1:])
    data[1] = data[0][:]  # coherent duplicate key/feature/target, first index wins
    duplicated = memorize_transfer(data, saved)
    assert duplicated["matches"][:2] == [0, 0]
    assert len(duplicated["selections"][0]["comparisons"]) == 4
    assert duplicated["selections"][0]["comparisons"][1]["equal"] == 1
    _same_words(duplicated["predictions"][8:], saved[8:])
    saved[8], data[0][5] = 17.0, 17.0
    _same_words(duplicated["predictions"][8:10], [-0.0, 0.0])
    assert duplicated["targets"][0][0] == 0.5


def check_controls_and_structure():
    """Every bounded loop count, final diagnostics, eta0 and saved-state isolation."""
    for p in range(4):
        for u in range(4):
            for scope in (0, 1):
                for eta in (0.0, -0.0, 0.5, 2.0):
                    result = mechanics_experiment(dict(preUpdates=p, updates=u, scope=scope, eta=eta))
                    assert len(result["construction"]) == 8
                    for name, updates in (("pre", p), ("prepared", u), ("fresh", u)):
                        cohort = result[name]
                        assert len(cohort["stages"]) == updates + 1 and len(cohort["transitions"]) == updates
                        for stage, evaluated in enumerate(cohort["stages"]):
                            assert evaluated["diagnosticOnly"] == int(stage == updates)
                            assert len(evaluated["forwards"]) == 8 and len(evaluated["predictions"]) == 16
                            assert len(evaluated["gradients"]) == 4
                            for gradient in evaluated["gradients"]:
                                assert len(gradient["contributions"]) == 4
                            for row in evaluated["forwards"]:
                                assert len(row["products"]) == 4
                            for split in ("train", "validation"):
                                assert len(evaluated["losses"][split]["additions"]) == 4
                                assert evaluated["losses"][split]["divisor"] == 4.0
                        for stage, transition in enumerate(cohort["transitions"]):
                            _same_words(transition["weights"], cohort["stages"][stage + 1]["weights"])
                            for i, coordinate in enumerate(transition["coordinates"]):
                                _same_words([coordinate["old"]], [cohort["stages"][stage]["weights"][i]])
                                if not coordinate["enabled"]:
                                    _same_words([coordinate["committed"]], [coordinate["old"]])
                        if name != "pre" and eta == 0.0:
                            # Numeric invariance; enabled zero signs still follow arithmetic.
                            assert cohort["stages"][-1]["weights"] == cohort["stages"][0]["weights"]
                    _same_words(result["prepared"]["initialWeights"], result["pre"]["stages"][-1]["weights"])
                    _same_words(result["fresh"]["initialWeights"], [0.0] * 4)
                    if p == 0:
                        assert result["prepared"]["stages"][0]["weights"] == result["fresh"]["stages"][0]["weights"]
                    assert result["memorizer"]["trainHalfMSE"] == 0.0
    # Independent fresh calls and later mutable records cannot alter earlier states.
    result = mechanics_experiment(dict(preUpdates=3, updates=3, scope=0, eta=0.5))
    original = result["pre"]["stages"][-1]["weights"][:]
    result["prepared"]["initialWeights"][0] = 123.0
    result["prepared"]["stages"][-1]["weights"][0] = 456.0
    _same_words(result["pre"]["stages"][-1]["weights"], original)
    _same_words(result["prepared"]["stages"][0]["weights"], original)
    assert mechanics_experiment(dict(DEFAULT_IV55))["pre"]["stages"][-1]["weights"][0] == 295.0 / 1024.0


def source_self_check():
    """Eight explicit terminal checks; ordinary queries reach none of them."""
    if not __debug__:
        raise RuntimeError("Explicit source checks require assertions enabled.")
    check_raw_guards()
    check_hand_anchors()
    check_helper_guards_and_words()
    check_memorizer()
    check_controls_and_structure()
    check_public_record()
    check_query_check_isolation()
    check_cli_boundary()


# Literal public prose copied from the owner-adopted current sources, not parsed.
_STEP_PROSE = {
    "setup": (
        "Set up a small transfer experiment with two output numbers",
        "W:[2,2]; phi:[2,1]; prediction=W phi:[2,1]; PRE eta=0.5; ADAPT eta=eta; scope0:4 enabled, scope1:2 enabled",
        "Pretraining first learns one numeric target rule. Fine-tuning then changes the desired outputs and updates either all readout entries or just the diagonal. A fresh run supplies a comparison with the same adaptation data and optimizer. These are fixed features with a learned readout, not language-model token probabilities."),
    "data": (
        "Prepare the two fixed features and both target pairs",
        "negatedX=-x; phiPlus=max(0,x); phiMinus=max(0,negatedX); preTarget0=phiPlus; preTarget1=phiMinus; scaledMinus=0.5*phiMinus; adaptTarget0=phiPlus+scaledMinus; scaledPlus=-0.5*phiPlus; adaptTarget1=scaledPlus+phiMinus",
        "A feature is a number supplied to the readout. These ReLU features keep the positive and negative parts of the input separate. Pretraining asks for the features themselves; adaptation changes the desired two outputs. The first four authored inputs train the readout and the last four only evaluate it. Features and targets are prepared once."),
    "initial": (
        "Start this cohort from positive-zero weights",
        "weights=[sourceWeight0,sourceWeight1,sourceWeight2,sourceWeight3]; enabled=mask",
        "All four source weights are positive zero. PRE will learn the feature-copy task; the fresh comparison learns ADAPT directly. Neither start uses hand-set pretrained weights."),
    "prepared": (
        "Copy the actual prepared readout into adaptation",
        "weights=[sourceWeight0,sourceWeight1,sourceWeight2,sourceWeight3]; enabled=mask",
        "These source weights are the genuinely evaluated final PRE weights. Copy every value exactly before any adaptation. The two target columns now change to ADAPT while inputs, fixed features and the squared-error loss form stay the same."),
    "forward": (
        "Read out two numbers from the same fixed feature column",
        "product00=w00*phiPlus; product01=w01*phiMinus; product10=w10*phiPlus; product11=w11*phiMinus; prediction0=product00+product01; prediction1=product10+product11",
        "W has two output rows and two feature columns. Multiplying W:[2,2] by phi:[2,1] gives a two-number column. All four products and both sums are performed, including zero products. Every sample in this evaluation uses these same four weights, with no bias or softmax."),
    "loss": (
        "Measure the two output errors for one sample",
        "error0=prediction0-target0; error1=prediction1-target1; square0=error0*error0; square1=error1*error1; half0=square0/2; half1=square1/2; sampleLoss=half0+half1",
        "Each output is a scalar regression value, so its signed error is a difference of numbers. Squaring makes either error direction costly. Add the two half-losses to obtain one sample loss; the later average counts four samples, not eight output coordinates."),
    "mean": (
        "Average four saved sample losses in their original order",
        "sum starts at +0; sum0=initialSum+loss0; sum1=sum0+loss1; sum2=sum1+loss2; sum3=sum2+loss3; mean=sum3/4",
        "Dataset zero is training; dataset one is held-out validation. Both means are computed independently from their saved sample losses. Validation never contributes a gradient. This ordered average does not divide each output error by eight."),
    "gradient": (
        "Differentiate one readout coordinate using training errors",
        "contribution_j=error_j*feature_j; sum starts at +0 and adds contributions in training-row order; mathematical=sum3/4",
        "A gradient says how the training mean changes when one weight changes slightly. For this linear readout, a weight changes its output in proportion to its feature, giving error times feature. Average the four training contributions. Compute every coordinate even when adaptation will freeze it; final-stage gradients are observations, not extra updates."),
    "mask": (
        "Choose which derivatives the optimizer may use",
        "effective_i=enabled_i==1?mathematical_i:+0",
        "The mathematical derivative describes the loss even for a frozen weight. The effective derivative is the optimizer input: retain that derivative for an enabled weight and select positive zero otherwise. This is a conditional choice, not multiplication by a mask."),
    "stats": (
        "Save this evaluated state and whether an update follows",
        "diagnosticOnly=(stage==requestedUpdates); hasNextUpdate=(stage<requestedUpdates); losses belong to this same saved W",
        "Stage zero is evaluated before any step. Each later point follows a real simultaneous update and a fresh eight-sample evaluation. At the final requested stage, retain all four gradients for inspection but perform no additional optimizer step. Only actual evaluated points appear in the trajectory."),
    "coordinate": (
        "Propose one weight change from the same old state",
        "delta=eta*effective; proposed=old-delta; committed=enabled==1?proposed:old",
        "Subtracting a positive gradient lowers a weight; subtracting a negative one raises it. Every coordinate gets a real multiplication and subtraction, including frozen coordinates. A frozen weight keeps its exact old value and zero sign. All proposals use the unchanged old weights and saved gradients."),
    "commit": (
        "Publish all four proposed coordinates together",
        "nextWeights=[committed0,committed1,committed2,committed3]",
        "This simultaneous publication completes one optimizer step. No coordinate update changes a gradient used for another coordinate. A later stage evaluates the resulting weights again; its final diagnostic gradient causes no additional step."),
    "dictionary": (
        "Copy four training keys and their two desired outputs",
        "dictionary_j=[trainX_j,adaptTarget0_j,adaptTarget1_j], j=0..3",
        "This explicit lookup stores four keys and eight target values, twelve extra numeric slots. It is a constructed counterexample, not a neural network trained by gradient descent. Its fallback will reuse the already saved prepared predictions."),
    "scan": (
        "Compare this input with every stored training key",
        "match starts at -1; for key0..3: equal=(x==keyX); match=(oldMatch==-1 and equal==1)?keyIndex:oldMatch",
        "Perform all four equality comparisons even after finding a match. Keep the first matching index; minus one means none. The fixed eight inputs have four training matches and four held-out misses. If a caller supplies duplicate coherent keys, the first match still wins."),
    "select": (
        "Copy a matched target pair or this sample's saved prepared pair",
        "sourceKind=match==-1?1:0; sourceSample=match==-1?sample:match; sourceIndex0=match==-1?2*sample:3*match+1; sourceIndex1=sourceIndex0+1; source0=match==-1?prepared0:matchedDictionary0; source1=match==-1?prepared1:matchedDictionary1; prediction0=source0; prediction1=source1",
        "Source zero is the dictionary target pair at the first matching training index: in the stored [4,3] dictionary, flat positions 3*match+1 and 3*match+2 skip its x key. Source one is the saved prepared-network prediction at this same sample, at flat positions 2*sample and 2*sample+1 before adaptation. Copy both output values without another neural forward. A perfect lookup fit on training keys says nothing about the missing inputs."),
    "finish": (
        "Compare the final adaptation results and the lookup counterexample",
        "report actual final losses and completed work; final diagnostics add no optimizer steps; dictionary comparisons add no neural forwards",
        "Prepared and fresh losses measure the same ADAPT rule after the same number of adaptation steps. The dictionary can obtain zero training error by copying labels while keeping unadapted predictions on held-out misses. Counts describe this small algorithm, not elapsed time, memory bytes or a general benefit of pretraining."),
}

# Each metadata tuple names the actual row-major table, never an idealized value.
_TENSOR_META = {
    "Data": ([8, 7], ["Sample", "DataField"], "Actual once-prepared authored inputs, features and both target pairs in texts.dataFields order; first four training, last four validation."),
    "AdaptMask": ([2, 2], ["Output", "Feature"], "Actual scope-dependent ADAPT selectors in row-major W order; PRE always enables all four coordinates."),
    "InitialWeights": ([2, 2], ["Output", "Feature"], "Actual cohort initialization: PRE/fresh copy authored positive zeros; prepared ADAPT copies the saved final-PRE weight words."),
    "Weights": ([2, 2], ["Output", "Feature"], "Detached actual same-state W, row-major 00,01,10,11; arbitrary finite represented weights are permitted."),
    "Predictions": ([8, 2], ["Sample", "Output"], "Actual two-output predictions from all four products and both sums per sample, with the same W for all eight rows."),
    "Forward": ([8, 6], ["Sample", "ForwardField"], "Actual product00,product01,product10,product11,prediction0,prediction1; no zero-product shortcut."),
    "Loss": ([8, 9], ["Sample", "LossField"], "Actual target0,target1,error0,error1,square0,square1,half0,half1,sampleLoss in sample order; each sample loss sums both output half-losses."),
    "Reductions": ([2, 4, 3], ["Dataset", "DatasetSample", "ReductionField"], "Actual saved loss, oldSum, sum for each ordered four-sample reduction, training then validation, each initialized at floating positive zero."),
    "Means": ([2], ["Dataset"], "Actual independent training and validation means; each divides its own ordered four-sample sum by floating four."),
    "GradientRows": ([4, 4, 5], ["Coordinate", "TrainSample", "GradientRowField"], "Actual error,feature,contribution,oldSum,sum in coordinate-major then training-row order; each contraction starts at floating positive zero."),
    "MathematicalGradient": ([2, 2], ["Output", "Feature"], "All four actual derivatives of the current training objective; the final cohort stage is diagnostic only."),
    "EffectiveGradient": ([2, 2], ["Output", "Feature"], "Actual conditional mathematical-gradient or floating-positive-zero selection, in row-major W order."),
    "Mask": ([2, 2], ["Output", "Feature"], "Actual numeric zero-or-one selectors in row-major W order; integer values select effective gradients, never rescale features."),
    "Stats": ([4], ["StageField"], "Actual training mean,validation mean,diagnosticOnly,hasNextUpdate in texts.stageFields order; last two positions are integer VALUE selectors."),
    "Update": ([4, 7], ["Coordinate", "UpdateField"], "Actual old,mathematical,effective,enabled,delta,proposed,committed; enabled is an integer VALUE in this mixed float table. Frozen commits copy the old word, including nonzero values and negative zero."),
    "Dictionary": ([4, 3], ["TrainKey", "DictionaryField"], "Actual copied training x,adaptTarget0,adaptTarget1; four keys plus eight target values, twelve extra numeric slots."),
    "Comparisons": ([8, 4, 5], ["Sample", "TrainKey", "ComparisonField"], "Actual x,keyX,equal,oldMatch,match for all 32 comparisons; equal and both match columns are integer VALUE positions in this mixed float table."),
    "Selections": ([8, 9], ["Sample", "SelectionField"], "Actual match,sourceKind,sourceSample,sourceIndex0,sourceIndex1,source0,source1,prediction0,prediction1; first five columns are integer VALUE positions. Source zero indexes target columns at 3*match+1 and 3*match+2 in the flat stored Dictionary:[4,3]; source one indexes 2*sample and 2*sample+1 in the flat saved prepared Predictions:[8,2]."),
    "MemorizerPredictions": ([8, 2], ["Sample", "Output"], "Actual selected two-output values; no new neural forward, gradient or optimizer step."),
    "Matches": ([8], ["Sample"], "Actual first matching training-key index or minus one for every sample; fixed data gives four matches and four misses."),
    "StageMetrics": (None, ["Stage", "Dataset"], "Only actual cohort stages zero through its requested update count; training then independently computed validation mean."),
    "StageWeights": (None, ["Stage", "Coordinate"], "Only actual evaluated cohort weights in row-major 00,01,10,11 order; final weights have a real final evaluation."),
}


def _texts(raw):
    return {
        "trainingScope": "A tiny neural regression readout maps two fixed ReLU features to two scalar outputs. W has four learned entries and no bias. Unlike IV52 text cross-entropy, the loss here measures squared numeric errors; neither hidden features nor a Transformer are trained.",
        "shapePolicy": "For one sample phi=[max(0,x),max(0,-x)]^T:[2,1], W:[2,2], prediction=W phi:[2,1]. Flat W order is 00,01,10,11. With feature rows F:[4,2], batch outputs are F W^T:[4,2]; the transpose explicitly converts column-vector mathematics to row samples.",
        "dataPolicy": "Eight authored nonzero inputs: training [-1,-0.5,0.5,1], held-out [-0.75,-0.25,0.25,0.75]. Features are computed once. PRE targets copy the features; ADAPT targets are T phi with T=[[1,0.5],[-0.5,1]], computed by two half-scalings and two additions. No random sample or unseen test set is implied.",
        "preparationPolicy": "PRE starts at four positive-zero weights and really performs preUpdates full-coordinate steps at fixed learning rate 0.5. Save every evaluated stage from zero through preUpdates. Prepared adaptation copies the final PRE weights exactly; fresh adaptation starts at four positive zeros.",
        "adaptationPolicy": "Both adaptation cohorts use the ADAPT training targets, the same requested updates, learning rate eta and scope. Scope zero enables all four entries; scope one enables only W00 and W11. Inputs, features and loss form stay the same while the target rule changes. Compare actual evaluated states, not fitted curves or ideal optima.",
        "zeroPolicy": "With preUpdates zero, no pretraining has occurred and prepared and fresh starts coincide. With updates zero, both adaptation starts are still evaluated but neither is updated. Eta zero, including negative zero, keeps every requested step and evaluation; multiplication and subtraction still take place.",
        "objectivePolicy": "For each sample compute both predictions, error_o=prediction_o-target_o, square_o=error_o*error_o, half_o=square_o/2, then sampleLoss=half_0+half_1. Each dataset mean adds its four saved sample losses from positive zero in row order and divides by four. This averages samples after summing the two output half-losses; it does not divide by eight.",
        "gradientPolicy": "For each W[o,i], sum the four training products error[o]*phi[i] from positive zero in row order, then divide by four. All four mathematical derivatives belong to the same saved W and objective. Validation never supplies gradients. Each cohort has a final diagnostic gradient with no additional update.",
        "updatePolicy": "Select effective_i=enabled_i?mathematical_i:+0. Compute delta=eta*effective and proposed=old-delta for all four coordinates; commit proposed for enabled entries and the exact old word for frozen entries. Publish all four together. Frozen means preserve the old value, including a nonzero value or negative zero; it never means reset to zero.",
        "memorizerPolicy": "The dictionary copies four training x keys and their eight ADAPT target scalars: twelve extra numeric slots, in addition to the four retained prepared weights. For every input compare all four keys, keeping the first match. Copy a matching target pair or, on a miss, that same sample's saved final-PRE predictions. Compute its losses independently. This constructed lookup is not another neural forward or an SGD-trained network.",
        "evaluationPolicy": "The four held-out inputs have different magnitudes on the same two feature rays. For either homogeneous matrix target and any fixed W, real-arithmetic validation mean equals half the training mean because their feature Gram matrices are 5I/32 and 5I/16. Both means are still computed independently; arbitrary represented arithmetic can round. This grid does not test new directions, nonlinear rules or a population.",
        "transferLimits": "A prepared start can help this adaptation experiment, but this is not a universal transfer benefit. The dictionary fits the four training pairs exactly while retaining unadapted prepared predictions at all four held-out inputs. Perfect training fit alone therefore does not guarantee even this limited held-out performance. These numbers cannot establish LLM cognition, safety or alignment.",
        "computePolicy": "Counts describe actual feature preparation, network evaluations, ordered loss and gradient arithmetic, stored-coordinate proposals and enabled commits. Each gradient batch uses four training rows, counted by gradientRowContributions, and performs sixteen coordinate-by-row multiplications, counted by gradientProducts. Final diagnostics count as gradient work but not optimizer steps. Dictionary comparisons and copies are separate. Counts are not measured seconds, bytes, throughput or hardware savings.",
        "numericPolicy": "Separate finite binary64 additions, subtractions, multiplications and divisions use round-to-nearest ties-to-even, with no fused multiply-add or reordered contraction. Fixed max and comparisons have explicit operands. Raw eta, copied values, products, sums, deltas and proposals retain zero signs; displayed rounding never feeds computation.",
        "diagnosticPolicy": "For eta=positive 0.5, centered differences with h=2^-12 have an exact arithmetic identity only at PRE stages0..preUpdates and prepared/fresh ADAPT stages0..min(1,updates), on enabled coordinates. The first fresh ADAPT state after a step needs the 2^-6 weight grid; the largest selected grid exponent is20. The objective is quadratic in W because features stay fixed. Later ADAPT states and arbitrary eta need complete rounding analysis; zero signs require their own word comparison.",
        "provenance": "Inputs and both target rules are authored examples. Each calculation starts from declared positive-zero weights, actually prepares the PRE state through its requested updates, and copies that state for adaptation. The dictionary is explicitly constructed from training labels; no historical pretrained checkpoint or measured training run is supplied.",
        "rawFields": ["preUpdates", "updates", "scope", "eta"],
        "parameterKeys": ["W00", "W01", "W10", "W11"],
        "cohortKeys": ["pre", "adapt", "fresh"],
        "cohortLabels": ["Pretraining from zero", "Prepared start: no pretraining steps" if raw["preUpdates"] == 0 else "Adaptation from actual pretraining", "Adaptation from fresh zero weights"],
        "taskKeys": ["PRE", "ADAPT"],
        "dataFields": ["x", "phiPlus", "phiMinus", "preTarget0", "preTarget1", "adaptTarget0", "adaptTarget1"],
        "sampleKeys": ["train0", "train1", "train2", "train3", "validation0", "validation1", "validation2", "validation3"],
        "forwardFields": ["product00", "product01", "product10", "product11", "prediction0", "prediction1"],
        "lossFields": ["target0", "target1", "error0", "error1", "square0", "square1", "half0", "half1", "sampleLoss"],
        "datasetKeys": ["training", "validation"],
        "reductionFields": ["loss", "oldSum", "sum"],
        "gradientRowFields": ["error", "feature", "contribution", "oldSum", "sum"],
        "updateFields": ["old", "mathematical", "effective", "enabled", "delta", "proposed", "committed"],
        "stageFields": ["trainHalfMSE", "validationHalfMSE", "diagnosticOnly", "hasNextUpdate"],
        "dictionaryFields": ["x", "adaptTarget0", "adaptTarget1"],
        "comparisonFields": ["x", "keyX", "equal", "oldMatch", "match"],
        "selectionFields": ["match", "sourceKind", "sourceSample", "sourceIndex0", "sourceIndex1", "source0", "source1", "prediction0", "prediction1"],
        "predictionSources": ["dictionary target pair", "same-sample saved prepared prediction pair"],
        "integerValuePolicy": "Mixed float64 tables retain integer values at Update.enabled, Stats.diagnosticOnly/hasNextUpdate, Comparisons.equal/oldMatch/match, and Selections.match/sourceKind/sourceSample/sourceIndex0/sourceIndex1. Masks and matches have int32 dtype and precision zero. These integer selectors and indices are not rounded floating measurements.",
    }


def _step(steps, identifier, family, inputs, outputs):
    label, equation, explanation = _STEP_PROSE[family]
    steps.append(dict(id=identifier, label=label, equation=equation,
                      explanation=explanation, inputs=inputs, outputs=outputs))


def _tensor(identifier, family, values, shape=None):
    fixed_shape, axes, provenance = _TENSOR_META[family]
    integer = family in ("Mask", "AdaptMask", "Matches")
    return dict(id=identifier, shape=list(fixed_shape if shape is None else shape),
                axes=axes[:], dtype="int32" if integer else "float64", values=values[:],
                provenance=provenance, precision=0 if integer else 8)


def _loss_records(evidence, predictions, task, prefix, steps):
    rows, reductions = [], []
    for sample, row in enumerate(evidence["rows"]):
        c0, c1 = row["components"]
        inputs = dict(sample=sample, task=task, prediction0=predictions[2 * sample],
                      prediction1=predictions[2 * sample + 1], target0=c0["target"],
                      target1=c1["target"], divisor=2.0)
        outputs = dict(error0=c0["error"], error1=c1["error"], square0=c0["square"],
                       square1=c1["square"], half0=c0["half"], half1=c1["half"], sampleLoss=row["sampleLoss"])
        _step(steps, f"{prefix}_loss_{sample}", "loss", inputs, outputs)
        rows.extend([c0["target"], c1["target"], *outputs.values()])
    means = []
    for dataset, key in enumerate(("train", "validation")):
        reduced = evidence[key]
        inputs = dict(dataset=dataset, initialSum=reduced["initialSum"], divisor=reduced["divisor"])
        outputs = {}
        for i, addition in enumerate(reduced["additions"]):
            inputs[f"loss{i}"] = addition["value"]
            outputs[f"sum{i}"] = addition["total"]
            reductions.extend([addition["value"], addition["old"], addition["total"]])
        outputs["mean"] = reduced["mean"]
        means.append(reduced["mean"])
        _step(steps, f"{prefix}_mean_{dataset}", "mean", inputs, outputs)
    return [_tensor(f"{prefix}_Loss", "Loss", rows),
            _tensor(f"{prefix}_Reductions", "Reductions", reductions),
            _tensor(f"{prefix}_Means", "Means", means)]


def _evaluation_records(evaluated, data, prefix, steps):
    weights, predictions = evaluated["weights"], evaluated["predictions"]
    forward_rows, gradient_rows = [], []
    for sample, row in enumerate(evaluated["forwards"]):
        inputs = dict(sample=sample, x=data[sample][0], phiPlus=data[sample][1], phiMinus=data[sample][2],
                      w00=weights[0], w01=weights[1], w10=weights[2], w11=weights[3])
        products = [entry["product"] for entry in row["products"]]
        outputs = dict(zip(("product00", "product01", "product10", "product11"), products))
        outputs.update(prediction0=row["predictions"][0], prediction1=row["predictions"][1])
        forward_rows.extend(outputs.values())
        _step(steps, f"{prefix}_forward_{sample}", "forward", inputs, outputs)
    measured = _loss_records(evaluated["losses"], predictions, evaluated["task"], prefix, steps)
    for coordinate, gradient in enumerate(evaluated["gradients"]):
        inputs = dict(coordinate=coordinate, output=coordinate // 2, feature=coordinate % 2,
                      initialSum=gradient["initialSum"], divisor=gradient["divisor"])
        outputs = {}
        for sample, contribution in enumerate(gradient["contributions"]):
            inputs[f"error{sample}"] = contribution["error"]
            inputs[f"feature{sample}"] = contribution["feature"]
            outputs[f"contribution{sample}"] = contribution["product"]
            outputs[f"sum{sample}"] = contribution["total"]
            gradient_rows.extend(contribution[key] for key in ("error", "feature", "product", "old", "total"))
        outputs["mathematical"] = gradient["mathematical"]
        _step(steps, f"{prefix}_gradient_{coordinate}", "gradient", inputs, outputs)
    inputs, outputs = dict(positiveZero=0.0), {}
    for coordinate in range(4):
        inputs[f"mathematical{coordinate}"] = evaluated["mathematicalGradient"][coordinate]
        inputs[f"enabled{coordinate}"] = evaluated["mask"][coordinate]
        outputs[f"effective{coordinate}"] = evaluated["effectiveGradient"][coordinate]
    _step(steps, f"{prefix}_mask", "mask", inputs, outputs)
    return [_tensor(f"{prefix}_Weights", "Weights", weights),
            _tensor(f"{prefix}_Predictions", "Predictions", predictions),
            _tensor(f"{prefix}_Forward", "Forward", forward_rows), *measured,
            _tensor(f"{prefix}_GradientRows", "GradientRows", gradient_rows),
            _tensor(f"{prefix}_MathematicalGradient", "MathematicalGradient", evaluated["mathematicalGradient"]),
            _tensor(f"{prefix}_EffectiveGradient", "EffectiveGradient", evaluated["effectiveGradient"]),
            _tensor(f"{prefix}_Mask", "Mask", evaluated["mask"])]


def _update_records(transition, prefix, steps):
    rows = []
    for coordinate, row in enumerate(transition["coordinates"]):
        inputs = dict(coordinate=coordinate, old=row["old"], mathematical=row["mathematical"],
                      effective=row["effective"], enabled=row["enabled"], eta=row["eta"])
        outputs = {key: row[key] for key in ("delta", "proposed", "committed")}
        _step(steps, f"{prefix}_coordinate_{coordinate}", "coordinate", inputs, outputs)
        rows.extend(row[key] for key in ("old", "mathematical", "effective", "enabled", "delta", "proposed", "committed"))
    _step(steps, f"{prefix}_commit", "commit",
          {f"old{i}": row["old"] for i, row in enumerate(transition["coordinates"])},
          {f"weight{i}": value for i, value in enumerate(transition["weights"])})
    return _tensor(f"{prefix}_Update", "Update", rows)


def _cohort_records(cohort, number, key, data, steps, tensors):
    initial, mask, task = cohort["initialWeights"], cohort["mask"], cohort["task"]
    requested = len(cohort["transitions"])
    inputs = dict(cohort=number, task=task, requestedUpdates=requested, eta=cohort["eta"])
    inputs.update({f"sourceWeight{i}": value for i, value in enumerate(initial)})
    inputs.update({f"mask{i}": value for i, value in enumerate(mask)})
    outputs = {f"weight{i}": value for i, value in enumerate(initial)}
    outputs.update({f"enabled{i}": value for i, value in enumerate(mask)})
    _step(steps, f"{key}_initial", "prepared" if number == 1 else "initial", inputs, outputs)
    tensors.append(_tensor(f"{key}_InitialWeights", "InitialWeights", initial))
    metrics, weights = [], []
    for stage, evaluated in enumerate(cohort["stages"]):
        prefix = f"{key}_stage_{stage}"
        tensors.extend(_evaluation_records(evaluated, data, prefix, steps))
        stats = [evaluated["trainHalfMSE"], evaluated["validationHalfMSE"],
                 int(stage == requested), int(stage < requested)]
        tensors.append(_tensor(f"{prefix}_Stats", "Stats", stats))
        inputs = dict(cohort=number, task=task, stage=stage, requestedUpdates=requested)
        inputs.update({f"weight{i}": value for i, value in enumerate(evaluated["weights"])})
        inputs.update(trainHalfMSE=stats[0], validationHalfMSE=stats[1])
        _step(steps, f"{prefix}_stats", "stats", inputs,
              dict(zip(("trainHalfMSE", "validationHalfMSE", "diagnosticOnly", "hasNextUpdate"), stats)))
        metrics.extend(stats[:2])
        weights.extend(evaluated["weights"])
        if stage < requested:
            tensors.append(_update_records(cohort["transitions"][stage], f"{key}_update_{stage + 1}", steps))
    tensors.extend([_tensor(f"{key}_StageMetrics", "StageMetrics", metrics, [len(cohort["stages"]), 2]),
                    _tensor(f"{key}_StageWeights", "StageWeights", weights, [len(cohort["stages"]), 4])])


def _memorizer_records(memo, steps):
    inputs, outputs, dictionary = {}, {}, []
    for key, row in enumerate(memo["dictionary"]):
        x, pair = row[0], row[1:3]
        inputs.update({f"dataX{key}": x, f"dataTarget{key}_0": pair[0], f"dataTarget{key}_1": pair[1]})
        outputs.update({f"key{key}": x, f"target{key}_0": pair[0], f"target{key}_1": pair[1]})
        dictionary.extend([x, *pair])
    _step(steps, "memorizer_dictionary", "dictionary", inputs, outputs)
    comparisons, selections = [], []
    for sample, selection in enumerate(memo["selections"]):
        inputs = dict(sample=sample, x=selection["comparisons"][0]["x"], noMatch=-1)
        outputs = {}
        for key, comparison in enumerate(selection["comparisons"]):
            inputs[f"key{key}"] = comparison["key"]
            outputs[f"equal{key}"] = comparison["equal"]
            outputs[f"match{key}"] = comparison["match"]
            comparisons.extend(comparison[name] for name in ("x", "key", "equal", "oldMatch", "match"))
        _step(steps, f"memorizer_scan_{sample}", "scan", inputs, outputs)
        match = selection["match"]
        inputs = dict(sample=sample, match=match, prepared0=memo["preparedPredictions"][2 * sample],
                      prepared1=memo["preparedPredictions"][2 * sample + 1])
        if match != -1:
            inputs.update(matchedDictionary0=memo["dictionary"][match][1], matchedDictionary1=memo["dictionary"][match][2])
        # Physical Dictionary[4,3] target positions skip x; fallback uses stride2.
        index0 = selection["sourceIndex0"]
        source0, source1 = selection["sourceValues"]
        outputs = dict(sourceKind=selection["sourceKind"],
                       sourceSample=selection["sourceRow"], sourceIndex0=index0, sourceIndex1=selection["sourceIndex1"],
                       source0=source0, source1=source1,
                       prediction0=selection["prediction"][0], prediction1=selection["prediction"][1])
        selections.extend([match, *outputs.values()])
        _step(steps, f"memorizer_select_{sample}", "select", inputs, outputs)
    measured = _loss_records(memo["losses"], memo["predictions"], 1, "memorizer", steps)
    return [_tensor("memorizer_Dictionary", "Dictionary", dictionary),
            _tensor("memorizer_Comparisons", "Comparisons", comparisons),
            _tensor("memorizer_Selections", "Selections", selections),
            _tensor("memorizer_Predictions", "MemorizerPredictions", memo["predictions"]),
            _tensor("memorizer_Matches", "Matches", memo["matches"]), *measured]


def derive_iv55(value):
    """Bind actual independent scalar evidence to the complete adopted root."""
    try:
        evidence = mechanics_experiment(value)
        raw, data = evidence["state"], evidence["data"]
        pre, adapt, fresh = evidence["pre"], evidence["prepared"], evidence["fresh"]
        memo = evidence["memorizer"]
        trainable = sum(adapt["mask"])
        steps, tensors = [], []
        _step(steps, "setup", "setup", raw.copy(),
              dict(storedParameters=4, trainableAdaptParameters=trainable, fixedFeatures=2,
                   outputsPerSample=2, trainSamples=4, validationSamples=4, preEta=0.5))
        for sample, row in enumerate(evidence["construction"]):
            inputs = dict(sample=sample, training=int(sample < 4), x=row["x"], positiveZero=row["zero"],
                          positiveHalf=row["positiveScale"], negativeHalf=row["negativeScale"])
            outputs = dict(negatedX=row["negativeX"])
            outputs.update({key: row[key] for key in ("phiPlus", "phiMinus", "preTarget0", "preTarget1", "scaledMinus", "adaptTarget0", "scaledPlus", "adaptTarget1")})
            _step(steps, f"data_{sample}", "data", inputs, outputs)
        tensors.extend([_tensor("Data", "Data", [entry for row in data for entry in row]),
                        _tensor("AdaptMask", "AdaptMask", adapt["mask"])])
        for number, (key, cohort) in enumerate((("pre", pre), ("adapt", adapt), ("fresh", fresh))):
            _cohort_records(cohort, number, key, data, steps, tensors)
        tensors.extend(_memorizer_records(memo, steps))
        p, u = raw["preUpdates"], raw["updates"]
        k, s = p + 2 * u, p + 2 * u + 3
        measured = 8 * (s + 1)
        work = dict(
            featureMaps=len(data), featureNegations=len(data), featureMaxSelections=2 * len(data),
            preTargetCopies=2 * len(data), adaptTargetScalings=2 * len(data), adaptTargetAdditions=2 * len(data),
            preparedWeightCopies=len(pre["stages"][-1]["weights"]), pretrainingStages=len(pre["stages"]),
            preparedAdaptStages=len(adapt["stages"]), freshAdaptStages=len(fresh["stages"]),
            stageCount=s, forwardSampleEvaluations=8 * s, forwardProducts=32 * s, forwardSums=16 * s,
            gradientBatches=s, gradientContractions=4 * s, gradientRowContributions=4 * s, gradientProducts=16 * s,
            optimizerBatches=k, usedForUpdateRows=4 * k, storedCoordinateUpdateRecords=4 * k,
            enabledCoordinateUpdates=4 * p + 2 * u * trainable, finalDiagnosticBatches=3,
            lossSampleEvaluations=measured, lossComponentErrors=2 * measured, lossSquares=2 * measured,
            lossHalfDivisions=2 * measured, lossOutputSums=measured, orderedLossAdditions=measured,
            datasetMeanDivisions=2 * (s + 1), memorizerComparisons=len(data) * 4,
            memorizerSelections=len(memo["predictions"]) // 2,
            memorizerMatches=sum(match != -1 for match in memo["matches"]),
            memorizerMisses=sum(match == -1 for match in memo["matches"]),
            dictionaryExtraSlots=12, retainedPreparedWeights=len(pre["stages"][-1]["weights"]),
            memorizerForwardEvaluations=0, memorizerGradientBatches=0, memorizerOptimizerBatches=0)
        pf, af, ff = pre["stages"][-1], adapt["stages"][-1], fresh["stages"][-1]
        metrics = dict(fineTunedValidationLoss=af["validationHalfMSE"], freshValidationLoss=ff["validationHalfMSE"],
                       memorizerValidationLoss=memo["validationHalfMSE"], fineTunedTrainLoss=af["trainHalfMSE"],
                       freshTrainLoss=ff["trainHalfMSE"], memorizerTrainLoss=memo["trainHalfMSE"])
        finish_inputs = {**raw, "trainableAdaptParameters": trainable, **metrics, **work}
        _step(steps, "finish", "finish", finish_inputs, {**metrics, **work})
        outputs = dict(fineTunedValidationLoss=metrics["fineTunedValidationLoss"], freshValidationLoss=metrics["freshValidationLoss"],
                       memorizerValidationLoss=metrics["memorizerValidationLoss"], trainableAdaptParameters=trainable,
                       **raw, storedParameters=4, fixedFeatures=2, outputsPerSample=2, trainSamples=4, validationSamples=4, preEta=0.5,
                       pretrainingTrainLoss=pf["trainHalfMSE"], pretrainingValidationLoss=pf["validationHalfMSE"],
                       preparedInitialTrainLoss=adapt["stages"][0]["trainHalfMSE"],
                       preparedInitialValidationLoss=adapt["stages"][0]["validationHalfMSE"],
                       freshInitialTrainLoss=fresh["stages"][0]["trainHalfMSE"],
                       freshInitialValidationLoss=fresh["stages"][0]["validationHalfMSE"],
                       fineTunedTrainLoss=metrics["fineTunedTrainLoss"], freshTrainLoss=metrics["freshTrainLoss"], memorizerTrainLoss=metrics["memorizerTrainLoss"])
        for prefix, evaluated in (("pre", pf), ("fine", af), ("fresh", ff)):
            outputs.update({f"{prefix}Weight{i}": value for i, value in enumerate(evaluated["weights"])})
        outputs.update(work)
        outputs.update(frames=len(steps), tensorCount=len(tensors))
        for step in steps:
            for key, entry in step["outputs"].items():
                alias = f"{step['id']}_{key}"
                if alias in outputs:
                    raise RuntimeError("IV55 output aliases must be unique.")
                outputs[alias] = entry
        # Repeated evidence is detached too: callers cannot mutate another copy.
        return _reference.deepcopy(dict(status="defined", outputs=outputs, steps=steps, tensors=tensors, texts=_texts(raw)))
    except NumericalFault as fault:
        return dict(status="unavailable", code=fault.code, reason=str(fault))


def strict_json(source):
    """Reject ambiguous JSON objects/constants and retain the word of JSON -0."""
    import json

    def pairs(entries):
        result = {}
        for key, value in entries:
            if key in result:
                raise ValueError("Duplicate JSON object key.")
            result[key] = value
        return result

    def constant(_value):
        raise ValueError("Nonfinite JSON constant.")

    def integer(token):
        return -0.0 if token == "-0" else int(token)

    return json.loads(source, object_pairs_hook=pairs, parse_constant=constant, parse_int=integer)


def run():
    """Default/JSON/stdin queries run no checks; --self-check is explicit."""
    import json
    import sys
    args = sys.argv[1:]
    if args == ["--self-check"]:
        source_self_check()  # Deliberate dispatch, outside parse and query catches.
        print("IV55 canonical source self-checks completed (8 terminal checks).")
        return 0
    if len(args) > 1:
        print("Usage: iv55.py [JSON|-|--self-check]", file=sys.stderr)
        return 2
    if not args:
        value = dict(DEFAULT_IV55)
    else:
        source = sys.stdin.read() if args[0] == "-" else args[0]
        try:
            value = strict_json(source)
        except ValueError as fault:
            print(json.dumps(dict(status="unavailable", code="INVALID_INPUT", reason=str(fault)), allow_nan=False))
            return 0
    # No parsing catch encloses semantic evaluation, serialization or self-checks.
    print(json.dumps(derive_iv55(value), allow_nan=False))
    return 0


def check_public_record():
    """Adopted ordering, complete aliases, retained words and physical sources."""
    summaries = (
        "fineTunedValidationLoss freshValidationLoss memorizerValidationLoss trainableAdaptParameters "
        "preUpdates updates scope eta storedParameters fixedFeatures outputsPerSample trainSamples validationSamples preEta "
        "pretrainingTrainLoss pretrainingValidationLoss preparedInitialTrainLoss preparedInitialValidationLoss "
        "freshInitialTrainLoss freshInitialValidationLoss fineTunedTrainLoss freshTrainLoss memorizerTrainLoss "
        "preWeight0 preWeight1 preWeight2 preWeight3 fineWeight0 fineWeight1 fineWeight2 fineWeight3 "
        "freshWeight0 freshWeight1 freshWeight2 freshWeight3 "
        "featureMaps featureNegations featureMaxSelections preTargetCopies adaptTargetScalings adaptTargetAdditions "
        "preparedWeightCopies pretrainingStages preparedAdaptStages freshAdaptStages stageCount forwardSampleEvaluations "
        "forwardProducts forwardSums gradientBatches gradientContractions gradientRowContributions gradientProducts "
        "optimizerBatches usedForUpdateRows storedCoordinateUpdateRecords enabledCoordinateUpdates finalDiagnosticBatches "
        "lossSampleEvaluations lossComponentErrors lossSquares lossHalfDivisions lossOutputSums orderedLossAdditions "
        "datasetMeanDivisions memorizerComparisons memorizerSelections memorizerMatches memorizerMisses "
        "dictionaryExtraSlots retainedPreparedWeights memorizerForwardEvaluations memorizerGradientBatches "
        "memorizerOptimizerBatches frames tensorCount"
    ).split()
    assert len(summaries) == 76
    for p in range(4):
        for u in range(4):
            for scope in (0, 1):
                raw = dict(preUpdates=p, updates=u, scope=scope, eta=0.5)
                record = derive_iv55(raw)
                assert tuple(record) == ("status", "outputs", "steps", "tensors", "texts")
                assert record["status"] == "defined"
                outputs, steps, tensors = record["outputs"], record["steps"], record["tensors"]
                k, s = p + 2 * u, p + 2 * u + 3
                assert len(steps) == outputs["frames"] == 112 + 29 * k
                assert len(tensors) == outputs["tensorCount"] == 52 + 12 * k
                assert len(outputs) == 904 + 174 * k and len(record["texts"]) == 35
                assert list(outputs)[:76] == summaries
                assert outputs["gradientRowContributions"] == 4 * s
                assert outputs["gradientProducts"] == 16 * s
                assert outputs["enabledCoordinateUpdates"] == 4 * p + 2 * u * (4 if scope == 0 else 2)
                assert record["texts"]["cohortLabels"][1] == (
                    "Prepared start: no pretraining steps" if p == 0 else "Adaptation from actual pretraining")
                aliases = []
                for step in steps:
                    assert tuple(step) == ("id", "label", "equation", "explanation", "inputs", "outputs")
                    for key, value in step["outputs"].items():
                        alias = f"{step['id']}_{key}"
                        aliases.append(alias)
                        assert _reference._word(outputs[alias]) == _reference._word(value)
                assert list(outputs)[76:] == aliases and len(set(aliases)) == len(aliases)
                assert len({step["id"] for step in steps}) == len(steps)
                assert len({tensor["id"] for tensor in tensors}) == len(tensors)
                for tensor in tensors:
                    assert tuple(tensor) == ("id", "shape", "axes", "dtype", "values", "provenance", "precision")
                    assert len(tensor["shape"]) == len(tensor["axes"])
                    cells = 1
                    for dimension in tensor["shape"]:
                        assert 1 <= dimension <= 64
                        cells *= dimension
                    assert len(tensor["values"]) == cells <= 4096
                    integer = tensor["id"] == "AdaptMask" or tensor["id"].endswith(("_Mask", "_Matches"))
                    assert tensor["dtype"] == ("int32" if integer else "float64")
                    assert tensor["precision"] == (0 if integer else 8)
                by_id = {tensor["id"]: tensor for tensor in tensors}
                source_predictions = by_id[f"pre_stage_{p}_Predictions"]["values"]
                dictionary = by_id["memorizer_Dictionary"]["values"]
                for sample in range(8):
                    select = next(step for step in steps if step["id"] == f"memorizer_select_{sample}")
                    assert tuple(select["outputs"]) == ("sourceKind", "sourceSample", "sourceIndex0", "sourceIndex1", "source0", "source1", "prediction0", "prediction1")
                    assert tuple(select["inputs"]) == (("sample", "match", "prepared0", "prepared1", "matchedDictionary0", "matchedDictionary1")
                                                       if sample < 4 else ("sample", "match", "prepared0", "prepared1"))
                    chosen = select["outputs"]
                    assert chosen["sourceIndex0"] == (3 * sample + 1 if sample < 4 else 2 * sample)
                    assert chosen["sourceIndex1"] == chosen["sourceIndex0"] + 1
                    storage = dictionary if sample < 4 else source_predictions
                    _same_words([chosen["source0"], chosen["source1"]],
                                [storage[chosen["sourceIndex0"]], storage[chosen["sourceIndex1"]]])
                for name, requested in (("pre", p), ("adapt", u), ("fresh", u)):
                    stats = [step for step in steps if step["id"].startswith(f"{name}_stage_") and step["id"].endswith("_stats")]
                    assert len(stats) == requested + 1
                    assert sum(step["outputs"]["diagnosticOnly"] for step in stats) == 1
                    for stage, step in enumerate(stats):
                        for field in ("trainHalfMSE", "validationHalfMSE"):
                            _same_words([step["inputs"][field]], [step["outputs"][field]])
                        _same_words([step["inputs"][f"weight{i}"] for i in range(4)],
                                    by_id[f"{name}_stage_{stage}_Weights"]["values"])
                finish = steps[-1]
                for field, value in finish["outputs"].items():
                    assert _reference._word(finish["inputs"][field]) == _reference._word(value)
    for eta in (0.0, -0.0, float.fromhex("0x0.0000000000001p-1022"), 0.1, 2.0):
        record = derive_iv55(dict(preUpdates=3, updates=3, scope=1, eta=eta))
        assert record["status"] == "defined"
        _same_words([record["outputs"]["eta"], record["steps"][0]["inputs"]["eta"], record["steps"][-1]["inputs"]["eta"]], [eta] * 3)
        for step in record["steps"]:
            if "eta" in step["inputs"] and not step["id"].startswith("pre_"):
                _same_words([step["inputs"]["eta"]], [eta])
    record = derive_iv55(dict(DEFAULT_IV55))
    _same_words([record["outputs"]["fineTunedValidationLoss"], record["outputs"]["freshValidationLoss"], record["outputs"]["memorizerValidationLoss"]],
                [2892617325.0 / 34359738368.0, 18225.0 / 131072.0, 3967925.0 / 33554432.0])
    source = record["tensors"][0]["values"][0]
    record["tensors"][0]["values"][0] = 123.0
    assert record["steps"][1]["inputs"]["x"] == source
    record["steps"][0]["outputs"]["storedParameters"] = 123
    assert record["outputs"]["setup_storedParameters"] == 4
    for raw, code, reason in (
            (None, "INVALID_INPUT", "state must be a plain object."),
            ({}, "INVALID_INPUT", "state must have exactly preUpdates, updates, scope, eta as own fields."),
            ({**dict(DEFAULT_IV55), "preUpdates": 4}, "INVALID_INPUT", "preUpdates must be an integer from 0 to 3."),
            ({**dict(DEFAULT_IV55), "updates": 0.5}, "INVALID_INPUT", "updates must be an integer from 0 to 3."),
            ({**dict(DEFAULT_IV55), "scope": 2}, "INVALID_INPUT", "scope must be numeric 0 or 1."),
            ({**dict(DEFAULT_IV55), "updates": 0, "eta": 3}, "INVALID_INPUT", "eta must be between 0 and 2."),
            ({**dict(DEFAULT_IV55), "preUpdates": 10 ** 400, "eta": True}, "NONFINITE", "eta must be an actual finite number.")):
        assert derive_iv55(raw) == dict(status="unavailable", code=code, reason=reason)


def check_query_check_isolation():
    """Import/query graph has no reachable self-check, even through the CLI."""
    import contextlib
    import io
    import sys
    names = ("source_self_check", "check_raw_guards", "check_hand_anchors", "check_helper_guards_and_words",
             "check_memorizer", "check_controls_and_structure", "check_public_record",
             "check_query_check_isolation", "check_cli_boundary")
    saved = {name: globals()[name] for name in names}
    original_argv, original_stdin = sys.argv, sys.stdin

    def forbidden_check(*_args, **_kwargs):
        raise AssertionError("An ordinary query reached a self-check.")

    try:
        for name in names:
            globals()[name] = forbidden_check
        assert derive_iv55(dict(DEFAULT_IV55))["status"] == "defined"
        assert derive_iv55(None)["status"] == "unavailable"
        for args, source in (([], ""), (["{}"], ""), (["-"], '{"preUpdates":0,"updates":0,"scope":1,"eta":-0}'), (["{"], "")):
            sys.argv, sys.stdin = ["iv55.py", *args], io.StringIO(source)
            with contextlib.redirect_stdout(io.StringIO()):
                assert run() == 0
    finally:
        globals().update(saved)
        sys.argv, sys.stdin = original_argv, original_stdin


def check_cli_boundary():
    """Known parse faults return JSON; unexpected semantic/resource errors escape."""
    import contextlib
    import io
    import json
    import sys
    saved_argv, saved_stdin = sys.argv, sys.stdin

    def invoke(args, source=""):
        sys.argv, sys.stdin = ["iv55.py", *args], io.StringIO(source)
        out, err = io.StringIO(), io.StringIO()
        with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
            status = run()
        return status, out.getvalue(), err.getvalue()

    try:
        for args, source in (([], ""), (["-"], '{"preUpdates":0,"updates":0,"scope":1,"eta":-0}'),
                             (['{"preUpdates":2,"updates":1,"scope":0,"eta":0.5}'], "")):
            code, output, error = invoke(args, source)
            assert code == 0 and not error
            value = json.loads(output)
            assert value["status"] == "defined"
            if args == ["-"]:
                _same_words([value["outputs"]["eta"]], [-0.0])
        for source in ("{", "{} {}", '{"eta":0,"eta":1}', "NaN", "Infinity", "-Infinity", "1" * 5000):
            code, output, error = invoke([source])
            assert code == 0 and not error
            result = json.loads(output)
            assert tuple(result) == ("status", "code", "reason")
            assert result["status"] == "unavailable" and result["code"] == "INVALID_INPUT"
        for source in ("{}", "null", "[]", "true", '{"preUpdates":2,"updates":1,"scope":0,"eta":1e999}'):
            code, output, error = invoke([source])
            assert code == 0 and not error and json.loads(output)["status"] == "unavailable"
        code, output, error = invoke(["{}", "{}"])
        assert code == 2 and not output and "Usage:" in error
        original_semantics = globals()["mechanics_experiment"]
        try:
            for fault in (RuntimeError("unexpected semantics"), json.JSONDecodeError("semantic sentinel", "", 0)):
                def broken_semantics(_value):
                    raise fault
                globals()["mechanics_experiment"] = broken_semantics
                try:
                    invoke(["{}"])
                except type(fault) as raised:
                    assert raised is fault
                else:
                    raise AssertionError("Semantic failure was caught as a query result.")
        finally:
            globals()["mechanics_experiment"] = original_semantics
        original_parser = globals()["strict_json"]
        try:
            for fault in (OverflowError("parser sentinel"), RecursionError("parser sentinel")):
                def broken_parser(_source):
                    raise fault
                globals()["strict_json"] = broken_parser
                try:
                    invoke(["{}"])
                except type(fault) as raised:
                    assert raised is fault
                else:
                    raise AssertionError("Unknown parser/resource failure was swallowed.")
        finally:
            globals()["strict_json"] = original_parser
        original_check = globals()["source_self_check"]
        calls = []
        try:
            def explicit_check():
                calls.append("explicit")
            globals()["source_self_check"] = explicit_check
            code, output, error = invoke(["--self-check"])
            assert code == 0 and not error and calls == ["explicit"]
            assert "8 terminal checks" in output
            sentinel = AssertionError("explicit check sentinel")
            def failed_check():
                raise sentinel
            globals()["source_self_check"] = failed_check
            try:
                invoke(["--self-check"])
            except AssertionError as raised:
                assert raised is sentinel
            else:
                raise AssertionError("Self-check failure was swallowed.")
        finally:
            globals()["source_self_check"] = original_check
    finally:
        sys.argv, sys.stdin = saved_argv, saved_stdin


if __name__ == "__main__":
    raise SystemExit(run())

Take away the right comparison

  • Pretraining changes actual readout weights from zero on PRE; adaptation changes a copied state on ADAPT. A fresh baseline uses the same ADAPT task and fine-update budget.
  • Each output has its own error-feature chains. Sum the two output half-losses, then average the four samples; compute all proposals from the same old weights.
  • Freezing removes a coordinate from permitted changes, not from mathematical sensitivity, stored state or diagnostic evidence.
  • Perfect lookup fit can coexist with unchanged held-out error. Our held-out grid itself probes only rescaled known feature rays.

The next planned chapter, IV-56 — Low-Rank Adaptation (LoRA), will ask how the structured addition W+(α/r)BAW+(\alpha/r)BA can replace full weight adaptation, with rank rr, factor shapes and gradients made explicit. Matrix composition in II.10 — Matrix × matrix as composition prepares that question. In this two-by-two example a rank-1 pair of factors already has four trainable entries, and rank 2 has eight, compared with four for full adaptation; it does not automatically save parameters here. The next chapter must also explain its zero-initialized branch’s update policy. No LoRA implementation or result is assumed in this lesson.