The neural notebook
← All chapters

IV-66 / Part XV · Modern LLM Architectures

From Text to Output: Full-Stack LLM Capstone

Trace real bytes and BPE rules through positioned embeddings, two causal blocks, active next-token decisions and strict byte decoding in a disclosed untrained toy.

Review the ideas this chapter uses

Type ab. How can a program turn those letters into numbers, choose another piece of text from computed scores, and recover readable letters? This chapter joins the computations you have studied into one disclosed model. Every chosen piece must come from its actual scores; every visible letter must come from decoding its actual token IDs.

This is an untrained, hand-set toy with alphabet a and b. It has no hidden API, downloaded model, canned completion, training run, or measured quality claim. The lab below is bound to the signed actual source; the worksheets explain its computation by hand. Source binding alone does not establish runtime correctness.

Learning objective: Trace text → bytes/BPE → embeddings → positioned block → logits → decode. Begin with IV-59 — Decoder-Only Transformer Anatomy for the two-block feature calculation. The final section connects each of the other six direct prerequisites to the choices made here.

Compute it yourself

Follow actual text through two blocks and back to bytes

This untrained, hand-set offline toy turns actual prompt bytes into BPE IDs, adds absolute positions to embeddings, runs two unchanged causal decoder blocks and chooses from real active logits. One or two greedy decisions feed a real final byte decoder. There is no service, downloaded model, compatible cache or learned answer table.

Try raising biasEOS to 2 and lowering biasAB to -2 to explore stopping; the actual current gains and scores still decide. For the separate exact zero-output-gain worksheet, set o1=f1=o2=f2=0. Both blocks still compute all branches. Changing merges can activate a previously ineligible class even though all five logits were already computed.

One text field is followed by eighteen numeric controls in raw order. Only merges and outputs require integers. Position scale, gains and biases accept every finite value in their shown intervals, with step any. Invalid numeric drafts retain the last admitted state internally and withhold successful views and grading. Semantically invalid text also withholds results through the model’s explicit unavailable record. Every edit, reset or trace seek clears answers; opening an inspector preserves them.

promptTokens1
decisions2
forwardPasses2
observedTokens2

The original text is retained without trimming, normalization or silent truncation. The model requires nonempty a/b text, at most two UTF-16 units and two actual UTF-8 bytes, and one or two real BPE IDs. Empty, unsupported or oversized text reports its actual reason. Repair the draft or Reset example.

Exact starting inputs for this saved calculation

promptTokens 1. decisions 2. forwardPasses 2. observedTokens 2. Capture the bounded text-to-output computation. The hand-set, untrained model uses full uncached recomputation. Two blocks are not two generated tokens. No hidden service, learned answer table or compatible KV cache is present.

Capture the bounded text-to-output computation

one actual BPE preparation; each decision=lookup+position+block1+block2+all-position head; final real ID decode

The hand-set, untrained model uses full uncached recomputation. Two blocks are not two generated tokens. No hidden service, learned answer table or compatible KV cache is present.

Saved inputs

utf16Units
2
merges
1
outputs
2

Saved outputs

rawInputCount
19
numericInputCount
18
promptTokens
1
activeClasses
4
requestedOutputs
2

Current whole run. Decoded text "ababab". Selected IDs [256, 256]. Stop budget. promptTokens=1; decisions=2; forwardPasses=2; observedTokens=2; logicalTokens=3; decodedBytes=6; decodedUnits=6; eos=0; budgetReached=1; lastTokenId=256; lastClassIndex=2; lastLogit=2.999582312034601; lastProbability=0.6143051228061488; activeClasses=4; blockCount=2; featureWidth=2; hiddenWidth=3; sqrtCalls=16; expCalls=20; nativeElementaryCalls=36; frames=317; tensorCount=257. Selected saved step capstone_setup. Capture the bounded text-to-output computation. Equation: one actual BPE preparation; each decision=lookup+position+block1+block2+all-position head; final real ID decode. The hand-set, untrained model uses full uncached recomputation. Two blocks are not two generated tokens. No hidden service, learned answer table or compatible KV cache is present. Inputs: utf16Units=2; merges=1; outputs=2. Outputs: rawInputCount=19; numericInputCount=18; promptTokens=1; activeClasses=4; requestedOutputs=2.

Current whole decoded text

"ababab"

Original prompt "ab"; observed prompt IDs [256]; actual selected IDs [256, 256]; final logical IDs [256, 256, 256]; decoded bytes [97, 98, 97, 98, 97, 98]. Stop: budget.

The whole run and questions remain the same while the replay cursor inspects an earlier step. Change an input to compute a new run. The final selected tail is decoded and has no later feature row, block state or cache entry.

Complete saved summary in original field order
promptTokens
1
decisions
2
forwardPasses
2
observedTokens
2
logicalTokens
3
decodedBytes
6
decodedUnits
6
eos
0
budgetReached
1
lastTokenId
256
lastClassIndex
2
lastLogit
2.999582312034601
lastProbability
0.6143051228061488
activeClasses
4
blockCount
2
featureWidth
2
hiddenWidth
3
sqrtCalls
16
expCalls
20
nativeElementaryCalls
36
frames
317
tensorCount
257

Text → actual bytes and BPE → features → two blocks → active choice → strict decode

Owner-selected IV66 hand-set toy composed from unchanged real IV39 BPE/strict codecs and two unchanged IV59 blocks; no external model, training dataset or learned capability claim.

1. Once-prepared real tokenizer

Corpus "abab". Original prompt bytes [97, 98]; initial byte IDs [97, 98]; actual BPE prompt IDs [256]. Prompt EOS is off.

Actual rule labels: ["ID 256, bytes [97,98]"]. Actual byte expansions: ["[97,98]"]. Requested merge budget completed.

Every original tokenizer tensor, including actual before/after rank passes and roundtrip bytes

capstone_tokenizer_CorpusCodePoints

Shape [4] · axes [Scalars] · dtype int32

capstone_tokenizer_CorpusCodePoints: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198
297
398

Validated Unicode scalars in exact input order.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusUTF16Offsets

Shape [4] · axes [Scalars] · dtype int32

capstone_tokenizer_CorpusUTF16Offsets: every cell in original row-major storage order
Zero-based storage indexSaved value
00
11
22
33

Zero-based UTF-16 storage offset for each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusUTF16Widths

Shape [4] · axes [Scalars] · dtype int32

capstone_tokenizer_CorpusUTF16Widths: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
31

UTF-16 storage units consumed by each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusByteOffsets

Shape [4] · axes [Scalars] · dtype int32

capstone_tokenizer_CorpusByteOffsets: every cell in original row-major storage order
Zero-based storage indexSaved value
00
11
22
33

Zero-based UTF-8 byte offset for each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusByteWidths

Shape [4] · axes [Scalars] · dtype int32

capstone_tokenizer_CorpusByteWidths: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
31

Actual UTF-8 bytes emitted by each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusBytes

Shape [4] · axes [Bytes] · dtype int32

capstone_tokenizer_CorpusBytes: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198
297
398

Manual UTF-8 encoding in source order, preserving all data.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_SourceCodePoints

Shape [2] · axes [Scalars] · dtype int32

capstone_tokenizer_SourceCodePoints: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Validated Unicode scalars in exact input order.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_SourceUTF16Offsets

Shape [2] · axes [Scalars] · dtype int32

capstone_tokenizer_SourceUTF16Offsets: every cell in original row-major storage order
Zero-based storage indexSaved value
00
11

Zero-based UTF-16 storage offset for each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_SourceUTF16Widths

Shape [2] · axes [Scalars] · dtype int32

capstone_tokenizer_SourceUTF16Widths: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

UTF-16 storage units consumed by each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_SourceByteOffsets

Shape [2] · axes [Scalars] · dtype int32

capstone_tokenizer_SourceByteOffsets: every cell in original row-major storage order
Zero-based storage indexSaved value
00
11

Zero-based UTF-8 byte offset for each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_SourceByteWidths

Shape [2] · axes [Scalars] · dtype int32

capstone_tokenizer_SourceByteWidths: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Actual UTF-8 bytes emitted by each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_SourceBytes

Shape [2] · axes [Bytes] · dtype int32

capstone_tokenizer_SourceBytes: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Manual UTF-8 encoding in source order, preserving all data.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TrainInitialIDs

Shape [4] · axes [Tokens] · dtype int32

capstone_tokenizer_TrainInitialIDs: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198
297
398

Initial training byte IDs, one ID for each actual corpus byte.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TrainR0CandidateLeft

Shape [2] · axes [Candidates] · dtype int32

capstone_tokenizer_TrainR0CandidateLeft: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Numeric tuple order: left ID, then right ID; aligned candidate columns.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TrainR0CandidateRight

Shape [2] · axes [Candidates] · dtype int32

capstone_tokenizer_TrainR0CandidateRight: every cell in original row-major storage order
Zero-based storage indexSaved value
098
197

Right ID in the same sorted candidate order.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TrainR0CandidateFrequency

Shape [2] · axes [Candidates] · dtype int32

capstone_tokenizer_TrainR0CandidateFrequency: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11

Actual adjacent-pair frequency, including overlapping occurrences.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TrainR0Before

Shape [4] · axes [Tokens] · dtype int32

capstone_tokenizer_TrainR0Before: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198
297
398

Complete current token list before this nonoverlapping left-to-right pass.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TrainR0After

Shape [2] · axes [Tokens] · dtype int32

capstone_tokenizer_TrainR0After: every cell in original row-major storage order
Zero-based storage indexSaved value
0256
1256

Complete actual output token list after this rank; no padding or truncation.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusIDs

Shape [2] · axes [Tokens] · dtype int32

capstone_tokenizer_CorpusIDs: every cell in original row-major storage order
Zero-based storage indexSaved value
0256
1256

Final learned corpus token IDs; corpus training never contains EOS.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_RuleIDs

Shape [1] · axes [Rules] · dtype int32

capstone_tokenizer_RuleIDs: every cell in original row-major storage order
Zero-based storage indexSaved value
0256

Learned IDs in ascending rank, ID=256+rank.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_RuleLeft

Shape [1] · axes [Rules] · dtype int32

capstone_tokenizer_RuleLeft: every cell in original row-major storage order
Zero-based storage indexSaved value
097

Left operand ID for each learned rank.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_RuleRight

Shape [1] · axes [Rules] · dtype int32

capstone_tokenizer_RuleRight: every cell in original row-major storage order
Zero-based storage indexSaved value
098

Right operand ID for each learned rank.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_Rule256Bytes

Shape [2] · axes [Bytes] · dtype int32

capstone_tokenizer_Rule256Bytes: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Actual concatenated operand bytes; the piece alone need not be valid UTF-8.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_EncodeInitialIDs

Shape [2] · axes [Tokens] · dtype int32

capstone_tokenizer_EncodeInitialIDs: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Initial target byte IDs before any ranked application.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_EncodeR0Before

Shape [2] · axes [Tokens] · dtype int32

capstone_tokenizer_EncodeR0Before: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Complete current token list before this nonoverlapping left-to-right pass.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_EncodeR0After

Shape [1] · axes [Tokens] · dtype int32

capstone_tokenizer_EncodeR0After: every cell in original row-major storage order
Zero-based storage indexSaved value
0256

Complete actual output token list after this rank; no padding or truncation.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TargetIDs

Shape [1] · axes [Tokens] · dtype int32

capstone_tokenizer_TargetIDs: every cell in original row-major storage order
Zero-based storage indexSaved value
0256

Final target token IDs after all learned ranks, then optional unique EOS tail.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusDecodedBytes

Shape [4] · axes [Bytes] · dtype int32

capstone_tokenizer_CorpusDecodedBytes: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198
297
398

Actual final corpus ID expansions passed to strict UTF-8 decoding.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TargetDecodedBytes

Shape [2] · axes [Bytes] · dtype int32

capstone_tokenizer_TargetDecodedBytes: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Actual final target ID expansions passed to strict UTF-8 decoding.

Declared display precision 0; the cells above retain their saved values.

2. Public IDs, storage rows and activity

Actual ascending public IDs, embedding rows, biases and active flags
Zero-based class rowPublic IDSaved labelActiveEmbedding feature 0Embedding feature 1Saved bias
097atrue100
198btrue010
2256abtrue110
3257ababfalse-110
4512EOStrue000

Hand-set untrained E5/U5 in ascending public-ID order. Each actual forward gathers all observed IDs, adds absolute position once, then calls unchanged IV59 decoderBlock twice. Block2 consumes real block1 output words. D2,H1,Dk2,Dv2,M3,epsilon1/4. Compute all five logits and active-class distributions at every observed position.

Actual feature-last readout weights U

capstone_U

Shape [2, 5] · axes [D, Vocab] · dtype float64

capstone_U: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
21
3-1
40
50
61
71
81
90

Hand-set feature-last readout rows [1,0,1,-1,0] and [0,1,1,1,0].

Declared display precision 8; the cells above retain their saved values.

3. Every real full forward and generation disposition

capstone_forward0

Actual observed IDs [256]. Input shape [1, 1, 2], axes [B, T, D]. This is one full uncached forward.

Actual lookup, absolute position and feature addition before block 1

capstone_forward0_feature_0_0

Position 0, feature 0: actual lookup and position

position=d=0?+0:t*positionScale; feature=embedding+position

Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.

Saved inputs
t
0
d
0
tokenId
256
row
2
embedding
1
positionScale
0.5
Saved outputs
position
0
feature
1

capstone_forward0_feature_0_1

Position 0, feature 1: actual lookup and position

position=d=0?+0:t*positionScale; feature=embedding+position

Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.

Saved inputs
t
0
d
1
tokenId
256
row
2
embedding
1
positionScale
0.5
Saved outputs
position
0
feature
1

capstone_forward0_Positions

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_Positions: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual absolute P_t=[+0,t*positionScale] words before the first block only.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_Embeddings

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_Embeddings: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Actual indexed embedding word copies in observed-position order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_Features

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_Features: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Actual coordinate-wise E+P words, passed unchanged to block1.

Declared display precision 8; the cells above retain their saved values.

block1: actual causal feature path
  1. Input features capstone_forward0_block1_Features [1, 1, 2] [1, 1]
  2. First feature normalization capstone_forward0_block1_n1_Output [1, 1, 2] [0, 0]
  3. Query capstone_forward0_block1_attn_QHeads [1, 1, 1, 2] [0, 0]
  4. Key capstone_forward0_block1_attn_KHeads [1, 1, 1, 2] [0, 0]
  5. Value capstone_forward0_block1_attn_VHeads [1, 1, 1, 2] [0, 0]
  6. Scaled causal scores capstone_forward0_block1_attn_scores [1, 1, 1, 1] [0]
  7. Allowed key mask capstone_forward0_block1_attn_allowed [1, 1, 1, 1] [true]
  8. Allowed-key probabilities capstone_forward0_block1_attn_probabilities [1, 1, 1, 1] [1]
  9. Attention output projection capstone_forward0_block1_attn_Y [1, 1, 2] [0, 0]
  10. First residual capstone_forward0_block1_R1 [1, 1, 2] [1, 1]
  11. Second feature normalization capstone_forward0_block1_n2_Output [1, 1, 2] [0, 0]
  12. All three ReLU hidden coordinates capstone_forward0_block1_ffn_Hidden [1, 1, 3] [0, 0, 0]
  13. FFN output capstone_forward0_block1_ffn_F [1, 1, 2] [0, 0]
  14. Second residual / block output capstone_forward0_block1_Output [1, 1, 2] [1, 1]

One batch, one to three positions, two features per position. Block output keeps B,T,D axes and feeds the next block directly; it is never a token lookup.

All original tensors for capstone_forward0_block1: norms, weights, projections, causal mask, residuals, FFN and native copies

capstone_forward0_block1_Features

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_Features: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Actual captured per-position block features; repeated token IDs do not merge positions.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_Gains

Shape [5] · axes [Gain] · dtype float64

capstone_forward0_block1_Gains: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
30.5
40.5

Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n1_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward0_block1_n1_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n1_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward0_block1_n1_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n1_Statistics

Shape [1, 1, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward0_block1_n1_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n1_Centered

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_n1_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n1_Normalized

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_n1_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n1_Output

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_n1_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_X

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_attn_X: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Active token rows; D=2 input features always retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_WQ

Shape [2, 2] · axes [D, QueryFeature] · dtype float64

capstone_forward0_block1_attn_WQ: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Query columns packed by h*Dk+f from wq{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_WK

Shape [2, 2] · axes [D, KeyFeature] · dtype float64

capstone_forward0_block1_attn_WK: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Key columns packed by h*Dk+f from wk{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_WV

Shape [2, 2] · axes [D, ValueFeature] · dtype float64

capstone_forward0_block1_attn_WV: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Value columns packed by h*Dv+f from wv{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_QConcat

Shape [1, 1, 2] · axes [B, T, QueryFeature] · dtype float64

capstone_forward0_block1_attn_QConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

XWQ; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_KConcat

Shape [1, 1, 2] · axes [B, T, KeyFeature] · dtype float64

capstone_forward0_block1_attn_KConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

XWK; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_VConcat

Shape [1, 1, 2] · axes [B, T, ValueFeature] · dtype float64

capstone_forward0_block1_attn_VConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

XWV; values are projected separately from queries and keys.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_QSplit

Shape [1, 1, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward0_block1_attn_QSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

QConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_QHeads

Shape [1, 1, 1, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward0_block1_attn_QHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

QSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_KSplit

Shape [1, 1, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward0_block1_attn_KSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

KConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_KHeads

Shape [1, 1, 1, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward0_block1_attn_KHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

KSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_VSplit

Shape [1, 1, 1, 2] · axes [B, T, H, Dv] · dtype float64

capstone_forward0_block1_attn_VSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

VConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_VHeads

Shape [1, 1, 1, 2] · axes [B, H, T, Dv] · dtype float64

capstone_forward0_block1_attn_VHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

VSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_raw

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block1_attn_raw: every cell in original row-major storage order
Zero-based storage indexSaved value
00

Separate QHeads KHeads transpose products within every batch and head.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_scores

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block1_attn_scores: every cell in original row-major storage order
Zero-based storage indexSaved value
00

raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_allowed

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype bool

capstone_forward0_block1_attn_allowed: every cell in original row-major storage order
Zero-based storage indexSaved value
0true

Causal and/or valid-key mask; shared validity across B and H; every query retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_logits

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block1_attn_logits: every cell in original row-major storage order
Zero-based storage indexSaved value
00

Finite score+shift, including forbidden cells; mask applied separately.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_probabilities

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block1_attn_probabilities: every cell in original row-major storage order
Zero-based storage indexSaved value
01

Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_OHeads

Shape [1, 1, 1, 2] · axes [B, H, Query, Dv] · dtype float64

capstone_forward0_block1_attn_OHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual per-head P times VHeads; every product and running sum is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_C

Shape [1, 1, 2] · axes [B, T, JoinedValue] · dtype float64

capstone_forward0_block1_attn_C: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_WO

Shape [2, 2] · axes [JoinedValue, D] · dtype float64

capstone_forward0_block1_attn_WO: every cell in original row-major storage order
Zero-based storage indexSaved value
00.5
10
20
30.5

wo{h}{f}{d} packed in h,f,d order, preserving parameter identity.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_Y

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_attn_Y: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Y=C WO, summing products in ascending joined-feature order from zero; no normalization.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_R1

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_R1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Exact named-shape addition of capstone_forward0_block1_Features and capstone_forward0_block1_attn_Y; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n2_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward0_block1_n2_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n2_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward0_block1_n2_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n2_Statistics

Shape [1, 1, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward0_block1_n2_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n2_Centered

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_n2_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n2_Normalized

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_n2_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n2_Output

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_n2_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_W1

Shape [2, 3] · axes [D, HiddenFeature] · dtype float64

capstone_forward0_block1_ffn_W1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
30
41
50

Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_b1

Shape [3] · axes [HiddenFeature] · dtype float64

capstone_forward0_block1_ffn_b1: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

Shared hidden bias, added after the two products.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_Z

Shape [1, 1, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward0_block1_ffn_Z: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

Hidden preactivations X W1+b1; no batch or token mixing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_Hidden

Shape [1, 1, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward0_block1_ffn_Hidden: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

ReLU(Z)=max(0,Z), before the second affine layer.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_W2

Shape [3, 2] · axes [HiddenFeature, D] · dtype float64

capstone_forward0_block1_ffn_W2: every cell in original row-major storage order
Zero-based storage indexSaved value
00.5
10
20
30.5
40
50

Shared hidden-to-output weights, f2{m}{d}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_b2

Shape [2] · axes [D] · dtype float64

capstone_forward0_block1_ffn_b2: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared output bias, added after all three running sums.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_F

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_ffn_F: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

ReLU(X W1+b1) W2+b2, independently per token with shared parameters.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_Output

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Exact named-shape addition of capstone_forward0_block1_R1 and capstone_forward0_block1_ffn_F; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_NativeArguments

Shape [4, 2] · axes [Native, NativeField] · dtype float64

capstone_forward0_block1_NativeArguments: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10.5
22
31.4142135623730951
40
51
60.25
70.5

Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_NativeKinds

Shape [4] · axes [Native] · dtype int32

capstone_forward0_block1_NativeKinds: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
21
30

Native kind codes in native occurrence order: sqrt=0, exp=1.

Declared display precision 0; the cells above retain their saved values.

block2: actual causal feature path
  1. Input features capstone_forward0_block2_Features [1, 1, 2] [1, 1]
  2. First feature normalization capstone_forward0_block2_n1_Output [1, 1, 2] [0, 0]
  3. Query capstone_forward0_block2_attn_QHeads [1, 1, 1, 2] [0, 0]
  4. Key capstone_forward0_block2_attn_KHeads [1, 1, 1, 2] [0, 0]
  5. Value capstone_forward0_block2_attn_VHeads [1, 1, 1, 2] [0, 0]
  6. Scaled causal scores capstone_forward0_block2_attn_scores [1, 1, 1, 1] [0]
  7. Allowed key mask capstone_forward0_block2_attn_allowed [1, 1, 1, 1] [true]
  8. Allowed-key probabilities capstone_forward0_block2_attn_probabilities [1, 1, 1, 1] [1]
  9. Attention output projection capstone_forward0_block2_attn_Y [1, 1, 2] [0, 0]
  10. First residual capstone_forward0_block2_R1 [1, 1, 2] [1, 1]
  11. Second feature normalization capstone_forward0_block2_n2_Output [1, 1, 2] [0, 0]
  12. All three ReLU hidden coordinates capstone_forward0_block2_ffn_Hidden [1, 1, 3] [0, 0, 0]
  13. FFN output capstone_forward0_block2_ffn_F [1, 1, 2] [0, 0]
  14. Second residual / block output capstone_forward0_block2_Output [1, 1, 2] [1, 1]

One batch, one to three positions, two features per position. Block output keeps B,T,D axes and feeds the next block directly; it is never a token lookup.

All original tensors for capstone_forward0_block2: norms, weights, projections, causal mask, residuals, FFN and native copies

capstone_forward0_block2_Features

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_Features: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Actual captured per-position block features; repeated token IDs do not merge positions.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_Gains

Shape [5] · axes [Gain] · dtype float64

capstone_forward0_block2_Gains: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
30.25
40.25

Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n1_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward0_block2_n1_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n1_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward0_block2_n1_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n1_Statistics

Shape [1, 1, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward0_block2_n1_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n1_Centered

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_n1_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n1_Normalized

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_n1_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n1_Output

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_n1_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_X

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_attn_X: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Active token rows; D=2 input features always retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_WQ

Shape [2, 2] · axes [D, QueryFeature] · dtype float64

capstone_forward0_block2_attn_WQ: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Query columns packed by h*Dk+f from wq{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_WK

Shape [2, 2] · axes [D, KeyFeature] · dtype float64

capstone_forward0_block2_attn_WK: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Key columns packed by h*Dk+f from wk{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_WV

Shape [2, 2] · axes [D, ValueFeature] · dtype float64

capstone_forward0_block2_attn_WV: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Value columns packed by h*Dv+f from wv{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_QConcat

Shape [1, 1, 2] · axes [B, T, QueryFeature] · dtype float64

capstone_forward0_block2_attn_QConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

XWQ; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_KConcat

Shape [1, 1, 2] · axes [B, T, KeyFeature] · dtype float64

capstone_forward0_block2_attn_KConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

XWK; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_VConcat

Shape [1, 1, 2] · axes [B, T, ValueFeature] · dtype float64

capstone_forward0_block2_attn_VConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

XWV; values are projected separately from queries and keys.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_QSplit

Shape [1, 1, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward0_block2_attn_QSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

QConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_QHeads

Shape [1, 1, 1, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward0_block2_attn_QHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

QSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_KSplit

Shape [1, 1, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward0_block2_attn_KSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

KConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_KHeads

Shape [1, 1, 1, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward0_block2_attn_KHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

KSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_VSplit

Shape [1, 1, 1, 2] · axes [B, T, H, Dv] · dtype float64

capstone_forward0_block2_attn_VSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

VConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_VHeads

Shape [1, 1, 1, 2] · axes [B, H, T, Dv] · dtype float64

capstone_forward0_block2_attn_VHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

VSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_raw

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block2_attn_raw: every cell in original row-major storage order
Zero-based storage indexSaved value
00

Separate QHeads KHeads transpose products within every batch and head.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_scores

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block2_attn_scores: every cell in original row-major storage order
Zero-based storage indexSaved value
00

raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_allowed

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype bool

capstone_forward0_block2_attn_allowed: every cell in original row-major storage order
Zero-based storage indexSaved value
0true

Causal and/or valid-key mask; shared validity across B and H; every query retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_logits

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block2_attn_logits: every cell in original row-major storage order
Zero-based storage indexSaved value
00

Finite score+shift, including forbidden cells; mask applied separately.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_probabilities

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block2_attn_probabilities: every cell in original row-major storage order
Zero-based storage indexSaved value
01

Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_OHeads

Shape [1, 1, 1, 2] · axes [B, H, Query, Dv] · dtype float64

capstone_forward0_block2_attn_OHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual per-head P times VHeads; every product and running sum is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_C

Shape [1, 1, 2] · axes [B, T, JoinedValue] · dtype float64

capstone_forward0_block2_attn_C: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_WO

Shape [2, 2] · axes [JoinedValue, D] · dtype float64

capstone_forward0_block2_attn_WO: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10
20
30.25

wo{h}{f}{d} packed in h,f,d order, preserving parameter identity.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_Y

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_attn_Y: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Y=C WO, summing products in ascending joined-feature order from zero; no normalization.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_R1

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_R1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Exact named-shape addition of capstone_forward0_block2_Features and capstone_forward0_block2_attn_Y; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n2_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward0_block2_n2_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n2_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward0_block2_n2_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n2_Statistics

Shape [1, 1, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward0_block2_n2_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n2_Centered

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_n2_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n2_Normalized

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_n2_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n2_Output

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_n2_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_W1

Shape [2, 3] · axes [D, HiddenFeature] · dtype float64

capstone_forward0_block2_ffn_W1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
30
41
50

Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_b1

Shape [3] · axes [HiddenFeature] · dtype float64

capstone_forward0_block2_ffn_b1: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

Shared hidden bias, added after the two products.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_Z

Shape [1, 1, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward0_block2_ffn_Z: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

Hidden preactivations X W1+b1; no batch or token mixing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_Hidden

Shape [1, 1, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward0_block2_ffn_Hidden: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

ReLU(Z)=max(0,Z), before the second affine layer.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_W2

Shape [3, 2] · axes [HiddenFeature, D] · dtype float64

capstone_forward0_block2_ffn_W2: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10
20
30.25
40
50

Shared hidden-to-output weights, f2{m}{d}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_b2

Shape [2] · axes [D] · dtype float64

capstone_forward0_block2_ffn_b2: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared output bias, added after all three running sums.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_F

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_ffn_F: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

ReLU(X W1+b1) W2+b2, independently per token with shared parameters.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_Output

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Exact named-shape addition of capstone_forward0_block2_R1 and capstone_forward0_block2_ffn_F; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_NativeArguments

Shape [4, 2] · axes [Native, NativeField] · dtype float64

capstone_forward0_block2_NativeArguments: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10.5
22
31.4142135623730951
40
51
60.25
70.5

Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_NativeKinds

Shape [4] · axes [Native] · dtype int32

capstone_forward0_block2_NativeKinds: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
21
30

Native kind codes in native occurrence order: sqrt=0, exp=1.

Declared display precision 0; the cells above retain their saved values.

All five classes at every observed position
capstone_forward0: all actual head products, sums, logits, active flags and probabilities
Observed positionClass indexPublic IDActive (1=yes)Product 0Product 1SumLogitProbability
0097110110.19661193324148185
0198101110.19661193324148185
02256111220.5344466453885229
032570-11000
04512100000.07232948812851327

Only the last observed row chooses. Its saved active-logit selection is class 2, public ID 256, logit 2, probability 0.5344466453885229. An inactive class can have the largest displayed logit and still be ineligible.

All saved head maxima, executed shifts, terms, ordered partial sums, divisions and selection operands

capstone_forward0_softmax_0

Active-class softmax at observed position 0

max=Math.max(allowed logits); term=allowed?exp(logit-max):+0; denominator=ordered +0 fold over all five terms; p=term/denominator

The unchanged stableSoftmax supplies the actual terms, denominator and five divisions. Shifted arguments and denominator partials repeat the same immutable-operand operations for functional evidence, as in IV59 attention. Inactive classes have no shifted field or native occurrence; their terms and probabilities are policy +0.

Saved inputs
t
0
logit0
1
logit1
1
logit2
2
logit3
0
logit4
0
allowed0
1
allowed1
1
allowed2
1
allowed3
0
allowed4
1
Saved outputs
max
2
shifted0
-1
shifted1
-1
shifted2
0
shifted4
-2
term0
0.36787944117144233
term1
0.36787944117144233
term2
1
term3
0
term4
0.1353352832366127
partial0
0.36787944117144233
partial1
0.7357588823428847
partial2
1.7357588823428847
partial3
1.7357588823428847
partial4
1.8710941655794975
denominator
1.8710941655794975
p0
0.19661193324148185
p1
0.19661193324148185
p2
0.5344466453885229
p3
0
p4
0.07232948812851327

capstone_forward0_select

Choose the actual last-row active logit maximum

strict greater scan over ascending active public IDs; retain first on exact tie

Rounded probabilities never choose the token. Inactive logits remain visible candidates with allowed=0. The chosen probability is copied from the saved actual distribution.

Saved inputs
position
0
logit0
1
allowed0
1
p0
0.19661193324148185
logit1
1
allowed1
1
p1
0.19661193324148185
logit2
2
allowed2
1
p2
0.5344466453885229
logit3
0
allowed3
0
p3
0
logit4
0
allowed4
1
p4
0.07232948812851327
Saved outputs
index
2
tokenId
256
logit
2
probability
0.5344466453885229

Continue: append this actual ID without retokenization, then recompute the full observed prefix uncached. Actual after IDs [256, 256].

capstone_forward0_disposition

Append the actual selected ID and decide whether another forward exists

logicalAfter=observedBefore+[selectedId]; stop=EOS before budget; continue only when neither

Continue: append this actual ID without retokenization, then recompute the full observed prefix uncached.

Saved inputs
beforeCount
1
selectedId
256
requestedOutputs
2
id0
256
Saved outputs
afterCount
2
decisions
1
eos
0
budget
0
continueForward
1
id0
256
id1
256

capstone_forward1

Actual observed IDs [256, 256]. Input shape [1, 2, 2], axes [B, T, D]. This is one full uncached forward.

Actual lookup, absolute position and feature addition before block 1

capstone_forward1_feature_0_0

Position 0, feature 0: actual lookup and position

position=d=0?+0:t*positionScale; feature=embedding+position

Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.

Saved inputs
t
0
d
0
tokenId
256
row
2
embedding
1
positionScale
0.5
Saved outputs
position
0
feature
1

capstone_forward1_feature_0_1

Position 0, feature 1: actual lookup and position

position=d=0?+0:t*positionScale; feature=embedding+position

Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.

Saved inputs
t
0
d
1
tokenId
256
row
2
embedding
1
positionScale
0.5
Saved outputs
position
0
feature
1

capstone_forward1_feature_1_0

Position 1, feature 0: actual lookup and position

position=d=0?+0:t*positionScale; feature=embedding+position

Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.

Saved inputs
t
1
d
0
tokenId
256
row
2
embedding
1
positionScale
0.5
Saved outputs
position
0
feature
1

capstone_forward1_feature_1_1

Position 1, feature 1: actual lookup and position

position=d=0?+0:t*positionScale; feature=embedding+position

Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.

Saved inputs
t
1
d
1
tokenId
256
row
2
embedding
1
positionScale
0.5
Saved outputs
position
0.5
feature
1.5

capstone_forward1_Positions

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_Positions: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.5

Actual absolute P_t=[+0,t*positionScale] words before the first block only.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_Embeddings

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_Embeddings: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
31

Actual indexed embedding word copies in observed-position order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_Features

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_Features: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
31.5

Actual coordinate-wise E+P words, passed unchanged to block1.

Declared display precision 8; the cells above retain their saved values.

block1: actual causal feature path
  1. Input features capstone_forward1_block1_Features [1, 2, 2] [1, 1, 1, 1.5]
  2. First feature normalization capstone_forward1_block1_n1_Output [1, 2, 2] [0, 0, -0.4472135954999579, 0.4472135954999579]
  3. Query capstone_forward1_block1_attn_QHeads [1, 1, 2, 2] [0, 0, -0.4472135954999579, 0.4472135954999579]
  4. Key capstone_forward1_block1_attn_KHeads [1, 1, 2, 2] [0, 0, -0.4472135954999579, 0.4472135954999579]
  5. Value capstone_forward1_block1_attn_VHeads [1, 1, 2, 2] [0, 0, -0.4472135954999579, 0.4472135954999579]
  6. Scaled causal scores capstone_forward1_block1_attn_scores [1, 1, 2, 2] [0, 0, 0, 0.28284271247461895]
  7. Allowed key mask capstone_forward1_block1_attn_allowed [1, 1, 2, 2] [true, false, true, true]
  8. Allowed-key probabilities capstone_forward1_block1_attn_probabilities [1, 1, 2, 2] [1, 0, 0.429756985449589, 0.570243014550411]
  9. Attention output projection capstone_forward1_block1_attn_Y [1, 2, 2] [0, 0, -0.12751021442291208, 0.12751021442291208]
  10. First residual capstone_forward1_block1_R1 [1, 2, 2] [1, 1, 0.8724897855770879, 1.627510214422912]
  11. Second feature normalization capstone_forward1_block1_n2_Output [1, 2, 2] [0, 0, -0.6025611847216092, 0.6025611847216092]
  12. All three ReLU hidden coordinates capstone_forward1_block1_ffn_Hidden [1, 2, 3] [0, 0, 0, 0, 0.6025611847216092, 0]
  13. FFN output capstone_forward1_block1_ffn_F [1, 2, 2] [0, 0, 0, 0.3012805923608046]
  14. Second residual / block output capstone_forward1_block1_Output [1, 2, 2] [1, 1, 0.8724897855770879, 1.9287908067837167]

One batch, one to three positions, two features per position. Block output keeps B,T,D axes and feeds the next block directly; it is never a token lookup.

All original tensors for capstone_forward1_block1: norms, weights, projections, causal mask, residuals, FFN and native copies

capstone_forward1_block1_Features

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_Features: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
31.5

Actual captured per-position block features; repeated token IDs do not merge positions.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_Gains

Shape [5] · axes [Gain] · dtype float64

capstone_forward1_block1_Gains: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
30.5
40.5

Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n1_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward1_block1_n1_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n1_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward1_block1_n1_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n1_Statistics

Shape [1, 2, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward1_block1_n1_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5
102.5
111.25
12-0.25
130.25
140.0625
150.0625
160.125
170.0625
180.3125
190.5590169943749475

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n1_Centered

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_n1_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.25
30.25

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n1_Normalized

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_n1_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n1_Output

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_n1_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_X

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_attn_X: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

Active token rows; D=2 input features always retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_WQ

Shape [2, 2] · axes [D, QueryFeature] · dtype float64

capstone_forward1_block1_attn_WQ: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Query columns packed by h*Dk+f from wq{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_WK

Shape [2, 2] · axes [D, KeyFeature] · dtype float64

capstone_forward1_block1_attn_WK: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Key columns packed by h*Dk+f from wk{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_WV

Shape [2, 2] · axes [D, ValueFeature] · dtype float64

capstone_forward1_block1_attn_WV: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Value columns packed by h*Dv+f from wv{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_QConcat

Shape [1, 2, 2] · axes [B, T, QueryFeature] · dtype float64

capstone_forward1_block1_attn_QConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

XWQ; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_KConcat

Shape [1, 2, 2] · axes [B, T, KeyFeature] · dtype float64

capstone_forward1_block1_attn_KConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

XWK; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_VConcat

Shape [1, 2, 2] · axes [B, T, ValueFeature] · dtype float64

capstone_forward1_block1_attn_VConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

XWV; values are projected separately from queries and keys.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_QSplit

Shape [1, 2, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward1_block1_attn_QSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

QConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_QHeads

Shape [1, 1, 2, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward1_block1_attn_QHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

QSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_KSplit

Shape [1, 2, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward1_block1_attn_KSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

KConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_KHeads

Shape [1, 1, 2, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward1_block1_attn_KHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

KSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_VSplit

Shape [1, 2, 1, 2] · axes [B, T, H, Dv] · dtype float64

capstone_forward1_block1_attn_VSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

VConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_VHeads

Shape [1, 1, 2, 2] · axes [B, H, T, Dv] · dtype float64

capstone_forward1_block1_attn_VHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

VSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_raw

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block1_attn_raw: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.39999999999999997

Separate QHeads KHeads transpose products within every batch and head.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_scores

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block1_attn_scores: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.28284271247461895

raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_allowed

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype bool

capstone_forward1_block1_attn_allowed: every cell in original row-major storage order
Zero-based storage indexSaved value
0true
1false
2true
3true

Causal and/or valid-key mask; shared validity across B and H; every query retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_logits

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block1_attn_logits: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.28284271247461895

Finite score+shift, including forbidden cells; mask applied separately.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_probabilities

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block1_attn_probabilities: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20.429756985449589
30.570243014550411

Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_OHeads

Shape [1, 1, 2, 2] · axes [B, H, Query, Dv] · dtype float64

capstone_forward1_block1_attn_OHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.25502042884582415
30.25502042884582415

Actual per-head P times VHeads; every product and running sum is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_C

Shape [1, 2, 2] · axes [B, T, JoinedValue] · dtype float64

capstone_forward1_block1_attn_C: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.25502042884582415
30.25502042884582415

OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_WO

Shape [2, 2] · axes [JoinedValue, D] · dtype float64

capstone_forward1_block1_attn_WO: every cell in original row-major storage order
Zero-based storage indexSaved value
00.5
10
20
30.5

wo{h}{f}{d} packed in h,f,d order, preserving parameter identity.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_Y

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_attn_Y: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.12751021442291208
30.12751021442291208

Y=C WO, summing products in ascending joined-feature order from zero; no normalization.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_R1

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_R1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
20.8724897855770879
31.627510214422912

Exact named-shape addition of capstone_forward1_block1_Features and capstone_forward1_block1_attn_Y; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n2_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward1_block1_n2_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n2_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward1_block1_n2_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n2_Statistics

Shape [1, 2, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward1_block1_n2_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5
102.5
111.25
12-0.3775102144229121
130.3775102144229121
140.1425139619936331
150.1425139619936331
160.2850279239872662
170.1425139619936331
180.3925139619936331
190.6265093470919912

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n2_Centered

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_n2_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.3775102144229121
30.3775102144229121

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n2_Normalized

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_n2_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.6025611847216092
30.6025611847216092

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n2_Output

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_n2_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.6025611847216092
30.6025611847216092

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_W1

Shape [2, 3] · axes [D, HiddenFeature] · dtype float64

capstone_forward1_block1_ffn_W1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
30
41
50

Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_b1

Shape [3] · axes [HiddenFeature] · dtype float64

capstone_forward1_block1_ffn_b1: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

Shared hidden bias, added after the two products.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_Z

Shape [1, 2, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward1_block1_ffn_Z: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
3-0.6025611847216092
40.6025611847216092
50

Hidden preactivations X W1+b1; no batch or token mixing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_Hidden

Shape [1, 2, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward1_block1_ffn_Hidden: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30
40.6025611847216092
50

ReLU(Z)=max(0,Z), before the second affine layer.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_W2

Shape [3, 2] · axes [HiddenFeature, D] · dtype float64

capstone_forward1_block1_ffn_W2: every cell in original row-major storage order
Zero-based storage indexSaved value
00.5
10
20
30.5
40
50

Shared hidden-to-output weights, f2{m}{d}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_b2

Shape [2] · axes [D] · dtype float64

capstone_forward1_block1_ffn_b2: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared output bias, added after all three running sums.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_F

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_ffn_F: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.3012805923608046

ReLU(X W1+b1) W2+b2, independently per token with shared parameters.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_Output

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
20.8724897855770879
31.9287908067837167

Exact named-shape addition of capstone_forward1_block1_R1 and capstone_forward1_block1_ffn_F; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_NativeArguments

Shape [8, 2] · axes [Native, NativeField] · dtype float64

capstone_forward1_block1_NativeArguments: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10.5
20.3125
30.5590169943749475
42
51.4142135623730951
60
71
8-0.28284271247461895
90.7536383164437648
100
111
120.25
130.5
140.3925139619936331
150.6265093470919912

Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_NativeKinds

Shape [8] · axes [Native] · dtype int32

capstone_forward1_block1_NativeKinds: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
31
41
51
60
70

Native kind codes in native occurrence order: sqrt=0, exp=1.

Declared display precision 0; the cells above retain their saved values.

block2: actual causal feature path
  1. Input features capstone_forward1_block2_Features [1, 2, 2] [1, 1, 0.8724897855770879, 1.9287908067837167]
  2. First feature normalization capstone_forward1_block2_n1_Output [1, 2, 2] [0, 0, -0.7261950472083369, 0.7261950472083369]
  3. Query capstone_forward1_block2_attn_QHeads [1, 1, 2, 2] [0, 0, -0.7261950472083369, 0.7261950472083369]
  4. Key capstone_forward1_block2_attn_KHeads [1, 1, 2, 2] [0, 0, -0.7261950472083369, 0.7261950472083369]
  5. Value capstone_forward1_block2_attn_VHeads [1, 1, 2, 2] [0, 0, -0.7261950472083369, 0.7261950472083369]
  6. Scaled causal scores capstone_forward1_block2_attn_scores [1, 1, 2, 2] [0, 0, 0, 0.7457985987703204]
  7. Allowed key mask capstone_forward1_block2_attn_allowed [1, 1, 2, 2] [true, false, true, true]
  8. Allowed-key probabilities capstone_forward1_block2_attn_probabilities [1, 1, 2, 2] [1, 0, 0.3217374534528671, 0.6782625465471329]
  9. Attention output projection capstone_forward1_block2_attn_Y [1, 2, 2] [0, 0, -0.1231377255023605, 0.1231377255023605]
  10. First residual capstone_forward1_block2_R1 [1, 2, 2] [1, 1, 0.7493520600747274, 2.051928532286077]
  11. Second feature normalization capstone_forward1_block2_n2_Output [1, 2, 2] [0, 0, -0.793206878695186, 0.793206878695186]
  12. All three ReLU hidden coordinates capstone_forward1_block2_ffn_Hidden [1, 2, 3] [0, 0, 0, 0, 0.793206878695186, 0]
  13. FFN output capstone_forward1_block2_ffn_F [1, 2, 2] [0, 0, 0, 0.1983017196737965]
  14. Second residual / block output capstone_forward1_block2_Output [1, 2, 2] [1, 1, 0.7493520600747274, 2.2502302519598736]

One batch, one to three positions, two features per position. Block output keeps B,T,D axes and feeds the next block directly; it is never a token lookup.

All original tensors for capstone_forward1_block2: norms, weights, projections, causal mask, residuals, FFN and native copies

capstone_forward1_block2_Features

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_Features: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
20.8724897855770879
31.9287908067837167

Actual captured per-position block features; repeated token IDs do not merge positions.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_Gains

Shape [5] · axes [Gain] · dtype float64

capstone_forward1_block2_Gains: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
30.25
40.25

Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n1_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward1_block2_n1_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n1_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward1_block2_n1_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n1_Statistics

Shape [1, 2, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward1_block2_n1_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5
102.8012805923608046
111.4006402961804023
12-0.5281505106033144
130.5281505106033144
140.27894296185054174
150.27894296185054174
160.5578859237010835
170.27894296185054174
180.5289429618505417
190.727284649810885

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n1_Centered

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_n1_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.5281505106033144
30.5281505106033144

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n1_Normalized

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_n1_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n1_Output

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_n1_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_X

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_attn_X: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

Active token rows; D=2 input features always retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_WQ

Shape [2, 2] · axes [D, QueryFeature] · dtype float64

capstone_forward1_block2_attn_WQ: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Query columns packed by h*Dk+f from wq{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_WK

Shape [2, 2] · axes [D, KeyFeature] · dtype float64

capstone_forward1_block2_attn_WK: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Key columns packed by h*Dk+f from wk{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_WV

Shape [2, 2] · axes [D, ValueFeature] · dtype float64

capstone_forward1_block2_attn_WV: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Value columns packed by h*Dv+f from wv{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_QConcat

Shape [1, 2, 2] · axes [B, T, QueryFeature] · dtype float64

capstone_forward1_block2_attn_QConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

XWQ; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_KConcat

Shape [1, 2, 2] · axes [B, T, KeyFeature] · dtype float64

capstone_forward1_block2_attn_KConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

XWK; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_VConcat

Shape [1, 2, 2] · axes [B, T, ValueFeature] · dtype float64

capstone_forward1_block2_attn_VConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

XWV; values are projected separately from queries and keys.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_QSplit

Shape [1, 2, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward1_block2_attn_QSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

QConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_QHeads

Shape [1, 1, 2, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward1_block2_attn_QHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

QSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_KSplit

Shape [1, 2, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward1_block2_attn_KSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

KConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_KHeads

Shape [1, 1, 2, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward1_block2_attn_KHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

KSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_VSplit

Shape [1, 2, 1, 2] · axes [B, T, H, Dv] · dtype float64

capstone_forward1_block2_attn_VSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

VConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_VHeads

Shape [1, 1, 2, 2] · axes [B, H, T, Dv] · dtype float64

capstone_forward1_block2_attn_VHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

VSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_raw

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block2_attn_raw: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
31.0547184931798375

Separate QHeads KHeads transpose products within every batch and head.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_scores

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block2_attn_scores: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.7457985987703204

raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_allowed

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype bool

capstone_forward1_block2_attn_allowed: every cell in original row-major storage order
Zero-based storage indexSaved value
0true
1false
2true
3true

Causal and/or valid-key mask; shared validity across B and H; every query retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_logits

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block2_attn_logits: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.7457985987703204

Finite score+shift, including forbidden cells; mask applied separately.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_probabilities

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block2_attn_probabilities: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20.3217374534528671
30.6782625465471329

Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_OHeads

Shape [1, 1, 2, 2] · axes [B, H, Query, Dv] · dtype float64

capstone_forward1_block2_attn_OHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.492550902009442
30.492550902009442

Actual per-head P times VHeads; every product and running sum is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_C

Shape [1, 2, 2] · axes [B, T, JoinedValue] · dtype float64

capstone_forward1_block2_attn_C: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.492550902009442
30.492550902009442

OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_WO

Shape [2, 2] · axes [JoinedValue, D] · dtype float64

capstone_forward1_block2_attn_WO: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10
20
30.25

wo{h}{f}{d} packed in h,f,d order, preserving parameter identity.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_Y

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_attn_Y: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.1231377255023605
30.1231377255023605

Y=C WO, summing products in ascending joined-feature order from zero; no normalization.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_R1

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_R1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
20.7493520600747274
32.051928532286077

Exact named-shape addition of capstone_forward1_block2_Features and capstone_forward1_block2_attn_Y; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n2_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward1_block2_n2_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n2_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward1_block2_n2_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n2_Statistics

Shape [1, 2, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward1_block2_n2_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5
102.8012805923608046
111.4006402961804023
12-0.6512882361056749
130.6512882361056749
140.4241763664896413
150.4241763664896413
160.8483527329792826
170.4241763664896413
180.6741763664896413
190.8210824358672163

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n2_Centered

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_n2_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.6512882361056749
30.6512882361056749

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n2_Normalized

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_n2_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.793206878695186
30.793206878695186

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n2_Output

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_n2_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.793206878695186
30.793206878695186

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_W1

Shape [2, 3] · axes [D, HiddenFeature] · dtype float64

capstone_forward1_block2_ffn_W1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
30
41
50

Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_b1

Shape [3] · axes [HiddenFeature] · dtype float64

capstone_forward1_block2_ffn_b1: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

Shared hidden bias, added after the two products.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_Z

Shape [1, 2, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward1_block2_ffn_Z: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
3-0.793206878695186
40.793206878695186
50

Hidden preactivations X W1+b1; no batch or token mixing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_Hidden

Shape [1, 2, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward1_block2_ffn_Hidden: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30
40.793206878695186
50

ReLU(Z)=max(0,Z), before the second affine layer.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_W2

Shape [3, 2] · axes [HiddenFeature, D] · dtype float64

capstone_forward1_block2_ffn_W2: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10
20
30.25
40
50

Shared hidden-to-output weights, f2{m}{d}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_b2

Shape [2] · axes [D] · dtype float64

capstone_forward1_block2_ffn_b2: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared output bias, added after all three running sums.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_F

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_ffn_F: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.1983017196737965

ReLU(X W1+b1) W2+b2, independently per token with shared parameters.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_Output

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
20.7493520600747274
32.2502302519598736

Exact named-shape addition of capstone_forward1_block2_R1 and capstone_forward1_block2_ffn_F; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_NativeArguments

Shape [8, 2] · axes [Native, NativeField] · dtype float64

capstone_forward1_block2_NativeArguments: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10.5
20.5289429618505417
30.727284649810885
42
51.4142135623730951
60
71
8-0.7457985987703204
90.474355329054734
100
111
120.25
130.5
140.6741763664896413
150.8210824358672163

Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_NativeKinds

Shape [8] · axes [Native] · dtype int32

capstone_forward1_block2_NativeKinds: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
31
41
51
60
70

Native kind codes in native occurrence order: sqrt=0, exp=1.

Declared display precision 0; the cells above retain their saved values.

All five classes at every observed position
capstone_forward1: all actual head products, sums, logits, active flags and probabilities
Observed positionClass indexPublic IDActive (1=yes)Product 0Product 1SumLogitProbability
0097110110.19661193324148185
0198101110.19661193324148185
02256111220.5344466453885229
032570-11000
04512100000.07232948812851327
109710.749352060074727400.74935206007472740.74935206007472740.0647323771153944
1198102.25023025195987362.25023025195987362.25023025195987360.29036527150510255
1225610.74935206007472742.25023025195987362.9995823120346012.9995823120346010.6143051228061488
132570-0.74935206007472742.25023025195987361.50087819188514621.50087819188514620
14512100000.030597228573354247

Only the last observed row chooses. Its saved active-logit selection is class 2, public ID 256, logit 2.999582312034601, probability 0.6143051228061488. An inactive class can have the largest displayed logit and still be ineligible.

All saved head maxima, executed shifts, terms, ordered partial sums, divisions and selection operands

capstone_forward1_softmax_0

Active-class softmax at observed position 0

max=Math.max(allowed logits); term=allowed?exp(logit-max):+0; denominator=ordered +0 fold over all five terms; p=term/denominator

The unchanged stableSoftmax supplies the actual terms, denominator and five divisions. Shifted arguments and denominator partials repeat the same immutable-operand operations for functional evidence, as in IV59 attention. Inactive classes have no shifted field or native occurrence; their terms and probabilities are policy +0.

Saved inputs
t
0
logit0
1
logit1
1
logit2
2
logit3
0
logit4
0
allowed0
1
allowed1
1
allowed2
1
allowed3
0
allowed4
1
Saved outputs
max
2
shifted0
-1
shifted1
-1
shifted2
0
shifted4
-2
term0
0.36787944117144233
term1
0.36787944117144233
term2
1
term3
0
term4
0.1353352832366127
partial0
0.36787944117144233
partial1
0.7357588823428847
partial2
1.7357588823428847
partial3
1.7357588823428847
partial4
1.8710941655794975
denominator
1.8710941655794975
p0
0.19661193324148185
p1
0.19661193324148185
p2
0.5344466453885229
p3
0
p4
0.07232948812851327

capstone_forward1_softmax_1

Active-class softmax at observed position 1

max=Math.max(allowed logits); term=allowed?exp(logit-max):+0; denominator=ordered +0 fold over all five terms; p=term/denominator

The unchanged stableSoftmax supplies the actual terms, denominator and five divisions. Shifted arguments and denominator partials repeat the same immutable-operand operations for functional evidence, as in IV59 attention. Inactive classes have no shifted field or native occurrence; their terms and probabilities are policy +0.

Saved inputs
t
1
logit0
0.7493520600747274
logit1
2.2502302519598736
logit2
2.999582312034601
logit3
1.5008781918851462
logit4
0
allowed0
1
allowed1
1
allowed2
1
allowed3
0
allowed4
1
Saved outputs
max
2.999582312034601
shifted0
-2.2502302519598736
shifted1
-0.7493520600747274
shifted2
0
shifted4
-2.999582312034601
term0
0.10537495897754619
term1
0.472672717067233
term2
1
term3
0
term4
0.04980786817076498
partial0
0.10537495897754619
partial1
0.5780476760447792
partial2
1.5780476760447792
partial3
1.5780476760447792
partial4
1.6278555442155442
denominator
1.6278555442155442
p0
0.0647323771153944
p1
0.29036527150510255
p2
0.6143051228061488
p3
0
p4
0.030597228573354247

capstone_forward1_select

Choose the actual last-row active logit maximum

strict greater scan over ascending active public IDs; retain first on exact tie

Rounded probabilities never choose the token. Inactive logits remain visible candidates with allowed=0. The chosen probability is copied from the saved actual distribution.

Saved inputs
position
1
logit0
0.7493520600747274
allowed0
1
p0
0.0647323771153944
logit1
2.2502302519598736
allowed1
1
p1
0.29036527150510255
logit2
2.999582312034601
allowed2
1
p2
0.6143051228061488
logit3
1.5008781918851462
allowed3
0
p3
0
logit4
0
allowed4
1
p4
0.030597228573354247
Saved outputs
index
2
tokenId
256
logit
2.999582312034601
probability
0.6143051228061488

Budget: stop before forwarding the final pending selected ID. Actual after IDs [256, 256, 256].

capstone_forward1_disposition

Append the actual selected ID and decide whether another forward exists

logicalAfter=observedBefore+[selectedId]; stop=EOS before budget; continue only when neither

Budget: stop before forwarding the final pending selected ID.

Saved inputs
beforeCount
2
selectedId
256
requestedOutputs
2
id0
256
id1
256
Saved outputs
afterCount
3
decisions
2
eos
0
budget
1
continueForward
0
id0
256
id1
256
id2
256

4. Decode the complete actual logical stream once

One or two decisions unless EOS stops sooner. Append actual public ID without retokenization. Recompute full prefix only for a remaining decision. EOS wins stop precedence and is never forwarded; the final budget tail is never forwarded. Final decodeBPEIDs expands the actual complete logical stream once and strictly reconstructs its bytes. No cached engine or generated-string lookup exists.

Every final expansion, optional EOS strip and UTF-8 reconstruction

capstone_decode_expand_0

capstone_decode: expand ID at token 0

ID → validated byte expansion

Byte IDs expand to their own byte; learned IDs expand to their validated concatenated bytes. Concatenate every expansion before strict UTF-8 decoding; no replacement-character guess or input copy is used.

Saved inputs
index
0
id
256
Saved outputs
byteOffset
0
byteWidth
2
byte0
97
byte1
98

capstone_decode_expand_1

capstone_decode: expand ID at token 1

ID → validated byte expansion

Byte IDs expand to their own byte; learned IDs expand to their validated concatenated bytes. Concatenate every expansion before strict UTF-8 decoding; no replacement-character guess or input copy is used.

Saved inputs
index
1
id
256
Saved outputs
byteOffset
2
byteWidth
2
byte0
97
byte1
98

capstone_decode_expand_2

capstone_decode: expand ID at token 2

ID → validated byte expansion

Byte IDs expand to their own byte; learned IDs expand to their validated concatenated bytes. Concatenate every expansion before strict UTF-8 decoding; no replacement-character guess or input copy is used.

Saved inputs
index
2
id
256
Saved outputs
byteOffset
4
byteWidth
2
byte0
97
byte1
98

capstone_decode_decode_0

Decode UTF-8 scalar 0

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
0
byteOffset
0
byteWidth
1
byte0
97
Saved outputs
payload0
97
accumulator0
97
codePoint
97
utf16Width
1
unit0
97

capstone_decode_decode_1

Decode UTF-8 scalar 1

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
1
byteOffset
1
byteWidth
1
byte0
98
Saved outputs
payload0
98
accumulator0
98
codePoint
98
utf16Width
1
unit0
98

capstone_decode_decode_2

Decode UTF-8 scalar 2

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
2
byteOffset
2
byteWidth
1
byte0
97
Saved outputs
payload0
97
accumulator0
97
codePoint
97
utf16Width
1
unit0
97

capstone_decode_decode_3

Decode UTF-8 scalar 3

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
3
byteOffset
3
byteWidth
1
byte0
98
Saved outputs
payload0
98
accumulator0
98
codePoint
98
utf16Width
1
unit0
98

capstone_decode_decode_4

Decode UTF-8 scalar 4

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
4
byteOffset
4
byteWidth
1
byte0
97
Saved outputs
payload0
97
accumulator0
97
codePoint
97
utf16Width
1
unit0
97

capstone_decode_decode_5

Decode UTF-8 scalar 5

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
5
byteOffset
5
byteWidth
1
byte0
98
Saved outputs
payload0
98
accumulator0
98
codePoint
98
utf16Width
1
unit0
98
Every native occurrence, including both global chunks when present

Forward order: complete block1 ledger, complete block2 ledger, head exp in position/active-class order. Native IDs/kinds/arguments/results and all block duplicates are retained. Shifted arguments and softmax partials are same-immutable-operand functional reconstructions, never physical instruction attestation. Serialization performs no sqrt/exp. Global native tensors use contiguous chunks<=64 to retain up to67 occurrences without violating platform dimensions.

Future independent authority must bind each occurrence ID/kind/input WORD before admitting its own positive finite sqrt or exp output within four ordered binary64 words of isolated RN-even reference; sqrt input[1/4,4096], exp input[-256,0], exp(+0/-0)=+1 exactly. TS and canonical admit their own leaves; no bitwise cross-libm parity or whole-output tolerance is assumed.

Complete saved global native ledger joined by nativeTensorIds, nativeIds and nativeKinds
Global occurrenceActual occurrence IDSaved kindSaved kind codeSaved input WORDSaved output WORDActual chunk tensors and local index
0capstone_forward0_block1_n1_0_0_sqrtsqrt00.250.5capstone_NativeArguments0 / capstone_NativeKinds0; local 0
1capstone_forward0_block1_attn_sqrtsqrt021.4142135623730951capstone_NativeArguments0 / capstone_NativeKinds0; local 1
2capstone_forward0_block1_attn_exp_0_0_0_0exp101capstone_NativeArguments0 / capstone_NativeKinds0; local 2
3capstone_forward0_block1_n2_0_0_sqrtsqrt00.250.5capstone_NativeArguments0 / capstone_NativeKinds0; local 3
4capstone_forward0_block2_n1_0_0_sqrtsqrt00.250.5capstone_NativeArguments0 / capstone_NativeKinds0; local 4
5capstone_forward0_block2_attn_sqrtsqrt021.4142135623730951capstone_NativeArguments0 / capstone_NativeKinds0; local 5
6capstone_forward0_block2_attn_exp_0_0_0_0exp101capstone_NativeArguments0 / capstone_NativeKinds0; local 6
7capstone_forward0_block2_n2_0_0_sqrtsqrt00.250.5capstone_NativeArguments0 / capstone_NativeKinds0; local 7
8capstone_forward0_head_exp_0_0exp1-10.36787944117144233capstone_NativeArguments0 / capstone_NativeKinds0; local 8
9capstone_forward0_head_exp_0_1exp1-10.36787944117144233capstone_NativeArguments0 / capstone_NativeKinds0; local 9
10capstone_forward0_head_exp_0_2exp101capstone_NativeArguments0 / capstone_NativeKinds0; local 10
11capstone_forward0_head_exp_0_4exp1-20.1353352832366127capstone_NativeArguments0 / capstone_NativeKinds0; local 11
12capstone_forward1_block1_n1_0_0_sqrtsqrt00.250.5capstone_NativeArguments0 / capstone_NativeKinds0; local 12
13capstone_forward1_block1_n1_0_1_sqrtsqrt00.31250.5590169943749475capstone_NativeArguments0 / capstone_NativeKinds0; local 13
14capstone_forward1_block1_attn_sqrtsqrt021.4142135623730951capstone_NativeArguments0 / capstone_NativeKinds0; local 14
15capstone_forward1_block1_attn_exp_0_0_0_0exp101capstone_NativeArguments0 / capstone_NativeKinds0; local 15
16capstone_forward1_block1_attn_exp_0_0_1_0exp1-0.282842712474618950.7536383164437648capstone_NativeArguments0 / capstone_NativeKinds0; local 16
17capstone_forward1_block1_attn_exp_0_0_1_1exp101capstone_NativeArguments0 / capstone_NativeKinds0; local 17
18capstone_forward1_block1_n2_0_0_sqrtsqrt00.250.5capstone_NativeArguments0 / capstone_NativeKinds0; local 18
19capstone_forward1_block1_n2_0_1_sqrtsqrt00.39251396199363310.6265093470919912capstone_NativeArguments0 / capstone_NativeKinds0; local 19
20capstone_forward1_block2_n1_0_0_sqrtsqrt00.250.5capstone_NativeArguments0 / capstone_NativeKinds0; local 20
21capstone_forward1_block2_n1_0_1_sqrtsqrt00.52894296185054170.727284649810885capstone_NativeArguments0 / capstone_NativeKinds0; local 21
22capstone_forward1_block2_attn_sqrtsqrt021.4142135623730951capstone_NativeArguments0 / capstone_NativeKinds0; local 22
23capstone_forward1_block2_attn_exp_0_0_0_0exp101capstone_NativeArguments0 / capstone_NativeKinds0; local 23
24capstone_forward1_block2_attn_exp_0_0_1_0exp1-0.74579859877032040.474355329054734capstone_NativeArguments0 / capstone_NativeKinds0; local 24
25capstone_forward1_block2_attn_exp_0_0_1_1exp101capstone_NativeArguments0 / capstone_NativeKinds0; local 25
26capstone_forward1_block2_n2_0_0_sqrtsqrt00.250.5capstone_NativeArguments0 / capstone_NativeKinds0; local 26
27capstone_forward1_block2_n2_0_1_sqrtsqrt00.67417636648964130.8210824358672163capstone_NativeArguments0 / capstone_NativeKinds0; local 27
28capstone_forward1_head_exp_0_0exp1-10.36787944117144233capstone_NativeArguments0 / capstone_NativeKinds0; local 28
29capstone_forward1_head_exp_0_1exp1-10.36787944117144233capstone_NativeArguments0 / capstone_NativeKinds0; local 29
30capstone_forward1_head_exp_0_2exp101capstone_NativeArguments0 / capstone_NativeKinds0; local 30
31capstone_forward1_head_exp_0_4exp1-20.1353352832366127capstone_NativeArguments0 / capstone_NativeKinds0; local 31
32capstone_forward1_head_exp_1_0exp1-2.25023025195987360.10537495897754619capstone_NativeArguments0 / capstone_NativeKinds0; local 32
33capstone_forward1_head_exp_1_1exp1-0.74935206007472740.472672717067233capstone_NativeArguments0 / capstone_NativeKinds0; local 33
34capstone_forward1_head_exp_1_2exp101capstone_NativeArguments0 / capstone_NativeKinds0; local 34
35capstone_forward1_head_exp_1_4exp1-2.9995823120346010.04980786817076498capstone_NativeArguments0 / capstone_NativeKinds0; local 35

These are saved mathematical occurrences, not timings or hardware instructions. Repeated arguments remain distinct. The global ledger retains all occurrences across chunks of at most 64; block-local duplicate ledgers remain in complete tensor storage. No native function is evaluated by this table.

All nineteen current inputs in exact capture order
Current whole raw19: original text and all eighteen numeric controls
Raw fieldSaved value
text"ab"
merges1
outputs2
positionScale0.5
q11
k11
v11
o10.5
f10.5
q21
k21
v21
o20.25
f20.25
biasA0
biasB0
biasAB0
biasABAB0
biasEOS0

Exact raw19 own-data plain/null-prototype record. Acquire all descriptors, inspect all, text type, all18 finite numbers, raw-order domains, outer UTF16<=2; one actual strict evaluateIV39 BPE/codec record; actual bytes<=2 before a/b alphabet, nonempty and active1..2 observed IDs; ASCII prefix last. Counts normalize -0 to +0; remaining16 numeric words preserve -0. No trimming, normalization, coercion, partial defaults or truncation.

Complete tensor fallback: all seven fields and every cell (257 tensors)

WORD: all sixteen real raw fields, E/U/bias/gains/features/positions, float arithmetic/native/logit/probability/partial results and their copies. VALUE: merges,outputs,public IDs,class/position/feature indices,dimensions,masks,flags,bytes,UTF16/scalars,rule counts/ranks,source counts. Raw float tensor cells0,1 alone are VALUE. Selection cells0,1 VALUE; cells2,3 WORD. All other float64 cells WORD, all int32/bool cells VALUE. Frame aliases inherit original roles; inactive floating policy zeros remain WORD.

Successful prompts/decisions/native/decoded-byte families are nonempty. At merges0, actual tokenizer rule/candidate/pass families are absent exactly as in IV39: no zero-size tensor or padding row is invented. Inactive head shifted/native occurrences are absent by policy, while full logits/terms/probabilities remain present. EOS has no byte/feature/native row.

capstone_Raw

Shape [18] · axes [RawNumericField] · dtype float64

capstone_Raw: every cell in original row-major storage order
Zero-based storage indexSaved value
01
12
20.5
31
41
51
60.5
70.5
81
91
101
110.25
120.25
130
140
150
160
170

Raw order excluding text; merges/outputs cells VALUE, remaining sixteen cells WORD including -0.

Declared display precision 8; the cells above retain their saved values.

capstone_VocabularyIds

Shape [5] · axes [Vocab] · dtype int32

capstone_VocabularyIds: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198
2256
3257
4512

Ascending public IDs and exact greedy tie order: 97,98,256,257,512.

Declared display precision 0; the cells above retain their saved values.

capstone_ActiveMask

Shape [5] · axes [Vocab] · dtype bool

capstone_ActiveMask: every cell in original row-major storage order
Zero-based storage indexSaved value
0true
1true
2true
3false
4true

True means active; merge IDs require their actual learned rank.

Declared display precision 8; the cells above retain their saved values.

capstone_ActiveIndices

Shape [4] · axes [ActiveClass] · dtype int32

capstone_ActiveIndices: every cell in original row-major storage order
Zero-based storage indexSaved value
00
11
22
34

Compact class indices of active public IDs, in full class order; maps sparse shifted-argument columns.

Declared display precision 0; the cells above retain their saved values.

capstone_E

Shape [5, 2] · axes [Vocab, D] · dtype float64

capstone_E: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31
41
51
6-1
71
80
90

Hand-set embedding rows [1,0],[0,1],[1,1],[-1,1],[+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_U

Shape [2, 5] · axes [D, Vocab] · dtype float64

capstone_U: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
21
3-1
40
50
61
71
81
90

Hand-set feature-last readout rows [1,0,1,-1,0] and [0,1,1,1,0].

Declared display precision 8; the cells above retain their saved values.

capstone_Bias

Shape [5] · axes [Vocab] · dtype float64

capstone_Bias: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30
40

Captured biasA,biasB,biasAB,biasABAB,biasEOS words; inactive columns retain their real biases.

Declared display precision 8; the cells above retain their saved values.

capstone_tokenizer_CorpusCodePoints

Shape [4] · axes [Scalars] · dtype int32

capstone_tokenizer_CorpusCodePoints: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198
297
398

Validated Unicode scalars in exact input order.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusUTF16Offsets

Shape [4] · axes [Scalars] · dtype int32

capstone_tokenizer_CorpusUTF16Offsets: every cell in original row-major storage order
Zero-based storage indexSaved value
00
11
22
33

Zero-based UTF-16 storage offset for each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusUTF16Widths

Shape [4] · axes [Scalars] · dtype int32

capstone_tokenizer_CorpusUTF16Widths: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
31

UTF-16 storage units consumed by each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusByteOffsets

Shape [4] · axes [Scalars] · dtype int32

capstone_tokenizer_CorpusByteOffsets: every cell in original row-major storage order
Zero-based storage indexSaved value
00
11
22
33

Zero-based UTF-8 byte offset for each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusByteWidths

Shape [4] · axes [Scalars] · dtype int32

capstone_tokenizer_CorpusByteWidths: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
31

Actual UTF-8 bytes emitted by each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusBytes

Shape [4] · axes [Bytes] · dtype int32

capstone_tokenizer_CorpusBytes: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198
297
398

Manual UTF-8 encoding in source order, preserving all data.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_SourceCodePoints

Shape [2] · axes [Scalars] · dtype int32

capstone_tokenizer_SourceCodePoints: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Validated Unicode scalars in exact input order.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_SourceUTF16Offsets

Shape [2] · axes [Scalars] · dtype int32

capstone_tokenizer_SourceUTF16Offsets: every cell in original row-major storage order
Zero-based storage indexSaved value
00
11

Zero-based UTF-16 storage offset for each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_SourceUTF16Widths

Shape [2] · axes [Scalars] · dtype int32

capstone_tokenizer_SourceUTF16Widths: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

UTF-16 storage units consumed by each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_SourceByteOffsets

Shape [2] · axes [Scalars] · dtype int32

capstone_tokenizer_SourceByteOffsets: every cell in original row-major storage order
Zero-based storage indexSaved value
00
11

Zero-based UTF-8 byte offset for each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_SourceByteWidths

Shape [2] · axes [Scalars] · dtype int32

capstone_tokenizer_SourceByteWidths: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Actual UTF-8 bytes emitted by each scalar.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_SourceBytes

Shape [2] · axes [Bytes] · dtype int32

capstone_tokenizer_SourceBytes: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Manual UTF-8 encoding in source order, preserving all data.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TrainInitialIDs

Shape [4] · axes [Tokens] · dtype int32

capstone_tokenizer_TrainInitialIDs: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198
297
398

Initial training byte IDs, one ID for each actual corpus byte.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TrainR0CandidateLeft

Shape [2] · axes [Candidates] · dtype int32

capstone_tokenizer_TrainR0CandidateLeft: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Numeric tuple order: left ID, then right ID; aligned candidate columns.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TrainR0CandidateRight

Shape [2] · axes [Candidates] · dtype int32

capstone_tokenizer_TrainR0CandidateRight: every cell in original row-major storage order
Zero-based storage indexSaved value
098
197

Right ID in the same sorted candidate order.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TrainR0CandidateFrequency

Shape [2] · axes [Candidates] · dtype int32

capstone_tokenizer_TrainR0CandidateFrequency: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11

Actual adjacent-pair frequency, including overlapping occurrences.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TrainR0Before

Shape [4] · axes [Tokens] · dtype int32

capstone_tokenizer_TrainR0Before: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198
297
398

Complete current token list before this nonoverlapping left-to-right pass.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TrainR0After

Shape [2] · axes [Tokens] · dtype int32

capstone_tokenizer_TrainR0After: every cell in original row-major storage order
Zero-based storage indexSaved value
0256
1256

Complete actual output token list after this rank; no padding or truncation.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusIDs

Shape [2] · axes [Tokens] · dtype int32

capstone_tokenizer_CorpusIDs: every cell in original row-major storage order
Zero-based storage indexSaved value
0256
1256

Final learned corpus token IDs; corpus training never contains EOS.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_RuleIDs

Shape [1] · axes [Rules] · dtype int32

capstone_tokenizer_RuleIDs: every cell in original row-major storage order
Zero-based storage indexSaved value
0256

Learned IDs in ascending rank, ID=256+rank.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_RuleLeft

Shape [1] · axes [Rules] · dtype int32

capstone_tokenizer_RuleLeft: every cell in original row-major storage order
Zero-based storage indexSaved value
097

Left operand ID for each learned rank.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_RuleRight

Shape [1] · axes [Rules] · dtype int32

capstone_tokenizer_RuleRight: every cell in original row-major storage order
Zero-based storage indexSaved value
098

Right operand ID for each learned rank.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_Rule256Bytes

Shape [2] · axes [Bytes] · dtype int32

capstone_tokenizer_Rule256Bytes: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Actual concatenated operand bytes; the piece alone need not be valid UTF-8.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_EncodeInitialIDs

Shape [2] · axes [Tokens] · dtype int32

capstone_tokenizer_EncodeInitialIDs: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Initial target byte IDs before any ranked application.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_EncodeR0Before

Shape [2] · axes [Tokens] · dtype int32

capstone_tokenizer_EncodeR0Before: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Complete current token list before this nonoverlapping left-to-right pass.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_EncodeR0After

Shape [1] · axes [Tokens] · dtype int32

capstone_tokenizer_EncodeR0After: every cell in original row-major storage order
Zero-based storage indexSaved value
0256

Complete actual output token list after this rank; no padding or truncation.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TargetIDs

Shape [1] · axes [Tokens] · dtype int32

capstone_tokenizer_TargetIDs: every cell in original row-major storage order
Zero-based storage indexSaved value
0256

Final target token IDs after all learned ranks, then optional unique EOS tail.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_CorpusDecodedBytes

Shape [4] · axes [Bytes] · dtype int32

capstone_tokenizer_CorpusDecodedBytes: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198
297
398

Actual final corpus ID expansions passed to strict UTF-8 decoding.

Declared display precision 0; the cells above retain their saved values.

capstone_tokenizer_TargetDecodedBytes

Shape [2] · axes [Bytes] · dtype int32

capstone_tokenizer_TargetDecodedBytes: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198

Actual final target ID expansions passed to strict UTF-8 decoding.

Declared display precision 0; the cells above retain their saved values.

capstone_forward0_ObservedIds

Shape [1] · axes [T] · dtype int32

capstone_forward0_ObservedIds: every cell in original row-major storage order
Zero-based storage indexSaved value
0256

Actual complete prefix forwarded at this decision; no EOS or final pending tail is forwarded.

Declared display precision 0; the cells above retain their saved values.

capstone_forward0_Positions

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_Positions: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual absolute P_t=[+0,t*positionScale] words before the first block only.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_Embeddings

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_Embeddings: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Actual indexed embedding word copies in observed-position order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_Features

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_Features: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Actual coordinate-wise E+P words, passed unchanged to block1.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_Features

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_Features: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Actual captured per-position block features; repeated token IDs do not merge positions.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_Gains

Shape [5] · axes [Gain] · dtype float64

capstone_forward0_block1_Gains: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
30.5
40.5

Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n1_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward0_block1_n1_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n1_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward0_block1_n1_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n1_Statistics

Shape [1, 1, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward0_block1_n1_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n1_Centered

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_n1_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n1_Normalized

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_n1_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n1_Output

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_n1_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_X

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_attn_X: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Active token rows; D=2 input features always retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_WQ

Shape [2, 2] · axes [D, QueryFeature] · dtype float64

capstone_forward0_block1_attn_WQ: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Query columns packed by h*Dk+f from wq{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_WK

Shape [2, 2] · axes [D, KeyFeature] · dtype float64

capstone_forward0_block1_attn_WK: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Key columns packed by h*Dk+f from wk{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_WV

Shape [2, 2] · axes [D, ValueFeature] · dtype float64

capstone_forward0_block1_attn_WV: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Value columns packed by h*Dv+f from wv{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_QConcat

Shape [1, 1, 2] · axes [B, T, QueryFeature] · dtype float64

capstone_forward0_block1_attn_QConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

XWQ; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_KConcat

Shape [1, 1, 2] · axes [B, T, KeyFeature] · dtype float64

capstone_forward0_block1_attn_KConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

XWK; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_VConcat

Shape [1, 1, 2] · axes [B, T, ValueFeature] · dtype float64

capstone_forward0_block1_attn_VConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

XWV; values are projected separately from queries and keys.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_QSplit

Shape [1, 1, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward0_block1_attn_QSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

QConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_QHeads

Shape [1, 1, 1, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward0_block1_attn_QHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

QSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_KSplit

Shape [1, 1, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward0_block1_attn_KSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

KConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_KHeads

Shape [1, 1, 1, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward0_block1_attn_KHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

KSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_VSplit

Shape [1, 1, 1, 2] · axes [B, T, H, Dv] · dtype float64

capstone_forward0_block1_attn_VSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

VConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_VHeads

Shape [1, 1, 1, 2] · axes [B, H, T, Dv] · dtype float64

capstone_forward0_block1_attn_VHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

VSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_raw

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block1_attn_raw: every cell in original row-major storage order
Zero-based storage indexSaved value
00

Separate QHeads KHeads transpose products within every batch and head.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_scores

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block1_attn_scores: every cell in original row-major storage order
Zero-based storage indexSaved value
00

raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_allowed

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype bool

capstone_forward0_block1_attn_allowed: every cell in original row-major storage order
Zero-based storage indexSaved value
0true

Causal and/or valid-key mask; shared validity across B and H; every query retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_logits

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block1_attn_logits: every cell in original row-major storage order
Zero-based storage indexSaved value
00

Finite score+shift, including forbidden cells; mask applied separately.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_probabilities

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block1_attn_probabilities: every cell in original row-major storage order
Zero-based storage indexSaved value
01

Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_OHeads

Shape [1, 1, 1, 2] · axes [B, H, Query, Dv] · dtype float64

capstone_forward0_block1_attn_OHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual per-head P times VHeads; every product and running sum is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_C

Shape [1, 1, 2] · axes [B, T, JoinedValue] · dtype float64

capstone_forward0_block1_attn_C: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_WO

Shape [2, 2] · axes [JoinedValue, D] · dtype float64

capstone_forward0_block1_attn_WO: every cell in original row-major storage order
Zero-based storage indexSaved value
00.5
10
20
30.5

wo{h}{f}{d} packed in h,f,d order, preserving parameter identity.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_attn_Y

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_attn_Y: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Y=C WO, summing products in ascending joined-feature order from zero; no normalization.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_R1

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_R1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Exact named-shape addition of capstone_forward0_block1_Features and capstone_forward0_block1_attn_Y; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n2_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward0_block1_n2_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n2_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward0_block1_n2_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n2_Statistics

Shape [1, 1, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward0_block1_n2_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n2_Centered

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_n2_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n2_Normalized

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_n2_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_n2_Output

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_n2_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_W1

Shape [2, 3] · axes [D, HiddenFeature] · dtype float64

capstone_forward0_block1_ffn_W1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
30
41
50

Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_b1

Shape [3] · axes [HiddenFeature] · dtype float64

capstone_forward0_block1_ffn_b1: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

Shared hidden bias, added after the two products.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_Z

Shape [1, 1, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward0_block1_ffn_Z: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

Hidden preactivations X W1+b1; no batch or token mixing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_Hidden

Shape [1, 1, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward0_block1_ffn_Hidden: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

ReLU(Z)=max(0,Z), before the second affine layer.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_W2

Shape [3, 2] · axes [HiddenFeature, D] · dtype float64

capstone_forward0_block1_ffn_W2: every cell in original row-major storage order
Zero-based storage indexSaved value
00.5
10
20
30.5
40
50

Shared hidden-to-output weights, f2{m}{d}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_b2

Shape [2] · axes [D] · dtype float64

capstone_forward0_block1_ffn_b2: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared output bias, added after all three running sums.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_ffn_F

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_ffn_F: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

ReLU(X W1+b1) W2+b2, independently per token with shared parameters.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_Output

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block1_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Exact named-shape addition of capstone_forward0_block1_R1 and capstone_forward0_block1_ffn_F; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_NativeArguments

Shape [4, 2] · axes [Native, NativeField] · dtype float64

capstone_forward0_block1_NativeArguments: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10.5
22
31.4142135623730951
40
51
60.25
70.5

Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block1_NativeKinds

Shape [4] · axes [Native] · dtype int32

capstone_forward0_block1_NativeKinds: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
21
30

Native kind codes in native occurrence order: sqrt=0, exp=1.

Declared display precision 0; the cells above retain their saved values.

capstone_forward0_block2_Features

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_Features: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Actual captured per-position block features; repeated token IDs do not merge positions.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_Gains

Shape [5] · axes [Gain] · dtype float64

capstone_forward0_block2_Gains: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
30.25
40.25

Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n1_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward0_block2_n1_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n1_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward0_block2_n1_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n1_Statistics

Shape [1, 1, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward0_block2_n1_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n1_Centered

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_n1_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n1_Normalized

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_n1_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n1_Output

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_n1_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_X

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_attn_X: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Active token rows; D=2 input features always retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_WQ

Shape [2, 2] · axes [D, QueryFeature] · dtype float64

capstone_forward0_block2_attn_WQ: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Query columns packed by h*Dk+f from wq{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_WK

Shape [2, 2] · axes [D, KeyFeature] · dtype float64

capstone_forward0_block2_attn_WK: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Key columns packed by h*Dk+f from wk{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_WV

Shape [2, 2] · axes [D, ValueFeature] · dtype float64

capstone_forward0_block2_attn_WV: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Value columns packed by h*Dv+f from wv{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_QConcat

Shape [1, 1, 2] · axes [B, T, QueryFeature] · dtype float64

capstone_forward0_block2_attn_QConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

XWQ; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_KConcat

Shape [1, 1, 2] · axes [B, T, KeyFeature] · dtype float64

capstone_forward0_block2_attn_KConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

XWK; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_VConcat

Shape [1, 1, 2] · axes [B, T, ValueFeature] · dtype float64

capstone_forward0_block2_attn_VConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

XWV; values are projected separately from queries and keys.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_QSplit

Shape [1, 1, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward0_block2_attn_QSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

QConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_QHeads

Shape [1, 1, 1, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward0_block2_attn_QHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

QSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_KSplit

Shape [1, 1, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward0_block2_attn_KSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

KConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_KHeads

Shape [1, 1, 1, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward0_block2_attn_KHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

KSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_VSplit

Shape [1, 1, 1, 2] · axes [B, T, H, Dv] · dtype float64

capstone_forward0_block2_attn_VSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

VConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_VHeads

Shape [1, 1, 1, 2] · axes [B, H, T, Dv] · dtype float64

capstone_forward0_block2_attn_VHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

VSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_raw

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block2_attn_raw: every cell in original row-major storage order
Zero-based storage indexSaved value
00

Separate QHeads KHeads transpose products within every batch and head.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_scores

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block2_attn_scores: every cell in original row-major storage order
Zero-based storage indexSaved value
00

raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_allowed

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype bool

capstone_forward0_block2_attn_allowed: every cell in original row-major storage order
Zero-based storage indexSaved value
0true

Causal and/or valid-key mask; shared validity across B and H; every query retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_logits

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block2_attn_logits: every cell in original row-major storage order
Zero-based storage indexSaved value
00

Finite score+shift, including forbidden cells; mask applied separately.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_probabilities

Shape [1, 1, 1, 1] · axes [B, H, Query, Key] · dtype float64

capstone_forward0_block2_attn_probabilities: every cell in original row-major storage order
Zero-based storage indexSaved value
01

Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_OHeads

Shape [1, 1, 1, 2] · axes [B, H, Query, Dv] · dtype float64

capstone_forward0_block2_attn_OHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual per-head P times VHeads; every product and running sum is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_C

Shape [1, 1, 2] · axes [B, T, JoinedValue] · dtype float64

capstone_forward0_block2_attn_C: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_WO

Shape [2, 2] · axes [JoinedValue, D] · dtype float64

capstone_forward0_block2_attn_WO: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10
20
30.25

wo{h}{f}{d} packed in h,f,d order, preserving parameter identity.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_attn_Y

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_attn_Y: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Y=C WO, summing products in ascending joined-feature order from zero; no normalization.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_R1

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_R1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Exact named-shape addition of capstone_forward0_block2_Features and capstone_forward0_block2_attn_Y; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n2_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward0_block2_n2_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n2_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward0_block2_n2_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n2_Statistics

Shape [1, 1, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward0_block2_n2_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n2_Centered

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_n2_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n2_Normalized

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_n2_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_n2_Output

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_n2_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_W1

Shape [2, 3] · axes [D, HiddenFeature] · dtype float64

capstone_forward0_block2_ffn_W1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
30
41
50

Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_b1

Shape [3] · axes [HiddenFeature] · dtype float64

capstone_forward0_block2_ffn_b1: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

Shared hidden bias, added after the two products.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_Z

Shape [1, 1, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward0_block2_ffn_Z: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

Hidden preactivations X W1+b1; no batch or token mixing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_Hidden

Shape [1, 1, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward0_block2_ffn_Hidden: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

ReLU(Z)=max(0,Z), before the second affine layer.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_W2

Shape [3, 2] · axes [HiddenFeature, D] · dtype float64

capstone_forward0_block2_ffn_W2: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10
20
30.25
40
50

Shared hidden-to-output weights, f2{m}{d}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_b2

Shape [2] · axes [D] · dtype float64

capstone_forward0_block2_ffn_b2: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared output bias, added after all three running sums.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_ffn_F

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_ffn_F: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

ReLU(X W1+b1) W2+b2, independently per token with shared parameters.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_Output

Shape [1, 1, 2] · axes [B, T, D] · dtype float64

capstone_forward0_block2_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Exact named-shape addition of capstone_forward0_block2_R1 and capstone_forward0_block2_ffn_F; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_NativeArguments

Shape [4, 2] · axes [Native, NativeField] · dtype float64

capstone_forward0_block2_NativeArguments: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10.5
22
31.4142135623730951
40
51
60.25
70.5

Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_block2_NativeKinds

Shape [4] · axes [Native] · dtype int32

capstone_forward0_block2_NativeKinds: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
21
30

Native kind codes in native occurrence order: sqrt=0, exp=1.

Declared display precision 0; the cells above retain their saved values.

capstone_forward0_Readout

Shape [1, 1, 5, 4] · axes [B, T, Vocab, ReadoutField] · dtype float64

capstone_forward0_Readout: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
21
31
40
51
61
71
81
91
102
112
12-1
131
140
150
160
170
180
190

Actual product0,product1,sum,logit at every position and all five classes.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_Logits

Shape [1, 1, 5] · axes [B, T, Vocab] · dtype float64

capstone_forward0_Logits: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
22
30
40

All actual logits, including inactive merge columns; only active last-row logits select.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_ClassMaxima

Shape [1, 1] · axes [B, T] · dtype float64

capstone_forward0_ClassMaxima: every cell in original row-major storage order
Zero-based storage indexSaved value
02

Actual Math.max over allowed logits; mixed signed zeros prefer +0.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_ClassShifted

Shape [1, 1, 4] · axes [B, T, ActiveClass] · dtype float64

capstone_forward0_ClassShifted: every cell in original row-major storage order
Zero-based storage indexSaved value
0-1
1-1
20
3-2

Only executed allowed-class exp arguments, in position/ActiveIndices order; no fabricated inactive argument.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_ClassTerms

Shape [1, 1, 5] · axes [B, T, Vocab] · dtype float64

capstone_forward0_ClassTerms: every cell in original row-major storage order
Zero-based storage indexSaved value
00.36787944117144233
10.36787944117144233
21
30
40.1353352832366127

Actual allowed exp outputs and literal inactive +0 policy terms.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_ClassPartials

Shape [1, 1, 5] · axes [B, T, Vocab] · dtype float64

capstone_forward0_ClassPartials: every cell in original row-major storage order
Zero-based storage indexSaved value
00.36787944117144233
10.7357588823428847
21.7357588823428847
31.7357588823428847
41.8710941655794975

Functional reconstruction of identical ordered +0 term folds, including inactive zero terms; no native recomputation.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_ClassDenominators

Shape [1, 1] · axes [B, T] · dtype float64

capstone_forward0_ClassDenominators: every cell in original row-major storage order
Zero-based storage indexSaved value
01.8710941655794975

Actual final ordered denominator supplied by stableSoftmax.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_Probabilities

Shape [1, 1, 5] · axes [B, T, Vocab] · dtype float64

capstone_forward0_Probabilities: every cell in original row-major storage order
Zero-based storage indexSaved value
00.19661193324148185
10.19661193324148185
20.5344466453885229
30
40.07232948812851327

Actual five term/denominator divisions, including inactive exact zero probabilities.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_Selection

Shape [4] · axes [SelectionField] · dtype float64

capstone_forward0_Selection: every cell in original row-major storage order
Zero-based storage indexSaved value
02
1256
22
30.5344466453885229

Actual selected class index and public ID are VALUE; selected logit and probability are unchanged WORD copies.

Declared display precision 8; the cells above retain their saved values.

capstone_forward0_AfterIds

Shape [2] · axes [LogicalToken] · dtype int32

capstone_forward0_AfterIds: every cell in original row-major storage order
Zero-based storage indexSaved value
0256
1256

Actual complete logical IDs after this decision, including its unforwarded tail; EOS can occur only at the final tail.

Declared display precision 0; the cells above retain their saved values.

capstone_forward1_ObservedIds

Shape [2] · axes [T] · dtype int32

capstone_forward1_ObservedIds: every cell in original row-major storage order
Zero-based storage indexSaved value
0256
1256

Actual complete prefix forwarded at this decision; no EOS or final pending tail is forwarded.

Declared display precision 0; the cells above retain their saved values.

capstone_forward1_Positions

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_Positions: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.5

Actual absolute P_t=[+0,t*positionScale] words before the first block only.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_Embeddings

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_Embeddings: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
31

Actual indexed embedding word copies in observed-position order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_Features

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_Features: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
31.5

Actual coordinate-wise E+P words, passed unchanged to block1.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_Features

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_Features: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
31.5

Actual captured per-position block features; repeated token IDs do not merge positions.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_Gains

Shape [5] · axes [Gain] · dtype float64

capstone_forward1_block1_Gains: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
30.5
40.5

Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n1_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward1_block1_n1_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n1_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward1_block1_n1_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n1_Statistics

Shape [1, 2, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward1_block1_n1_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5
102.5
111.25
12-0.25
130.25
140.0625
150.0625
160.125
170.0625
180.3125
190.5590169943749475

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n1_Centered

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_n1_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.25
30.25

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n1_Normalized

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_n1_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n1_Output

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_n1_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_X

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_attn_X: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

Active token rows; D=2 input features always retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_WQ

Shape [2, 2] · axes [D, QueryFeature] · dtype float64

capstone_forward1_block1_attn_WQ: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Query columns packed by h*Dk+f from wq{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_WK

Shape [2, 2] · axes [D, KeyFeature] · dtype float64

capstone_forward1_block1_attn_WK: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Key columns packed by h*Dk+f from wk{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_WV

Shape [2, 2] · axes [D, ValueFeature] · dtype float64

capstone_forward1_block1_attn_WV: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Value columns packed by h*Dv+f from wv{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_QConcat

Shape [1, 2, 2] · axes [B, T, QueryFeature] · dtype float64

capstone_forward1_block1_attn_QConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

XWQ; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_KConcat

Shape [1, 2, 2] · axes [B, T, KeyFeature] · dtype float64

capstone_forward1_block1_attn_KConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

XWK; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_VConcat

Shape [1, 2, 2] · axes [B, T, ValueFeature] · dtype float64

capstone_forward1_block1_attn_VConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

XWV; values are projected separately from queries and keys.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_QSplit

Shape [1, 2, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward1_block1_attn_QSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

QConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_QHeads

Shape [1, 1, 2, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward1_block1_attn_QHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

QSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_KSplit

Shape [1, 2, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward1_block1_attn_KSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

KConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_KHeads

Shape [1, 1, 2, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward1_block1_attn_KHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

KSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_VSplit

Shape [1, 2, 1, 2] · axes [B, T, H, Dv] · dtype float64

capstone_forward1_block1_attn_VSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

VConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_VHeads

Shape [1, 1, 2, 2] · axes [B, H, T, Dv] · dtype float64

capstone_forward1_block1_attn_VHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.4472135954999579
30.4472135954999579

VSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_raw

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block1_attn_raw: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.39999999999999997

Separate QHeads KHeads transpose products within every batch and head.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_scores

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block1_attn_scores: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.28284271247461895

raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_allowed

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype bool

capstone_forward1_block1_attn_allowed: every cell in original row-major storage order
Zero-based storage indexSaved value
0true
1false
2true
3true

Causal and/or valid-key mask; shared validity across B and H; every query retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_logits

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block1_attn_logits: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.28284271247461895

Finite score+shift, including forbidden cells; mask applied separately.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_probabilities

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block1_attn_probabilities: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20.429756985449589
30.570243014550411

Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_OHeads

Shape [1, 1, 2, 2] · axes [B, H, Query, Dv] · dtype float64

capstone_forward1_block1_attn_OHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.25502042884582415
30.25502042884582415

Actual per-head P times VHeads; every product and running sum is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_C

Shape [1, 2, 2] · axes [B, T, JoinedValue] · dtype float64

capstone_forward1_block1_attn_C: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.25502042884582415
30.25502042884582415

OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_WO

Shape [2, 2] · axes [JoinedValue, D] · dtype float64

capstone_forward1_block1_attn_WO: every cell in original row-major storage order
Zero-based storage indexSaved value
00.5
10
20
30.5

wo{h}{f}{d} packed in h,f,d order, preserving parameter identity.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_attn_Y

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_attn_Y: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.12751021442291208
30.12751021442291208

Y=C WO, summing products in ascending joined-feature order from zero; no normalization.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_R1

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_R1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
20.8724897855770879
31.627510214422912

Exact named-shape addition of capstone_forward1_block1_Features and capstone_forward1_block1_attn_Y; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n2_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward1_block1_n2_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n2_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward1_block1_n2_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n2_Statistics

Shape [1, 2, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward1_block1_n2_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5
102.5
111.25
12-0.3775102144229121
130.3775102144229121
140.1425139619936331
150.1425139619936331
160.2850279239872662
170.1425139619936331
180.3925139619936331
190.6265093470919912

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n2_Centered

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_n2_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.3775102144229121
30.3775102144229121

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n2_Normalized

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_n2_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.6025611847216092
30.6025611847216092

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_n2_Output

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_n2_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.6025611847216092
30.6025611847216092

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_W1

Shape [2, 3] · axes [D, HiddenFeature] · dtype float64

capstone_forward1_block1_ffn_W1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
30
41
50

Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_b1

Shape [3] · axes [HiddenFeature] · dtype float64

capstone_forward1_block1_ffn_b1: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

Shared hidden bias, added after the two products.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_Z

Shape [1, 2, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward1_block1_ffn_Z: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
3-0.6025611847216092
40.6025611847216092
50

Hidden preactivations X W1+b1; no batch or token mixing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_Hidden

Shape [1, 2, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward1_block1_ffn_Hidden: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30
40.6025611847216092
50

ReLU(Z)=max(0,Z), before the second affine layer.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_W2

Shape [3, 2] · axes [HiddenFeature, D] · dtype float64

capstone_forward1_block1_ffn_W2: every cell in original row-major storage order
Zero-based storage indexSaved value
00.5
10
20
30.5
40
50

Shared hidden-to-output weights, f2{m}{d}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_b2

Shape [2] · axes [D] · dtype float64

capstone_forward1_block1_ffn_b2: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared output bias, added after all three running sums.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_ffn_F

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_ffn_F: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.3012805923608046

ReLU(X W1+b1) W2+b2, independently per token with shared parameters.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_Output

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block1_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
20.8724897855770879
31.9287908067837167

Exact named-shape addition of capstone_forward1_block1_R1 and capstone_forward1_block1_ffn_F; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_NativeArguments

Shape [8, 2] · axes [Native, NativeField] · dtype float64

capstone_forward1_block1_NativeArguments: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10.5
20.3125
30.5590169943749475
42
51.4142135623730951
60
71
8-0.28284271247461895
90.7536383164437648
100
111
120.25
130.5
140.3925139619936331
150.6265093470919912

Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block1_NativeKinds

Shape [8] · axes [Native] · dtype int32

capstone_forward1_block1_NativeKinds: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
31
41
51
60
70

Native kind codes in native occurrence order: sqrt=0, exp=1.

Declared display precision 0; the cells above retain their saved values.

capstone_forward1_block2_Features

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_Features: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
20.8724897855770879
31.9287908067837167

Actual captured per-position block features; repeated token IDs do not merge positions.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_Gains

Shape [5] · axes [Gain] · dtype float64

capstone_forward1_block2_Gains: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
21
30.25
40.25

Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n1_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward1_block2_n1_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n1_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward1_block2_n1_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n1_Statistics

Shape [1, 2, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward1_block2_n1_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5
102.8012805923608046
111.4006402961804023
12-0.5281505106033144
130.5281505106033144
140.27894296185054174
150.27894296185054174
160.5578859237010835
170.27894296185054174
180.5289429618505417
190.727284649810885

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n1_Centered

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_n1_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.5281505106033144
30.5281505106033144

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n1_Normalized

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_n1_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n1_Output

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_n1_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_X

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_attn_X: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

Active token rows; D=2 input features always retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_WQ

Shape [2, 2] · axes [D, QueryFeature] · dtype float64

capstone_forward1_block2_attn_WQ: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Query columns packed by h*Dk+f from wq{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_WK

Shape [2, 2] · axes [D, KeyFeature] · dtype float64

capstone_forward1_block2_attn_WK: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Key columns packed by h*Dk+f from wk{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_WV

Shape [2, 2] · axes [D, ValueFeature] · dtype float64

capstone_forward1_block2_attn_WV: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
31

Value columns packed by h*Dv+f from wv{d}{h}{f}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_QConcat

Shape [1, 2, 2] · axes [B, T, QueryFeature] · dtype float64

capstone_forward1_block2_attn_QConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

XWQ; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_KConcat

Shape [1, 2, 2] · axes [B, T, KeyFeature] · dtype float64

capstone_forward1_block2_attn_KConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

XWK; each packed coordinate has two products and one sum.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_VConcat

Shape [1, 2, 2] · axes [B, T, ValueFeature] · dtype float64

capstone_forward1_block2_attn_VConcat: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

XWV; values are projected separately from queries and keys.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_QSplit

Shape [1, 2, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward1_block2_attn_QSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

QConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_QHeads

Shape [1, 1, 2, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward1_block2_attn_QHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

QSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_KSplit

Shape [1, 2, 1, 2] · axes [B, T, H, Dk] · dtype float64

capstone_forward1_block2_attn_KSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

KConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_KHeads

Shape [1, 1, 2, 2] · axes [B, H, T, Dk] · dtype float64

capstone_forward1_block2_attn_KHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

KSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_VSplit

Shape [1, 2, 1, 2] · axes [B, T, H, Dv] · dtype float64

capstone_forward1_block2_attn_VSplit: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

VConcat reshaped without changing flat order; feature=h*F+f.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_VHeads

Shape [1, 1, 2, 2] · axes [B, H, T, Dv] · dtype float64

capstone_forward1_block2_attn_VHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.7261950472083369
30.7261950472083369

VSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_raw

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block2_attn_raw: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
31.0547184931798375

Separate QHeads KHeads transpose products within every batch and head.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_scores

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block2_attn_scores: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.7457985987703204

raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_allowed

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype bool

capstone_forward1_block2_attn_allowed: every cell in original row-major storage order
Zero-based storage indexSaved value
0true
1false
2true
3true

Causal and/or valid-key mask; shared validity across B and H; every query retained.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_logits

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block2_attn_logits: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.7457985987703204

Finite score+shift, including forbidden cells; mask applied separately.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_probabilities

Shape [1, 1, 2, 2] · axes [B, H, Query, Key] · dtype float64

capstone_forward1_block2_attn_probabilities: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20.3217374534528671
30.6782625465471329

Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_OHeads

Shape [1, 1, 2, 2] · axes [B, H, Query, Dv] · dtype float64

capstone_forward1_block2_attn_OHeads: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.492550902009442
30.492550902009442

Actual per-head P times VHeads; every product and running sum is traced.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_C

Shape [1, 2, 2] · axes [B, T, JoinedValue] · dtype float64

capstone_forward1_block2_attn_C: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.492550902009442
30.492550902009442

OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_WO

Shape [2, 2] · axes [JoinedValue, D] · dtype float64

capstone_forward1_block2_attn_WO: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10
20
30.25

wo{h}{f}{d} packed in h,f,d order, preserving parameter identity.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_attn_Y

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_attn_Y: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.1231377255023605
30.1231377255023605

Y=C WO, summing products in ascending joined-feature order from zero; no normalization.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_R1

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_R1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
20.7493520600747274
32.051928532286077

Exact named-shape addition of capstone_forward1_block2_Features and capstone_forward1_block2_attn_Y; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n2_Gamma

Shape [2] · axes [D] · dtype float64

capstone_forward1_block2_n2_Gamma: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11

Shared literal feature scales [1,1].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n2_Beta

Shape [2] · axes [D] · dtype float64

capstone_forward1_block2_n2_Beta: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared literal feature offsets [+0,+0].

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n2_Statistics

Shape [1, 2, 10] · axes [B, T, NormStatistic] · dtype float64

capstone_forward1_block2_n2_Statistics: every cell in original row-major storage order
Zero-based storage indexSaved value
02
11
20
30
40
50
60
70
80.25
90.5
102.8012805923608046
111.4006402961804023
12-0.6512882361056749
130.6512882361056749
140.4241763664896413
150.4241763664896413
160.8483527329792826
170.4241763664896413
180.6741763664896413
190.8210824358672163

Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n2_Centered

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_n2_Centered: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.6512882361056749
30.6512882361056749

Actual saved input feature minus feature mean, before division.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n2_Normalized

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_n2_Normalized: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.793206878695186
30.793206878695186

Actual centered/denominator words before gamma multiplication and beta addition.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_n2_Output

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_n2_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
2-0.793206878695186
30.793206878695186

Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_W1

Shape [2, 3] · axes [D, HiddenFeature] · dtype float64

capstone_forward1_block2_ffn_W1: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
20
30
41
50

Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_b1

Shape [3] · axes [HiddenFeature] · dtype float64

capstone_forward1_block2_ffn_b1: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20

Shared hidden bias, added after the two products.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_Z

Shape [1, 2, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward1_block2_ffn_Z: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
3-0.793206878695186
40.793206878695186
50

Hidden preactivations X W1+b1; no batch or token mixing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_Hidden

Shape [1, 2, 3] · axes [B, T, HiddenFeature] · dtype float64

capstone_forward1_block2_ffn_Hidden: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30
40.793206878695186
50

ReLU(Z)=max(0,Z), before the second affine layer.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_W2

Shape [3, 2] · axes [HiddenFeature, D] · dtype float64

capstone_forward1_block2_ffn_W2: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10
20
30.25
40
50

Shared hidden-to-output weights, f2{m}{d}.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_b2

Shape [2] · axes [D] · dtype float64

capstone_forward1_block2_ffn_b2: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10

Shared output bias, added after all three running sums.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_ffn_F

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_ffn_F: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
30.1983017196737965

ReLU(X W1+b1) W2+b2, independently per token with shared parameters.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_Output

Shape [1, 2, 2] · axes [B, T, D] · dtype float64

capstone_forward1_block2_Output: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
20.7493520600747274
32.2502302519598736

Exact named-shape addition of capstone_forward1_block2_R1 and capstone_forward1_block2_ffn_F; no broadcasting.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_NativeArguments

Shape [8, 2] · axes [Native, NativeField] · dtype float64

capstone_forward1_block2_NativeArguments: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10.5
20.5289429618505417
30.727284649810885
42
51.4142135623730951
60
71
8-0.7457985987703204
90.474355329054734
100
111
120.25
130.5
140.6741763664896413
150.8210824358672163

Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_block2_NativeKinds

Shape [8] · axes [Native] · dtype int32

capstone_forward1_block2_NativeKinds: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
20
31
41
51
60
70

Native kind codes in native occurrence order: sqrt=0, exp=1.

Declared display precision 0; the cells above retain their saved values.

capstone_forward1_Readout

Shape [1, 2, 5, 4] · axes [B, T, Vocab, ReadoutField] · dtype float64

capstone_forward1_Readout: every cell in original row-major storage order
Zero-based storage indexSaved value
01
10
21
31
40
51
61
71
81
91
102
112
12-1
131
140
150
160
170
180
190
200.7493520600747274
210
220.7493520600747274
230.7493520600747274
240
252.2502302519598736
262.2502302519598736
272.2502302519598736
280.7493520600747274
292.2502302519598736
302.999582312034601
312.999582312034601
32-0.7493520600747274
332.2502302519598736
341.5008781918851462
351.5008781918851462
360
370
380
390

Actual product0,product1,sum,logit at every position and all five classes.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_Logits

Shape [1, 2, 5] · axes [B, T, Vocab] · dtype float64

capstone_forward1_Logits: every cell in original row-major storage order
Zero-based storage indexSaved value
01
11
22
30
40
50.7493520600747274
62.2502302519598736
72.999582312034601
81.5008781918851462
90

All actual logits, including inactive merge columns; only active last-row logits select.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_ClassMaxima

Shape [1, 2] · axes [B, T] · dtype float64

capstone_forward1_ClassMaxima: every cell in original row-major storage order
Zero-based storage indexSaved value
02
12.999582312034601

Actual Math.max over allowed logits; mixed signed zeros prefer +0.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_ClassShifted

Shape [1, 2, 4] · axes [B, T, ActiveClass] · dtype float64

capstone_forward1_ClassShifted: every cell in original row-major storage order
Zero-based storage indexSaved value
0-1
1-1
20
3-2
4-2.2502302519598736
5-0.7493520600747274
60
7-2.999582312034601

Only executed allowed-class exp arguments, in position/ActiveIndices order; no fabricated inactive argument.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_ClassTerms

Shape [1, 2, 5] · axes [B, T, Vocab] · dtype float64

capstone_forward1_ClassTerms: every cell in original row-major storage order
Zero-based storage indexSaved value
00.36787944117144233
10.36787944117144233
21
30
40.1353352832366127
50.10537495897754619
60.472672717067233
71
80
90.04980786817076498

Actual allowed exp outputs and literal inactive +0 policy terms.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_ClassPartials

Shape [1, 2, 5] · axes [B, T, Vocab] · dtype float64

capstone_forward1_ClassPartials: every cell in original row-major storage order
Zero-based storage indexSaved value
00.36787944117144233
10.7357588823428847
21.7357588823428847
31.7357588823428847
41.8710941655794975
50.10537495897754619
60.5780476760447792
71.5780476760447792
81.5780476760447792
91.6278555442155442

Functional reconstruction of identical ordered +0 term folds, including inactive zero terms; no native recomputation.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_ClassDenominators

Shape [1, 2] · axes [B, T] · dtype float64

capstone_forward1_ClassDenominators: every cell in original row-major storage order
Zero-based storage indexSaved value
01.8710941655794975
11.6278555442155442

Actual final ordered denominator supplied by stableSoftmax.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_Probabilities

Shape [1, 2, 5] · axes [B, T, Vocab] · dtype float64

capstone_forward1_Probabilities: every cell in original row-major storage order
Zero-based storage indexSaved value
00.19661193324148185
10.19661193324148185
20.5344466453885229
30
40.07232948812851327
50.0647323771153944
60.29036527150510255
70.6143051228061488
80
90.030597228573354247

Actual five term/denominator divisions, including inactive exact zero probabilities.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_Selection

Shape [4] · axes [SelectionField] · dtype float64

capstone_forward1_Selection: every cell in original row-major storage order
Zero-based storage indexSaved value
02
1256
22.999582312034601
30.6143051228061488

Actual selected class index and public ID are VALUE; selected logit and probability are unchanged WORD copies.

Declared display precision 8; the cells above retain their saved values.

capstone_forward1_AfterIds

Shape [3] · axes [LogicalToken] · dtype int32

capstone_forward1_AfterIds: every cell in original row-major storage order
Zero-based storage indexSaved value
0256
1256
2256

Actual complete logical IDs after this decision, including its unforwarded tail; EOS can occur only at the final tail.

Declared display precision 0; the cells above retain their saved values.

capstone_LogicalIds

Shape [3] · axes [LogicalToken] · dtype int32

capstone_LogicalIds: every cell in original row-major storage order
Zero-based storage indexSaved value
0256
1256
2256

Actual prompt plus actual selected IDs, passed once to final real BPE decoding.

Declared display precision 0; the cells above retain their saved values.

capstone_SelectedIds

Shape [2] · axes [Decision] · dtype int32

capstone_SelectedIds: every cell in original row-major storage order
Zero-based storage indexSaved value
0256
1256

Actual selected public IDs in generation order, including tail EOS if selected.

Declared display precision 0; the cells above retain their saved values.

capstone_DecodedBytes

Shape [6] · axes [Bytes] · dtype int32

capstone_DecodedBytes: every cell in original row-major storage order
Zero-based storage indexSaved value
097
198
297
398
497
598

Actual concatenated BPE ID expansions passed to strict UTF-8 decoding, not copied from original text.

Declared display precision 0; the cells above retain their saved values.

capstone_NativeArguments0

Shape [36, 2] · axes [Native, NativeField] · dtype float64

capstone_NativeArguments0: every cell in original row-major storage order
Zero-based storage indexSaved value
00.25
10.5
22
31.4142135623730951
40
51
60.25
70.5
80.25
90.5
102
111.4142135623730951
120
131
140.25
150.5
16-1
170.36787944117144233
18-1
190.36787944117144233
200
211
22-2
230.1353352832366127
240.25
250.5
260.3125
270.5590169943749475
282
291.4142135623730951
300
311
32-0.28284271247461895
330.7536383164437648
340
351
360.25
370.5
380.3925139619936331
390.6265093470919912
400.25
410.5
420.5289429618505417
430.727284649810885
442
451.4142135623730951
460
471
48-0.7457985987703204
490.474355329054734
500
511
520.25
530.5
540.6741763664896413
550.8210824358672163
56-1
570.36787944117144233
58-1
590.36787944117144233
600
611
62-2
630.1353352832366127
64-2.2502302519598736
650.10537495897754619
66-0.7493520600747274
670.472672717067233
680
691
70-2.999582312034601
710.04980786817076498

Contiguous global native input/output WORD copies, chunks of at most64 in nativeIds order; no native evaluation while serializing.

Declared display precision 8; the cells above retain their saved values.

capstone_NativeKinds0

Shape [36] · axes [Native] · dtype int32

capstone_NativeKinds0: every cell in original row-major storage order
Zero-based storage indexSaved value
00
10
21
30
40
50
61
70
81
91
101
111
120
130
140
151
161
171
180
190
200
210
220
231
241
251
260
270
281
291
301
311
321
331
341
351

Aligned VALUE native kind codes: sqrt=0, exp=1; global occurrence offset is64 times the chunk index.

Declared display precision 0; the cells above retain their saved values.

Complete frame fallback: all six fields and every operand (317 frames)

All computation and codec/scalar/native evidence is completed and snapshotted privately before publishing any external frame. Each callback receives only frozen detached six-field frames. Every tokenizer frame/tensor/text is copied once under prefix_tokenizer, and its whole actual output record is copied in one frame. All block tensors/texts survive with unique forward/block prefixes. No StepRecord.state or hidden state field is used.

capstone_setup — selected saved step

Capture the bounded text-to-output computation

one actual BPE preparation; each decision=lookup+position+block1+block2+all-position head; final real ID decode

The hand-set, untrained model uses full uncached recomputation. Two blocks are not two generated tokens. No hidden service, learned answer table or compatible KV cache is present.

Saved inputs
utf16Units
2
merges
1
outputs
2
Saved outputs
rawInputCount
19
numericInputCount
18
promptTokens
1
activeClasses
4
requestedOutputs
2

capstone_raw

Retain all eighteen captured numeric controls

rawNumeric=raw19 without text

The two counts are VALUE; every other numeric field is a binary64 WORD, including admitted signed zero. Original text is retained separately without normalization.

Saved inputs
merges
1
outputs
2
positionScale
0.5
q1
1
k1
1
v1
1
o1
0.5
f1
0.5
q2
1
k2
1
v2
1
o2
0.25
f2
0.25
biasA
0
biasB
0
biasAB
0
biasABAB
0
biasEOS
0
Saved outputs
merges
1
outputs
2
positionScale
0.5
q1
1
k1
1
v1
1
o1
0.5
f1
0.5
q2
1
k2
1
v2
1
o2
0.25
f2
0.25
biasA
0
biasB
0
biasAB
0
biasABAB
0
biasEOS
0

capstone_vocabulary

Declare ascending public classes and hand-set tables

IDs=[97,98,256,257,512]; E[Vocab,D]; U[D,Vocab]; active97,98,512 plus learned merge IDs

Public token IDs are distinct from compact class rows. Every class logit is computed, but inactive merge classes are neither exponentiated nor eligible for greedy selection.

Saved inputs
id0
97
allowed0
1
id1
98
allowed1
1
id2
256
allowed2
1
id3
257
allowed3
0
id4
512
allowed4
1
e0
1
e1
0
e2
0
e3
1
e4
1
e5
1
e6
-1
e7
1
e8
0
e9
0
u0
1
u1
0
u2
1
u3
-1
u4
0
u5
0
u6
1
u7
1
u8
1
u9
0
bias0
0
bias1
0
bias2
0
bias3
0
bias4
0
Saved outputs
vocabularySize
5
featureWidth
2
hiddenWidth
3
blockCount
2
activeCount
4

capstone_tokenizer_setup

Declare learned byte-pair encoding and both exact inputs

byte IDs=0..255; learned ID=256+rank; EOS=512; each text field<=24 UTF-8 bytes

Validate every raw field before corpus then target Unicode semantics. Train on the corpus byte stream including spaces; encode the separate target using learned ranks. No normalization, word splitting, inferred EOS or pretrained vocabulary is used.

Saved inputs
requestedMerges
1
eos
0
Saved outputs
corpusUnits
4
corpusScalars
4
utf16Units
2
scalarCount
2
byteBound
24
mergeBase
256
mergeBound
4
EOS
512

capstone_tokenizer_corpus_scalar_0

Encode scalar 0: U+0061

supplementary cp=(high−55296)*1024+(low−56320)+65536; split cp into payload groups; add UTF-8 prefix bits

A continuation byte has prefix 10 and six payload bits (base 64). Lead prefixes are 0, 110, 1110 or 11110. UTF-16 offsets count storage units, not perceived characters. No normalization or BOM stripping occurs.

Saved inputs
scalarIndex
0
utf16Offset
0
utf16Width
1
codePoint
97
unit0
97
Saved outputs
byteOffset
0
byteWidth
1
payload0
97
byte0
97

capstone_tokenizer_corpus_scalar_1

Encode scalar 1: U+0062

supplementary cp=(high−55296)*1024+(low−56320)+65536; split cp into payload groups; add UTF-8 prefix bits

A continuation byte has prefix 10 and six payload bits (base 64). Lead prefixes are 0, 110, 1110 or 11110. UTF-16 offsets count storage units, not perceived characters. No normalization or BOM stripping occurs.

Saved inputs
scalarIndex
1
utf16Offset
1
utf16Width
1
codePoint
98
unit0
98
Saved outputs
byteOffset
1
byteWidth
1
payload0
98
byte0
98

capstone_tokenizer_corpus_scalar_2

Encode scalar 2: U+0061

supplementary cp=(high−55296)*1024+(low−56320)+65536; split cp into payload groups; add UTF-8 prefix bits

A continuation byte has prefix 10 and six payload bits (base 64). Lead prefixes are 0, 110, 1110 or 11110. UTF-16 offsets count storage units, not perceived characters. No normalization or BOM stripping occurs.

Saved inputs
scalarIndex
2
utf16Offset
2
utf16Width
1
codePoint
97
unit0
97
Saved outputs
byteOffset
2
byteWidth
1
payload0
97
byte0
97

capstone_tokenizer_corpus_scalar_3

Encode scalar 3: U+0062

supplementary cp=(high−55296)*1024+(low−56320)+65536; split cp into payload groups; add UTF-8 prefix bits

A continuation byte has prefix 10 and six payload bits (base 64). Lead prefixes are 0, 110, 1110 or 11110. UTF-16 offsets count storage units, not perceived characters. No normalization or BOM stripping occurs.

Saved inputs
scalarIndex
3
utf16Offset
3
utf16Width
1
codePoint
98
unit0
98
Saved outputs
byteOffset
3
byteWidth
1
payload0
98
byte0
98

capstone_tokenizer_source_scalar_0

Encode scalar 0: U+0061

supplementary cp=(high−55296)*1024+(low−56320)+65536; split cp into payload groups; add UTF-8 prefix bits

A continuation byte has prefix 10 and six payload bits (base 64). Lead prefixes are 0, 110, 1110 or 11110. UTF-16 offsets count storage units, not perceived characters. No normalization or BOM stripping occurs.

Saved inputs
scalarIndex
0
utf16Offset
0
utf16Width
1
codePoint
97
unit0
97
Saved outputs
byteOffset
0
byteWidth
1
payload0
97
byte0
97

capstone_tokenizer_source_scalar_1

Encode scalar 1: U+0062

supplementary cp=(high−55296)*1024+(low−56320)+65536; split cp into payload groups; add UTF-8 prefix bits

A continuation byte has prefix 10 and six payload bits (base 64). Lead prefixes are 0, 110, 1110 or 11110. UTF-16 offsets count storage units, not perceived characters. No normalization or BOM stripping occurs.

Saved inputs
scalarIndex
1
utf16Offset
1
utf16Width
1
codePoint
98
unit0
98
Saved outputs
byteOffset
1
byteWidth
1
payload0
98
byte0
98

capstone_tokenizer_train_count_0_0

Count round 0 pair at current-token position 0

frequency(left,right)=previous frequency+1; next counting position=position+1

Count every adjacent occurrence, including overlaps. The table starts empty each round. In aaaa, aa occurs at positions 0, 1 and 2 even though replacement will consume only two disjoint pairs.

Saved inputs
rank
0
position
0
left
97
right
98
countBefore
0
Saved outputs
countAfter
1
distinctPairs
1

capstone_tokenizer_train_count_0_1

Count round 0 pair at current-token position 1

frequency(left,right)=previous frequency+1; next counting position=position+1

Count every adjacent occurrence, including overlaps. The table starts empty each round. In aaaa, aa occurs at positions 0, 1 and 2 even though replacement will consume only two disjoint pairs.

Saved inputs
rank
0
position
1
left
98
right
97
countBefore
0
Saved outputs
countAfter
1
distinctPairs
2

capstone_tokenizer_train_count_0_2

Count round 0 pair at current-token position 2

frequency(left,right)=previous frequency+1; next counting position=position+1

Count every adjacent occurrence, including overlaps. The table starts empty each round. In aaaa, aa occurs at positions 0, 1 and 2 even though replacement will consume only two disjoint pairs.

Saved inputs
rank
0
position
2
left
97
right
98
countBefore
1
Saved outputs
countAfter
2
distinctPairs
2

capstone_tokenizer_train_compare_0_0

Compare round 0 candidate 0

take=first candidate or greater frequency or (equal frequency and numerically smaller (left,right))

Compare integer IDs, left first and then right, not string keys or encounter order. Candidate columns use numeric tuple order. The first comparison uses best IDs -1 and frequency 0 as an explicit empty-best sentinel.

Saved inputs
candidateIndex
0
left
97
right
98
frequency
2
bestLeft
-1
bestRight
-1
bestFrequency
0
Saved outputs
take
1
frequencyGreater
1
frequencyEqual
0
lexSmaller
0
bestLeft
97
bestRight
98
bestFrequency
2

capstone_tokenizer_train_compare_0_1

Compare round 0 candidate 1

take=first candidate or greater frequency or (equal frequency and numerically smaller (left,right))

Compare integer IDs, left first and then right, not string keys or encounter order. Candidate columns use numeric tuple order. The first comparison uses best IDs -1 and frequency 0 as an explicit empty-best sentinel.

Saved inputs
candidateIndex
1
left
98
right
97
frequency
1
bestLeft
97
bestRight
98
bestFrequency
2
Saved outputs
take
0
frequencyGreater
0
frequencyEqual
0
lexSmaller
0
bestLeft
97
bestRight
98
bestFrequency
2

capstone_tokenizer_train_select_0

Select round 0 winning pair

newID=256+rank; select greatest frequency, then smallest numeric pair

Frequency 1 is eligible. Requested merges are a budget; actual merges stop early only when no adjacent pair remains.

Saved inputs
rank
0
currentLength
4
candidateCount
2
Saved outputs
id
256
left
97
right
98
frequency
2

capstone_tokenizer_train_rule_0

Build rule 0 byte expansion

new bytes=left bytes followed by right bytes

Both operands are bytes or earlier merge IDs. Their complete concatenation defines the new ID and cannot create a cycle. A piece may end inside a UTF-8 scalar, so its label uses ID and exact JSON bytes.

Saved inputs
id
256
left
97
right
98
leftWidth
1
rightWidth
1
leftByte0
97
rightByte0
98
Saved outputs
byteWidth
2
byte0
97
byte1
98

capstone_tokenizer_train_replace_0_0

train: rank 0, current-token position 0

matched=(currentID=left and nextID=right); emit matched?newID:currentID; consumed=matched?2:1; nextPosition=position+consumed

Positions index the current token list, not original bytes. A match consumes two tokens and emits one; a nonmatch copies one token. Advancing past both matched operands prevents overlapping replacements. The complete pass snapshots and position/consumed/nextPosition retain every scan; nextID -1 means no next token, never a token or padding item.

Saved inputs
rank
0
position
0
inputLength
4
left
97
right
98
newID
256
currentID
97
nextID
98
outputLength
0
Saved outputs
matched
1
id
256
consumed
2
nextPosition
2
outputLength
1

capstone_tokenizer_train_replace_0_2

train: rank 0, current-token position 2

matched=(currentID=left and nextID=right); emit matched?newID:currentID; consumed=matched?2:1; nextPosition=position+consumed

Positions index the current token list, not original bytes. A match consumes two tokens and emits one; a nonmatch copies one token. Advancing past both matched operands prevents overlapping replacements. The complete pass snapshots and position/consumed/nextPosition retain every scan; nextID -1 means no next token, never a token or padding item.

Saved inputs
rank
0
position
2
inputLength
4
left
97
right
98
newID
256
currentID
97
nextID
98
outputLength
1
Saved outputs
matched
1
id
256
consumed
2
nextPosition
4
outputLength
2

capstone_tokenizer_encode_replace_0_0

encode: rank 0, current-token position 0

matched=(currentID=left and nextID=right); emit matched?newID:currentID; consumed=matched?2:1; nextPosition=position+consumed

Positions index the current token list, not original bytes. A match consumes two tokens and emits one; a nonmatch copies one token. Advancing past both matched operands prevents overlapping replacements. The complete pass snapshots and position/consumed/nextPosition retain every scan; nextID -1 means no next token, never a token or padding item.

Saved inputs
rank
0
position
0
inputLength
2
left
97
right
98
newID
256
currentID
97
nextID
98
outputLength
0
Saved outputs
matched
1
id
256
consumed
2
nextPosition
2
outputLength
1

capstone_tokenizer_corpus_expand_0

corpus: expand ID at token 0

ID → validated byte expansion

Byte IDs expand to their own byte; learned IDs expand to their validated concatenated bytes. Concatenate every expansion before strict UTF-8 decoding; no replacement-character guess or input copy is used.

Saved inputs
index
0
id
256
Saved outputs
byteOffset
0
byteWidth
2
byte0
97
byte1
98

capstone_tokenizer_corpus_expand_1

corpus: expand ID at token 1

ID → validated byte expansion

Byte IDs expand to their own byte; learned IDs expand to their validated concatenated bytes. Concatenate every expansion before strict UTF-8 decoding; no replacement-character guess or input copy is used.

Saved inputs
index
1
id
256
Saved outputs
byteOffset
2
byteWidth
2
byte0
97
byte1
98

capstone_tokenizer_corpus_decode_0

Decode UTF-8 scalar 0

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
0
byteOffset
0
byteWidth
1
byte0
97
Saved outputs
payload0
97
accumulator0
97
codePoint
97
utf16Width
1
unit0
97

capstone_tokenizer_corpus_decode_1

Decode UTF-8 scalar 1

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
1
byteOffset
1
byteWidth
1
byte0
98
Saved outputs
payload0
98
accumulator0
98
codePoint
98
utf16Width
1
unit0
98

capstone_tokenizer_corpus_decode_2

Decode UTF-8 scalar 2

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
2
byteOffset
2
byteWidth
1
byte0
97
Saved outputs
payload0
97
accumulator0
97
codePoint
97
utf16Width
1
unit0
97

capstone_tokenizer_corpus_decode_3

Decode UTF-8 scalar 3

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
3
byteOffset
3
byteWidth
1
byte0
98
Saved outputs
payload0
98
accumulator0
98
codePoint
98
utf16Width
1
unit0
98

capstone_tokenizer_target_expand_0

target: expand ID at token 0

ID → validated byte expansion

Byte IDs expand to their own byte; learned IDs expand to their validated concatenated bytes. Concatenate every expansion before strict UTF-8 decoding; no replacement-character guess or input copy is used.

Saved inputs
index
0
id
256
Saved outputs
byteOffset
0
byteWidth
2
byte0
97
byte1
98

capstone_tokenizer_target_decode_0

Decode UTF-8 scalar 0

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
0
byteOffset
0
byteWidth
1
byte0
97
Saved outputs
payload0
97
accumulator0
97
codePoint
97
utf16Width
1
unit0
97

capstone_tokenizer_target_decode_1

Decode UTF-8 scalar 1

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
1
byteOffset
1
byteWidth
1
byte0
98
Saved outputs
payload0
98
accumulator0
98
codePoint
98
utf16Width
1
unit0
98

capstone_tokenizer_roundtrip

Compare both actual strict reconstructions with the original strings

corpusEqual=(corpusDecoded===corpus); equal=(targetDecoded===text)

Expand real corpus and target IDs separately, concatenate real bytes, strictly reconstruct Unicode scalars, and only then compare strings. Empty content reconstructs the empty string; optional target EOS emits no bytes.

Saved inputs
corpusOriginalUnits
4
corpusDecodedUnits
4
corpusDecodedByteCount
4
originalUnits
2
decodedUnits
2
decodedByteCount
2
Saved outputs
corpusTokens
2
tokenCount
1
corpusEqual
1
equal
1

capstone_tokenizer_outputs

Copy the whole actual tokenizer output record

copy every actual IV39 primary summary and frame-output alias

This is a copy of the one saved tokenizer result, including all byte/BPE/roundtrip evidence. No encoder, training pass or decoder is replayed for this projection.

Saved inputs
Saved outputs
corpusBytes
4
byteCount
2
actualMerges
1
tokenCount
1
requestedMerges
1
corpusTokens
2
eos
0
byteBound
24
vocabularyItems
258
corpusEqual
1
equal
1
setup_corpusUnits
4
setup_corpusScalars
4
setup_utf16Units
2
setup_scalarCount
2
setup_byteBound
24
setup_mergeBase
256
setup_mergeBound
4
setup_EOS
512
corpus_scalar_0_byteOffset
0
corpus_scalar_0_byteWidth
1
corpus_scalar_0_payload0
97
corpus_scalar_0_byte0
97
corpus_scalar_1_byteOffset
1
corpus_scalar_1_byteWidth
1
corpus_scalar_1_payload0
98
corpus_scalar_1_byte0
98
corpus_scalar_2_byteOffset
2
corpus_scalar_2_byteWidth
1
corpus_scalar_2_payload0
97
corpus_scalar_2_byte0
97
corpus_scalar_3_byteOffset
3
corpus_scalar_3_byteWidth
1
corpus_scalar_3_payload0
98
corpus_scalar_3_byte0
98
source_scalar_0_byteOffset
0
source_scalar_0_byteWidth
1
source_scalar_0_payload0
97
source_scalar_0_byte0
97
source_scalar_1_byteOffset
1
source_scalar_1_byteWidth
1
source_scalar_1_payload0
98
source_scalar_1_byte0
98
train_count_0_0_countAfter
1
train_count_0_0_distinctPairs
1
train_count_0_1_countAfter
1
train_count_0_1_distinctPairs
2
train_count_0_2_countAfter
2
train_count_0_2_distinctPairs
2
train_compare_0_0_take
1
train_compare_0_0_frequencyGreater
1
train_compare_0_0_frequencyEqual
0
train_compare_0_0_lexSmaller
0
train_compare_0_0_bestLeft
97
train_compare_0_0_bestRight
98
train_compare_0_0_bestFrequency
2
train_compare_0_1_take
0
train_compare_0_1_frequencyGreater
0
train_compare_0_1_frequencyEqual
0
train_compare_0_1_lexSmaller
0
train_compare_0_1_bestLeft
97
train_compare_0_1_bestRight
98
train_compare_0_1_bestFrequency
2
train_select_0_id
256
train_select_0_left
97
train_select_0_right
98
train_select_0_frequency
2
train_rule_0_byteWidth
2
train_rule_0_byte0
97
train_rule_0_byte1
98
train_replace_0_0_matched
1
train_replace_0_0_id
256
train_replace_0_0_consumed
2
train_replace_0_0_nextPosition
2
train_replace_0_0_outputLength
1
train_replace_0_2_matched
1
train_replace_0_2_id
256
train_replace_0_2_consumed
2
train_replace_0_2_nextPosition
4
train_replace_0_2_outputLength
2
encode_replace_0_0_matched
1
encode_replace_0_0_id
256
encode_replace_0_0_consumed
2
encode_replace_0_0_nextPosition
2
encode_replace_0_0_outputLength
1
corpus_expand_0_byteOffset
0
corpus_expand_0_byteWidth
2
corpus_expand_0_byte0
97
corpus_expand_0_byte1
98
corpus_expand_1_byteOffset
2
corpus_expand_1_byteWidth
2
corpus_expand_1_byte0
97
corpus_expand_1_byte1
98
corpus_decode_0_payload0
97
corpus_decode_0_accumulator0
97
corpus_decode_0_codePoint
97
corpus_decode_0_utf16Width
1
corpus_decode_0_unit0
97
corpus_decode_1_payload0
98
corpus_decode_1_accumulator0
98
corpus_decode_1_codePoint
98
corpus_decode_1_utf16Width
1
corpus_decode_1_unit0
98
corpus_decode_2_payload0
97
corpus_decode_2_accumulator0
97
corpus_decode_2_codePoint
97
corpus_decode_2_utf16Width
1
corpus_decode_2_unit0
97
corpus_decode_3_payload0
98
corpus_decode_3_accumulator0
98
corpus_decode_3_codePoint
98
corpus_decode_3_utf16Width
1
corpus_decode_3_unit0
98
target_expand_0_byteOffset
0
target_expand_0_byteWidth
2
target_expand_0_byte0
97
target_expand_0_byte1
98
target_decode_0_payload0
97
target_decode_0_accumulator0
97
target_decode_0_codePoint
97
target_decode_0_utf16Width
1
target_decode_0_unit0
97
target_decode_1_payload0
98
target_decode_1_accumulator0
98
target_decode_1_codePoint
98
target_decode_1_utf16Width
1
target_decode_1_unit0
98
roundtrip_corpusTokens
2
roundtrip_tokenCount
1
roundtrip_corpusEqual
1
roundtrip_equal
1

capstone_forward0_feature_0_0

Position 0, feature 0: actual lookup and position

position=d=0?+0:t*positionScale; feature=embedding+position

Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.

Saved inputs
t
0
d
0
tokenId
256
row
2
embedding
1
positionScale
0.5
Saved outputs
position
0
feature
1

capstone_forward0_feature_0_1

Position 0, feature 1: actual lookup and position

position=d=0?+0:t*positionScale; feature=embedding+position

Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.

Saved inputs
t
0
d
1
tokenId
256
row
2
embedding
1
positionScale
0.5
Saved outputs
position
0
feature
1

capstone_forward0_block1_n1_0_0_statistics

0_0: feature-only mean and population variance

sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)

Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.

Saved inputs
x0
1
x1
1
epsilon
0.25
Saved outputs
sum
2
mean
1
centered0
0
centered1
0
square0
0
square1
0
squareSum
0
variance
0
variancePlusEpsilon
0.25
denominator
0.5

capstone_forward0_block1_n1_0_0_feature_0

0_0: affine feature 0

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
0
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward0_block1_n1_0_0_feature_1

0_0: affine feature 1

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
1
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward0_block1_attn_setup

Validate every scalar slot, then select active dimensions

D=2; X[B,T,2]; WQ,WK[2,H*Dk]; WV[2,H*Dv]

All inactive fields remain finite and bounded. Parameter names identify input d, head h and feature f, so changing width never relabels a head’s weights.

Saved inputs
B
1
T
1
H
1
Dk
2
Dv
2
x000
0
x001
0
x010
0
x011
0
x020
0
x021
0
x100
0
x101
0
x110
0
x111
0
x120
0
x121
0
wq000
1
wq001
0
wq010
0
wq011
0
wq100
0
wq101
1
wq110
0
wq111
0
wk000
1
wk001
0
wk010
0
wk011
0
wk100
0
wk101
1
wk110
0
wk111
0
wv000
1
wv001
0
wv010
0
wv011
0
wv100
0
wv101
1
wv110
0
wv111
0
mode
1
valid0
1
valid1
1
valid2
1
shift
0
wo000
0.5
wo001
0
wo010
0
wo011
0.5
wo100
0
wo101
0
wo110
0
wo111
0
Saved outputs
B
1
T
1
D
2
H
1
Dk
2
Dv
2

capstone_forward0_block1_attn_project_Q_0_0_0_0

Q[0,0,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
0
x0
0
x1
0
w0
1
w1
0
Saved outputs
product0
0
product1
0
value
0

capstone_forward0_block1_attn_project_Q_0_0_0_1

Q[0,0,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
1
x0
0
x1
0
w0
0
w1
1
Saved outputs
product0
0
product1
0
value
0

capstone_forward0_block1_attn_project_K_0_0_0_0

K[0,0,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
0
x0
0
x1
0
w0
1
w1
0
Saved outputs
product0
0
product1
0
value
0

capstone_forward0_block1_attn_project_K_0_0_0_1

K[0,0,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
1
x0
0
x1
0
w0
0
w1
1
Saved outputs
product0
0
product1
0
value
0

capstone_forward0_block1_attn_project_V_0_0_0_0

V[0,0,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
0
x0
0
x1
0
w0
1
w1
0
Saved outputs
product0
0
product1
0
value
0

capstone_forward0_block1_attn_project_V_0_0_0_1

V[0,0,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
1
x0
0
x1
0
w0
0
w1
1
Saved outputs
product0
0
product1
0
value
0

capstone_forward0_block1_attn_reshape_Q

Q: reshape the packed feature axis

[B,T,H*F] → [B,T,H,F]; feature=h*F+f

Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.

Saved inputs
B
1
T
1
H
1
F
2
features
2
elements
2
Saved outputs
elements
2

capstone_forward0_block1_attn_permute_Q_0_0_0_0

Q: copy [0,0,0,0] to [0,0,0,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
0
feature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward0_block1_attn_permute_Q_0_0_0_1

Q: copy [0,0,0,1] to [0,0,0,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
1
feature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward0_block1_attn_reshape_K

K: reshape the packed feature axis

[B,T,H*F] → [B,T,H,F]; feature=h*F+f

Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.

Saved inputs
B
1
T
1
H
1
F
2
features
2
elements
2
Saved outputs
elements
2

capstone_forward0_block1_attn_permute_K_0_0_0_0

K: copy [0,0,0,0] to [0,0,0,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
0
feature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward0_block1_attn_permute_K_0_0_0_1

K: copy [0,0,0,1] to [0,0,0,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
1
feature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward0_block1_attn_reshape_V

V: reshape the packed feature axis

[B,T,H*F] → [B,T,H,F]; feature=h*F+f

Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.

Saved inputs
B
1
T
1
H
1
F
2
features
2
elements
2
Saved outputs
elements
2

capstone_forward0_block1_attn_permute_V_0_0_0_0

V: copy [0,0,0,0] to [0,0,0,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
0
feature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward0_block1_attn_permute_V_0_0_0_1

V: copy [0,0,0,1] to [0,0,0,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
1
feature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward0_block1_attn_score_0_0_0_0

Batch 0, head 0: query 0 against key 0

product0=q0*k0; product1=q1*k1; raw=product0+product1; score=raw/sqrt(Dk)

Matching features are multiplied inside this batch and head only. Dk, not H or T or Dv, supplies the scaling width. Signed scores are not probabilities.

Saved inputs
b
0
h
0
i
0
j
0
Dk
2
divisor
1.4142135623730951
q0
0
k0
0
q1
0
k1
0
Saved outputs
product0
0
product1
0
raw
0
score
0

capstone_forward0_block1_attn_row_0_0_0

Batch 0, head 0, query 0: key-axis stable softmax

logit_j=score_j+shift; max=max(allowed logits); term_j=allowed_j?exp(logit_j-max):0; denominator=sum_j term_j; p_j=term_j/denominator

Each head has its own probabilities. Key validity is shared across batches and heads; queries remain. Forbidden terms are exactly zero, without an infinity sentinel or invented shifted value. Allowed terms can underflow; a large common shift can change low bits.

Saved inputs
b
0
h
0
i
0
mode
1
shift
0
score0
0
allowed0
1
Saved outputs
max
0
denominator
1
shifted0
0
term0
1
p0
1

capstone_forward0_block1_attn_head_mix_0_0_0_0

OHeads[0,0,0,0]: this head’s weighted values

product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum

Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.

Saved inputs
b
0
h
0
i
0
f
0
p0
1
v0
0
Saved outputs
product0
0
running0
0
value
0

capstone_forward0_block1_attn_head_mix_0_0_0_1

OHeads[0,0,0,1]: this head’s weighted values

product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum

Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.

Saved inputs
b
0
h
0
i
0
f
1
p0
1
v0
0
Saved outputs
product0
0
running0
0
value
0

capstone_forward0_block1_attn_concat_0_0_0_0

Join head 0, feature 0 into C[0,0,0]

C[b,t,h*Dv+f]=OHeads[b,h,t,f]

Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.

Saved inputs
b
0
t
0
h
0
f
0
concatFeature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward0_block1_attn_concat_0_0_0_1

Join head 0, feature 1 into C[0,0,1]

C[b,t,h*Dv+f]=OHeads[b,h,t,f]

Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.

Saved inputs
b
0
t
0
h
0
f
1
concatFeature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward0_block1_attn_output_0_0_0

Y[0,0,0]: explicit output projection

product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum

WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.

Saved inputs
b
0
t
0
d
0
c0
0
w0
0.5
c1
0
w1
0
Saved outputs
product0
0
product1
0
running0
0
running1
0
value
0

capstone_forward0_block1_attn_output_0_0_1

Y[0,0,1]: explicit output projection

product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum

WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.

Saved inputs
b
0
t
0
d
1
c0
0
w0
0
c1
0
w1
0.5
Saved outputs
product0
0
product1
0
running0
0
running1
0
value
0

capstone_forward0_block1_r1_0_0_0

capstone_forward0_block1_R1[0,0,0]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
0
skip
1
branch
0
Saved outputs
value
1

capstone_forward0_block1_r1_0_0_1

capstone_forward0_block1_R1[0,0,1]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
1
skip
1
branch
0
Saved outputs
value
1

capstone_forward0_block1_n2_0_0_statistics

0_0: feature-only mean and population variance

sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)

Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.

Saved inputs
x0
1
x1
1
epsilon
0.25
Saved outputs
sum
2
mean
1
centered0
0
centered1
0
square0
0
square1
0
squareSum
0
variance
0
variancePlusEpsilon
0.25
denominator
0.5

capstone_forward0_block1_n2_0_0_feature_0

0_0: affine feature 0

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
0
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward0_block1_n2_0_0_feature_1

0_0: affine feature 1

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
1
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward0_block1_ffn_hidden_0_0_0

Hidden affine [0,0,0]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
0
m
0
x0
0
x1
0
w0
1
w1
0
bias
0
Saved outputs
product0
0
product1
0
sum
0
preactivation
0

capstone_forward0_block1_ffn_hidden_0_0_1

Hidden affine [0,0,1]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
0
m
1
x0
0
x1
0
w0
0
w1
1
bias
0
Saved outputs
product0
0
product1
0
sum
0
preactivation
0

capstone_forward0_block1_ffn_hidden_0_0_2

Hidden affine [0,0,2]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
0
m
2
x0
0
x1
0
w0
0
w1
0
bias
0
Saved outputs
product0
0
product1
0
sum
0
preactivation
0

capstone_forward0_block1_ffn_relu_0_0_0

ReLU [0,0,0]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
0
m
0
preactivation
0
Saved outputs
activation
0

capstone_forward0_block1_ffn_relu_0_0_1

ReLU [0,0,1]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
0
m
1
preactivation
0
Saved outputs
activation
0

capstone_forward0_block1_ffn_relu_0_0_2

ReLU [0,0,2]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
0
m
2
preactivation
0
Saved outputs
activation
0

capstone_forward0_block1_ffn_output_0_0_0

FFN output [0,0,0]

product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias

Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.

Saved inputs
b
0
t
0
d
0
h0
0
w0
0.5
h1
0
w1
0
h2
0
w2
0
bias
0
Saved outputs
product0
0
product1
0
product2
0
running0
0
running1
0
running2
0
sum
0
value
0

capstone_forward0_block1_ffn_output_0_0_1

FFN output [0,0,1]

product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias

Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.

Saved inputs
b
0
t
0
d
1
h0
0
w0
0
h1
0
w1
0.5
h2
0
w2
0
bias
0
Saved outputs
product0
0
product1
0
product2
0
running0
0
running1
0
running2
0
sum
0
value
0

capstone_forward0_block1_r2_0_0_0

capstone_forward0_block1_Output[0,0,0]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
0
skip
1
branch
0
Saved outputs
value
1

capstone_forward0_block1_r2_0_0_1

capstone_forward0_block1_Output[0,0,1]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
1
skip
1
branch
0
Saved outputs
value
1

capstone_forward0_block2_n1_0_0_statistics

0_0: feature-only mean and population variance

sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)

Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.

Saved inputs
x0
1
x1
1
epsilon
0.25
Saved outputs
sum
2
mean
1
centered0
0
centered1
0
square0
0
square1
0
squareSum
0
variance
0
variancePlusEpsilon
0.25
denominator
0.5

capstone_forward0_block2_n1_0_0_feature_0

0_0: affine feature 0

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
0
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward0_block2_n1_0_0_feature_1

0_0: affine feature 1

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
1
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward0_block2_attn_setup

Validate every scalar slot, then select active dimensions

D=2; X[B,T,2]; WQ,WK[2,H*Dk]; WV[2,H*Dv]

All inactive fields remain finite and bounded. Parameter names identify input d, head h and feature f, so changing width never relabels a head’s weights.

Saved inputs
B
1
T
1
H
1
Dk
2
Dv
2
x000
0
x001
0
x010
0
x011
0
x020
0
x021
0
x100
0
x101
0
x110
0
x111
0
x120
0
x121
0
wq000
1
wq001
0
wq010
0
wq011
0
wq100
0
wq101
1
wq110
0
wq111
0
wk000
1
wk001
0
wk010
0
wk011
0
wk100
0
wk101
1
wk110
0
wk111
0
wv000
1
wv001
0
wv010
0
wv011
0
wv100
0
wv101
1
wv110
0
wv111
0
mode
1
valid0
1
valid1
1
valid2
1
shift
0
wo000
0.25
wo001
0
wo010
0
wo011
0.25
wo100
0
wo101
0
wo110
0
wo111
0
Saved outputs
B
1
T
1
D
2
H
1
Dk
2
Dv
2

capstone_forward0_block2_attn_project_Q_0_0_0_0

Q[0,0,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
0
x0
0
x1
0
w0
1
w1
0
Saved outputs
product0
0
product1
0
value
0

capstone_forward0_block2_attn_project_Q_0_0_0_1

Q[0,0,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
1
x0
0
x1
0
w0
0
w1
1
Saved outputs
product0
0
product1
0
value
0

capstone_forward0_block2_attn_project_K_0_0_0_0

K[0,0,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
0
x0
0
x1
0
w0
1
w1
0
Saved outputs
product0
0
product1
0
value
0

capstone_forward0_block2_attn_project_K_0_0_0_1

K[0,0,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
1
x0
0
x1
0
w0
0
w1
1
Saved outputs
product0
0
product1
0
value
0

capstone_forward0_block2_attn_project_V_0_0_0_0

V[0,0,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
0
x0
0
x1
0
w0
1
w1
0
Saved outputs
product0
0
product1
0
value
0

capstone_forward0_block2_attn_project_V_0_0_0_1

V[0,0,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
1
x0
0
x1
0
w0
0
w1
1
Saved outputs
product0
0
product1
0
value
0

capstone_forward0_block2_attn_reshape_Q

Q: reshape the packed feature axis

[B,T,H*F] → [B,T,H,F]; feature=h*F+f

Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.

Saved inputs
B
1
T
1
H
1
F
2
features
2
elements
2
Saved outputs
elements
2

capstone_forward0_block2_attn_permute_Q_0_0_0_0

Q: copy [0,0,0,0] to [0,0,0,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
0
feature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward0_block2_attn_permute_Q_0_0_0_1

Q: copy [0,0,0,1] to [0,0,0,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
1
feature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward0_block2_attn_reshape_K

K: reshape the packed feature axis

[B,T,H*F] → [B,T,H,F]; feature=h*F+f

Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.

Saved inputs
B
1
T
1
H
1
F
2
features
2
elements
2
Saved outputs
elements
2

capstone_forward0_block2_attn_permute_K_0_0_0_0

K: copy [0,0,0,0] to [0,0,0,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
0
feature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward0_block2_attn_permute_K_0_0_0_1

K: copy [0,0,0,1] to [0,0,0,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
1
feature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward0_block2_attn_reshape_V

V: reshape the packed feature axis

[B,T,H*F] → [B,T,H,F]; feature=h*F+f

Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.

Saved inputs
B
1
T
1
H
1
F
2
features
2
elements
2
Saved outputs
elements
2

capstone_forward0_block2_attn_permute_V_0_0_0_0

V: copy [0,0,0,0] to [0,0,0,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
0
feature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward0_block2_attn_permute_V_0_0_0_1

V: copy [0,0,0,1] to [0,0,0,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
1
feature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward0_block2_attn_score_0_0_0_0

Batch 0, head 0: query 0 against key 0

product0=q0*k0; product1=q1*k1; raw=product0+product1; score=raw/sqrt(Dk)

Matching features are multiplied inside this batch and head only. Dk, not H or T or Dv, supplies the scaling width. Signed scores are not probabilities.

Saved inputs
b
0
h
0
i
0
j
0
Dk
2
divisor
1.4142135623730951
q0
0
k0
0
q1
0
k1
0
Saved outputs
product0
0
product1
0
raw
0
score
0

capstone_forward0_block2_attn_row_0_0_0

Batch 0, head 0, query 0: key-axis stable softmax

logit_j=score_j+shift; max=max(allowed logits); term_j=allowed_j?exp(logit_j-max):0; denominator=sum_j term_j; p_j=term_j/denominator

Each head has its own probabilities. Key validity is shared across batches and heads; queries remain. Forbidden terms are exactly zero, without an infinity sentinel or invented shifted value. Allowed terms can underflow; a large common shift can change low bits.

Saved inputs
b
0
h
0
i
0
mode
1
shift
0
score0
0
allowed0
1
Saved outputs
max
0
denominator
1
shifted0
0
term0
1
p0
1

capstone_forward0_block2_attn_head_mix_0_0_0_0

OHeads[0,0,0,0]: this head’s weighted values

product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum

Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.

Saved inputs
b
0
h
0
i
0
f
0
p0
1
v0
0
Saved outputs
product0
0
running0
0
value
0

capstone_forward0_block2_attn_head_mix_0_0_0_1

OHeads[0,0,0,1]: this head’s weighted values

product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum

Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.

Saved inputs
b
0
h
0
i
0
f
1
p0
1
v0
0
Saved outputs
product0
0
running0
0
value
0

capstone_forward0_block2_attn_concat_0_0_0_0

Join head 0, feature 0 into C[0,0,0]

C[b,t,h*Dv+f]=OHeads[b,h,t,f]

Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.

Saved inputs
b
0
t
0
h
0
f
0
concatFeature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward0_block2_attn_concat_0_0_0_1

Join head 0, feature 1 into C[0,0,1]

C[b,t,h*Dv+f]=OHeads[b,h,t,f]

Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.

Saved inputs
b
0
t
0
h
0
f
1
concatFeature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward0_block2_attn_output_0_0_0

Y[0,0,0]: explicit output projection

product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum

WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.

Saved inputs
b
0
t
0
d
0
c0
0
w0
0.25
c1
0
w1
0
Saved outputs
product0
0
product1
0
running0
0
running1
0
value
0

capstone_forward0_block2_attn_output_0_0_1

Y[0,0,1]: explicit output projection

product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum

WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.

Saved inputs
b
0
t
0
d
1
c0
0
w0
0
c1
0
w1
0.25
Saved outputs
product0
0
product1
0
running0
0
running1
0
value
0

capstone_forward0_block2_r1_0_0_0

capstone_forward0_block2_R1[0,0,0]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
0
skip
1
branch
0
Saved outputs
value
1

capstone_forward0_block2_r1_0_0_1

capstone_forward0_block2_R1[0,0,1]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
1
skip
1
branch
0
Saved outputs
value
1

capstone_forward0_block2_n2_0_0_statistics

0_0: feature-only mean and population variance

sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)

Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.

Saved inputs
x0
1
x1
1
epsilon
0.25
Saved outputs
sum
2
mean
1
centered0
0
centered1
0
square0
0
square1
0
squareSum
0
variance
0
variancePlusEpsilon
0.25
denominator
0.5

capstone_forward0_block2_n2_0_0_feature_0

0_0: affine feature 0

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
0
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward0_block2_n2_0_0_feature_1

0_0: affine feature 1

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
1
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward0_block2_ffn_hidden_0_0_0

Hidden affine [0,0,0]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
0
m
0
x0
0
x1
0
w0
1
w1
0
bias
0
Saved outputs
product0
0
product1
0
sum
0
preactivation
0

capstone_forward0_block2_ffn_hidden_0_0_1

Hidden affine [0,0,1]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
0
m
1
x0
0
x1
0
w0
0
w1
1
bias
0
Saved outputs
product0
0
product1
0
sum
0
preactivation
0

capstone_forward0_block2_ffn_hidden_0_0_2

Hidden affine [0,0,2]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
0
m
2
x0
0
x1
0
w0
0
w1
0
bias
0
Saved outputs
product0
0
product1
0
sum
0
preactivation
0

capstone_forward0_block2_ffn_relu_0_0_0

ReLU [0,0,0]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
0
m
0
preactivation
0
Saved outputs
activation
0

capstone_forward0_block2_ffn_relu_0_0_1

ReLU [0,0,1]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
0
m
1
preactivation
0
Saved outputs
activation
0

capstone_forward0_block2_ffn_relu_0_0_2

ReLU [0,0,2]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
0
m
2
preactivation
0
Saved outputs
activation
0

capstone_forward0_block2_ffn_output_0_0_0

FFN output [0,0,0]

product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias

Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.

Saved inputs
b
0
t
0
d
0
h0
0
w0
0.25
h1
0
w1
0
h2
0
w2
0
bias
0
Saved outputs
product0
0
product1
0
product2
0
running0
0
running1
0
running2
0
sum
0
value
0

capstone_forward0_block2_ffn_output_0_0_1

FFN output [0,0,1]

product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias

Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.

Saved inputs
b
0
t
0
d
1
h0
0
w0
0
h1
0
w1
0.25
h2
0
w2
0
bias
0
Saved outputs
product0
0
product1
0
product2
0
running0
0
running1
0
running2
0
sum
0
value
0

capstone_forward0_block2_r2_0_0_0

capstone_forward0_block2_Output[0,0,0]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
0
skip
1
branch
0
Saved outputs
value
1

capstone_forward0_block2_r2_0_0_1

capstone_forward0_block2_Output[0,0,1]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
1
skip
1
branch
0
Saved outputs
value
1

capstone_forward0_readout_0_0

Readout at position 0, class 0

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
0
c
0
tokenId
97
x0
1
x1
1
u0
1
u1
0
bias
0
Saved outputs
product0
1
product1
0
sum
1
logit
1

capstone_forward0_readout_0_1

Readout at position 0, class 1

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
0
c
1
tokenId
98
x0
1
x1
1
u0
0
u1
1
bias
0
Saved outputs
product0
0
product1
1
sum
1
logit
1

capstone_forward0_readout_0_2

Readout at position 0, class 2

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
0
c
2
tokenId
256
x0
1
x1
1
u0
1
u1
1
bias
0
Saved outputs
product0
1
product1
1
sum
2
logit
2

capstone_forward0_readout_0_3

Readout at position 0, class 3

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
0
c
3
tokenId
257
x0
1
x1
1
u0
-1
u1
1
bias
0
Saved outputs
product0
-1
product1
1
sum
0
logit
0

capstone_forward0_readout_0_4

Readout at position 0, class 4

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
0
c
4
tokenId
512
x0
1
x1
1
u0
0
u1
0
bias
0
Saved outputs
product0
0
product1
0
sum
0
logit
0

capstone_forward0_softmax_0

Active-class softmax at observed position 0

max=Math.max(allowed logits); term=allowed?exp(logit-max):+0; denominator=ordered +0 fold over all five terms; p=term/denominator

The unchanged stableSoftmax supplies the actual terms, denominator and five divisions. Shifted arguments and denominator partials repeat the same immutable-operand operations for functional evidence, as in IV59 attention. Inactive classes have no shifted field or native occurrence; their terms and probabilities are policy +0.

Saved inputs
t
0
logit0
1
logit1
1
logit2
2
logit3
0
logit4
0
allowed0
1
allowed1
1
allowed2
1
allowed3
0
allowed4
1
Saved outputs
max
2
shifted0
-1
shifted1
-1
shifted2
0
shifted4
-2
term0
0.36787944117144233
term1
0.36787944117144233
term2
1
term3
0
term4
0.1353352832366127
partial0
0.36787944117144233
partial1
0.7357588823428847
partial2
1.7357588823428847
partial3
1.7357588823428847
partial4
1.8710941655794975
denominator
1.8710941655794975
p0
0.19661193324148185
p1
0.19661193324148185
p2
0.5344466453885229
p3
0
p4
0.07232948812851327

capstone_forward0_select

Choose the actual last-row active logit maximum

strict greater scan over ascending active public IDs; retain first on exact tie

Rounded probabilities never choose the token. Inactive logits remain visible candidates with allowed=0. The chosen probability is copied from the saved actual distribution.

Saved inputs
position
0
logit0
1
allowed0
1
p0
0.19661193324148185
logit1
1
allowed1
1
p1
0.19661193324148185
logit2
2
allowed2
1
p2
0.5344466453885229
logit3
0
allowed3
0
p3
0
logit4
0
allowed4
1
p4
0.07232948812851327
Saved outputs
index
2
tokenId
256
logit
2
probability
0.5344466453885229

capstone_forward0_disposition

Append the actual selected ID and decide whether another forward exists

logicalAfter=observedBefore+[selectedId]; stop=EOS before budget; continue only when neither

Continue: append this actual ID without retokenization, then recompute the full observed prefix uncached.

Saved inputs
beforeCount
1
selectedId
256
requestedOutputs
2
id0
256
Saved outputs
afterCount
2
decisions
1
eos
0
budget
0
continueForward
1
id0
256
id1
256

capstone_forward1_feature_0_0

Position 0, feature 0: actual lookup and position

position=d=0?+0:t*positionScale; feature=embedding+position

Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.

Saved inputs
t
0
d
0
tokenId
256
row
2
embedding
1
positionScale
0.5
Saved outputs
position
0
feature
1

capstone_forward1_feature_0_1

Position 0, feature 1: actual lookup and position

position=d=0?+0:t*positionScale; feature=embedding+position

Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.

Saved inputs
t
0
d
1
tokenId
256
row
2
embedding
1
positionScale
0.5
Saved outputs
position
0
feature
1

capstone_forward1_feature_1_0

Position 1, feature 0: actual lookup and position

position=d=0?+0:t*positionScale; feature=embedding+position

Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.

Saved inputs
t
1
d
0
tokenId
256
row
2
embedding
1
positionScale
0.5
Saved outputs
position
0
feature
1

capstone_forward1_feature_1_1

Position 1, feature 1: actual lookup and position

position=d=0?+0:t*positionScale; feature=embedding+position

Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.

Saved inputs
t
1
d
1
tokenId
256
row
2
embedding
1
positionScale
0.5
Saved outputs
position
0.5
feature
1.5

capstone_forward1_block1_n1_0_0_statistics

0_0: feature-only mean and population variance

sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)

Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.

Saved inputs
x0
1
x1
1
epsilon
0.25
Saved outputs
sum
2
mean
1
centered0
0
centered1
0
square0
0
square1
0
squareSum
0
variance
0
variancePlusEpsilon
0.25
denominator
0.5

capstone_forward1_block1_n1_0_0_feature_0

0_0: affine feature 0

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
0
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward1_block1_n1_0_0_feature_1

0_0: affine feature 1

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
1
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward1_block1_n1_0_1_statistics

0_1: feature-only mean and population variance

sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)

Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.

Saved inputs
x0
1
x1
1.5
epsilon
0.25
Saved outputs
sum
2.5
mean
1.25
centered0
-0.25
centered1
0.25
square0
0.0625
square1
0.0625
squareSum
0.125
variance
0.0625
variancePlusEpsilon
0.3125
denominator
0.5590169943749475

capstone_forward1_block1_n1_0_1_feature_0

0_1: affine feature 0

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
0
source
-0.25
denominator
0.5590169943749475
gamma
1
beta
0
Saved outputs
normalized
-0.4472135954999579
scaled
-0.4472135954999579
value
-0.4472135954999579

capstone_forward1_block1_n1_0_1_feature_1

0_1: affine feature 1

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
1
source
0.25
denominator
0.5590169943749475
gamma
1
beta
0
Saved outputs
normalized
0.4472135954999579
scaled
0.4472135954999579
value
0.4472135954999579

capstone_forward1_block1_attn_setup

Validate every scalar slot, then select active dimensions

D=2; X[B,T,2]; WQ,WK[2,H*Dk]; WV[2,H*Dv]

All inactive fields remain finite and bounded. Parameter names identify input d, head h and feature f, so changing width never relabels a head’s weights.

Saved inputs
B
1
T
2
H
1
Dk
2
Dv
2
x000
0
x001
0
x010
-0.4472135954999579
x011
0.4472135954999579
x020
0
x021
0
x100
0
x101
0
x110
0
x111
0
x120
0
x121
0
wq000
1
wq001
0
wq010
0
wq011
0
wq100
0
wq101
1
wq110
0
wq111
0
wk000
1
wk001
0
wk010
0
wk011
0
wk100
0
wk101
1
wk110
0
wk111
0
wv000
1
wv001
0
wv010
0
wv011
0
wv100
0
wv101
1
wv110
0
wv111
0
mode
1
valid0
1
valid1
1
valid2
1
shift
0
wo000
0.5
wo001
0
wo010
0
wo011
0.5
wo100
0
wo101
0
wo110
0
wo111
0
Saved outputs
B
1
T
2
D
2
H
1
Dk
2
Dv
2

capstone_forward1_block1_attn_project_Q_0_0_0_0

Q[0,0,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
0
x0
0
x1
0
w0
1
w1
0
Saved outputs
product0
0
product1
0
value
0

capstone_forward1_block1_attn_project_Q_0_0_0_1

Q[0,0,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
1
x0
0
x1
0
w0
0
w1
1
Saved outputs
product0
0
product1
0
value
0

capstone_forward1_block1_attn_project_Q_0_1_0_0

Q[0,1,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
1
h
0
f
0
x0
-0.4472135954999579
x1
0.4472135954999579
w0
1
w1
0
Saved outputs
product0
-0.4472135954999579
product1
0
value
-0.4472135954999579

capstone_forward1_block1_attn_project_Q_0_1_0_1

Q[0,1,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
1
h
0
f
1
x0
-0.4472135954999579
x1
0.4472135954999579
w0
0
w1
1
Saved outputs
product0
-0
product1
0.4472135954999579
value
0.4472135954999579

capstone_forward1_block1_attn_project_K_0_0_0_0

K[0,0,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
0
x0
0
x1
0
w0
1
w1
0
Saved outputs
product0
0
product1
0
value
0

capstone_forward1_block1_attn_project_K_0_0_0_1

K[0,0,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
1
x0
0
x1
0
w0
0
w1
1
Saved outputs
product0
0
product1
0
value
0

capstone_forward1_block1_attn_project_K_0_1_0_0

K[0,1,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
1
h
0
f
0
x0
-0.4472135954999579
x1
0.4472135954999579
w0
1
w1
0
Saved outputs
product0
-0.4472135954999579
product1
0
value
-0.4472135954999579

capstone_forward1_block1_attn_project_K_0_1_0_1

K[0,1,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
1
h
0
f
1
x0
-0.4472135954999579
x1
0.4472135954999579
w0
0
w1
1
Saved outputs
product0
-0
product1
0.4472135954999579
value
0.4472135954999579

capstone_forward1_block1_attn_project_V_0_0_0_0

V[0,0,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
0
x0
0
x1
0
w0
1
w1
0
Saved outputs
product0
0
product1
0
value
0

capstone_forward1_block1_attn_project_V_0_0_0_1

V[0,0,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
1
x0
0
x1
0
w0
0
w1
1
Saved outputs
product0
0
product1
0
value
0

capstone_forward1_block1_attn_project_V_0_1_0_0

V[0,1,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
1
h
0
f
0
x0
-0.4472135954999579
x1
0.4472135954999579
w0
1
w1
0
Saved outputs
product0
-0.4472135954999579
product1
0
value
-0.4472135954999579

capstone_forward1_block1_attn_project_V_0_1_0_1

V[0,1,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
1
h
0
f
1
x0
-0.4472135954999579
x1
0.4472135954999579
w0
0
w1
1
Saved outputs
product0
-0
product1
0.4472135954999579
value
0.4472135954999579

capstone_forward1_block1_attn_reshape_Q

Q: reshape the packed feature axis

[B,T,H*F] → [B,T,H,F]; feature=h*F+f

Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.

Saved inputs
B
1
T
2
H
1
F
2
features
2
elements
4
Saved outputs
elements
4

capstone_forward1_block1_attn_permute_Q_0_0_0_0

Q: copy [0,0,0,0] to [0,0,0,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
0
feature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward1_block1_attn_permute_Q_0_0_0_1

Q: copy [0,0,0,1] to [0,0,0,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
1
feature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward1_block1_attn_permute_Q_0_0_1_0

Q: copy [0,1,0,0] to [0,0,1,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
1
f
0
feature
0
sourceOffset
2
destinationOffset
2
sourceValue
-0.4472135954999579
Saved outputs
value
-0.4472135954999579

capstone_forward1_block1_attn_permute_Q_0_0_1_1

Q: copy [0,1,0,1] to [0,0,1,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
1
f
1
feature
1
sourceOffset
3
destinationOffset
3
sourceValue
0.4472135954999579
Saved outputs
value
0.4472135954999579

capstone_forward1_block1_attn_reshape_K

K: reshape the packed feature axis

[B,T,H*F] → [B,T,H,F]; feature=h*F+f

Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.

Saved inputs
B
1
T
2
H
1
F
2
features
2
elements
4
Saved outputs
elements
4

capstone_forward1_block1_attn_permute_K_0_0_0_0

K: copy [0,0,0,0] to [0,0,0,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
0
feature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward1_block1_attn_permute_K_0_0_0_1

K: copy [0,0,0,1] to [0,0,0,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
1
feature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward1_block1_attn_permute_K_0_0_1_0

K: copy [0,1,0,0] to [0,0,1,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
1
f
0
feature
0
sourceOffset
2
destinationOffset
2
sourceValue
-0.4472135954999579
Saved outputs
value
-0.4472135954999579

capstone_forward1_block1_attn_permute_K_0_0_1_1

K: copy [0,1,0,1] to [0,0,1,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
1
f
1
feature
1
sourceOffset
3
destinationOffset
3
sourceValue
0.4472135954999579
Saved outputs
value
0.4472135954999579

capstone_forward1_block1_attn_reshape_V

V: reshape the packed feature axis

[B,T,H*F] → [B,T,H,F]; feature=h*F+f

Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.

Saved inputs
B
1
T
2
H
1
F
2
features
2
elements
4
Saved outputs
elements
4

capstone_forward1_block1_attn_permute_V_0_0_0_0

V: copy [0,0,0,0] to [0,0,0,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
0
feature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward1_block1_attn_permute_V_0_0_0_1

V: copy [0,0,0,1] to [0,0,0,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
1
feature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward1_block1_attn_permute_V_0_0_1_0

V: copy [0,1,0,0] to [0,0,1,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
1
f
0
feature
0
sourceOffset
2
destinationOffset
2
sourceValue
-0.4472135954999579
Saved outputs
value
-0.4472135954999579

capstone_forward1_block1_attn_permute_V_0_0_1_1

V: copy [0,1,0,1] to [0,0,1,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
1
f
1
feature
1
sourceOffset
3
destinationOffset
3
sourceValue
0.4472135954999579
Saved outputs
value
0.4472135954999579

capstone_forward1_block1_attn_score_0_0_0_0

Batch 0, head 0: query 0 against key 0

product0=q0*k0; product1=q1*k1; raw=product0+product1; score=raw/sqrt(Dk)

Matching features are multiplied inside this batch and head only. Dk, not H or T or Dv, supplies the scaling width. Signed scores are not probabilities.

Saved inputs
b
0
h
0
i
0
j
0
Dk
2
divisor
1.4142135623730951
q0
0
k0
0
q1
0
k1
0
Saved outputs
product0
0
product1
0
raw
0
score
0

capstone_forward1_block1_attn_score_0_0_0_1

Batch 0, head 0: query 0 against key 1

product0=q0*k0; product1=q1*k1; raw=product0+product1; score=raw/sqrt(Dk)

Matching features are multiplied inside this batch and head only. Dk, not H or T or Dv, supplies the scaling width. Signed scores are not probabilities.

Saved inputs
b
0
h
0
i
0
j
1
Dk
2
divisor
1.4142135623730951
q0
0
k0
-0.4472135954999579
q1
0
k1
0.4472135954999579
Saved outputs
product0
-0
product1
0
raw
0
score
0

capstone_forward1_block1_attn_score_0_0_1_0

Batch 0, head 0: query 1 against key 0

product0=q0*k0; product1=q1*k1; raw=product0+product1; score=raw/sqrt(Dk)

Matching features are multiplied inside this batch and head only. Dk, not H or T or Dv, supplies the scaling width. Signed scores are not probabilities.

Saved inputs
b
0
h
0
i
1
j
0
Dk
2
divisor
1.4142135623730951
q0
-0.4472135954999579
k0
0
q1
0.4472135954999579
k1
0
Saved outputs
product0
-0
product1
0
raw
0
score
0

capstone_forward1_block1_attn_score_0_0_1_1

Batch 0, head 0: query 1 against key 1

product0=q0*k0; product1=q1*k1; raw=product0+product1; score=raw/sqrt(Dk)

Matching features are multiplied inside this batch and head only. Dk, not H or T or Dv, supplies the scaling width. Signed scores are not probabilities.

Saved inputs
b
0
h
0
i
1
j
1
Dk
2
divisor
1.4142135623730951
q0
-0.4472135954999579
k0
-0.4472135954999579
q1
0.4472135954999579
k1
0.4472135954999579
Saved outputs
product0
0.19999999999999998
product1
0.19999999999999998
raw
0.39999999999999997
score
0.28284271247461895

capstone_forward1_block1_attn_row_0_0_0

Batch 0, head 0, query 0: key-axis stable softmax

logit_j=score_j+shift; max=max(allowed logits); term_j=allowed_j?exp(logit_j-max):0; denominator=sum_j term_j; p_j=term_j/denominator

Each head has its own probabilities. Key validity is shared across batches and heads; queries remain. Forbidden terms are exactly zero, without an infinity sentinel or invented shifted value. Allowed terms can underflow; a large common shift can change low bits.

Saved inputs
b
0
h
0
i
0
mode
1
shift
0
score0
0
score1
0
allowed0
1
allowed1
0
Saved outputs
max
0
denominator
1
shifted0
0
term0
1
term1
0
p0
1
p1
0

capstone_forward1_block1_attn_row_0_0_1

Batch 0, head 0, query 1: key-axis stable softmax

logit_j=score_j+shift; max=max(allowed logits); term_j=allowed_j?exp(logit_j-max):0; denominator=sum_j term_j; p_j=term_j/denominator

Each head has its own probabilities. Key validity is shared across batches and heads; queries remain. Forbidden terms are exactly zero, without an infinity sentinel or invented shifted value. Allowed terms can underflow; a large common shift can change low bits.

Saved inputs
b
0
h
0
i
1
mode
1
shift
0
score0
0
score1
0.28284271247461895
allowed0
1
allowed1
1
Saved outputs
max
0.28284271247461895
denominator
1.7536383164437648
shifted0
-0.28284271247461895
shifted1
0
term0
0.7536383164437648
term1
1
p0
0.429756985449589
p1
0.570243014550411

capstone_forward1_block1_attn_head_mix_0_0_0_0

OHeads[0,0,0,0]: this head’s weighted values

product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum

Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.

Saved inputs
b
0
h
0
i
0
f
0
p0
1
v0
0
p1
0
v1
-0.4472135954999579
Saved outputs
product0
0
product1
-0
running0
0
running1
0
value
0

capstone_forward1_block1_attn_head_mix_0_0_0_1

OHeads[0,0,0,1]: this head’s weighted values

product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum

Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.

Saved inputs
b
0
h
0
i
0
f
1
p0
1
v0
0
p1
0
v1
0.4472135954999579
Saved outputs
product0
0
product1
0
running0
0
running1
0
value
0

capstone_forward1_block1_attn_head_mix_0_0_1_0

OHeads[0,0,1,0]: this head’s weighted values

product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum

Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.

Saved inputs
b
0
h
0
i
1
f
0
p0
0.429756985449589
v0
0
p1
0.570243014550411
v1
-0.4472135954999579
Saved outputs
product0
0
product1
-0.25502042884582415
running0
0
running1
-0.25502042884582415
value
-0.25502042884582415

capstone_forward1_block1_attn_head_mix_0_0_1_1

OHeads[0,0,1,1]: this head’s weighted values

product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum

Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.

Saved inputs
b
0
h
0
i
1
f
1
p0
0.429756985449589
v0
0
p1
0.570243014550411
v1
0.4472135954999579
Saved outputs
product0
0
product1
0.25502042884582415
running0
0
running1
0.25502042884582415
value
0.25502042884582415

capstone_forward1_block1_attn_concat_0_0_0_0

Join head 0, feature 0 into C[0,0,0]

C[b,t,h*Dv+f]=OHeads[b,h,t,f]

Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.

Saved inputs
b
0
t
0
h
0
f
0
concatFeature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward1_block1_attn_concat_0_0_0_1

Join head 0, feature 1 into C[0,0,1]

C[b,t,h*Dv+f]=OHeads[b,h,t,f]

Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.

Saved inputs
b
0
t
0
h
0
f
1
concatFeature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward1_block1_attn_concat_0_1_0_0

Join head 0, feature 0 into C[0,1,0]

C[b,t,h*Dv+f]=OHeads[b,h,t,f]

Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.

Saved inputs
b
0
t
1
h
0
f
0
concatFeature
0
sourceOffset
2
destinationOffset
2
sourceValue
-0.25502042884582415
Saved outputs
value
-0.25502042884582415

capstone_forward1_block1_attn_concat_0_1_0_1

Join head 0, feature 1 into C[0,1,1]

C[b,t,h*Dv+f]=OHeads[b,h,t,f]

Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.

Saved inputs
b
0
t
1
h
0
f
1
concatFeature
1
sourceOffset
3
destinationOffset
3
sourceValue
0.25502042884582415
Saved outputs
value
0.25502042884582415

capstone_forward1_block1_attn_output_0_0_0

Y[0,0,0]: explicit output projection

product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum

WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.

Saved inputs
b
0
t
0
d
0
c0
0
w0
0.5
c1
0
w1
0
Saved outputs
product0
0
product1
0
running0
0
running1
0
value
0

capstone_forward1_block1_attn_output_0_0_1

Y[0,0,1]: explicit output projection

product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum

WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.

Saved inputs
b
0
t
0
d
1
c0
0
w0
0
c1
0
w1
0.5
Saved outputs
product0
0
product1
0
running0
0
running1
0
value
0

capstone_forward1_block1_attn_output_0_1_0

Y[0,1,0]: explicit output projection

product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum

WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.

Saved inputs
b
0
t
1
d
0
c0
-0.25502042884582415
w0
0.5
c1
0.25502042884582415
w1
0
Saved outputs
product0
-0.12751021442291208
product1
0
running0
-0.12751021442291208
running1
-0.12751021442291208
value
-0.12751021442291208

capstone_forward1_block1_attn_output_0_1_1

Y[0,1,1]: explicit output projection

product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum

WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.

Saved inputs
b
0
t
1
d
1
c0
-0.25502042884582415
w0
0
c1
0.25502042884582415
w1
0.5
Saved outputs
product0
-0
product1
0.12751021442291208
running0
0
running1
0.12751021442291208
value
0.12751021442291208

capstone_forward1_block1_r1_0_0_0

capstone_forward1_block1_R1[0,0,0]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
0
skip
1
branch
0
Saved outputs
value
1

capstone_forward1_block1_r1_0_0_1

capstone_forward1_block1_R1[0,0,1]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
1
skip
1
branch
0
Saved outputs
value
1

capstone_forward1_block1_r1_0_1_0

capstone_forward1_block1_R1[0,1,0]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
1
d
0
skip
1
branch
-0.12751021442291208
Saved outputs
value
0.8724897855770879

capstone_forward1_block1_r1_0_1_1

capstone_forward1_block1_R1[0,1,1]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
1
d
1
skip
1.5
branch
0.12751021442291208
Saved outputs
value
1.627510214422912

capstone_forward1_block1_n2_0_0_statistics

0_0: feature-only mean and population variance

sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)

Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.

Saved inputs
x0
1
x1
1
epsilon
0.25
Saved outputs
sum
2
mean
1
centered0
0
centered1
0
square0
0
square1
0
squareSum
0
variance
0
variancePlusEpsilon
0.25
denominator
0.5

capstone_forward1_block1_n2_0_0_feature_0

0_0: affine feature 0

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
0
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward1_block1_n2_0_0_feature_1

0_0: affine feature 1

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
1
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward1_block1_n2_0_1_statistics

0_1: feature-only mean and population variance

sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)

Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.

Saved inputs
x0
0.8724897855770879
x1
1.627510214422912
epsilon
0.25
Saved outputs
sum
2.5
mean
1.25
centered0
-0.3775102144229121
centered1
0.3775102144229121
square0
0.1425139619936331
square1
0.1425139619936331
squareSum
0.2850279239872662
variance
0.1425139619936331
variancePlusEpsilon
0.3925139619936331
denominator
0.6265093470919912

capstone_forward1_block1_n2_0_1_feature_0

0_1: affine feature 0

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
0
source
-0.3775102144229121
denominator
0.6265093470919912
gamma
1
beta
0
Saved outputs
normalized
-0.6025611847216092
scaled
-0.6025611847216092
value
-0.6025611847216092

capstone_forward1_block1_n2_0_1_feature_1

0_1: affine feature 1

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
1
source
0.3775102144229121
denominator
0.6265093470919912
gamma
1
beta
0
Saved outputs
normalized
0.6025611847216092
scaled
0.6025611847216092
value
0.6025611847216092

capstone_forward1_block1_ffn_hidden_0_0_0

Hidden affine [0,0,0]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
0
m
0
x0
0
x1
0
w0
1
w1
0
bias
0
Saved outputs
product0
0
product1
0
sum
0
preactivation
0

capstone_forward1_block1_ffn_hidden_0_0_1

Hidden affine [0,0,1]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
0
m
1
x0
0
x1
0
w0
0
w1
1
bias
0
Saved outputs
product0
0
product1
0
sum
0
preactivation
0

capstone_forward1_block1_ffn_hidden_0_0_2

Hidden affine [0,0,2]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
0
m
2
x0
0
x1
0
w0
0
w1
0
bias
0
Saved outputs
product0
0
product1
0
sum
0
preactivation
0

capstone_forward1_block1_ffn_hidden_0_1_0

Hidden affine [0,1,0]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
1
m
0
x0
-0.6025611847216092
x1
0.6025611847216092
w0
1
w1
0
bias
0
Saved outputs
product0
-0.6025611847216092
product1
0
sum
-0.6025611847216092
preactivation
-0.6025611847216092

capstone_forward1_block1_ffn_hidden_0_1_1

Hidden affine [0,1,1]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
1
m
1
x0
-0.6025611847216092
x1
0.6025611847216092
w0
0
w1
1
bias
0
Saved outputs
product0
-0
product1
0.6025611847216092
sum
0.6025611847216092
preactivation
0.6025611847216092

capstone_forward1_block1_ffn_hidden_0_1_2

Hidden affine [0,1,2]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
1
m
2
x0
-0.6025611847216092
x1
0.6025611847216092
w0
0
w1
0
bias
0
Saved outputs
product0
-0
product1
0
sum
0
preactivation
0

capstone_forward1_block1_ffn_relu_0_0_0

ReLU [0,0,0]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
0
m
0
preactivation
0
Saved outputs
activation
0

capstone_forward1_block1_ffn_relu_0_0_1

ReLU [0,0,1]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
0
m
1
preactivation
0
Saved outputs
activation
0

capstone_forward1_block1_ffn_relu_0_0_2

ReLU [0,0,2]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
0
m
2
preactivation
0
Saved outputs
activation
0

capstone_forward1_block1_ffn_relu_0_1_0

ReLU [0,1,0]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
1
m
0
preactivation
-0.6025611847216092
Saved outputs
activation
0

capstone_forward1_block1_ffn_relu_0_1_1

ReLU [0,1,1]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
1
m
1
preactivation
0.6025611847216092
Saved outputs
activation
0.6025611847216092

capstone_forward1_block1_ffn_relu_0_1_2

ReLU [0,1,2]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
1
m
2
preactivation
0
Saved outputs
activation
0

capstone_forward1_block1_ffn_output_0_0_0

FFN output [0,0,0]

product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias

Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.

Saved inputs
b
0
t
0
d
0
h0
0
w0
0.5
h1
0
w1
0
h2
0
w2
0
bias
0
Saved outputs
product0
0
product1
0
product2
0
running0
0
running1
0
running2
0
sum
0
value
0

capstone_forward1_block1_ffn_output_0_0_1

FFN output [0,0,1]

product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias

Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.

Saved inputs
b
0
t
0
d
1
h0
0
w0
0
h1
0
w1
0.5
h2
0
w2
0
bias
0
Saved outputs
product0
0
product1
0
product2
0
running0
0
running1
0
running2
0
sum
0
value
0

capstone_forward1_block1_ffn_output_0_1_0

FFN output [0,1,0]

product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias

Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.

Saved inputs
b
0
t
1
d
0
h0
0
w0
0.5
h1
0.6025611847216092
w1
0
h2
0
w2
0
bias
0
Saved outputs
product0
0
product1
0
product2
0
running0
0
running1
0
running2
0
sum
0
value
0

capstone_forward1_block1_ffn_output_0_1_1

FFN output [0,1,1]

product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias

Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.

Saved inputs
b
0
t
1
d
1
h0
0
w0
0
h1
0.6025611847216092
w1
0.5
h2
0
w2
0
bias
0
Saved outputs
product0
0
product1
0.3012805923608046
product2
0
running0
0
running1
0.3012805923608046
running2
0.3012805923608046
sum
0.3012805923608046
value
0.3012805923608046

capstone_forward1_block1_r2_0_0_0

capstone_forward1_block1_Output[0,0,0]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
0
skip
1
branch
0
Saved outputs
value
1

capstone_forward1_block1_r2_0_0_1

capstone_forward1_block1_Output[0,0,1]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
1
skip
1
branch
0
Saved outputs
value
1

capstone_forward1_block1_r2_0_1_0

capstone_forward1_block1_Output[0,1,0]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
1
d
0
skip
0.8724897855770879
branch
0
Saved outputs
value
0.8724897855770879

capstone_forward1_block1_r2_0_1_1

capstone_forward1_block1_Output[0,1,1]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
1
d
1
skip
1.627510214422912
branch
0.3012805923608046
Saved outputs
value
1.9287908067837167

capstone_forward1_block2_n1_0_0_statistics

0_0: feature-only mean and population variance

sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)

Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.

Saved inputs
x0
1
x1
1
epsilon
0.25
Saved outputs
sum
2
mean
1
centered0
0
centered1
0
square0
0
square1
0
squareSum
0
variance
0
variancePlusEpsilon
0.25
denominator
0.5

capstone_forward1_block2_n1_0_0_feature_0

0_0: affine feature 0

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
0
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward1_block2_n1_0_0_feature_1

0_0: affine feature 1

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
1
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward1_block2_n1_0_1_statistics

0_1: feature-only mean and population variance

sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)

Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.

Saved inputs
x0
0.8724897855770879
x1
1.9287908067837167
epsilon
0.25
Saved outputs
sum
2.8012805923608046
mean
1.4006402961804023
centered0
-0.5281505106033144
centered1
0.5281505106033144
square0
0.27894296185054174
square1
0.27894296185054174
squareSum
0.5578859237010835
variance
0.27894296185054174
variancePlusEpsilon
0.5289429618505417
denominator
0.727284649810885

capstone_forward1_block2_n1_0_1_feature_0

0_1: affine feature 0

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
0
source
-0.5281505106033144
denominator
0.727284649810885
gamma
1
beta
0
Saved outputs
normalized
-0.7261950472083369
scaled
-0.7261950472083369
value
-0.7261950472083369

capstone_forward1_block2_n1_0_1_feature_1

0_1: affine feature 1

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
1
source
0.5281505106033144
denominator
0.727284649810885
gamma
1
beta
0
Saved outputs
normalized
0.7261950472083369
scaled
0.7261950472083369
value
0.7261950472083369

capstone_forward1_block2_attn_setup

Validate every scalar slot, then select active dimensions

D=2; X[B,T,2]; WQ,WK[2,H*Dk]; WV[2,H*Dv]

All inactive fields remain finite and bounded. Parameter names identify input d, head h and feature f, so changing width never relabels a head’s weights.

Saved inputs
B
1
T
2
H
1
Dk
2
Dv
2
x000
0
x001
0
x010
-0.7261950472083369
x011
0.7261950472083369
x020
0
x021
0
x100
0
x101
0
x110
0
x111
0
x120
0
x121
0
wq000
1
wq001
0
wq010
0
wq011
0
wq100
0
wq101
1
wq110
0
wq111
0
wk000
1
wk001
0
wk010
0
wk011
0
wk100
0
wk101
1
wk110
0
wk111
0
wv000
1
wv001
0
wv010
0
wv011
0
wv100
0
wv101
1
wv110
0
wv111
0
mode
1
valid0
1
valid1
1
valid2
1
shift
0
wo000
0.25
wo001
0
wo010
0
wo011
0.25
wo100
0
wo101
0
wo110
0
wo111
0
Saved outputs
B
1
T
2
D
2
H
1
Dk
2
Dv
2

capstone_forward1_block2_attn_project_Q_0_0_0_0

Q[0,0,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
0
x0
0
x1
0
w0
1
w1
0
Saved outputs
product0
0
product1
0
value
0

capstone_forward1_block2_attn_project_Q_0_0_0_1

Q[0,0,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
1
x0
0
x1
0
w0
0
w1
1
Saved outputs
product0
0
product1
0
value
0

capstone_forward1_block2_attn_project_Q_0_1_0_0

Q[0,1,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
1
h
0
f
0
x0
-0.7261950472083369
x1
0.7261950472083369
w0
1
w1
0
Saved outputs
product0
-0.7261950472083369
product1
0
value
-0.7261950472083369

capstone_forward1_block2_attn_project_Q_0_1_0_1

Q[0,1,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
1
h
0
f
1
x0
-0.7261950472083369
x1
0.7261950472083369
w0
0
w1
1
Saved outputs
product0
-0
product1
0.7261950472083369
value
0.7261950472083369

capstone_forward1_block2_attn_project_K_0_0_0_0

K[0,0,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
0
x0
0
x1
0
w0
1
w1
0
Saved outputs
product0
0
product1
0
value
0

capstone_forward1_block2_attn_project_K_0_0_0_1

K[0,0,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
1
x0
0
x1
0
w0
0
w1
1
Saved outputs
product0
0
product1
0
value
0

capstone_forward1_block2_attn_project_K_0_1_0_0

K[0,1,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
1
h
0
f
0
x0
-0.7261950472083369
x1
0.7261950472083369
w0
1
w1
0
Saved outputs
product0
-0.7261950472083369
product1
0
value
-0.7261950472083369

capstone_forward1_block2_attn_project_K_0_1_0_1

K[0,1,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
1
h
0
f
1
x0
-0.7261950472083369
x1
0.7261950472083369
w0
0
w1
1
Saved outputs
product0
-0
product1
0.7261950472083369
value
0.7261950472083369

capstone_forward1_block2_attn_project_V_0_0_0_0

V[0,0,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
0
x0
0
x1
0
w0
1
w1
0
Saved outputs
product0
0
product1
0
value
0

capstone_forward1_block2_attn_project_V_0_0_0_1

V[0,0,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
0
h
0
f
1
x0
0
x1
0
w0
0
w1
1
Saved outputs
product0
0
product1
0
value
0

capstone_forward1_block2_attn_project_V_0_1_0_0

V[0,1,head 0,feature 0]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
1
h
0
f
0
x0
-0.7261950472083369
x1
0.7261950472083369
w0
1
w1
0
Saved outputs
product0
-0.7261950472083369
product1
0
value
-0.7261950472083369

capstone_forward1_block2_attn_project_V_0_1_0_1

V[0,1,head 0,feature 1]: both input contributions

product0=x0*w0; product1=x1*w1; value=product0+product1

One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.

Saved inputs
b
0
t
1
h
0
f
1
x0
-0.7261950472083369
x1
0.7261950472083369
w0
0
w1
1
Saved outputs
product0
-0
product1
0.7261950472083369
value
0.7261950472083369

capstone_forward1_block2_attn_reshape_Q

Q: reshape the packed feature axis

[B,T,H*F] → [B,T,H,F]; feature=h*F+f

Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.

Saved inputs
B
1
T
2
H
1
F
2
features
2
elements
4
Saved outputs
elements
4

capstone_forward1_block2_attn_permute_Q_0_0_0_0

Q: copy [0,0,0,0] to [0,0,0,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
0
feature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward1_block2_attn_permute_Q_0_0_0_1

Q: copy [0,0,0,1] to [0,0,0,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
1
feature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward1_block2_attn_permute_Q_0_0_1_0

Q: copy [0,1,0,0] to [0,0,1,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
1
f
0
feature
0
sourceOffset
2
destinationOffset
2
sourceValue
-0.7261950472083369
Saved outputs
value
-0.7261950472083369

capstone_forward1_block2_attn_permute_Q_0_0_1_1

Q: copy [0,1,0,1] to [0,0,1,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
1
f
1
feature
1
sourceOffset
3
destinationOffset
3
sourceValue
0.7261950472083369
Saved outputs
value
0.7261950472083369

capstone_forward1_block2_attn_reshape_K

K: reshape the packed feature axis

[B,T,H*F] → [B,T,H,F]; feature=h*F+f

Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.

Saved inputs
B
1
T
2
H
1
F
2
features
2
elements
4
Saved outputs
elements
4

capstone_forward1_block2_attn_permute_K_0_0_0_0

K: copy [0,0,0,0] to [0,0,0,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
0
feature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward1_block2_attn_permute_K_0_0_0_1

K: copy [0,0,0,1] to [0,0,0,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
1
feature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward1_block2_attn_permute_K_0_0_1_0

K: copy [0,1,0,0] to [0,0,1,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
1
f
0
feature
0
sourceOffset
2
destinationOffset
2
sourceValue
-0.7261950472083369
Saved outputs
value
-0.7261950472083369

capstone_forward1_block2_attn_permute_K_0_0_1_1

K: copy [0,1,0,1] to [0,0,1,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
1
f
1
feature
1
sourceOffset
3
destinationOffset
3
sourceValue
0.7261950472083369
Saved outputs
value
0.7261950472083369

capstone_forward1_block2_attn_reshape_V

V: reshape the packed feature axis

[B,T,H*F] → [B,T,H,F]; feature=h*F+f

Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.

Saved inputs
B
1
T
2
H
1
F
2
features
2
elements
4
Saved outputs
elements
4

capstone_forward1_block2_attn_permute_V_0_0_0_0

V: copy [0,0,0,0] to [0,0,0,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
0
feature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward1_block2_attn_permute_V_0_0_0_1

V: copy [0,0,0,1] to [0,0,0,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
0
f
1
feature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward1_block2_attn_permute_V_0_0_1_0

V: copy [0,1,0,0] to [0,0,1,0]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
1
f
0
feature
0
sourceOffset
2
destinationOffset
2
sourceValue
-0.7261950472083369
Saved outputs
value
-0.7261950472083369

capstone_forward1_block2_attn_permute_V_0_0_1_1

V: copy [0,1,0,1] to [0,0,1,1]

axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]

Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.

Saved inputs
b
0
h
0
t
1
f
1
feature
1
sourceOffset
3
destinationOffset
3
sourceValue
0.7261950472083369
Saved outputs
value
0.7261950472083369

capstone_forward1_block2_attn_score_0_0_0_0

Batch 0, head 0: query 0 against key 0

product0=q0*k0; product1=q1*k1; raw=product0+product1; score=raw/sqrt(Dk)

Matching features are multiplied inside this batch and head only. Dk, not H or T or Dv, supplies the scaling width. Signed scores are not probabilities.

Saved inputs
b
0
h
0
i
0
j
0
Dk
2
divisor
1.4142135623730951
q0
0
k0
0
q1
0
k1
0
Saved outputs
product0
0
product1
0
raw
0
score
0

capstone_forward1_block2_attn_score_0_0_0_1

Batch 0, head 0: query 0 against key 1

product0=q0*k0; product1=q1*k1; raw=product0+product1; score=raw/sqrt(Dk)

Matching features are multiplied inside this batch and head only. Dk, not H or T or Dv, supplies the scaling width. Signed scores are not probabilities.

Saved inputs
b
0
h
0
i
0
j
1
Dk
2
divisor
1.4142135623730951
q0
0
k0
-0.7261950472083369
q1
0
k1
0.7261950472083369
Saved outputs
product0
-0
product1
0
raw
0
score
0

capstone_forward1_block2_attn_score_0_0_1_0

Batch 0, head 0: query 1 against key 0

product0=q0*k0; product1=q1*k1; raw=product0+product1; score=raw/sqrt(Dk)

Matching features are multiplied inside this batch and head only. Dk, not H or T or Dv, supplies the scaling width. Signed scores are not probabilities.

Saved inputs
b
0
h
0
i
1
j
0
Dk
2
divisor
1.4142135623730951
q0
-0.7261950472083369
k0
0
q1
0.7261950472083369
k1
0
Saved outputs
product0
-0
product1
0
raw
0
score
0

capstone_forward1_block2_attn_score_0_0_1_1

Batch 0, head 0: query 1 against key 1

product0=q0*k0; product1=q1*k1; raw=product0+product1; score=raw/sqrt(Dk)

Matching features are multiplied inside this batch and head only. Dk, not H or T or Dv, supplies the scaling width. Signed scores are not probabilities.

Saved inputs
b
0
h
0
i
1
j
1
Dk
2
divisor
1.4142135623730951
q0
-0.7261950472083369
k0
-0.7261950472083369
q1
0.7261950472083369
k1
0.7261950472083369
Saved outputs
product0
0.5273592465899187
product1
0.5273592465899187
raw
1.0547184931798375
score
0.7457985987703204

capstone_forward1_block2_attn_row_0_0_0

Batch 0, head 0, query 0: key-axis stable softmax

logit_j=score_j+shift; max=max(allowed logits); term_j=allowed_j?exp(logit_j-max):0; denominator=sum_j term_j; p_j=term_j/denominator

Each head has its own probabilities. Key validity is shared across batches and heads; queries remain. Forbidden terms are exactly zero, without an infinity sentinel or invented shifted value. Allowed terms can underflow; a large common shift can change low bits.

Saved inputs
b
0
h
0
i
0
mode
1
shift
0
score0
0
score1
0
allowed0
1
allowed1
0
Saved outputs
max
0
denominator
1
shifted0
0
term0
1
term1
0
p0
1
p1
0

capstone_forward1_block2_attn_row_0_0_1

Batch 0, head 0, query 1: key-axis stable softmax

logit_j=score_j+shift; max=max(allowed logits); term_j=allowed_j?exp(logit_j-max):0; denominator=sum_j term_j; p_j=term_j/denominator

Each head has its own probabilities. Key validity is shared across batches and heads; queries remain. Forbidden terms are exactly zero, without an infinity sentinel or invented shifted value. Allowed terms can underflow; a large common shift can change low bits.

Saved inputs
b
0
h
0
i
1
mode
1
shift
0
score0
0
score1
0.7457985987703204
allowed0
1
allowed1
1
Saved outputs
max
0.7457985987703204
denominator
1.474355329054734
shifted0
-0.7457985987703204
shifted1
0
term0
0.474355329054734
term1
1
p0
0.3217374534528671
p1
0.6782625465471329

capstone_forward1_block2_attn_head_mix_0_0_0_0

OHeads[0,0,0,0]: this head’s weighted values

product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum

Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.

Saved inputs
b
0
h
0
i
0
f
0
p0
1
v0
0
p1
0
v1
-0.7261950472083369
Saved outputs
product0
0
product1
-0
running0
0
running1
0
value
0

capstone_forward1_block2_attn_head_mix_0_0_0_1

OHeads[0,0,0,1]: this head’s weighted values

product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum

Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.

Saved inputs
b
0
h
0
i
0
f
1
p0
1
v0
0
p1
0
v1
0.7261950472083369
Saved outputs
product0
0
product1
0
running0
0
running1
0
value
0

capstone_forward1_block2_attn_head_mix_0_0_1_0

OHeads[0,0,1,0]: this head’s weighted values

product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum

Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.

Saved inputs
b
0
h
0
i
1
f
0
p0
0.3217374534528671
v0
0
p1
0.6782625465471329
v1
-0.7261950472083369
Saved outputs
product0
0
product1
-0.492550902009442
running0
0
running1
-0.492550902009442
value
-0.492550902009442

capstone_forward1_block2_attn_head_mix_0_0_1_1

OHeads[0,0,1,1]: this head’s weighted values

product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum

Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.

Saved inputs
b
0
h
0
i
1
f
1
p0
0.3217374534528671
v0
0
p1
0.6782625465471329
v1
0.7261950472083369
Saved outputs
product0
0
product1
0.492550902009442
running0
0
running1
0.492550902009442
value
0.492550902009442

capstone_forward1_block2_attn_concat_0_0_0_0

Join head 0, feature 0 into C[0,0,0]

C[b,t,h*Dv+f]=OHeads[b,h,t,f]

Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.

Saved inputs
b
0
t
0
h
0
f
0
concatFeature
0
sourceOffset
0
destinationOffset
0
sourceValue
0
Saved outputs
value
0

capstone_forward1_block2_attn_concat_0_0_0_1

Join head 0, feature 1 into C[0,0,1]

C[b,t,h*Dv+f]=OHeads[b,h,t,f]

Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.

Saved inputs
b
0
t
0
h
0
f
1
concatFeature
1
sourceOffset
1
destinationOffset
1
sourceValue
0
Saved outputs
value
0

capstone_forward1_block2_attn_concat_0_1_0_0

Join head 0, feature 0 into C[0,1,0]

C[b,t,h*Dv+f]=OHeads[b,h,t,f]

Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.

Saved inputs
b
0
t
1
h
0
f
0
concatFeature
0
sourceOffset
2
destinationOffset
2
sourceValue
-0.492550902009442
Saved outputs
value
-0.492550902009442

capstone_forward1_block2_attn_concat_0_1_0_1

Join head 0, feature 1 into C[0,1,1]

C[b,t,h*Dv+f]=OHeads[b,h,t,f]

Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.

Saved inputs
b
0
t
1
h
0
f
1
concatFeature
1
sourceOffset
3
destinationOffset
3
sourceValue
0.492550902009442
Saved outputs
value
0.492550902009442

capstone_forward1_block2_attn_output_0_0_0

Y[0,0,0]: explicit output projection

product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum

WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.

Saved inputs
b
0
t
0
d
0
c0
0
w0
0.25
c1
0
w1
0
Saved outputs
product0
0
product1
0
running0
0
running1
0
value
0

capstone_forward1_block2_attn_output_0_0_1

Y[0,0,1]: explicit output projection

product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum

WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.

Saved inputs
b
0
t
0
d
1
c0
0
w0
0
c1
0
w1
0.25
Saved outputs
product0
0
product1
0
running0
0
running1
0
value
0

capstone_forward1_block2_attn_output_0_1_0

Y[0,1,0]: explicit output projection

product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum

WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.

Saved inputs
b
0
t
1
d
0
c0
-0.492550902009442
w0
0.25
c1
0.492550902009442
w1
0
Saved outputs
product0
-0.1231377255023605
product1
0
running0
-0.1231377255023605
running1
-0.1231377255023605
value
-0.1231377255023605

capstone_forward1_block2_attn_output_0_1_1

Y[0,1,1]: explicit output projection

product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum

WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.

Saved inputs
b
0
t
1
d
1
c0
-0.492550902009442
w0
0
c1
0.492550902009442
w1
0.25
Saved outputs
product0
-0
product1
0.1231377255023605
running0
0
running1
0.1231377255023605
value
0.1231377255023605

capstone_forward1_block2_r1_0_0_0

capstone_forward1_block2_R1[0,0,0]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
0
skip
1
branch
0
Saved outputs
value
1

capstone_forward1_block2_r1_0_0_1

capstone_forward1_block2_R1[0,0,1]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
1
skip
1
branch
0
Saved outputs
value
1

capstone_forward1_block2_r1_0_1_0

capstone_forward1_block2_R1[0,1,0]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
1
d
0
skip
0.8724897855770879
branch
-0.1231377255023605
Saved outputs
value
0.7493520600747274

capstone_forward1_block2_r1_0_1_1

capstone_forward1_block2_R1[0,1,1]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
1
d
1
skip
1.9287908067837167
branch
0.1231377255023605
Saved outputs
value
2.051928532286077

capstone_forward1_block2_n2_0_0_statistics

0_0: feature-only mean and population variance

sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)

Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.

Saved inputs
x0
1
x1
1
epsilon
0.25
Saved outputs
sum
2
mean
1
centered0
0
centered1
0
square0
0
square1
0
squareSum
0
variance
0
variancePlusEpsilon
0.25
denominator
0.5

capstone_forward1_block2_n2_0_0_feature_0

0_0: affine feature 0

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
0
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward1_block2_n2_0_0_feature_1

0_0: affine feature 1

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
1
source
0
denominator
0.5
gamma
1
beta
0
Saved outputs
normalized
0
scaled
0
value
0

capstone_forward1_block2_n2_0_1_statistics

0_1: feature-only mean and population variance

sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)

Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.

Saved inputs
x0
0.7493520600747274
x1
2.051928532286077
epsilon
0.25
Saved outputs
sum
2.8012805923608046
mean
1.4006402961804023
centered0
-0.6512882361056749
centered1
0.6512882361056749
square0
0.4241763664896413
square1
0.4241763664896413
squareSum
0.8483527329792826
variance
0.4241763664896413
variancePlusEpsilon
0.6741763664896413
denominator
0.8210824358672163

capstone_forward1_block2_n2_0_1_feature_0

0_1: affine feature 0

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
0
source
-0.6512882361056749
denominator
0.8210824358672163
gamma
1
beta
0
Saved outputs
normalized
-0.793206878695186
scaled
-0.793206878695186
value
-0.793206878695186

capstone_forward1_block2_n2_0_1_feature_1

0_1: affine feature 1

normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta

The source is the saved centered feature. Gamma and beta may change output mean and variance.

Saved inputs
d
1
source
0.6512882361056749
denominator
0.8210824358672163
gamma
1
beta
0
Saved outputs
normalized
0.793206878695186
scaled
0.793206878695186
value
0.793206878695186

capstone_forward1_block2_ffn_hidden_0_0_0

Hidden affine [0,0,0]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
0
m
0
x0
0
x1
0
w0
1
w1
0
bias
0
Saved outputs
product0
0
product1
0
sum
0
preactivation
0

capstone_forward1_block2_ffn_hidden_0_0_1

Hidden affine [0,0,1]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
0
m
1
x0
0
x1
0
w0
0
w1
1
bias
0
Saved outputs
product0
0
product1
0
sum
0
preactivation
0

capstone_forward1_block2_ffn_hidden_0_0_2

Hidden affine [0,0,2]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
0
m
2
x0
0
x1
0
w0
0
w1
0
bias
0
Saved outputs
product0
0
product1
0
sum
0
preactivation
0

capstone_forward1_block2_ffn_hidden_0_1_0

Hidden affine [0,1,0]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
1
m
0
x0
-0.793206878695186
x1
0.793206878695186
w0
1
w1
0
bias
0
Saved outputs
product0
-0.793206878695186
product1
0
sum
-0.793206878695186
preactivation
-0.793206878695186

capstone_forward1_block2_ffn_hidden_0_1_1

Hidden affine [0,1,1]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
1
m
1
x0
-0.793206878695186
x1
0.793206878695186
w0
0
w1
1
bias
0
Saved outputs
product0
-0
product1
0.793206878695186
sum
0.793206878695186
preactivation
0.793206878695186

capstone_forward1_block2_ffn_hidden_0_1_2

Hidden affine [0,1,2]

product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias

The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.

Saved inputs
b
0
t
1
m
2
x0
-0.793206878695186
x1
0.793206878695186
w0
0
w1
0
bias
0
Saved outputs
product0
-0
product1
0
sum
0
preactivation
0

capstone_forward1_block2_ffn_relu_0_0_0

ReLU [0,0,0]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
0
m
0
preactivation
0
Saved outputs
activation
0

capstone_forward1_block2_ffn_relu_0_0_1

ReLU [0,0,1]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
0
m
1
preactivation
0
Saved outputs
activation
0

capstone_forward1_block2_ffn_relu_0_0_2

ReLU [0,0,2]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
0
m
2
preactivation
0
Saved outputs
activation
0

capstone_forward1_block2_ffn_relu_0_1_0

ReLU [0,1,0]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
1
m
0
preactivation
-0.793206878695186
Saved outputs
activation
0

capstone_forward1_block2_ffn_relu_0_1_1

ReLU [0,1,1]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
1
m
1
preactivation
0.793206878695186
Saved outputs
activation
0.793206878695186

capstone_forward1_block2_ffn_relu_0_1_2

ReLU [0,1,2]

activation=max(0,preactivation)

ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.

Saved inputs
b
0
t
1
m
2
preactivation
0
Saved outputs
activation
0

capstone_forward1_block2_ffn_output_0_0_0

FFN output [0,0,0]

product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias

Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.

Saved inputs
b
0
t
0
d
0
h0
0
w0
0.25
h1
0
w1
0
h2
0
w2
0
bias
0
Saved outputs
product0
0
product1
0
product2
0
running0
0
running1
0
running2
0
sum
0
value
0

capstone_forward1_block2_ffn_output_0_0_1

FFN output [0,0,1]

product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias

Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.

Saved inputs
b
0
t
0
d
1
h0
0
w0
0
h1
0
w1
0.25
h2
0
w2
0
bias
0
Saved outputs
product0
0
product1
0
product2
0
running0
0
running1
0
running2
0
sum
0
value
0

capstone_forward1_block2_ffn_output_0_1_0

FFN output [0,1,0]

product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias

Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.

Saved inputs
b
0
t
1
d
0
h0
0
w0
0.25
h1
0.793206878695186
w1
0
h2
0
w2
0
bias
0
Saved outputs
product0
0
product1
0
product2
0
running0
0
running1
0
running2
0
sum
0
value
0

capstone_forward1_block2_ffn_output_0_1_1

FFN output [0,1,1]

product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias

Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.

Saved inputs
b
0
t
1
d
1
h0
0
w0
0
h1
0.793206878695186
w1
0.25
h2
0
w2
0
bias
0
Saved outputs
product0
0
product1
0.1983017196737965
product2
0
running0
0
running1
0.1983017196737965
running2
0.1983017196737965
sum
0.1983017196737965
value
0.1983017196737965

capstone_forward1_block2_r2_0_0_0

capstone_forward1_block2_Output[0,0,0]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
0
skip
1
branch
0
Saved outputs
value
1

capstone_forward1_block2_r2_0_0_1

capstone_forward1_block2_Output[0,0,1]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
0
d
1
skip
1
branch
0
Saved outputs
value
1

capstone_forward1_block2_r2_0_1_0

capstone_forward1_block2_Output[0,1,0]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
1
d
0
skip
0.7493520600747274
branch
0
Saved outputs
value
0.7493520600747274

capstone_forward1_block2_r2_0_1_1

capstone_forward1_block2_Output[0,1,1]: skip plus branch

value=skip+branch

The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.

Saved inputs
b
0
t
1
d
1
skip
2.051928532286077
branch
0.1983017196737965
Saved outputs
value
2.2502302519598736

capstone_forward1_readout_0_0

Readout at position 0, class 0

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
0
c
0
tokenId
97
x0
1
x1
1
u0
1
u1
0
bias
0
Saved outputs
product0
1
product1
0
sum
1
logit
1

capstone_forward1_readout_0_1

Readout at position 0, class 1

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
0
c
1
tokenId
98
x0
1
x1
1
u0
0
u1
1
bias
0
Saved outputs
product0
0
product1
1
sum
1
logit
1

capstone_forward1_readout_0_2

Readout at position 0, class 2

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
0
c
2
tokenId
256
x0
1
x1
1
u0
1
u1
1
bias
0
Saved outputs
product0
1
product1
1
sum
2
logit
2

capstone_forward1_readout_0_3

Readout at position 0, class 3

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
0
c
3
tokenId
257
x0
1
x1
1
u0
-1
u1
1
bias
0
Saved outputs
product0
-1
product1
1
sum
0
logit
0

capstone_forward1_readout_0_4

Readout at position 0, class 4

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
0
c
4
tokenId
512
x0
1
x1
1
u0
0
u1
0
bias
0
Saved outputs
product0
0
product1
0
sum
0
logit
0

capstone_forward1_readout_1_0

Readout at position 1, class 0

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
1
c
0
tokenId
97
x0
0.7493520600747274
x1
2.2502302519598736
u0
1
u1
0
bias
0
Saved outputs
product0
0.7493520600747274
product1
0
sum
0.7493520600747274
logit
0.7493520600747274

capstone_forward1_readout_1_1

Readout at position 1, class 1

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
1
c
1
tokenId
98
x0
0.7493520600747274
x1
2.2502302519598736
u0
0
u1
1
bias
0
Saved outputs
product0
0
product1
2.2502302519598736
sum
2.2502302519598736
logit
2.2502302519598736

capstone_forward1_readout_1_2

Readout at position 1, class 2

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
1
c
2
tokenId
256
x0
0.7493520600747274
x1
2.2502302519598736
u0
1
u1
1
bias
0
Saved outputs
product0
0.7493520600747274
product1
2.2502302519598736
sum
2.999582312034601
logit
2.999582312034601

capstone_forward1_readout_1_3

Readout at position 1, class 3

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
1
c
3
tokenId
257
x0
0.7493520600747274
x1
2.2502302519598736
u0
-1
u1
1
bias
0
Saved outputs
product0
-0.7493520600747274
product1
2.2502302519598736
sum
1.5008781918851462
logit
1.5008781918851462

capstone_forward1_readout_1_4

Readout at position 1, class 4

product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias

Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.

Saved inputs
t
1
c
4
tokenId
512
x0
0.7493520600747274
x1
2.2502302519598736
u0
0
u1
0
bias
0
Saved outputs
product0
0
product1
0
sum
0
logit
0

capstone_forward1_softmax_0

Active-class softmax at observed position 0

max=Math.max(allowed logits); term=allowed?exp(logit-max):+0; denominator=ordered +0 fold over all five terms; p=term/denominator

The unchanged stableSoftmax supplies the actual terms, denominator and five divisions. Shifted arguments and denominator partials repeat the same immutable-operand operations for functional evidence, as in IV59 attention. Inactive classes have no shifted field or native occurrence; their terms and probabilities are policy +0.

Saved inputs
t
0
logit0
1
logit1
1
logit2
2
logit3
0
logit4
0
allowed0
1
allowed1
1
allowed2
1
allowed3
0
allowed4
1
Saved outputs
max
2
shifted0
-1
shifted1
-1
shifted2
0
shifted4
-2
term0
0.36787944117144233
term1
0.36787944117144233
term2
1
term3
0
term4
0.1353352832366127
partial0
0.36787944117144233
partial1
0.7357588823428847
partial2
1.7357588823428847
partial3
1.7357588823428847
partial4
1.8710941655794975
denominator
1.8710941655794975
p0
0.19661193324148185
p1
0.19661193324148185
p2
0.5344466453885229
p3
0
p4
0.07232948812851327

capstone_forward1_softmax_1

Active-class softmax at observed position 1

max=Math.max(allowed logits); term=allowed?exp(logit-max):+0; denominator=ordered +0 fold over all five terms; p=term/denominator

The unchanged stableSoftmax supplies the actual terms, denominator and five divisions. Shifted arguments and denominator partials repeat the same immutable-operand operations for functional evidence, as in IV59 attention. Inactive classes have no shifted field or native occurrence; their terms and probabilities are policy +0.

Saved inputs
t
1
logit0
0.7493520600747274
logit1
2.2502302519598736
logit2
2.999582312034601
logit3
1.5008781918851462
logit4
0
allowed0
1
allowed1
1
allowed2
1
allowed3
0
allowed4
1
Saved outputs
max
2.999582312034601
shifted0
-2.2502302519598736
shifted1
-0.7493520600747274
shifted2
0
shifted4
-2.999582312034601
term0
0.10537495897754619
term1
0.472672717067233
term2
1
term3
0
term4
0.04980786817076498
partial0
0.10537495897754619
partial1
0.5780476760447792
partial2
1.5780476760447792
partial3
1.5780476760447792
partial4
1.6278555442155442
denominator
1.6278555442155442
p0
0.0647323771153944
p1
0.29036527150510255
p2
0.6143051228061488
p3
0
p4
0.030597228573354247

capstone_forward1_select

Choose the actual last-row active logit maximum

strict greater scan over ascending active public IDs; retain first on exact tie

Rounded probabilities never choose the token. Inactive logits remain visible candidates with allowed=0. The chosen probability is copied from the saved actual distribution.

Saved inputs
position
1
logit0
0.7493520600747274
allowed0
1
p0
0.0647323771153944
logit1
2.2502302519598736
allowed1
1
p1
0.29036527150510255
logit2
2.999582312034601
allowed2
1
p2
0.6143051228061488
logit3
1.5008781918851462
allowed3
0
p3
0
logit4
0
allowed4
1
p4
0.030597228573354247
Saved outputs
index
2
tokenId
256
logit
2.999582312034601
probability
0.6143051228061488

capstone_forward1_disposition

Append the actual selected ID and decide whether another forward exists

logicalAfter=observedBefore+[selectedId]; stop=EOS before budget; continue only when neither

Budget: stop before forwarding the final pending selected ID.

Saved inputs
beforeCount
2
selectedId
256
requestedOutputs
2
id0
256
id1
256
Saved outputs
afterCount
3
decisions
2
eos
0
budget
1
continueForward
0
id0
256
id1
256
id2
256

capstone_decode_expand_0

capstone_decode: expand ID at token 0

ID → validated byte expansion

Byte IDs expand to their own byte; learned IDs expand to their validated concatenated bytes. Concatenate every expansion before strict UTF-8 decoding; no replacement-character guess or input copy is used.

Saved inputs
index
0
id
256
Saved outputs
byteOffset
0
byteWidth
2
byte0
97
byte1
98

capstone_decode_expand_1

capstone_decode: expand ID at token 1

ID → validated byte expansion

Byte IDs expand to their own byte; learned IDs expand to their validated concatenated bytes. Concatenate every expansion before strict UTF-8 decoding; no replacement-character guess or input copy is used.

Saved inputs
index
1
id
256
Saved outputs
byteOffset
2
byteWidth
2
byte0
97
byte1
98

capstone_decode_expand_2

capstone_decode: expand ID at token 2

ID → validated byte expansion

Byte IDs expand to their own byte; learned IDs expand to their validated concatenated bytes. Concatenate every expansion before strict UTF-8 decoding; no replacement-character guess or input copy is used.

Saved inputs
index
2
id
256
Saved outputs
byteOffset
4
byteWidth
2
byte0
97
byte1
98

capstone_decode_decode_0

Decode UTF-8 scalar 0

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
0
byteOffset
0
byteWidth
1
byte0
97
Saved outputs
payload0
97
accumulator0
97
codePoint
97
utf16Width
1
unit0
97

capstone_decode_decode_1

Decode UTF-8 scalar 1

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
1
byteOffset
1
byteWidth
1
byte0
98
Saved outputs
payload0
98
accumulator0
98
codePoint
98
utf16Width
1
unit0
98

capstone_decode_decode_2

Decode UTF-8 scalar 2

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
2
byteOffset
2
byteWidth
1
byte0
97
Saved outputs
payload0
97
accumulator0
97
codePoint
97
utf16Width
1
unit0
97

capstone_decode_decode_3

Decode UTF-8 scalar 3

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
3
byteOffset
3
byteWidth
1
byte0
98
Saved outputs
payload0
98
accumulator0
98
codePoint
98
utf16Width
1
unit0
98

capstone_decode_decode_4

Decode UTF-8 scalar 4

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
4
byteOffset
4
byteWidth
1
byte0
97
Saved outputs
payload0
97
accumulator0
97
codePoint
97
utf16Width
1
unit0
97

capstone_decode_decode_5

Decode UTF-8 scalar 5

accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar

Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.

Saved inputs
scalarIndex
5
byteOffset
5
byteWidth
1
byte0
98
Saved outputs
payload0
98
accumulator0
98
codePoint
98
utf16Width
1
unit0
98

capstone_finish

Retain the actual decoded output and complete source counts

copy last selection, stop disposition, actual decoded byte/unit counts and saved evidence sizes

The final selected tail is decoded but never forwarded. These are source-graph counts, not measured timing, quality or hardware instruction counts. Every copied frame is retained; nothing is truncated to fit the512 limit.

Saved inputs
index
2
tokenId
256
logit
2.999582312034601
probability
0.6143051228061488
decodedBytes
6
decodedUnits
6
Saved outputs
promptTokens
1
decisions
2
forwardPasses
2
observedTokens
2
logicalTokens
3
decodedBytes
6
decodedUnits
6
eos
0
budgetReached
1
lastTokenId
256
lastClassIndex
2
lastLogit
2.999582312034601
lastProbability
0.6143051228061488
activeClasses
4
blockCount
2
featureWidth
2
hiddenWidth
3
sqrtCalls
16
expCalls
20
nativeElementaryCalls
36
frames
317
tensorCount
257

Open the house “Inspect all stored values, text metadata and tensor storage” disclosure below for every output alias and text field in saved order. Signed zero is shown as -0; boolean cells are true/false. Display precision never rounds these stored values. No probability, winner, tokenization or decoded string is recomputed by a view.

Prompt UTF16<=2 and actual a/b bytes1..2; merges0..2; outputs1..2; forwarded T<=3; logical IDs<=4; decoded bytes<=10. Full real block and codec work stays under512 frames by the manual source-family proof in H_AUTHOR_NOTES. The older one-block/cache paper is a different model. IV60-65 variants, quantization, timings and evaluation are not computed in this run.

SOURCE IMPLEMENTATION ONLY. All checks/imports/parsers/counters/numerical programs/tests/type/build/browser/accessibility/offline checks are UNRUN under the FluxGeo hold. Actual owner adoption and independent full-record/source/native validation remain pending. The owner-provided strict evaluateIV39 entry preserves unknown codec exceptions; only exact known stage/class/code/reason faults normalize.

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.

capstone_Raw

RawNumericField=18 · float64 · precision 8 · Raw order excluding text; merges/outputs cells VALUE, remaining sixteen cells WORD including -0.

Zero-based storage indexStored value
01
12
20.5
31
41
51
60.5
70.5
81
91
101
110.25
120.25
130
140
150
160
170

capstone_VocabularyIds

Vocab=5 · int32 · precision 0 · Ascending public IDs and exact greedy tie order: 97,98,256,257,512.

Zero-based storage indexStored value
097
198
2256
3257
4512

capstone_ActiveMask

Vocab=5 · bool · precision 8 · True means active; merge IDs require their actual learned rank.

Zero-based storage indexStored value
0true
1true
2true
3false
4true

capstone_ActiveIndices

ActiveClass=4 · int32 · precision 0 · Compact class indices of active public IDs, in full class order; maps sparse shifted-argument columns.

Zero-based storage indexStored value
00
11
22
34

capstone_E

Vocab=5 × D=2 · float64 · precision 8 · Hand-set embedding rows [1,0],[0,1],[1,1],[-1,1],[+0,+0].

Zero-based storage indexStored value
01
10
20
31
41
51
6-1
71
80
90

capstone_U

D=2 × Vocab=5 · float64 · precision 8 · Hand-set feature-last readout rows [1,0,1,-1,0] and [0,1,1,1,0].

Zero-based storage indexStored value
01
10
21
3-1
40
50
61
71
81
90

capstone_Bias

Vocab=5 · float64 · precision 8 · Captured biasA,biasB,biasAB,biasABAB,biasEOS words; inactive columns retain their real biases.

Zero-based storage indexStored value
00
10
20
30
40

capstone_tokenizer_CorpusCodePoints

Scalars=4 · int32 · precision 0 · Validated Unicode scalars in exact input order.

Zero-based storage indexStored value
097
198
297
398

capstone_tokenizer_CorpusUTF16Offsets

Scalars=4 · int32 · precision 0 · Zero-based UTF-16 storage offset for each scalar.

Zero-based storage indexStored value
00
11
22
33

capstone_tokenizer_CorpusUTF16Widths

Scalars=4 · int32 · precision 0 · UTF-16 storage units consumed by each scalar.

Zero-based storage indexStored value
01
11
21
31

capstone_tokenizer_CorpusByteOffsets

Scalars=4 · int32 · precision 0 · Zero-based UTF-8 byte offset for each scalar.

Zero-based storage indexStored value
00
11
22
33

capstone_tokenizer_CorpusByteWidths

Scalars=4 · int32 · precision 0 · Actual UTF-8 bytes emitted by each scalar.

Zero-based storage indexStored value
01
11
21
31

capstone_tokenizer_CorpusBytes

Bytes=4 · int32 · precision 0 · Manual UTF-8 encoding in source order, preserving all data.

Zero-based storage indexStored value
097
198
297
398

capstone_tokenizer_SourceCodePoints

Scalars=2 · int32 · precision 0 · Validated Unicode scalars in exact input order.

Zero-based storage indexStored value
097
198

capstone_tokenizer_SourceUTF16Offsets

Scalars=2 · int32 · precision 0 · Zero-based UTF-16 storage offset for each scalar.

Zero-based storage indexStored value
00
11

capstone_tokenizer_SourceUTF16Widths

Scalars=2 · int32 · precision 0 · UTF-16 storage units consumed by each scalar.

Zero-based storage indexStored value
01
11

capstone_tokenizer_SourceByteOffsets

Scalars=2 · int32 · precision 0 · Zero-based UTF-8 byte offset for each scalar.

Zero-based storage indexStored value
00
11

capstone_tokenizer_SourceByteWidths

Scalars=2 · int32 · precision 0 · Actual UTF-8 bytes emitted by each scalar.

Zero-based storage indexStored value
01
11

capstone_tokenizer_SourceBytes

Bytes=2 · int32 · precision 0 · Manual UTF-8 encoding in source order, preserving all data.

Zero-based storage indexStored value
097
198

capstone_tokenizer_TrainInitialIDs

Tokens=4 · int32 · precision 0 · Initial training byte IDs, one ID for each actual corpus byte.

Zero-based storage indexStored value
097
198
297
398

capstone_tokenizer_TrainR0CandidateLeft

Candidates=2 · int32 · precision 0 · Numeric tuple order: left ID, then right ID; aligned candidate columns.

Zero-based storage indexStored value
097
198

capstone_tokenizer_TrainR0CandidateRight

Candidates=2 · int32 · precision 0 · Right ID in the same sorted candidate order.

Zero-based storage indexStored value
098
197

capstone_tokenizer_TrainR0CandidateFrequency

Candidates=2 · int32 · precision 0 · Actual adjacent-pair frequency, including overlapping occurrences.

Zero-based storage indexStored value
02
11

capstone_tokenizer_TrainR0Before

Tokens=4 · int32 · precision 0 · Complete current token list before this nonoverlapping left-to-right pass.

Zero-based storage indexStored value
097
198
297
398

capstone_tokenizer_TrainR0After

Tokens=2 · int32 · precision 0 · Complete actual output token list after this rank; no padding or truncation.

Zero-based storage indexStored value
0256
1256

capstone_tokenizer_CorpusIDs

Tokens=2 · int32 · precision 0 · Final learned corpus token IDs; corpus training never contains EOS.

Zero-based storage indexStored value
0256
1256

capstone_tokenizer_RuleIDs

Rules=1 · int32 · precision 0 · Learned IDs in ascending rank, ID=256+rank.

Zero-based storage indexStored value
0256

capstone_tokenizer_RuleLeft

Rules=1 · int32 · precision 0 · Left operand ID for each learned rank.

Zero-based storage indexStored value
097

capstone_tokenizer_RuleRight

Rules=1 · int32 · precision 0 · Right operand ID for each learned rank.

Zero-based storage indexStored value
098

capstone_tokenizer_Rule256Bytes

Bytes=2 · int32 · precision 0 · Actual concatenated operand bytes; the piece alone need not be valid UTF-8.

Zero-based storage indexStored value
097
198

capstone_tokenizer_EncodeInitialIDs

Tokens=2 · int32 · precision 0 · Initial target byte IDs before any ranked application.

Zero-based storage indexStored value
097
198

capstone_tokenizer_EncodeR0Before

Tokens=2 · int32 · precision 0 · Complete current token list before this nonoverlapping left-to-right pass.

Zero-based storage indexStored value
097
198

capstone_tokenizer_EncodeR0After

Tokens=1 · int32 · precision 0 · Complete actual output token list after this rank; no padding or truncation.

Zero-based storage indexStored value
0256

capstone_tokenizer_TargetIDs

Tokens=1 · int32 · precision 0 · Final target token IDs after all learned ranks, then optional unique EOS tail.

Zero-based storage indexStored value
0256

capstone_tokenizer_CorpusDecodedBytes

Bytes=4 · int32 · precision 0 · Actual final corpus ID expansions passed to strict UTF-8 decoding.

Zero-based storage indexStored value
097
198
297
398

capstone_tokenizer_TargetDecodedBytes

Bytes=2 · int32 · precision 0 · Actual final target ID expansions passed to strict UTF-8 decoding.

Zero-based storage indexStored value
097
198

capstone_forward0_ObservedIds

T=1 · int32 · precision 0 · Actual complete prefix forwarded at this decision; no EOS or final pending tail is forwarded.

Zero-based storage indexStored value
0256

capstone_forward0_Positions

B=1 × T=1 × D=2 · float64 · precision 8 · Actual absolute P_t=[+0,t*positionScale] words before the first block only.

Zero-based storage indexStored value
00
10

capstone_forward0_Embeddings

B=1 × T=1 × D=2 · float64 · precision 8 · Actual indexed embedding word copies in observed-position order.

Zero-based storage indexStored value
01
11

capstone_forward0_Features

B=1 × T=1 × D=2 · float64 · precision 8 · Actual coordinate-wise E+P words, passed unchanged to block1.

Zero-based storage indexStored value
01
11

capstone_forward0_block1_Features

B=1 × T=1 × D=2 · float64 · precision 8 · Actual captured per-position block features; repeated token IDs do not merge positions.

Zero-based storage indexStored value
01
11

capstone_forward0_block1_Gains

Gain=5 · float64 · precision 8 · Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0.

Zero-based storage indexStored value
01
11
21
30.5
40.5

capstone_forward0_block1_n1_Gamma

D=2 · float64 · precision 8 · Shared literal feature scales [1,1].

Zero-based storage indexStored value
01
11

capstone_forward0_block1_n1_Beta

D=2 · float64 · precision 8 · Shared literal feature offsets [+0,+0].

Zero-based storage indexStored value
00
10

capstone_forward0_block1_n1_Statistics

B=1 × T=1 × NormStatistic=10 · float64 · precision 8 · Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Zero-based storage indexStored value
02
11
20
30
40
50
60
70
80.25
90.5

capstone_forward0_block1_n1_Centered

B=1 × T=1 × D=2 · float64 · precision 8 · Actual saved input feature minus feature mean, before division.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_n1_Normalized

B=1 × T=1 × D=2 · float64 · precision 8 · Actual centered/denominator words before gamma multiplication and beta addition.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_n1_Output

B=1 × T=1 × D=2 · float64 · precision 8 · Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_X

B=1 × T=1 × D=2 · float64 · precision 8 · Active token rows; D=2 input features always retained.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_WQ

D=2 × QueryFeature=2 · float64 · precision 8 · Query columns packed by h*Dk+f from wq{d}{h}{f}.

Zero-based storage indexStored value
01
10
20
31

capstone_forward0_block1_attn_WK

D=2 × KeyFeature=2 · float64 · precision 8 · Key columns packed by h*Dk+f from wk{d}{h}{f}.

Zero-based storage indexStored value
01
10
20
31

capstone_forward0_block1_attn_WV

D=2 × ValueFeature=2 · float64 · precision 8 · Value columns packed by h*Dv+f from wv{d}{h}{f}.

Zero-based storage indexStored value
01
10
20
31

capstone_forward0_block1_attn_QConcat

B=1 × T=1 × QueryFeature=2 · float64 · precision 8 · XWQ; each packed coordinate has two products and one sum.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_KConcat

B=1 × T=1 × KeyFeature=2 · float64 · precision 8 · XWK; each packed coordinate has two products and one sum.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_VConcat

B=1 × T=1 × ValueFeature=2 · float64 · precision 8 · XWV; values are projected separately from queries and keys.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_QSplit

B=1 × T=1 × H=1 × Dk=2 · float64 · precision 8 · QConcat reshaped without changing flat order; feature=h*F+f.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_QHeads

B=1 × H=1 × T=1 × Dk=2 · float64 · precision 8 · QSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_KSplit

B=1 × T=1 × H=1 × Dk=2 · float64 · precision 8 · KConcat reshaped without changing flat order; feature=h*F+f.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_KHeads

B=1 × H=1 × T=1 × Dk=2 · float64 · precision 8 · KSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_VSplit

B=1 × T=1 × H=1 × Dv=2 · float64 · precision 8 · VConcat reshaped without changing flat order; feature=h*F+f.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_VHeads

B=1 × H=1 × T=1 × Dv=2 · float64 · precision 8 · VSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_raw

B=1 × H=1 × Query=1 × Key=1 · float64 · precision 8 · Separate QHeads KHeads transpose products within every batch and head.

Zero-based storage indexStored value
00

capstone_forward0_block1_attn_scores

B=1 × H=1 × Query=1 × Key=1 · float64 · precision 8 · raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.

Zero-based storage indexStored value
00

capstone_forward0_block1_attn_allowed

B=1 × H=1 × Query=1 × Key=1 · bool · precision 8 · Causal and/or valid-key mask; shared validity across B and H; every query retained.

Zero-based storage indexStored value
0true

capstone_forward0_block1_attn_logits

B=1 × H=1 × Query=1 × Key=1 · float64 · precision 8 · Finite score+shift, including forbidden cells; mask applied separately.

Zero-based storage indexStored value
00

capstone_forward0_block1_attn_probabilities

B=1 × H=1 × Query=1 × Key=1 · float64 · precision 8 · Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.

Zero-based storage indexStored value
01

capstone_forward0_block1_attn_OHeads

B=1 × H=1 × Query=1 × Dv=2 · float64 · precision 8 · Actual per-head P times VHeads; every product and running sum is traced.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_C

B=1 × T=1 × JoinedValue=2 · float64 · precision 8 · OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_attn_WO

JoinedValue=2 × D=2 · float64 · precision 8 · wo{h}{f}{d} packed in h,f,d order, preserving parameter identity.

Zero-based storage indexStored value
00.5
10
20
30.5

capstone_forward0_block1_attn_Y

B=1 × T=1 × D=2 · float64 · precision 8 · Y=C WO, summing products in ascending joined-feature order from zero; no normalization.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_R1

B=1 × T=1 × D=2 · float64 · precision 8 · Exact named-shape addition of capstone_forward0_block1_Features and capstone_forward0_block1_attn_Y; no broadcasting.

Zero-based storage indexStored value
01
11

capstone_forward0_block1_n2_Gamma

D=2 · float64 · precision 8 · Shared literal feature scales [1,1].

Zero-based storage indexStored value
01
11

capstone_forward0_block1_n2_Beta

D=2 · float64 · precision 8 · Shared literal feature offsets [+0,+0].

Zero-based storage indexStored value
00
10

capstone_forward0_block1_n2_Statistics

B=1 × T=1 × NormStatistic=10 · float64 · precision 8 · Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Zero-based storage indexStored value
02
11
20
30
40
50
60
70
80.25
90.5

capstone_forward0_block1_n2_Centered

B=1 × T=1 × D=2 · float64 · precision 8 · Actual saved input feature minus feature mean, before division.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_n2_Normalized

B=1 × T=1 × D=2 · float64 · precision 8 · Actual centered/denominator words before gamma multiplication and beta addition.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_n2_Output

B=1 × T=1 × D=2 · float64 · precision 8 · Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_ffn_W1

D=2 × HiddenFeature=3 · float64 · precision 8 · Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features.

Zero-based storage indexStored value
01
10
20
30
41
50

capstone_forward0_block1_ffn_b1

HiddenFeature=3 · float64 · precision 8 · Shared hidden bias, added after the two products.

Zero-based storage indexStored value
00
10
20

capstone_forward0_block1_ffn_Z

B=1 × T=1 × HiddenFeature=3 · float64 · precision 8 · Hidden preactivations X W1+b1; no batch or token mixing.

Zero-based storage indexStored value
00
10
20

capstone_forward0_block1_ffn_Hidden

B=1 × T=1 × HiddenFeature=3 · float64 · precision 8 · ReLU(Z)=max(0,Z), before the second affine layer.

Zero-based storage indexStored value
00
10
20

capstone_forward0_block1_ffn_W2

HiddenFeature=3 × D=2 · float64 · precision 8 · Shared hidden-to-output weights, f2{m}{d}.

Zero-based storage indexStored value
00.5
10
20
30.5
40
50

capstone_forward0_block1_ffn_b2

D=2 · float64 · precision 8 · Shared output bias, added after all three running sums.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_ffn_F

B=1 × T=1 × D=2 · float64 · precision 8 · ReLU(X W1+b1) W2+b2, independently per token with shared parameters.

Zero-based storage indexStored value
00
10

capstone_forward0_block1_Output

B=1 × T=1 × D=2 · float64 · precision 8 · Exact named-shape addition of capstone_forward0_block1_R1 and capstone_forward0_block1_ffn_F; no broadcasting.

Zero-based storage indexStored value
01
11

capstone_forward0_block1_NativeArguments

Native=4 × NativeField=2 · float64 · precision 8 · Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing.

Zero-based storage indexStored value
00.25
10.5
22
31.4142135623730951
40
51
60.25
70.5

capstone_forward0_block1_NativeKinds

Native=4 · int32 · precision 0 · Native kind codes in native occurrence order: sqrt=0, exp=1.

Zero-based storage indexStored value
00
10
21
30

capstone_forward0_block2_Features

B=1 × T=1 × D=2 · float64 · precision 8 · Actual captured per-position block features; repeated token IDs do not merge positions.

Zero-based storage indexStored value
01
11

capstone_forward0_block2_Gains

Gain=5 · float64 · precision 8 · Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0.

Zero-based storage indexStored value
01
11
21
30.25
40.25

capstone_forward0_block2_n1_Gamma

D=2 · float64 · precision 8 · Shared literal feature scales [1,1].

Zero-based storage indexStored value
01
11

capstone_forward0_block2_n1_Beta

D=2 · float64 · precision 8 · Shared literal feature offsets [+0,+0].

Zero-based storage indexStored value
00
10

capstone_forward0_block2_n1_Statistics

B=1 × T=1 × NormStatistic=10 · float64 · precision 8 · Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Zero-based storage indexStored value
02
11
20
30
40
50
60
70
80.25
90.5

capstone_forward0_block2_n1_Centered

B=1 × T=1 × D=2 · float64 · precision 8 · Actual saved input feature minus feature mean, before division.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_n1_Normalized

B=1 × T=1 × D=2 · float64 · precision 8 · Actual centered/denominator words before gamma multiplication and beta addition.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_n1_Output

B=1 × T=1 × D=2 · float64 · precision 8 · Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_X

B=1 × T=1 × D=2 · float64 · precision 8 · Active token rows; D=2 input features always retained.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_WQ

D=2 × QueryFeature=2 · float64 · precision 8 · Query columns packed by h*Dk+f from wq{d}{h}{f}.

Zero-based storage indexStored value
01
10
20
31

capstone_forward0_block2_attn_WK

D=2 × KeyFeature=2 · float64 · precision 8 · Key columns packed by h*Dk+f from wk{d}{h}{f}.

Zero-based storage indexStored value
01
10
20
31

capstone_forward0_block2_attn_WV

D=2 × ValueFeature=2 · float64 · precision 8 · Value columns packed by h*Dv+f from wv{d}{h}{f}.

Zero-based storage indexStored value
01
10
20
31

capstone_forward0_block2_attn_QConcat

B=1 × T=1 × QueryFeature=2 · float64 · precision 8 · XWQ; each packed coordinate has two products and one sum.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_KConcat

B=1 × T=1 × KeyFeature=2 · float64 · precision 8 · XWK; each packed coordinate has two products and one sum.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_VConcat

B=1 × T=1 × ValueFeature=2 · float64 · precision 8 · XWV; values are projected separately from queries and keys.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_QSplit

B=1 × T=1 × H=1 × Dk=2 · float64 · precision 8 · QConcat reshaped without changing flat order; feature=h*F+f.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_QHeads

B=1 × H=1 × T=1 × Dk=2 · float64 · precision 8 · QSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_KSplit

B=1 × T=1 × H=1 × Dk=2 · float64 · precision 8 · KConcat reshaped without changing flat order; feature=h*F+f.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_KHeads

B=1 × H=1 × T=1 × Dk=2 · float64 · precision 8 · KSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_VSplit

B=1 × T=1 × H=1 × Dv=2 · float64 · precision 8 · VConcat reshaped without changing flat order; feature=h*F+f.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_VHeads

B=1 × H=1 × T=1 × Dv=2 · float64 · precision 8 · VSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_raw

B=1 × H=1 × Query=1 × Key=1 · float64 · precision 8 · Separate QHeads KHeads transpose products within every batch and head.

Zero-based storage indexStored value
00

capstone_forward0_block2_attn_scores

B=1 × H=1 × Query=1 × Key=1 · float64 · precision 8 · raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.

Zero-based storage indexStored value
00

capstone_forward0_block2_attn_allowed

B=1 × H=1 × Query=1 × Key=1 · bool · precision 8 · Causal and/or valid-key mask; shared validity across B and H; every query retained.

Zero-based storage indexStored value
0true

capstone_forward0_block2_attn_logits

B=1 × H=1 × Query=1 × Key=1 · float64 · precision 8 · Finite score+shift, including forbidden cells; mask applied separately.

Zero-based storage indexStored value
00

capstone_forward0_block2_attn_probabilities

B=1 × H=1 × Query=1 × Key=1 · float64 · precision 8 · Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.

Zero-based storage indexStored value
01

capstone_forward0_block2_attn_OHeads

B=1 × H=1 × Query=1 × Dv=2 · float64 · precision 8 · Actual per-head P times VHeads; every product and running sum is traced.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_C

B=1 × T=1 × JoinedValue=2 · float64 · precision 8 · OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_attn_WO

JoinedValue=2 × D=2 · float64 · precision 8 · wo{h}{f}{d} packed in h,f,d order, preserving parameter identity.

Zero-based storage indexStored value
00.25
10
20
30.25

capstone_forward0_block2_attn_Y

B=1 × T=1 × D=2 · float64 · precision 8 · Y=C WO, summing products in ascending joined-feature order from zero; no normalization.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_R1

B=1 × T=1 × D=2 · float64 · precision 8 · Exact named-shape addition of capstone_forward0_block2_Features and capstone_forward0_block2_attn_Y; no broadcasting.

Zero-based storage indexStored value
01
11

capstone_forward0_block2_n2_Gamma

D=2 · float64 · precision 8 · Shared literal feature scales [1,1].

Zero-based storage indexStored value
01
11

capstone_forward0_block2_n2_Beta

D=2 · float64 · precision 8 · Shared literal feature offsets [+0,+0].

Zero-based storage indexStored value
00
10

capstone_forward0_block2_n2_Statistics

B=1 × T=1 × NormStatistic=10 · float64 · precision 8 · Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Zero-based storage indexStored value
02
11
20
30
40
50
60
70
80.25
90.5

capstone_forward0_block2_n2_Centered

B=1 × T=1 × D=2 · float64 · precision 8 · Actual saved input feature minus feature mean, before division.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_n2_Normalized

B=1 × T=1 × D=2 · float64 · precision 8 · Actual centered/denominator words before gamma multiplication and beta addition.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_n2_Output

B=1 × T=1 × D=2 · float64 · precision 8 · Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_ffn_W1

D=2 × HiddenFeature=3 · float64 · precision 8 · Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features.

Zero-based storage indexStored value
01
10
20
30
41
50

capstone_forward0_block2_ffn_b1

HiddenFeature=3 · float64 · precision 8 · Shared hidden bias, added after the two products.

Zero-based storage indexStored value
00
10
20

capstone_forward0_block2_ffn_Z

B=1 × T=1 × HiddenFeature=3 · float64 · precision 8 · Hidden preactivations X W1+b1; no batch or token mixing.

Zero-based storage indexStored value
00
10
20

capstone_forward0_block2_ffn_Hidden

B=1 × T=1 × HiddenFeature=3 · float64 · precision 8 · ReLU(Z)=max(0,Z), before the second affine layer.

Zero-based storage indexStored value
00
10
20

capstone_forward0_block2_ffn_W2

HiddenFeature=3 × D=2 · float64 · precision 8 · Shared hidden-to-output weights, f2{m}{d}.

Zero-based storage indexStored value
00.25
10
20
30.25
40
50

capstone_forward0_block2_ffn_b2

D=2 · float64 · precision 8 · Shared output bias, added after all three running sums.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_ffn_F

B=1 × T=1 × D=2 · float64 · precision 8 · ReLU(X W1+b1) W2+b2, independently per token with shared parameters.

Zero-based storage indexStored value
00
10

capstone_forward0_block2_Output

B=1 × T=1 × D=2 · float64 · precision 8 · Exact named-shape addition of capstone_forward0_block2_R1 and capstone_forward0_block2_ffn_F; no broadcasting.

Zero-based storage indexStored value
01
11

capstone_forward0_block2_NativeArguments

Native=4 × NativeField=2 · float64 · precision 8 · Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing.

Zero-based storage indexStored value
00.25
10.5
22
31.4142135623730951
40
51
60.25
70.5

capstone_forward0_block2_NativeKinds

Native=4 · int32 · precision 0 · Native kind codes in native occurrence order: sqrt=0, exp=1.

Zero-based storage indexStored value
00
10
21
30

capstone_forward0_Readout

B=1 × T=1 × Vocab=5 × ReadoutField=4 · float64 · precision 8 · Actual product0,product1,sum,logit at every position and all five classes.

Zero-based storage indexStored value
01
10
21
31
40
51
61
71
81
91
102
112
12-1
131
140
150
160
170
180
190

capstone_forward0_Logits

B=1 × T=1 × Vocab=5 · float64 · precision 8 · All actual logits, including inactive merge columns; only active last-row logits select.

Zero-based storage indexStored value
01
11
22
30
40

capstone_forward0_ClassMaxima

B=1 × T=1 · float64 · precision 8 · Actual Math.max over allowed logits; mixed signed zeros prefer +0.

Zero-based storage indexStored value
02

capstone_forward0_ClassShifted

B=1 × T=1 × ActiveClass=4 · float64 · precision 8 · Only executed allowed-class exp arguments, in position/ActiveIndices order; no fabricated inactive argument.

Zero-based storage indexStored value
0-1
1-1
20
3-2

capstone_forward0_ClassTerms

B=1 × T=1 × Vocab=5 · float64 · precision 8 · Actual allowed exp outputs and literal inactive +0 policy terms.

Zero-based storage indexStored value
00.36787944117144233
10.36787944117144233
21
30
40.1353352832366127

capstone_forward0_ClassPartials

B=1 × T=1 × Vocab=5 · float64 · precision 8 · Functional reconstruction of identical ordered +0 term folds, including inactive zero terms; no native recomputation.

Zero-based storage indexStored value
00.36787944117144233
10.7357588823428847
21.7357588823428847
31.7357588823428847
41.8710941655794975

capstone_forward0_ClassDenominators

B=1 × T=1 · float64 · precision 8 · Actual final ordered denominator supplied by stableSoftmax.

Zero-based storage indexStored value
01.8710941655794975

capstone_forward0_Probabilities

B=1 × T=1 × Vocab=5 · float64 · precision 8 · Actual five term/denominator divisions, including inactive exact zero probabilities.

Zero-based storage indexStored value
00.19661193324148185
10.19661193324148185
20.5344466453885229
30
40.07232948812851327

capstone_forward0_Selection

SelectionField=4 · float64 · precision 8 · Actual selected class index and public ID are VALUE; selected logit and probability are unchanged WORD copies.

Zero-based storage indexStored value
02
1256
22
30.5344466453885229

capstone_forward0_AfterIds

LogicalToken=2 · int32 · precision 0 · Actual complete logical IDs after this decision, including its unforwarded tail; EOS can occur only at the final tail.

Zero-based storage indexStored value
0256
1256

capstone_forward1_ObservedIds

T=2 · int32 · precision 0 · Actual complete prefix forwarded at this decision; no EOS or final pending tail is forwarded.

Zero-based storage indexStored value
0256
1256

capstone_forward1_Positions

B=1 × T=2 × D=2 · float64 · precision 8 · Actual absolute P_t=[+0,t*positionScale] words before the first block only.

Zero-based storage indexStored value
00
10
20
30.5

capstone_forward1_Embeddings

B=1 × T=2 × D=2 · float64 · precision 8 · Actual indexed embedding word copies in observed-position order.

Zero-based storage indexStored value
01
11
21
31

capstone_forward1_Features

B=1 × T=2 × D=2 · float64 · precision 8 · Actual coordinate-wise E+P words, passed unchanged to block1.

Zero-based storage indexStored value
01
11
21
31.5

capstone_forward1_block1_Features

B=1 × T=2 × D=2 · float64 · precision 8 · Actual captured per-position block features; repeated token IDs do not merge positions.

Zero-based storage indexStored value
01
11
21
31.5

capstone_forward1_block1_Gains

Gain=5 · float64 · precision 8 · Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0.

Zero-based storage indexStored value
01
11
21
30.5
40.5

capstone_forward1_block1_n1_Gamma

D=2 · float64 · precision 8 · Shared literal feature scales [1,1].

Zero-based storage indexStored value
01
11

capstone_forward1_block1_n1_Beta

D=2 · float64 · precision 8 · Shared literal feature offsets [+0,+0].

Zero-based storage indexStored value
00
10

capstone_forward1_block1_n1_Statistics

B=1 × T=2 × NormStatistic=10 · float64 · precision 8 · Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Zero-based storage indexStored value
02
11
20
30
40
50
60
70
80.25
90.5
102.5
111.25
12-0.25
130.25
140.0625
150.0625
160.125
170.0625
180.3125
190.5590169943749475

capstone_forward1_block1_n1_Centered

B=1 × T=2 × D=2 · float64 · precision 8 · Actual saved input feature minus feature mean, before division.

Zero-based storage indexStored value
00
10
2-0.25
30.25

capstone_forward1_block1_n1_Normalized

B=1 × T=2 × D=2 · float64 · precision 8 · Actual centered/denominator words before gamma multiplication and beta addition.

Zero-based storage indexStored value
00
10
2-0.4472135954999579
30.4472135954999579

capstone_forward1_block1_n1_Output

B=1 × T=2 × D=2 · float64 · precision 8 · Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Zero-based storage indexStored value
00
10
2-0.4472135954999579
30.4472135954999579

capstone_forward1_block1_attn_X

B=1 × T=2 × D=2 · float64 · precision 8 · Active token rows; D=2 input features always retained.

Zero-based storage indexStored value
00
10
2-0.4472135954999579
30.4472135954999579

capstone_forward1_block1_attn_WQ

D=2 × QueryFeature=2 · float64 · precision 8 · Query columns packed by h*Dk+f from wq{d}{h}{f}.

Zero-based storage indexStored value
01
10
20
31

capstone_forward1_block1_attn_WK

D=2 × KeyFeature=2 · float64 · precision 8 · Key columns packed by h*Dk+f from wk{d}{h}{f}.

Zero-based storage indexStored value
01
10
20
31

capstone_forward1_block1_attn_WV

D=2 × ValueFeature=2 · float64 · precision 8 · Value columns packed by h*Dv+f from wv{d}{h}{f}.

Zero-based storage indexStored value
01
10
20
31

capstone_forward1_block1_attn_QConcat

B=1 × T=2 × QueryFeature=2 · float64 · precision 8 · XWQ; each packed coordinate has two products and one sum.

Zero-based storage indexStored value
00
10
2-0.4472135954999579
30.4472135954999579

capstone_forward1_block1_attn_KConcat

B=1 × T=2 × KeyFeature=2 · float64 · precision 8 · XWK; each packed coordinate has two products and one sum.

Zero-based storage indexStored value
00
10
2-0.4472135954999579
30.4472135954999579

capstone_forward1_block1_attn_VConcat

B=1 × T=2 × ValueFeature=2 · float64 · precision 8 · XWV; values are projected separately from queries and keys.

Zero-based storage indexStored value
00
10
2-0.4472135954999579
30.4472135954999579

capstone_forward1_block1_attn_QSplit

B=1 × T=2 × H=1 × Dk=2 · float64 · precision 8 · QConcat reshaped without changing flat order; feature=h*F+f.

Zero-based storage indexStored value
00
10
2-0.4472135954999579
30.4472135954999579

capstone_forward1_block1_attn_QHeads

B=1 × H=1 × T=2 × Dk=2 · float64 · precision 8 · QSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Zero-based storage indexStored value
00
10
2-0.4472135954999579
30.4472135954999579

capstone_forward1_block1_attn_KSplit

B=1 × T=2 × H=1 × Dk=2 · float64 · precision 8 · KConcat reshaped without changing flat order; feature=h*F+f.

Zero-based storage indexStored value
00
10
2-0.4472135954999579
30.4472135954999579

capstone_forward1_block1_attn_KHeads

B=1 × H=1 × T=2 × Dk=2 · float64 · precision 8 · KSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Zero-based storage indexStored value
00
10
2-0.4472135954999579
30.4472135954999579

capstone_forward1_block1_attn_VSplit

B=1 × T=2 × H=1 × Dv=2 · float64 · precision 8 · VConcat reshaped without changing flat order; feature=h*F+f.

Zero-based storage indexStored value
00
10
2-0.4472135954999579
30.4472135954999579

capstone_forward1_block1_attn_VHeads

B=1 × H=1 × T=2 × Dv=2 · float64 · precision 8 · VSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Zero-based storage indexStored value
00
10
2-0.4472135954999579
30.4472135954999579

capstone_forward1_block1_attn_raw

B=1 × H=1 × Query=2 × Key=2 · float64 · precision 8 · Separate QHeads KHeads transpose products within every batch and head.

Zero-based storage indexStored value
00
10
20
30.39999999999999997

capstone_forward1_block1_attn_scores

B=1 × H=1 × Query=2 × Key=2 · float64 · precision 8 · raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.

Zero-based storage indexStored value
00
10
20
30.28284271247461895

capstone_forward1_block1_attn_allowed

B=1 × H=1 × Query=2 × Key=2 · bool · precision 8 · Causal and/or valid-key mask; shared validity across B and H; every query retained.

Zero-based storage indexStored value
0true
1false
2true
3true

capstone_forward1_block1_attn_logits

B=1 × H=1 × Query=2 × Key=2 · float64 · precision 8 · Finite score+shift, including forbidden cells; mask applied separately.

Zero-based storage indexStored value
00
10
20
30.28284271247461895

capstone_forward1_block1_attn_probabilities

B=1 × H=1 × Query=2 × Key=2 · float64 · precision 8 · Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.

Zero-based storage indexStored value
01
10
20.429756985449589
30.570243014550411

capstone_forward1_block1_attn_OHeads

B=1 × H=1 × Query=2 × Dv=2 · float64 · precision 8 · Actual per-head P times VHeads; every product and running sum is traced.

Zero-based storage indexStored value
00
10
2-0.25502042884582415
30.25502042884582415

capstone_forward1_block1_attn_C

B=1 × T=2 × JoinedValue=2 · float64 · precision 8 · OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged.

Zero-based storage indexStored value
00
10
2-0.25502042884582415
30.25502042884582415

capstone_forward1_block1_attn_WO

JoinedValue=2 × D=2 · float64 · precision 8 · wo{h}{f}{d} packed in h,f,d order, preserving parameter identity.

Zero-based storage indexStored value
00.5
10
20
30.5

capstone_forward1_block1_attn_Y

B=1 × T=2 × D=2 · float64 · precision 8 · Y=C WO, summing products in ascending joined-feature order from zero; no normalization.

Zero-based storage indexStored value
00
10
2-0.12751021442291208
30.12751021442291208

capstone_forward1_block1_R1

B=1 × T=2 × D=2 · float64 · precision 8 · Exact named-shape addition of capstone_forward1_block1_Features and capstone_forward1_block1_attn_Y; no broadcasting.

Zero-based storage indexStored value
01
11
20.8724897855770879
31.627510214422912

capstone_forward1_block1_n2_Gamma

D=2 · float64 · precision 8 · Shared literal feature scales [1,1].

Zero-based storage indexStored value
01
11

capstone_forward1_block1_n2_Beta

D=2 · float64 · precision 8 · Shared literal feature offsets [+0,+0].

Zero-based storage indexStored value
00
10

capstone_forward1_block1_n2_Statistics

B=1 × T=2 × NormStatistic=10 · float64 · precision 8 · Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Zero-based storage indexStored value
02
11
20
30
40
50
60
70
80.25
90.5
102.5
111.25
12-0.3775102144229121
130.3775102144229121
140.1425139619936331
150.1425139619936331
160.2850279239872662
170.1425139619936331
180.3925139619936331
190.6265093470919912

capstone_forward1_block1_n2_Centered

B=1 × T=2 × D=2 · float64 · precision 8 · Actual saved input feature minus feature mean, before division.

Zero-based storage indexStored value
00
10
2-0.3775102144229121
30.3775102144229121

capstone_forward1_block1_n2_Normalized

B=1 × T=2 × D=2 · float64 · precision 8 · Actual centered/denominator words before gamma multiplication and beta addition.

Zero-based storage indexStored value
00
10
2-0.6025611847216092
30.6025611847216092

capstone_forward1_block1_n2_Output

B=1 × T=2 × D=2 · float64 · precision 8 · Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Zero-based storage indexStored value
00
10
2-0.6025611847216092
30.6025611847216092

capstone_forward1_block1_ffn_W1

D=2 × HiddenFeature=3 · float64 · precision 8 · Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features.

Zero-based storage indexStored value
01
10
20
30
41
50

capstone_forward1_block1_ffn_b1

HiddenFeature=3 · float64 · precision 8 · Shared hidden bias, added after the two products.

Zero-based storage indexStored value
00
10
20

capstone_forward1_block1_ffn_Z

B=1 × T=2 × HiddenFeature=3 · float64 · precision 8 · Hidden preactivations X W1+b1; no batch or token mixing.

Zero-based storage indexStored value
00
10
20
3-0.6025611847216092
40.6025611847216092
50

capstone_forward1_block1_ffn_Hidden

B=1 × T=2 × HiddenFeature=3 · float64 · precision 8 · ReLU(Z)=max(0,Z), before the second affine layer.

Zero-based storage indexStored value
00
10
20
30
40.6025611847216092
50

capstone_forward1_block1_ffn_W2

HiddenFeature=3 × D=2 · float64 · precision 8 · Shared hidden-to-output weights, f2{m}{d}.

Zero-based storage indexStored value
00.5
10
20
30.5
40
50

capstone_forward1_block1_ffn_b2

D=2 · float64 · precision 8 · Shared output bias, added after all three running sums.

Zero-based storage indexStored value
00
10

capstone_forward1_block1_ffn_F

B=1 × T=2 × D=2 · float64 · precision 8 · ReLU(X W1+b1) W2+b2, independently per token with shared parameters.

Zero-based storage indexStored value
00
10
20
30.3012805923608046

capstone_forward1_block1_Output

B=1 × T=2 × D=2 · float64 · precision 8 · Exact named-shape addition of capstone_forward1_block1_R1 and capstone_forward1_block1_ffn_F; no broadcasting.

Zero-based storage indexStored value
01
11
20.8724897855770879
31.9287908067837167

capstone_forward1_block1_NativeArguments

Native=8 × NativeField=2 · float64 · precision 8 · Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing.

Zero-based storage indexStored value
00.25
10.5
20.3125
30.5590169943749475
42
51.4142135623730951
60
71
8-0.28284271247461895
90.7536383164437648
100
111
120.25
130.5
140.3925139619936331
150.6265093470919912

capstone_forward1_block1_NativeKinds

Native=8 · int32 · precision 0 · Native kind codes in native occurrence order: sqrt=0, exp=1.

Zero-based storage indexStored value
00
10
20
31
41
51
60
70

capstone_forward1_block2_Features

B=1 × T=2 × D=2 · float64 · precision 8 · Actual captured per-position block features; repeated token IDs do not merge positions.

Zero-based storage indexStored value
01
11
20.8724897855770879
31.9287908067837167

capstone_forward1_block2_Gains

Gain=5 · float64 · precision 8 · Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0.

Zero-based storage indexStored value
01
11
21
30.25
40.25

capstone_forward1_block2_n1_Gamma

D=2 · float64 · precision 8 · Shared literal feature scales [1,1].

Zero-based storage indexStored value
01
11

capstone_forward1_block2_n1_Beta

D=2 · float64 · precision 8 · Shared literal feature offsets [+0,+0].

Zero-based storage indexStored value
00
10

capstone_forward1_block2_n1_Statistics

B=1 × T=2 × NormStatistic=10 · float64 · precision 8 · Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Zero-based storage indexStored value
02
11
20
30
40
50
60
70
80.25
90.5
102.8012805923608046
111.4006402961804023
12-0.5281505106033144
130.5281505106033144
140.27894296185054174
150.27894296185054174
160.5578859237010835
170.27894296185054174
180.5289429618505417
190.727284649810885

capstone_forward1_block2_n1_Centered

B=1 × T=2 × D=2 · float64 · precision 8 · Actual saved input feature minus feature mean, before division.

Zero-based storage indexStored value
00
10
2-0.5281505106033144
30.5281505106033144

capstone_forward1_block2_n1_Normalized

B=1 × T=2 × D=2 · float64 · precision 8 · Actual centered/denominator words before gamma multiplication and beta addition.

Zero-based storage indexStored value
00
10
2-0.7261950472083369
30.7261950472083369

capstone_forward1_block2_n1_Output

B=1 × T=2 × D=2 · float64 · precision 8 · Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Zero-based storage indexStored value
00
10
2-0.7261950472083369
30.7261950472083369

capstone_forward1_block2_attn_X

B=1 × T=2 × D=2 · float64 · precision 8 · Active token rows; D=2 input features always retained.

Zero-based storage indexStored value
00
10
2-0.7261950472083369
30.7261950472083369

capstone_forward1_block2_attn_WQ

D=2 × QueryFeature=2 · float64 · precision 8 · Query columns packed by h*Dk+f from wq{d}{h}{f}.

Zero-based storage indexStored value
01
10
20
31

capstone_forward1_block2_attn_WK

D=2 × KeyFeature=2 · float64 · precision 8 · Key columns packed by h*Dk+f from wk{d}{h}{f}.

Zero-based storage indexStored value
01
10
20
31

capstone_forward1_block2_attn_WV

D=2 × ValueFeature=2 · float64 · precision 8 · Value columns packed by h*Dv+f from wv{d}{h}{f}.

Zero-based storage indexStored value
01
10
20
31

capstone_forward1_block2_attn_QConcat

B=1 × T=2 × QueryFeature=2 · float64 · precision 8 · XWQ; each packed coordinate has two products and one sum.

Zero-based storage indexStored value
00
10
2-0.7261950472083369
30.7261950472083369

capstone_forward1_block2_attn_KConcat

B=1 × T=2 × KeyFeature=2 · float64 · precision 8 · XWK; each packed coordinate has two products and one sum.

Zero-based storage indexStored value
00
10
2-0.7261950472083369
30.7261950472083369

capstone_forward1_block2_attn_VConcat

B=1 × T=2 × ValueFeature=2 · float64 · precision 8 · XWV; values are projected separately from queries and keys.

Zero-based storage indexStored value
00
10
2-0.7261950472083369
30.7261950472083369

capstone_forward1_block2_attn_QSplit

B=1 × T=2 × H=1 × Dk=2 · float64 · precision 8 · QConcat reshaped without changing flat order; feature=h*F+f.

Zero-based storage indexStored value
00
10
2-0.7261950472083369
30.7261950472083369

capstone_forward1_block2_attn_QHeads

B=1 × H=1 × T=2 × Dk=2 · float64 · precision 8 · QSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Zero-based storage indexStored value
00
10
2-0.7261950472083369
30.7261950472083369

capstone_forward1_block2_attn_KSplit

B=1 × T=2 × H=1 × Dk=2 · float64 · precision 8 · KConcat reshaped without changing flat order; feature=h*F+f.

Zero-based storage indexStored value
00
10
2-0.7261950472083369
30.7261950472083369

capstone_forward1_block2_attn_KHeads

B=1 × H=1 × T=2 × Dk=2 · float64 · precision 8 · KSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Zero-based storage indexStored value
00
10
2-0.7261950472083369
30.7261950472083369

capstone_forward1_block2_attn_VSplit

B=1 × T=2 × H=1 × Dv=2 · float64 · precision 8 · VConcat reshaped without changing flat order; feature=h*F+f.

Zero-based storage indexStored value
00
10
2-0.7261950472083369
30.7261950472083369

capstone_forward1_block2_attn_VHeads

B=1 × H=1 × T=2 × Dv=2 · float64 · precision 8 · VSplit permuted by axes [0,2,1,3]; every copied source/destination offset is traced.

Zero-based storage indexStored value
00
10
2-0.7261950472083369
30.7261950472083369

capstone_forward1_block2_attn_raw

B=1 × H=1 × Query=2 × Key=2 · float64 · precision 8 · Separate QHeads KHeads transpose products within every batch and head.

Zero-based storage indexStored value
00
10
20
31.0547184931798375

capstone_forward1_block2_attn_scores

B=1 × H=1 × Query=2 × Key=2 · float64 · precision 8 · raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.

Zero-based storage indexStored value
00
10
20
30.7457985987703204

capstone_forward1_block2_attn_allowed

B=1 × H=1 × Query=2 × Key=2 · bool · precision 8 · Causal and/or valid-key mask; shared validity across B and H; every query retained.

Zero-based storage indexStored value
0true
1false
2true
3true

capstone_forward1_block2_attn_logits

B=1 × H=1 × Query=2 × Key=2 · float64 · precision 8 · Finite score+shift, including forbidden cells; mask applied separately.

Zero-based storage indexStored value
00
10
20
30.7457985987703204

capstone_forward1_block2_attn_probabilities

B=1 × H=1 × Query=2 × Key=2 · float64 · precision 8 · Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.

Zero-based storage indexStored value
01
10
20.3217374534528671
30.6782625465471329

capstone_forward1_block2_attn_OHeads

B=1 × H=1 × Query=2 × Dv=2 · float64 · precision 8 · Actual per-head P times VHeads; every product and running sum is traced.

Zero-based storage indexStored value
00
10
2-0.492550902009442
30.492550902009442

capstone_forward1_block2_attn_C

B=1 × T=2 × JoinedValue=2 · float64 · precision 8 · OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged.

Zero-based storage indexStored value
00
10
2-0.492550902009442
30.492550902009442

capstone_forward1_block2_attn_WO

JoinedValue=2 × D=2 · float64 · precision 8 · wo{h}{f}{d} packed in h,f,d order, preserving parameter identity.

Zero-based storage indexStored value
00.25
10
20
30.25

capstone_forward1_block2_attn_Y

B=1 × T=2 × D=2 · float64 · precision 8 · Y=C WO, summing products in ascending joined-feature order from zero; no normalization.

Zero-based storage indexStored value
00
10
2-0.1231377255023605
30.1231377255023605

capstone_forward1_block2_R1

B=1 × T=2 × D=2 · float64 · precision 8 · Exact named-shape addition of capstone_forward1_block2_Features and capstone_forward1_block2_attn_Y; no broadcasting.

Zero-based storage indexStored value
01
11
20.7493520600747274
32.051928532286077

capstone_forward1_block2_n2_Gamma

D=2 · float64 · precision 8 · Shared literal feature scales [1,1].

Zero-based storage indexStored value
01
11

capstone_forward1_block2_n2_Beta

D=2 · float64 · precision 8 · Shared literal feature offsets [+0,+0].

Zero-based storage indexStored value
00
10

capstone_forward1_block2_n2_Statistics

B=1 × T=2 × NormStatistic=10 · float64 · precision 8 · Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order.

Zero-based storage indexStored value
02
11
20
30
40
50
60
70
80.25
90.5
102.8012805923608046
111.4006402961804023
12-0.6512882361056749
130.6512882361056749
140.4241763664896413
150.4241763664896413
160.8483527329792826
170.4241763664896413
180.6741763664896413
190.8210824358672163

capstone_forward1_block2_n2_Centered

B=1 × T=2 × D=2 · float64 · precision 8 · Actual saved input feature minus feature mean, before division.

Zero-based storage indexStored value
00
10
2-0.6512882361056749
30.6512882361056749

capstone_forward1_block2_n2_Normalized

B=1 × T=2 × D=2 · float64 · precision 8 · Actual centered/denominator words before gamma multiplication and beta addition.

Zero-based storage indexStored value
00
10
2-0.793206878695186
30.793206878695186

capstone_forward1_block2_n2_Output

B=1 × T=2 × D=2 · float64 · precision 8 · Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4.

Zero-based storage indexStored value
00
10
2-0.793206878695186
30.793206878695186

capstone_forward1_block2_ffn_W1

D=2 × HiddenFeature=3 · float64 · precision 8 · Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features.

Zero-based storage indexStored value
01
10
20
30
41
50

capstone_forward1_block2_ffn_b1

HiddenFeature=3 · float64 · precision 8 · Shared hidden bias, added after the two products.

Zero-based storage indexStored value
00
10
20

capstone_forward1_block2_ffn_Z

B=1 × T=2 × HiddenFeature=3 · float64 · precision 8 · Hidden preactivations X W1+b1; no batch or token mixing.

Zero-based storage indexStored value
00
10
20
3-0.793206878695186
40.793206878695186
50

capstone_forward1_block2_ffn_Hidden

B=1 × T=2 × HiddenFeature=3 · float64 · precision 8 · ReLU(Z)=max(0,Z), before the second affine layer.

Zero-based storage indexStored value
00
10
20
30
40.793206878695186
50

capstone_forward1_block2_ffn_W2

HiddenFeature=3 × D=2 · float64 · precision 8 · Shared hidden-to-output weights, f2{m}{d}.

Zero-based storage indexStored value
00.25
10
20
30.25
40
50

capstone_forward1_block2_ffn_b2

D=2 · float64 · precision 8 · Shared output bias, added after all three running sums.

Zero-based storage indexStored value
00
10

capstone_forward1_block2_ffn_F

B=1 × T=2 × D=2 · float64 · precision 8 · ReLU(X W1+b1) W2+b2, independently per token with shared parameters.

Zero-based storage indexStored value
00
10
20
30.1983017196737965

capstone_forward1_block2_Output

B=1 × T=2 × D=2 · float64 · precision 8 · Exact named-shape addition of capstone_forward1_block2_R1 and capstone_forward1_block2_ffn_F; no broadcasting.

Zero-based storage indexStored value
01
11
20.7493520600747274
32.2502302519598736

capstone_forward1_block2_NativeArguments

Native=8 × NativeField=2 · float64 · precision 8 · Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing.

Zero-based storage indexStored value
00.25
10.5
20.5289429618505417
30.727284649810885
42
51.4142135623730951
60
71
8-0.7457985987703204
90.474355329054734
100
111
120.25
130.5
140.6741763664896413
150.8210824358672163

capstone_forward1_block2_NativeKinds

Native=8 · int32 · precision 0 · Native kind codes in native occurrence order: sqrt=0, exp=1.

Zero-based storage indexStored value
00
10
20
31
41
51
60
70

capstone_forward1_Readout

B=1 × T=2 × Vocab=5 × ReadoutField=4 · float64 · precision 8 · Actual product0,product1,sum,logit at every position and all five classes.

Zero-based storage indexStored value
01
10
21
31
40
51
61
71
81
91
102
112
12-1
131
140
150
160
170
180
190
200.7493520600747274
210
220.7493520600747274
230.7493520600747274
240
252.2502302519598736
262.2502302519598736
272.2502302519598736
280.7493520600747274
292.2502302519598736
302.999582312034601
312.999582312034601
32-0.7493520600747274
332.2502302519598736
341.5008781918851462
351.5008781918851462
360
370
380
390

capstone_forward1_Logits

B=1 × T=2 × Vocab=5 · float64 · precision 8 · All actual logits, including inactive merge columns; only active last-row logits select.

Zero-based storage indexStored value
01
11
22
30
40
50.7493520600747274
62.2502302519598736
72.999582312034601
81.5008781918851462
90

capstone_forward1_ClassMaxima

B=1 × T=2 · float64 · precision 8 · Actual Math.max over allowed logits; mixed signed zeros prefer +0.

Zero-based storage indexStored value
02
12.999582312034601

capstone_forward1_ClassShifted

B=1 × T=2 × ActiveClass=4 · float64 · precision 8 · Only executed allowed-class exp arguments, in position/ActiveIndices order; no fabricated inactive argument.

Zero-based storage indexStored value
0-1
1-1
20
3-2
4-2.2502302519598736
5-0.7493520600747274
60
7-2.999582312034601

capstone_forward1_ClassTerms

B=1 × T=2 × Vocab=5 · float64 · precision 8 · Actual allowed exp outputs and literal inactive +0 policy terms.

Zero-based storage indexStored value
00.36787944117144233
10.36787944117144233
21
30
40.1353352832366127
50.10537495897754619
60.472672717067233
71
80
90.04980786817076498

capstone_forward1_ClassPartials

B=1 × T=2 × Vocab=5 · float64 · precision 8 · Functional reconstruction of identical ordered +0 term folds, including inactive zero terms; no native recomputation.

Zero-based storage indexStored value
00.36787944117144233
10.7357588823428847
21.7357588823428847
31.7357588823428847
41.8710941655794975
50.10537495897754619
60.5780476760447792
71.5780476760447792
81.5780476760447792
91.6278555442155442

capstone_forward1_ClassDenominators

B=1 × T=2 · float64 · precision 8 · Actual final ordered denominator supplied by stableSoftmax.

Zero-based storage indexStored value
01.8710941655794975
11.6278555442155442

capstone_forward1_Probabilities

B=1 × T=2 × Vocab=5 · float64 · precision 8 · Actual five term/denominator divisions, including inactive exact zero probabilities.

Zero-based storage indexStored value
00.19661193324148185
10.19661193324148185
20.5344466453885229
30
40.07232948812851327
50.0647323771153944
60.29036527150510255
70.6143051228061488
80
90.030597228573354247

capstone_forward1_Selection

SelectionField=4 · float64 · precision 8 · Actual selected class index and public ID are VALUE; selected logit and probability are unchanged WORD copies.

Zero-based storage indexStored value
02
1256
22.999582312034601
30.6143051228061488

capstone_forward1_AfterIds

LogicalToken=3 · int32 · precision 0 · Actual complete logical IDs after this decision, including its unforwarded tail; EOS can occur only at the final tail.

Zero-based storage indexStored value
0256
1256
2256

capstone_LogicalIds

LogicalToken=3 · int32 · precision 0 · Actual prompt plus actual selected IDs, passed once to final real BPE decoding.

Zero-based storage indexStored value
0256
1256
2256

capstone_SelectedIds

Decision=2 · int32 · precision 0 · Actual selected public IDs in generation order, including tail EOS if selected.

Zero-based storage indexStored value
0256
1256

capstone_DecodedBytes

Bytes=6 · int32 · precision 0 · Actual concatenated BPE ID expansions passed to strict UTF-8 decoding, not copied from original text.

Zero-based storage indexStored value
097
198
297
398
497
598

capstone_NativeArguments0

Native=36 × NativeField=2 · float64 · precision 8 · Contiguous global native input/output WORD copies, chunks of at most64 in nativeIds order; no native evaluation while serializing.

Zero-based storage indexStored value
00.25
10.5
22
31.4142135623730951
40
51
60.25
70.5
80.25
90.5
102
111.4142135623730951
120
131
140.25
150.5
16-1
170.36787944117144233
18-1
190.36787944117144233
200
211
22-2
230.1353352832366127
240.25
250.5
260.3125
270.5590169943749475
282
291.4142135623730951
300
311
32-0.28284271247461895
330.7536383164437648
340
351
360.25
370.5
380.3925139619936331
390.6265093470919912
400.25
410.5
420.5289429618505417
430.727284649810885
442
451.4142135623730951
460
471
48-0.7457985987703204
490.474355329054734
500
511
520.25
530.5
540.6741763664896413
550.8210824358672163
56-1
570.36787944117144233
58-1
590.36787944117144233
600
611
62-2
630.1353352832366127
64-2.2502302519598736
650.10537495897754619
66-0.7493520600747274
670.472672717067233
680
691
70-2.999582312034601
710.04980786817076498

capstone_NativeKinds0

Native=36 · int32 · precision 0 · Aligned VALUE native kind codes: sqrt=0, exp=1; global occurrence offset is64 times the chunk index.

Zero-based storage indexStored value
00
10
21
30
40
50
61
70
81
91
101
111
120
130
140
151
161
171
180
190
200
210
220
231
241
251
260
270
281
291
301
311
321
331
341
351

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 the fixed ascending table [97,98,256,257,512], what is EOS 512's zero-based row, and is 257 active with one merge?
2. For prompt ab, corpus abab and exactly one merge, which reversible path is correct (prompt EOS off)?
3. In the explicit two-observed-token [256,256] handcase with positionScale=1/2, what enters block 1 at position 1, what is the full input shape, and what enters block 2?
4. Current WHOLE saved root, independent of trace selection. Raw19: text="ab"; merges=1; outputs=2; positionScale=0.5; q1=1; k1=1; v1=1; o1=0.5; f1=0.5; q2=1; k2=1; v2=1; o2=0.25; f2=0.25; biasA=0; biasB=0; biasAB=0; biasABAB=0; biasEOS=0. Prompt IDs [256]; logical IDs [256, 256, 256]; selected IDs [256, 256]; decoded bytes [97, 98, 97, 98, 97, 98]; decoded text "ababab"; stopReason=budget. Complete saved summary: promptTokens=1; decisions=2; forwardPasses=2; observedTokens=2; logicalTokens=3; decodedBytes=6; decodedUnits=6; eos=0; budgetReached=1; lastTokenId=256; lastClassIndex=2; lastLogit=2.999582312034601; lastProbability=0.6143051228061488; activeClasses=4; blockCount=2; featureWidth=2; hiddenWidth=3; sqrtCalls=16; expCalls=20; nativeElementaryCalls=36; frames=317; tensorCount=257. capstone_forward0_select: candidates position=0; logit0=1; allowed0=1; p0=0.19661193324148185; logit1=1; allowed1=1; p1=0.19661193324148185; logit2=2; allowed2=1; p2=0.5344466453885229; logit3=0; allowed3=0; p3=0; logit4=0; allowed4=1; p4=0.07232948812851327; selected index=2; tokenId=256; logit=2; probability=0.5344466453885229. capstone_forward1_select: candidates position=1; logit0=0.7493520600747274; allowed0=1; p0=0.0647323771153944; logit1=2.2502302519598736; allowed1=1; p1=0.29036527150510255; logit2=2.999582312034601; allowed2=1; p2=0.6143051228061488; logit3=1.5008781918851462; allowed3=0; p3=0; logit4=0; allowed4=1; p4=0.030597228573354247; selected index=2; tokenId=256; logit=2.999582312034601; probability=0.6143051228061488. Which stopping account matches this current whole saved run, regardless of the replay cursor?
5. In the explicit one-merge, one-decision zero-output-gain handcase with logits [1,1,0,2,0] in ascending public-ID order, which account is correct?

Start with the original prompt and the current whole decoded text. There is one text field followed by eighteen numeric controls, in the exact input order explained below. Only merges and outputs require integers; the other sixteen controls accept finite values throughout their intervals. For the simple worksheet, set o1=f1=o2=f2=0. Reset example restores the separate nonzero default. To explore immediate EOS with that handcase, set biasAB=-2 and biasEOS=2.

Use Calculation step, Previous step and Next step to inspect saved operands. The current whole output, both forward graphs and the live stopping question continue to describe the complete saved run. Editing, resetting or seeking clears graded answers; opening a storage disclosure preserves them. Invalid numeric drafts withhold successful views and questions until repaired. Empty, oversized, malformed or unsupported text reports the model’s actual reason. The textarea does not cut input to fit: raw admission and semantic admission are explicit model decisions.

Open the block disclosures for every normalization, causal mask, residual and all three hidden coordinates. The complete tensor and frame fallbacks retain every stored cell and operand; the house inspector retains every output alias and text field. Negative zero is shown as -0, and boolean masks as true or false. Focus a table region to scroll it with the keyboard. These are authored interaction paths; rendering, keyboard, accessibility and installed offline behavior remain unvalidated.

Read the whole chain before calculating

Text is a sequence of Unicode characters. JavaScript stores strings as UTF-16 code units; one visible character need not occupy one unit. UTF-8 is another representation: it encodes Unicode scalar values as bytes, integers from 0 to 255. Here ASCII a becomes byte 97 and b becomes byte 98. A character count, UTF-16 length and UTF-8 byte count are generally different.

A Unicode scalar value is an allowed character code point, excluding surrogate code points used inside UTF-16 pairs. A lone surrogate is malformed input; it must not become a replacement character. A token is a reusable piece of a byte stream. Byte-pair encoding, or BPE, learns ordered pair-merging rules from a disclosed training corpus and applies those rules to the prompt. A token ID names a piece; it is not its length, meaning, or storage address. The vocabulary lists the names and their expansions. An embedding assigns each ID numerical features. A position vector adds where the ID occurs.

A decoder block transforms those features without letting an earlier position use a later one. A logit is a score for a possible next token. Softmax turns allowed scores into probabilities. Greedy selection chooses the allowed ID with the greatest actual logit. Decoding then expands saved IDs into bytes and reconstructs text:

text → UTF-8 → real BPE rules and IDs → embeddings + positions → block 1 → block 2 → all-position logits → active greedy decision → append or stop → byte decoding.

A forward means one complete neural evaluation for all currently observed IDs. Uncached generation recomputes that whole observed prefix when another decision is needed. A KV cache retains previous keys and values to avoid recomputing them. RoPE, rotary position embedding, rotates query/key coordinate pairs. The earlier one-block RoPE cache has different positions, parameters and normalization; its records cannot supply this two-block model’s states.

Actual byte rules and five vocabulary rows

The fixed tokenizer-training corpus is abab, with bytes [97,98,97,98]. With no merges, byte IDs remain separate. The first learned rule is 256 = pair (97,98), expanding to [97,98], or ab. With two merges, the next rule is 257 = pair (256,256), expanding to [97,98,97,98], or abab. Initially pair (97,98) occurs twice and (98,97) once, so the first rule wins by frequency. The resulting corpus [256,256] supplies the second rule. In a frequency tie, numeric pair order decides: smaller left ID first, then smaller right ID. Counting includes overlapping pairs, while replacement scans left to right and consumes disjoint matches. Actual training and rule application still run; these explanations do not replace BPE with a hardcoded answer.

Prompt ab with one merge yields observed IDs [256]. No end marker is appended by the prompt tokenizer. The special EOS, end-of-sequence ID 512, contributes no bytes when generation actually selects it.

A row is a horizontal record. A tensor is an array with named axes; a matrix has two axes. A shape lists axis sizes in order. A feature is one numerical coordinate, and a scalar is one number. The embedding table has shape [5,2]: five vocabulary rows, two feature coordinates each. Public IDs and storage rows differ:

Storage rowPublic IDExpansionEmbeddingActive when
097[97][1,0]Always
198[98][0,1]Always
2256[97,98][1,1]At least one merge
3257[97,98,97,98][-1,1]Two merges
4512No bytes; EOS[0,0]Always

An inactive column still gets its real logit; it cannot be observed or selected. Public ID 512 is storage row 4, not row 512 or row 2.

The supported prompt is nonempty, has at most two actual UTF-8 bytes, contains only a and b, and produces at most two observed IDs. All raw controls must first be admitted. An outer UTF-16 length bound limits work; the real codec still checks surrogates and actual bytes. Valid Unicode can be unsupported: é has valid bytes [195,169] but lies outside this model’s alphabet. A longer byte sequence fails the actual size boundary first. Nothing is normalized, silently truncated, replaced by an unknown token, or repaired.

The complete signed input order is text, merges, outputs, positionScale, q1, k1, v1, o1, f1, q2, k2, v2, o2, f2, biasA, biasB, biasAB, biasABAB, biasEOS. merges is an integer from 0 to 2; outputs is the requested decision budget, an integer 1 or 2. A gain is a bounded multiplier. Position scale lies in [0,1], all ten gains in [-1,1], and all five biases in [-2,2]. A bias is a number added after the weighted products. Even a bias for an inactive ID must be valid. The state is a complete input, not a partial patch filled from defaults.

All eighteen numerical operands must be finite before any numerical-domain decision. After raw admission and the outer UTF-16 bound, strict encoding produces the actual bytes; the actual two-byte bound precedes the alphabet and nonempty checks. Valid raw text such as an empty string need not be a semantically available model prompt. Invalid input must withhold a successful result, never show an older completion as its answer. The raw-state helper checks those raw fields and the outer UTF-16 bound only. The full evaluator then admits actual bytes, alphabet and token IDs; valid raw state need not be a valid model prompt. This guard runs before public frame publication. An invalid preflight leaves the caller’s collector untouched; unknown exceptions retain their identity at the strict model boundary. No HTML length limit substitutes for these guards.

Positions and block inputs

Let TT mean the number of observed tokens, tt their absolute position starting at zero, and pp the position scale, initially 1/21/2. Let EiE_i mean the embedding of public ID ii, PtP_t its position vector, and XtX_t their sum:

Pt=[0,tp],Xt=Ei+Pt.P_t=[0,tp],\qquad X_t=E_i+P_t.

Both vectors have two coordinates, so addition is coordinate by coordinate. ID 256 at position zero gives [1,1]+[0,0]=[1,1]. If a selected 256 becomes observed for a second decision, position one gives [1,1]+[0,1/2]=[1,3/2]. We append the selected ID directly, without retokenizing its decoded string.

A batch groups independent sequences; here it contains just one. The model tensor has axes [Batch,Token,Feature] and shape [1,T,2]: one batch and two features. Any forward observes at most three tokens. Two unchanged IV-59 pre-norm causal blocks run in order. Block 1’s real features feed block 2. There is no new embedding lookup or position addition between blocks.

Each block has q,k,v,o,f: query, key, value, attention-output and feed-forward-output gains. The signed nonzero default uses q=k=v=1 in both blocks, o1=f1=1/2, o2=f2=1/4, position scale 1/2, one merge, two decisions and all five head biases zero. The simpler handcase below changes only the four output gains to zero. Keep these two settings separate. An attention head is one query/key comparison and value-mixture path; this model has one. The output head is the separate feature-to-vocabulary readout after block 2.

QuantityShapeNamed meanings
Embedding table; output readout[5,2]; [2,5]Vocabulary, Feature; Feature, Class
Positions, block inputs/outputs, norms, residuals[1,T,2]Batch, Token, Feature
Query, key; value[1,1,T,2]Batch, Head, Token, QueryKeyFeature or ValueFeature
Scores, mask, attention probabilities[1,1,T,T]Batch, Head, Query, Key
FFN first weights; hidden; second weights[2,3]; [1,T,3]; [3,2]Feature→Hidden; Batch, Token, Hidden; Hidden→Feature
All-position logits and class probabilities[1,T,5]Batch, Token, Class

The saved tensors use the short axis names B,T,D,H,Dk,Dv,Vocab for these same meanings. The actual input is capstone_forward0_Features (then forward1 if another decision exists); block features use the block1 and block2 prefixes. Readout evidence is [1,T,5,4] with fields product0,product1,sum,logit; logits and probabilities are [1,T,5]. Sparse executed head shifts are [1,T,A], where A=3+merges active classes; ActiveIndices maps them to the full five columns. The full logits, terms and probabilities retain inactive columns, whose mask is distinct from the causal query/key mask. Row-feature multiplication uses matching inner dimensions: a length-two row times [2,5] produces five logits. Book II’s column-vector convention uses the transposed readout [5,2] times a [2,1] column. Transposing exchanges axes; it does not reorder tokens.

The work inside each block

Pre-norm means normalization occurs before each attention or FFN branch. Write z\sqrt{z} for the nonnegative square root of zz. Normalization recenters and rescales a row. For coordinates h0,h1h_0,h_1, first define mean mm, centered coordinates cjc_j, variance vv, denominator dd, and normalized coordinates njn_j. The index jj means feature 0 or 1:

m=(h0+h1)/2,cj=hj−m,v=(c02+c12)/2,m=(h_0+h_1)/2,\quad c_j=h_j-m,\quad v=(c_0^2+c_1^2)/2,

d=v+1/4,nj=cj/d.d=\sqrt{v+1/4},\qquad n_j=c_j/d.

The added 1/41/4, called epsilon, keeps the denominator positive for a constant row. These are real-arithmetic teaching formulas; the implementation retains separately rounded operations.

A query provides a comparison vector for the current position, a key provides one for a candidate position, and a value supplies the features to mix. Here they are the normalized row times q, k, and v respectively. A dot product multiplies matching coordinates and adds the two products. Divide each query-key dot product by 2\sqrt{2} to get its scaled score.

A causal mask allows key position kk only when k≤tk\leq t. In a two-row forward, query zero allows only key zero; query one allows both keys. Forbidden scores still belong to score computation, but forbidden probabilities are exactly zero. A fully masked row would be unavailable, never a fabricated uniform distribution. These valid causal rows always allow themselves.

Write exp⁡(z)\exp(z) for the positive exponential function; exp⁡(0)=1\exp(0)=1. Stable softmax subtracts the greatest allowed score before exponentiating, so its exponential arguments are nonpositive. The context sums values weighted by those probabilities. Gain o scales that context. A residual adds the branch result to its input, preserving a direct path for earlier features.

The block normalizes this attention residual, then applies a positionwise feed-forward network, or FFN. Its hidden width is three: two input features become three hidden coordinates before returning to two. ReLU, rectified linear unit, replaces negative values by zero. For normalized [n0,n1], this block’s first map gives [n0,n1,0]; ReLU gives [max(0,n0),max(0,n1),0]. The second map gives [f·max(0,n0),f·max(0,n1)]. Other weights and biases are explicit zeros, whose operations remain part of the calculation. A second residual adds this output to the attention residual.

Zero output gains do not delete normalization, attention, masking, three hidden coordinates or zero products. They make the final branch contribution zero after real work. There is no output softmax inside the FFN, nor a new normalization after block 2. No parameter update or training is performed.

Complete zero-output-gain handcase

Use prompt ab, one merge, two decisions, scale 1/2, both query/key/value triples 1, all biases zero, and o1=f1=o2=f2=0. First observe [256] with positioned row [1,1].

Block 1 has mean 1, centered row [0,0], variance 0, denominator 1/21/2, and normalized row [0,0]. Query, key and value are zero; the sole allowed scaled score is zero, with softmax [1], giving context [0,0]. The attention residual remains [1,1]. Its second normalization is zero, all three hidden coordinates are zero, the FFN output is zero and the final residual is [1,1]. Block 2 repeats this actual work and returns [1,1].

The readout maps two final features to five logits. Let x,yx,y be the final coordinates and bA,bB,bAB,bABAB,bEOSb_A,b_B,b_{AB},b_{ABAB},b_{EOS} the five biases in ascending public-ID order. Every class uses two products, their direct sum, then the bias. The readout matrix has shape [2,5] with rows [1,0,1,-1,0] and [0,1,1,1,0]. In real arithmetic the logits are

[x+bA, y+bB, x+y+bAB, −x+y+bABAB, 0+bEOS].[x+b_A,\ y+b_B,\ x+y+b_{AB},\ -x+y+b_{ABAB},\ 0+b_{EOS}].

At [1,1], the five explicit product/sum/bias calculations are 1·1+1·0+0=1, 1·0+1·1+0=1, 1·1+1·1+0=2, 1·(-1)+1·1+0=0, and 1·0+1·0+0=0. All five logits are [1,1,2,0,0]. Active IDs are [97,98,256,512]; 257 is inactive. Let e1=exp⁡(−1)e_1=\exp(-1) and e2=exp⁡(−2)e_2=\exp(-2) denote exact-real numbers. The active maximum is 2; full-column probability terms are [e1,e1,1,0,e2]. With real sum Z=2e1+1+e2Z=2e_1+1+e_2, the probabilities are [e1/Z,e1/Z,1/Z,0,e2/Z].

A native function is the implementation’s built-in mathematical primitive, such as exponential or square root. The machine denominator instead starts at positive zero and adds all five terms in order. Native exp(-1), exp(-1), exp(0) and exp(-2) are separate calls. The denominator partials are successively 0, e1, e1+e1, (e1+e1)+1, ((e1+e1)+1)+0, and (((e1+e1)+1)+0)+e2, with separate rounding in the machine. The inactive column has no exponential or shifted-argument occurrence. Although exact-real exp⁡(−2)=exp⁡(−1)2\exp(-2)=\exp(-1)^2, the product of two rounded native exp(-1) outputs need not equal the separately rounded native exp(-2) output. A machine multiplication cannot replace that actual exp(-2) occurrence.

Greedy selection uses actual active logits, so 256 uniquely wins. Append that ID to observed IDs [256,256] because another decision remains. Do not decode and retokenize abab: that could change the token history.

The second forward has rows [1,1] and [1,3/2]. The second row’s mean is 5/45/4, centered row [-1/4,1/4], variance 1/161/16 and denominator 5/4\sqrt{5}/4. Define a=1/5a=1/\sqrt{5}; its normalized row is [-a,a], while row zero normalizes to zero. Query one’s scaled scores are 0 and 2/(52)2/(5\sqrt{2}). Define w=1/(1+exp⁡(−2/(52)))w=1/(1+\exp(-2/(5\sqrt{2}))), its self-attention weight. The last probability row is [1-w,w], so its context is (1-w)·[0,0]+w·[-a,a]=[-wa,wa]. The first row has mask [true,false], probabilities [1,0], and context [0,0]; its forbidden-key zero products still occur. The zero attention-output gain leaves [1,3/2] unchanged. Its FFN hidden row is [0,a,0], and zero FFN gain leaves the residual unchanged. Block 2 computes the same branches and returns the same two rows.

The last row’s five logits are [1,3/2,5/2,1/2,0]. Its active maximum is 5/25/2. Define r3=exp⁡(−3/2)r_3=\exp(-3/2), r1=exp⁡(−1)r_1=\exp(-1) and r5=exp⁡(−5/2)r_5=\exp(-5/2). Its full probability terms are [r3,r1,1,0,r5]; divide each by their ordered sum. ID 256 wins uniquely. The earlier row’s full head is computed too, but only the last row drives selection.

The second decision exhausts the budget. Logical IDs [256,256,256] expand through the actual rule to [97,98,97,98,97,98]; strict UTF-8 decoding gives ababab. Two forwards observed lengths one and two. In the larger admitted case, an initial length two can grow to length three for a second forward, with up to four final logical IDs and at most ten decoded bytes. The requested number counts decisions, not characters or additional forwards. The final selected ID has not been forwarded. There is no third-row neural state or cache entry for it.

The zero-output handcase’s residual features and head logits above are exact dyadic numbers, meaning fractions with power-of-two denominators. Its nontrivial normalized coordinates and attention probabilities are expressed over exact reals, not asserted machine words. Native admission still applies even when zero output gains prevent those branches from changing the residuals.

Nonzero default: follow both real feature handoffs

Restore o1=f1=1/2, o2=f2=1/4. Other defaults remain unchanged. The first forward still contains only constant [1,1], so normalized branches remain zero and the manual first selection is still 256.

For the second forward, use a,wa,w from above and define r=war=wa, the last attention-context magnitude. Let d=1/4+r/2d=1/4+r/2 be half the coordinate gap after the first attention residual, and s=d/d2+1/4s=d/\sqrt{d^2+1/4} its normalized positive coordinate. Block 1’s last attention residual is [1-r/2,3/2+r/2]; its FFN hidden row is [0,s,0]. Adding [0,s/2] gives the actual feature handoff

[1−r/2, 3/2+r/2+s/2].[1-r/2,\ 3/2+r/2+s/2].

For block 2 define d1=1/4+r/2+s/4d_1=1/4+r/2+s/4, half that row’s gap, and b=d1/d12+1/4b=d_1/\sqrt{d_1^2+1/4}, its normalized positive coordinate. Define w2=1/(1+exp⁡(−2b2/2))w_2=1/(1+\exp(-2b^2/\sqrt{2})) as self-attention weight and u=w2bu=w_2b as context magnitude. Attention context [-u,u] is scaled by 1/41/4. Let d2=d1+u/4d_2=d_1+u/4 and c=d2/d22+1/4c=d_2/\sqrt{d_2^2+1/4}. The final hidden row is [0,c,0], adding [0,c/4]. Final features are

x=1−r/2−u/4,y=3/2+r/2+s/2+u/4+c/4.x=1-r/2-u/4,\qquad y=3/2+r/2+s/2+u/4+c/4.

The earlier row stays [1,1] by causality. In exact real arithmetic, r,u,s,cr,u,s,c lie strictly between 0 and 1, so x>1/4x>1/4 and y>3/2y>3/2. Thus active logit x+yx+y beats x,y,0x,y,0. The intended second choice is again 256, expanding to the same ababab.

These fully defined symbolic equations are a real-valued derivation, not sampled decimal outputs or a binary64 margin proof. Binary64 is the finite floating-point format of the implementation. A floating-point word is the stored bit pattern, including the sign of zero. Write RN for rounding one exact primitive result to the nearest binary64 number, choosing the even neighbor at a tie. Each elementary operation rounds separately; native square root and exponential outputs need independent admission before subsequent arithmetic can be checked. Algebra explains the mechanism but cannot certify a machine record by itself. Under the signed authority policy, each saved native occurrence binds its kind and input before its output is admitted. Positive square-root inputs stay in [1/4,4096]; exponential inputs in [-256,0]. The policy allows at most four ordered binary64 word steps from an independently isolated reference, with exp(±0)=+1 exact. This is an admission policy, not a measured error. After admitting those leaves, primitive arithmetic and copies permit no word discrepancy; integer IDs/counts and boolean masks require exact values. TypeScript and canonical Python each require admission of their own actual native leaves, not an assumption that their native libraries return identical words.

Edits that test the explanation

Use the zero-output-gain handcase with one decision and one merge. Set biasAB=-2, biasEOS=2, other biases zero. Logits become [1,1,0,0,2]; active EOS wins. Final IDs [256,512] strip the unique EOS tail and decode to ab. EOS is never embedded or forwarded, even with unused budget.

Now set biasAB=-2, biasABAB=2, biasEOS=0. Logits are [1,1,0,2,0], but 257 is inactive with one merge. Active IDs 97 and 98 tie at 1; a strict-greater scan in ascending public-ID order keeps 97. Final [256,97] decodes to aba. Display rounding or a rounded probability cannot decide this logit tie.

Keep those biases but permit two merges. Now 257 is active and uniquely wins. Prompt IDs remain [256]; final [256,257] decodes to ababab after one decision. The text matches the two-decision worksheet, but IDs, rules, work and stop history differ. Final text alone cannot establish that two computations agree.

Prior lessons and limits

IV-59 — Decoder-Only Transformer Anatomy supplies both real decoder blocks. IV-60 — Encoder, Decoder and Cross-Attention Variants compares attention origins: cross-attention takes queries from one stream and keys/values from another, with potentially unequal lengths. IV-61 — Multi-Query and Grouped-Query Attention shares keys and values across groups of query heads; it changes head organization and logical storage. IV-62 — Mixture-of-Experts Routing routes tokens to admitted expert FFNs and discloses capacity drops. This capstone instead uses one ordinary attention head and one dense width-three FFN per block.

IV-63 — Quantization and Numerical Approximation reconstructs approximate weights from integer codes; no such quantization is inserted here. IV-64 — Inference Systems: Throughput and Latency separates analytical work/storage from separately requested local timing. There is no timing action or speed claim in this capstone. IV-65 — Evaluating LLMs, Leakage and Reliability separates a disclosed rubric from reliability evidence. Our chosen string establishes neither accuracy on language tasks nor safety or generalization. These are architectural and evidential contrasts, not extra branches computed inside this run.

IV-37–39 explain reversible bytes and BPE, IV-16–18 embeddings, IV-30–36 blocks and positions, IV-40–47 the next-token objective and generation, and IV-48–50 cache validity. Book II’s II.4 — Dot product, angle, and orthogonality, II.9 — Matrix × vector and II.10 — Matrix × matrix as composition explain dot products and matrix composition; VII.6 — Logits and softmax explains logits and softmax; VIII.1 — Floating-point representation and VIII.2 — Rounding and representation error explain stored numbers and rounding. Book III’s III-04 — Training, Validation, Testing and Generalization explains training and generalization, III-16 — Multiclass Classification and Softmax Regression connects class scores with probabilities, III-41 — Composition and Learned Representations explains composing representations, and III-39 — Reproducibility and Numerical Reliability connects reproducibility with numerical evidence. These use the existing source-mapped link component.

A saved computation must preserve real bytes/rules/IDs, positions, both feature handoffs, all-position logits, masks, native occurrences, probabilities, decisions, stopping and final byte reconstruction. Copying a record preserves its numerical words, including signed zero, rather than recomputing native functions for display. A replay cursor selects a saved step; it does not change the current whole saved run or turn an earlier frame into the final answer.

The real tokenizer calculation is prepared once per generation request, with corpus abab, the original text, the requested merge count and prompt EOS off. Each later neural forward reuses those actual rules and appended IDs; it does not invoke the tokenizer again. Final generated decoding expands the complete logical ID list once. The signed strict tokenizer entry preserves unexpected errors instead of turning them into a convincing completion. Only recognized input faults may become an unavailable result; an unknown exception is not a valid model answer.

The frame bound is a recording limit, not a speed measurement. Every actual frame must survive. The signed corrected conservative composition budget is 454+35+14+2+2+3=510, below the unchanged 512-frame cap, leaving only two spare frames. The 35-frame tokenizer maximum includes two-byte unmerged targets such as aa, ba, or bb with two merges; the ab examples retain 27 frames with one merge and 32 with two. The signed actual-source inventory reconciles this bound as 5+F+sum(2T²+82T+10)+N+B: five wrapper frames, F real tokenizer frames, each complete forward, N final logical IDs including a possible EOS strip, and B decoded bytes. At the conservative maximum this is 5+35+182+274+4+10=510; the 512-frame cap leaves two spare frames. No frame is omitted or truncated. These are manual construction bounds; actual saved records must also satisfy them.

The complete native ledger has at most 67 occurrences: 24 square roots and 43 exponentials. Global native tensors split them into chunks of 64+3; the first argument/result tensor has shape [64,2] (128 cells), the second [3,2]. Kind-code tensors are [64] and [3], aligned with the same occurrence IDs. A dimension of 67 would exceed the unchanged 64-axis bound. Repeated inputs stay separate occurrences, and block-local copies survive too. The default manual inventory is 36 natives (16 square roots, 20 exponentials), fitting one [36,2] argument/result tensor. Neither these counts nor the ledger establishes physical instruction counts, timing or native admission.

Read the six complete canonical source files

The panels below import the whole actual files, in dependency order. They preserve executable source, including its guards and explicit checks, rather than replacing it with a teaching snippet. The browser lab uses the TypeScript model; displaying Python does not execute Python in the browser.

1. Strict byte and Unicode mechanisms — code/python/p09/token_reference.py

Follow the manual UTF-8 encoder/decoder and the integer storage records. UTF-16 offsets, scalar values and bytes stay distinct. Its original NumericalFault belongs to the codec, separately from the decoder support class.

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.

"""Part IX: bounded integer tokenization, authored without execution.

NumPy int32 arrays store actual code points, offsets, bytes and IDs. Arithmetic
uses Python integers, so bit shifts never depend on NumPy scalar promotion.
UTF-8 is implemented below; no native codec supplies an encoded/decoded answer.
Empty streams, BOMs, noncharacters, spaces and NULs are ordinary valid data.
"""
import argparse
from functools import wraps
import json
import math
import sys
from types import MappingProxyType
import numpy as np

EOS = 512
BYTE_BOUND = 32
CHARACTER_BASE = 1024
IV37_DEFAULTS = MappingProxyType(dict(text="Aé🦊", eos=0))
IV38_DEFAULTS = MappingProxyType(dict(text="lower low", vocabLimit=8, eos=0))
# Fixed active-prefix dictionary: these pieces are authored, not trained.
SUBWORDS = (
    (384, "low", (108, 111, 119)),
    (385, "lower", (108, 111, 119, 101, 114)),
    (386, "lowest", (108, 111, 119, 101, 115, 116)),
    (387, "er", (101, 114)),
    (388, "est", (101, 115, 116)),
    (389, "ing", (105, 110, 103)),
    (390, "a", (97,)),
    (391, "ab", (97, 98)),
)


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


def guarded(derive):
    @wraps(derive)
    def call(state):
        try:
            return derive(state)
        except NumericalFault as error:
            return dict(status="unavailable", code=error.code, reason=str(error))
    return call


def integer(value, low, high, label):
    """Validate before conversion; Python bool is not a mathematical number here."""
    if isinstance(value, (bool, np.bool_)) or not isinstance(value, (int, float, np.integer, np.floating)):
        raise NumericalFault("NONFINITE", f"{label} must be an actual finite number.")
    try:
        finite = math.isfinite(value)
    except OverflowError:
        finite = False
    if not finite:
        raise NumericalFault("NONFINITE", f"{label} must be an actual finite number.")
    if value < low or value > high or int(value) != value:
        raise NumericalFault("INVALID_INPUT", f"{label} must be an integer from {low} to {high}.")
    return int(value)


def scalar_valid(cp):
    return 0 <= cp <= 0x10FFFF and not 0xD800 <= cp <= 0xDFFF


def utf16_units(cp):
    """Reconstruct the actual high/low units from a validated supplementary scalar."""
    if cp <= 0xFFFF:
        return [cp]
    return [0xD800 + ((cp - 0x10000) >> 10), 0xDC00 + ((cp - 0x10000) & 1023)]


def utf16_length(text):
    return sum(2 if ord(character) > 0xFFFF else 1 for character in text)


def text_state(state, chapter):
    """Exact raw fields and numeric domains precede ALL Unicode/size semantics."""
    if type(chapter) is not int or chapter not in (37, 38):
        raise NumericalFault("INVALID_INPUT", "Use token chapter 37 or 38.")
    defaults = IV37_DEFAULTS if chapter == 37 else IV38_DEFAULTS
    if type(state) not in (dict, MappingProxyType):
        raise NumericalFault("INVALID_INPUT", "Provide a plain object with exactly the named fields.")
    if set(state) != set(defaults):
        raise NumericalFault("INVALID_INPUT", "Provide every own field and no extra or symbol fields.")
    if type(state["text"]) is not str:
        raise NumericalFault("INVALID_INPUT", "text must be an actual string, without coercion.")
    result = dict(text=state["text"])
    for key in defaults:
        if key != "text":
            if type(state[key]) not in (int, float):
                raise NumericalFault("NONFINITE", f"{key} must be an actual finite number.")
            result[key] = integer(state[key], 0, 8 if key == "vocabLimit" else 1, key)
    return result


def int_array(values, low=0, high=0x7FFFFFFF, label="integer array", limit=BYTE_BOUND):
    """Check dense numeric storage BEFORE narrowing; integral-valued floats are legal."""
    if type(values) is np.ndarray:
        if values.ndim != 1 or values.dtype.kind not in "iuf":
            raise NumericalFault("INVALID_INPUT", f"{label} must be a dense one-dimensional numeric array.")
    elif type(values) not in (list, tuple):
        raise NumericalFault("INVALID_INPUT", f"{label} must be an actual array.")
    if len(values) > limit:
        raise NumericalFault("UNSUPPORTED_SIZE", f"{label} exceeds {limit} entries.")
    checked = []
    for index, value in enumerate(values):
        if isinstance(value, (bool, np.bool_)) or not isinstance(value, (int, float, np.integer, np.floating)):
            raise NumericalFault("INVALID_INPUT", f"{label}[{index}] must be an own integer from {low} to {high}.")
        try:
            finite = math.isfinite(value)
        except OverflowError:
            finite = False
        if not finite or value < low or value > high or int(value) != value:
            raise NumericalFault("INVALID_INPUT", f"{label}[{index}] must be an own integer from {low} to {high}.")
        checked.append(int(value))
    return np.array(checked, dtype=np.int32)


def utf8_encode(text, prefix="source", trace=None):
    """Scan valid scalars first; then split each into explicit UTF-8 payload groups."""
    if trace is None:
        trace = TokenTrace()
    if type(text) is not str:
        raise NumericalFault("INVALID_INPUT", "UTF-8 input must be an actual string.")
    if utf16_length(text) > BYTE_BOUND:
        raise NumericalFault("UNSUPPORTED_SIZE", "More than 32 UTF-16 units necessarily exceeds this 32-byte lab.")
    code_points, offsets, widths = [], [], []
    offset = 0
    # Python strings store scalars directly; explicit surrogate values are invalid.
    for character in text:
        cp = ord(character)
        if 0xD800 <= cp <= 0xDBFF:
            raise NumericalFault("INVALID_INPUT", f"Unpaired high surrogate at UTF-16 offset {offset}.")
        if 0xDC00 <= cp <= 0xDFFF:
            raise NumericalFault("INVALID_INPUT", f"Unpaired low surrogate at UTF-16 offset {offset}.")
        width = len(utf16_units(cp))
        code_points.append(cp)
        offsets.append(offset)
        widths.append(width)
        offset += width
    byte_values, byte_offsets, byte_widths = [], [], []
    for index, cp in enumerate(code_points):
        if cp <= 0x7F:
            expansion = [cp]
        elif cp <= 0x7FF:
            expansion = [0xC0 | (cp >> 6), 0x80 | (cp & 63)]
        elif cp <= 0xFFFF:
            expansion = [0xE0 | (cp >> 12), 0x80 | ((cp >> 6) & 63), 0x80 | (cp & 63)]
        else:
            expansion = [0xF0 | (cp >> 18), 0x80 | ((cp >> 12) & 63),
                         0x80 | ((cp >> 6) & 63), 0x80 | (cp & 63)]
        units = utf16_units(cp)
        inputs = dict(scalarIndex=index, utf16Offset=offsets[index], utf16Width=widths[index], codePoint=cp, unit0=units[0])
        if len(units) == 2:
            inputs["unit1"] = units[1]
        outputs = dict(byteOffset=len(byte_values), byteWidth=len(expansion))
        for j, byte in enumerate(expansion):
            mask = (31 if len(expansion) == 2 else 15 if len(expansion) == 3 else 7) if j == 0 else 63
            outputs[f"payload{j}"] = byte if len(expansion) == 1 else byte & mask
        outputs.update({f"byte{j}": byte for j, byte in enumerate(expansion)})
        trace.add(f"{prefix}_scalar_{index}", f"Encode scalar {index}: U+{cp:04X}",
                  "supplementary cp=(high−55296)*1024+(low−56320)+65536; split cp into payload groups; add UTF-8 prefix bits",
                  "A continuation byte has prefix 10 and six payload bits (base 64). Lead prefixes are 0, 110, 1110 or 11110. UTF-16 offsets count storage units, not perceived characters. No normalization or BOM stripping occurs.",
                  inputs, outputs)
        byte_offsets.append(len(byte_values))
        byte_widths.append(len(expansion))
        byte_values.extend(expansion)
    if len(byte_values) > BYTE_BOUND:
        raise NumericalFault("UNSUPPORTED_SIZE", "The actual UTF-8 encoding exceeds 32 bytes; shorten the input explicitly.")
    return dict(bytes=int_array(byte_values, high=255, label="UTF-8 bytes"), codePoints=int_array(code_points),
                offsets=int_array(offsets), widths=int_array(widths), byteOffsets=int_array(byte_offsets), byteWidths=int_array(byte_widths))


def utf8_decode(values, prefix="utf8", trace=None):
    """Remove prefixes, accumulate radix-64 digits, validate, then rebuild the text."""
    if trace is None:
        trace = TokenTrace()
    values = int_array(values, high=255, label="UTF-8 bytes")
    characters, offset = [], 0
    while offset < len(values):
        lead = int(values[offset])
        width = 1 if lead <= 0x7F else 2 if 0xC2 <= lead <= 0xDF else 3 if 0xE0 <= lead <= 0xEF else 4 if 0xF0 <= lead <= 0xF4 else 0
        if not width:
            raise NumericalFault("INVALID_INPUT", f"Invalid UTF-8 lead at byte {offset}.")
        if offset + width > len(values):
            raise NumericalFault("INVALID_INPUT", f"Truncated UTF-8 sequence at byte {offset}.")
        inputs = dict(scalarIndex=len(characters), byteOffset=offset, byteWidth=width)
        outputs, cp = {}, 0
        for j in range(width):
            byte = int(values[offset + j])
            if j > 0 and not 0x80 <= byte <= 0xBF:
                raise NumericalFault("INVALID_INPUT", f"Invalid continuation byte at {offset + j}.")
            inputs[f"byte{j}"] = byte
            mask = (31 if width == 2 else 15 if width == 3 else 7) if j == 0 else 63
            payload = byte if width == 1 else byte & mask
            outputs[f"payload{j}"] = payload
            cp = cp * 64 + payload
            outputs[f"accumulator{j}"] = cp
        minimum = 0 if width == 1 else 0x80 if width == 2 else 0x800 if width == 3 else 0x10000
        if cp < minimum or not scalar_valid(cp):
            raise NumericalFault("INVALID_INPUT", f"Overlong, surrogate or out-of-range scalar at byte {offset}.")
        units = utf16_units(cp)
        outputs.update(codePoint=cp, utf16Width=len(units))
        outputs.update({f"unit{j}": unit for j, unit in enumerate(units)})
        # chr uses the validated scalar; no source text is available to copy here.
        characters.append(chr(cp))
        trace.add(f"{prefix}_decode_{len(characters) - 1}", f"Decode UTF-8 scalar {len(characters) - 1}",
                  "accumulator=previous*64+payload; reconstruct UTF-16 units from the validated scalar",
                  "Remove lead/continuation prefixes, combine payloads in byte order, reject non-shortest encodings and invalid scalars, then append actual reconstructed units. U+FEFF and noncharacters are preserved.",
                  inputs, outputs)
        offset += width
    return "".join(characters)


def _flag(eos):
    if type(eos) not in (int, float) or eos not in (0, 1):
        raise NumericalFault("INVALID_INPUT", "eos must be numeric 0 or 1.")


def _vocabulary(limit):
    try:
        if type(limit) not in (int, float):
            raise NumericalFault("INVALID_INPUT", "vocabLimit must be an integer from 0 to 8.")
        return integer(limit, 0, 8, "vocabLimit")
    except NumericalFault as error:
        raise NumericalFault("INVALID_INPUT", "vocabLimit must be an integer from 0 to 8.") from error


def _strip_eos(ids, eos):
    _flag(eos)
    ids = int_array(ids, high=CHARACTER_BASE + 0x10FFFF, label="Token IDs", limit=BYTE_BOUND + 1)
    has_tail = len(ids) > 0 and int(ids[-1]) == EOS
    content = ids[:-1].copy() if has_tail else ids.copy()
    if has_tail != (eos == 1) or any(int(value) == EOS for value in content):
        raise NumericalFault("INVALID_INPUT", "EOS must occur exactly once at the tail when eos=1, and nowhere when eos=0.")
    return ids, content


def append_eos(ids, eos, prefix, trace):
    """Return actual int32 storage with the optional reserved tail, never text matching."""
    _flag(eos)
    if eos == 1:
        index = len(ids)
        ids = np.concatenate((ids, np.array([EOS], dtype=np.int32)))
        trace.add(f"{prefix}_eos", f"{prefix}: append explicit EOS", "id=512",
                  "Only this flag appends EOS; literal text such as <eos> remains ordinary input.",
                  dict(index=index, eos=eos), dict(id=EOS))
    return ids


def _eos_record(ids, eos, prefix, trace):
    if eos == 1:
        trace.add(f"{prefix}_strip_eos", f"{prefix}: strip explicit tail EOS", "EOS emits no text bytes",
                  "The decoder has validated the whole ID stream and the required unique tail marker.",
                  dict(index=len(ids) - 1, id=EOS), dict(stripped=1))


def decode_byte_ids(ids, eos, prefix="byte", trace=None):
    return _decode_pieces(ids, eos, 0, False, prefix, TokenTrace() if trace is None else trace)


def decode_subword_ids(ids, eos, limit, prefix="subword", trace=None):
    limit = _vocabulary(limit)
    return _decode_pieces(ids, eos, limit, True, prefix, TokenTrace() if trace is None else trace)


def _decode_pieces(ids, eos, limit, subwords, prefix, trace):
    ids, content = _strip_eos(ids, eos)
    active = {identifier: expansion for identifier, _, expansion in SUBWORDS[:limit]} if subwords else {}
    byte_values = []
    for index, stored in enumerate(content):
        identifier = int(stored)
        if identifier <= 255:
            expansion = (identifier,)
        elif identifier in active:
            expansion = active[identifier]
        else:
            raise NumericalFault("INVALID_INPUT", f"Unknown or inactive {prefix} ID {identifier}.")
        byte_offset = len(byte_values)
        byte_values.extend(expansion)
        if len(byte_values) > BYTE_BOUND:
            raise NumericalFault("UNSUPPORTED_SIZE", "Decoded token expansions exceed 32 bytes.")
        outputs = dict(byteOffset=byte_offset, byteWidth=len(expansion))
        outputs.update({f"byte{j}": byte for j, byte in enumerate(expansion)})
        trace.add(f"{prefix}_expand_{index}", f"{prefix}: expand ID at token {index}", "ID → declared byte expansion",
                  "Fallback byte IDs equal their byte value; active subword IDs expand to their full declared bytes. A single fallback byte may be only part of a Unicode scalar.",
                  dict(index=index, id=identifier), outputs)
    _eos_record(ids, eos, prefix, trace)
    values = int_array(byte_values, high=255, label="UTF-8 bytes")
    return dict(bytes=values, decoded=utf8_decode(values, prefix, trace))


def decode_character_ids(ids, eos, prefix="char", trace=None):
    if trace is None:
        trace = TokenTrace()
    ids, content = _strip_eos(ids, eos)
    characters = []
    for index, stored in enumerate(content):
        identifier = int(stored)
        cp = identifier - CHARACTER_BASE
        if not scalar_valid(cp):
            raise NumericalFault("INVALID_INPUT", f"Character ID {identifier} does not name a Unicode scalar.")
        units = utf16_units(cp)
        outputs = dict(codePoint=cp, utf16Width=len(units))
        outputs.update({f"unit{j}": unit for j, unit in enumerate(units)})
        characters.append(chr(cp))
        trace.add(f"{prefix}_inverse_{index}", f"Character ID {index}: inverse mapping",
                  "codePoint=id−1024; reconstruct UTF-16 units",
                  "The scalar range excludes surrogate code points but includes noncharacters. The comparison vocabulary is algorithmic; no million-row matrix is allocated.",
                  dict(index=index, id=identifier), outputs)
    _eos_record(ids, eos, prefix, trace)
    decoded = "".join(characters)
    # External ID streams obey the same text bound; this private trace is omitted.
    utf8_encode(decoded)
    return decoded


def greedy_ids(values, limit, trace):
    """Choose longest matching byte expansion, then lowest ID; no match keeps a byte."""
    values = int_array(values, high=255, label="Greedy source bytes")
    limit = _vocabulary(limit)
    ids, offset = [], 0
    while offset < len(values):
        matches = []
        for identifier, _, expansion in SUBWORDS[:limit]:
            if offset + len(expansion) <= len(values) and all(int(values[offset + j]) == byte for j, byte in enumerate(expansion)):
                matches.append((identifier, len(expansion)))
        chosen, width = int(values[offset]), 1
        if matches:
            chosen, width = min(matches, key=lambda candidate: (-candidate[1], candidate[0]))
        inputs = dict(byteOffset=offset, remaining=len(values) - offset, candidateMatches=len(matches))
        for index, (identifier, match_width) in enumerate(matches):
            inputs[f"candidate{index}ID"] = identifier
            inputs[f"candidate{index}Width"] = match_width
        trace.add(f"subword_decision_{len(ids)}", f"Choose subword at byte offset {offset}",
                  "choose longest matching active byte expansion; tie: lowest subword ID; no match: current byte",
                  "Matched candidates are listed in fixed vocabulary order. An active one-byte entry is preferred to fallback when it matches. Advance by the actual chosen byte width; spaces and unmatched Unicode bytes remain in the stream.",
                  inputs, dict(id=chosen, byteWidth=width, nextByteOffset=offset + width))
        ids.append(chosen)
        offset += width
    return int_array(ids)


def json_text(value):
    """Match JSON string/array metadata without ASCII escaping or added spaces."""
    return json.dumps(value, ensure_ascii=False, allow_nan=False, separators=(",", ":"))


def byte_labels(ids):
    return ["EOS (explicit control)" if int(value) == EOS else f"byte {int(value)}" for value in ids]


def byte_expansions(ids):
    return [json_text([] if int(value) == EOS else [int(value)]) for value in ids]


def numbers(values):
    return {key: integer(value, -0x80000000, 0x7FFFFFFF, key) for key, value in values.items()}


class TokenTrace:
    def __init__(self):
        self.steps = []

    def add(self, identifier, label, equation, explanation, inputs, outputs):
        inputs, outputs = numbers(inputs), numbers(outputs)
        if len(self.steps) >= 512:
            raise NumericalFault("UNSUPPORTED_SIZE", "At most 512 operations are supported.")
        self.steps.append(dict(id=identifier, label=label, equation=equation, explanation=explanation,
                               inputs=inputs, outputs=outputs))

    def result(self, summary, tensors, texts):
        # Include copied encoding steps too, after the signed first summary aliases.
        outputs = numbers(summary)
        for step in self.steps:
            outputs.update({f"{step['id']}_{key}": value for key, value in step["outputs"].items()})
        return dict(status="defined", outputs=outputs, steps=self.steps, tensors=tensors, texts=texts)


def tensor(identifier, axis, values, provenance):
    """Serialize actual nonempty int32 storage; empty streams yield no fake tensor."""
    if type(values) is not np.ndarray or values.dtype != np.dtype(np.int32) or values.ndim != 1:
        raise NumericalFault("SHAPE_MISMATCH", f"{identifier}: require one-dimensional int32 storage.")
    if not 1 <= len(values) <= 64:
        raise NumericalFault("UNSUPPORTED_SIZE", f"{identifier}: dimensions must be 1–64.")
    if type(axis) is not str or not axis:
        raise NumericalFault("SHAPE_MISMATCH", f"{identifier}: name the axis.")
    return dict(id=identifier, shape=[len(values)], axes=[axis], dtype="int32", values=values.tolist(),
                provenance=provenance, precision=0)


_JSON_INT = int


def run(derive, defaults):
    """No args: defaults; one JSON arg: full replacement; '-': JSON from stdin."""
    class ParseFault(ValueError):
        """Only locally owned JSON profile/conversion faults."""

    def _members(pairs):
        value = {}
        for key, member in pairs:
            if key in value:
                raise ParseFault("Duplicate JSON object members are not allowed.")
            value[key] = member
        return value

    def _constant(token):
        raise ParseFault(f"Nonstandard JSON constant {token} is not allowed.")

    def _integer(token):
        if token == "-0":
            return -0.0
        try:
            return _JSON_INT(token)
        except ValueError as fault:
            if type(fault) is not ValueError:
                raise
            raise ParseFault("JSON integer exceeds the interpreter's conversion capacity.") from fault

    parser = argparse.ArgumentParser(description=derive.__doc__)
    parser.add_argument("state", nargs="?")
    args = parser.parse_args()
    if args.state is not None:
        source = sys.stdin.read() if args.state == "-" else args.state
        try:
            state = json.loads(source, object_pairs_hook=_members,
                               parse_constant=_constant, parse_int=_integer)
        except (json.JSONDecodeError, ParseFault) as error:
            result = dict(status="unavailable", code="INVALID_INPUT", reason=str(error))
        else:
            result = derive(state)
    else:
        result = derive(dict(defaults))
    print(json.dumps(result, allow_nan=False, separators=(",", ":")))

2. Real pair counts, ranked merges and expansion — code/python/p09/bpe_reference.py

This file reaches the adjacent token reference and supplies actual training, replacement, encoding and concatenated-byte decoding. Counting overlaps differs from replacing disjoint matches. There is no generated-string lookup.

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.

"""IV-39: complete learned byte-pair encoding, authored without execution.

NumPy int32 arrays hold actual bytes, code points, offsets, IDs and rule
expansions. Python integers do scalar comparisons, counts and index arithmetic.
The unchanged token_reference.py supplies the manual UTF-8 codec and record
storage. No native codec supplies a production answer. A byte piece need not
be valid Unicode alone: concatenate all expansions before strict decoding.
"""
import importlib.util
from pathlib import Path
from types import MappingProxyType
import numpy as np

# File-relative loading works even when the caller has an unrelated cwd.
_token_spec = importlib.util.spec_from_file_location(
    "_p09_bpe_token_reference", Path(__file__).resolve().with_name("token_reference.py"))
_token = importlib.util.module_from_spec(_token_spec)
_token_spec.loader.exec_module(_token)

NumericalFault = _token.NumericalFault
BPE_BYTE_BOUND = 24
BYTE_BOUND = BPE_BYTE_BOUND
MERGE_BASE = 256
MERGE_BOUND = 4
EOS = 512
DEFAULT_IV39 = MappingProxyType(dict(corpus="abab", text="ababab", merges=2, eos=0))


def data_object(value, fields, label):
    """Exact built-in mappings have own data entries, never property getters."""
    if type(value) not in (dict, MappingProxyType):
        raise NumericalFault("INVALID_INPUT", f"{label} must be a plain object.")
    if any(type(key) is not str for key in value) or set(value) != set(fields):
        raise NumericalFault("INVALID_INPUT", f"{label} must have exactly {', '.join(fields)} as own fields.")


def dense_data(values, limit, label, numeric=True):
    """Reject custom indexing BEFORE reading entries; never narrow invalid data."""
    if type(values) is np.ndarray and numeric:
        if values.ndim != 1 or values.dtype.kind not in "iuf":
            raise NumericalFault("INVALID_INPUT", f"{label} must be a dense one-dimensional numeric array.")
    elif type(values) not in (list, tuple):
        raise NumericalFault("INVALID_INPUT", f"{label} must be an actual array.")
    if len(values) > limit:
        raise NumericalFault("UNSUPPORTED_SIZE", f"{label} exceeds {limit} entries.")


def budget(merges):
    if type(merges) not in (int, float):
        raise NumericalFault("NONFINITE", "merges must be an actual finite number.")
    # The reused integer validator catches finiteness OverflowError on huge ints.
    return _token.integer(merges, 0, MERGE_BOUND, "merges")


def eos_flag(eos):
    _token._flag(eos)
    return int(eos)


def bpe_state(state):
    """ALL raw strings/numbers precede corpus, then target Unicode semantics."""
    data_object(state, DEFAULT_IV39, "state")
    for key in ("corpus", "text"):
        if type(state[key]) is not str:
            raise NumericalFault("INVALID_INPUT", f"{key} must be an actual string, without coercion.")
    merges = budget(state["merges"])
    if type(state["eos"]) not in (int, float):
        raise NumericalFault("NONFINITE", "eos must be an actual finite number.")
    # Check finite before the flag domain, preserving NONFINITE error precedence.
    eos = _token.integer(state["eos"], 0, 1, "eos")
    return dict(corpus=state["corpus"], text=state["text"], merges=merges, eos=eos)


def encode_bounded(text, field, prefix, trace):
    """Early UTF-16 bound, all surrogate checks, then actual UTF-8 byte bound."""
    if type(text) is not str:
        raise NumericalFault("INVALID_INPUT", f"{field} must be an actual string, without coercion.")
    if _token.utf16_length(text) > BYTE_BOUND:
        raise NumericalFault("UNSUPPORTED_SIZE", f"{field}: more than 24 UTF-16 units necessarily exceeds this 24-byte field.")
    reason = f"{field}: the actual UTF-8 encoding exceeds 24 bytes; shorten this field explicitly."
    try:
        encoded = _token.utf8_encode(text, prefix, trace)
    except NumericalFault as error:
        # Nine foxes hit the inherited32-byte bound before this24-byte postcheck.
        if error.code == "UNSUPPORTED_SIZE":
            raise NumericalFault("UNSUPPORTED_SIZE", reason) from error
        raise
    if len(encoded["bytes"]) > BYTE_BOUND:
        raise NumericalFault("UNSUPPORTED_SIZE", reason)
    return encoded


def bytes_input(values):
    dense_data(values, BYTE_BOUND, "BPE bytes")
    return _token.int_array(values, high=255, label="BPE bytes", limit=BYTE_BOUND)


def rule_table(rules):
    """Validate a lossless, acyclic rule namespace before expanding caller IDs."""
    dense_data(rules, MERGE_BOUND, "BPE rules", numeric=False)
    # Inspect every object/container first; no arbitrary mapping/index getter runs.
    for rule in rules:
        data_object(rule, ("id", "left", "right", "bytes"), "rule")
        dense_data(rule["bytes"], BYTE_BOUND, "Rule bytes")
    expansions, pairs = {}, set()
    for rank, rule in enumerate(rules):
        expected_id = MERGE_BASE + rank
        identifier = int(_token.int_array([rule["id"]], high=259, label="Rule ID")[0])
        if identifier != expected_id:
            raise NumericalFault("INVALID_INPUT", f"Rule {rank} must have ID {expected_id}.")
        operands = _token.int_array([rule["left"], rule["right"]], high=expected_id - 1, label="Rule operands")
        left, right = int(operands[0]), int(operands[1])
        # IDs between255 and this ID must already be present, never forward/cyclic.
        if any(operand > 255 and operand not in expansions for operand in (left, right)):
            raise NumericalFault("INVALID_INPUT", "Each rule operand must be a byte ID or an earlier merge ID.")
        if (left, right) in pairs:
            raise NumericalFault("INVALID_INPUT", "Duplicate BPE rule pairs are not allowed.")
        pairs.add((left, right))
        stored = _token.int_array(rule["bytes"], high=255, label="Rule bytes", limit=BYTE_BOUND)
        left_bytes = np.array([left], dtype=np.int32) if left <= 255 else expansions[left]
        right_bytes = np.array([right], dtype=np.int32) if right <= 255 else expansions[right]
        expected = np.concatenate((left_bytes, right_bytes))
        if len(expected) > BYTE_BOUND:
            raise NumericalFault("UNSUPPORTED_SIZE", "A rule expansion exceeds 24 bytes.")
        if len(expected) != len(stored) or any(int(a) != int(b) for a, b in zip(expected, stored)):
            raise NumericalFault("INVALID_INPUT", "Rule bytes must equal the left expansion followed by the right expansion.")
        expansions[identifier] = expected
    return expansions


def save_tensor(tensors, identifier, axis, values, provenance):
    """Keep actual int32 storage; an empty stream has no fabricated tensor."""
    if len(values):
        tensors.append(_token.tensor(identifier, axis, values, provenance))


def replace_pass(ids, rule, rank, stage, trace, tensors):
    """Count positions in CURRENT input tokens, not original UTF-8 bytes."""
    stem = f"{'Train' if stage == 'train' else 'Encode'}R{rank}"
    save_tensor(tensors, f"{stem}Before", "Tokens", ids,
                "Complete current token list before this nonoverlapping left-to-right pass.")
    result, position = [], 0
    while position < len(ids):
        current_id = int(ids[position])
        next_id = int(ids[position + 1]) if position + 1 < len(ids) else -1
        matched = int(current_id == rule["left"] and next_id == rule["right"])
        consumed = 2 if matched else 1
        identifier = rule["id"] if matched else current_id
        next_position = position + consumed
        inputs = dict(rank=rank, position=position, inputLength=len(ids), left=rule["left"],
                      right=rule["right"], newID=rule["id"], currentID=current_id,
                      nextID=next_id, outputLength=len(result))
        result.append(identifier)
        trace.add(f"{stage}_replace_{rank}_{position}", f"{stage}: rank {rank}, current-token position {position}",
                  "matched=(currentID=left and nextID=right); emit matched?newID:currentID; consumed=matched?2:1; nextPosition=position+consumed",
                  "Positions index the current token list, not original bytes. A match consumes two tokens and emits one; a nonmatch copies one token. Advancing past both matched operands prevents overlapping replacements. The complete pass snapshots and position/consumed/nextPosition retain every scan; nextID -1 means no next token, never a token or padding item.",
                  inputs, dict(matched=matched, id=identifier, consumed=consumed,
                               nextPosition=next_position, outputLength=len(result)))
        position = next_position
    values = np.array(result, dtype=np.int32)
    save_tensor(tensors, f"{stem}After", "Tokens", values,
                "Complete actual output token list after this rank; no padding or truncation.")
    return values


def train_bpe(values, merges, trace, tensors):
    """Count overlaps, select numeric ties, concatenate bytes, replace disjointly."""
    merges = budget(merges)
    ids = bytes_input(values).copy()
    rules, expansions = [], {}
    save_tensor(tensors, "TrainInitialIDs", "Tokens", ids,
                "Initial training byte IDs, one ID for each actual corpus byte.")
    for rank in range(merges):
        if len(ids) < 2:
            trace.add("train_stop", "Stop: fewer than two training tokens remain", "length<2 means no adjacent pair exists",
                      "This is one real early stop, not a fabricated merge. A zero requested budget does not enter training at all.",
                      dict(rank=rank, length=len(ids), requestedMerges=merges), dict(actualMerges=len(rules)))
            break
        counts = {}
        # Advance by ONE here: unlike replacement, counting includes overlaps.
        for position in range(len(ids) - 1):
            left, right = int(ids[position]), int(ids[position + 1])
            count_before = counts.get((left, right), 0)
            counts[(left, right)] = count_before + 1
            trace.add(f"train_count_{rank}_{position}", f"Count round {rank} pair at current-token position {position}",
                      "frequency(left,right)=previous frequency+1; next counting position=position+1",
                      "Count every adjacent occurrence, including overlaps. The table starts empty each round. In aaaa, aa occurs at positions 0, 1 and 2 even though replacement will consume only two disjoint pairs.",
                      dict(rank=rank, position=position, left=left, right=right, countBefore=count_before),
                      dict(countAfter=counts[(left, right)], distinctPairs=len(counts)))
        # Sort NUMERIC tuples, never string keys or insertion order (bbaa anchor).
        candidates = sorted(counts)
        for suffix, entries, provenance in (
            ("Left", [pair[0] for pair in candidates], "Numeric tuple order: left ID, then right ID; aligned candidate columns."),
            ("Right", [pair[1] for pair in candidates], "Right ID in the same sorted candidate order."),
            ("Frequency", [counts[pair] for pair in candidates], "Actual adjacent-pair frequency, including overlapping occurrences."),
        ):
            save_tensor(tensors, f"TrainR{rank}Candidate{suffix}", "Candidates",
                        np.array(entries, dtype=np.int32), provenance)
        best = None
        best_frequency = 0
        for candidate_index, (left, right) in enumerate(candidates):
            frequency = counts[(left, right)]
            best_left, best_right = best if best is not None else (-1, -1)
            inputs = dict(candidateIndex=candidate_index, left=left, right=right, frequency=frequency,
                          bestLeft=best_left, bestRight=best_right, bestFrequency=best_frequency)
            frequency_greater = int(frequency > best_frequency)
            frequency_equal = int(frequency == best_frequency)
            lex_smaller = int(best is not None and (left, right) < best)
            take = int(best is None or frequency_greater or (frequency_equal and lex_smaller))
            if take:
                best, best_frequency = (left, right), frequency
            trace.add(f"train_compare_{rank}_{candidate_index}", f"Compare round {rank} candidate {candidate_index}",
                      "take=first candidate or greater frequency or (equal frequency and numerically smaller (left,right))",
                      "Compare integer IDs, left first and then right, not string keys or encounter order. Candidate columns use numeric tuple order. The first comparison uses best IDs -1 and frequency 0 as an explicit empty-best sentinel.",
                      inputs, dict(take=take, frequencyGreater=frequency_greater, frequencyEqual=frequency_equal,
                                   lexSmaller=lex_smaller, bestLeft=best[0], bestRight=best[1], bestFrequency=best_frequency))
        left, right = best
        identifier = MERGE_BASE + rank
        trace.add(f"train_select_{rank}", f"Select round {rank} winning pair",
                  "newID=256+rank; select greatest frequency, then smallest numeric pair",
                  "Frequency 1 is eligible. Requested merges are a budget; actual merges stop early only when no adjacent pair remains.",
                  dict(rank=rank, currentLength=len(ids), candidateCount=len(candidates)),
                  dict(id=identifier, left=left, right=right, frequency=best_frequency))
        left_bytes = np.array([left], dtype=np.int32) if left <= 255 else expansions[left]
        right_bytes = np.array([right], dtype=np.int32) if right <= 255 else expansions[right]
        expansion = np.concatenate((left_bytes, right_bytes))
        rule = dict(id=identifier, left=left, right=right, bytes=expansion)
        inputs = dict(id=identifier, left=left, right=right, leftWidth=len(left_bytes), rightWidth=len(right_bytes))
        inputs.update({f"leftByte{i}": int(byte) for i, byte in enumerate(left_bytes)})
        inputs.update({f"rightByte{i}": int(byte) for i, byte in enumerate(right_bytes)})
        outputs = dict(byteWidth=len(expansion))
        outputs.update({f"byte{i}": int(byte) for i, byte in enumerate(expansion)})
        trace.add(f"train_rule_{rank}", f"Build rule {rank} byte expansion", "new bytes=left bytes followed by right bytes",
                  "Both operands are bytes or earlier merge IDs. Their complete concatenation defines the new ID and cannot create a cycle. A piece may end inside a UTF-8 scalar, so its label uses ID and exact JSON bytes.",
                  inputs, outputs)
        rules.append(rule)
        expansions[identifier] = expansion.copy()
        ids = replace_pass(ids, rule, rank, "train", trace, tensors)
    save_tensor(tensors, "CorpusIDs", "Tokens", ids,
                "Final learned corpus token IDs; corpus training never contains EOS.")
    for identifier, key, provenance in (
        ("RuleIDs", "id", "Learned IDs in ascending rank, ID=256+rank."),
        ("RuleLeft", "left", "Left operand ID for each learned rank."),
        ("RuleRight", "right", "Right operand ID for each learned rank."),
    ):
        save_tensor(tensors, identifier, "Rules", np.array([rule[key] for rule in rules], dtype=np.int32), provenance)
    for rule in rules:
        save_tensor(tensors, f"Rule{rule['id']}Bytes", "Bytes", rule["bytes"],
                    "Actual concatenated operand bytes; the piece alone need not be valid UTF-8.")
    return dict(ids=ids, rules=rules)


def encode_bpe(values, rules, eos, trace, tensors):
    """Apply each learned rank once; only then append optional target EOS512.

    A later rule emits a higher ID and leaves a replacement token between any
    untouched neighbors, so it cannot create an earlier rule's lower-ID pair.
    """
    rule_table(rules)
    eos = eos_flag(eos)
    ids = bytes_input(values).copy()
    save_tensor(tensors, "EncodeInitialIDs", "Tokens", ids,
                "Initial target byte IDs before any ranked application.")
    for rank, rule in enumerate(rules):
        # Public rule fields may be integral floats; scalar trace fields are ints.
        actual = dict(id=int(rule["id"]), left=int(rule["left"]), right=int(rule["right"]))
        ids = replace_pass(ids, actual, rank, "encode", trace, tensors)
    ids = _token.append_eos(ids, eos, "target", trace)
    save_tensor(tensors, "TargetIDs", "Tokens", ids,
                "Final target token IDs after all learned ranks, then optional unique EOS tail.")
    return ids


def decode_bpe_ids(values, rules, eos, prefix, trace):
    """Expand the ACTUAL validated IDs, then strictly reconstruct Unicode."""
    expansions = rule_table(rules)
    eos = eos_flag(eos)
    dense_data(values, BYTE_BOUND + 1, "BPE token IDs")
    ids = _token.int_array(values, high=EOS, label="BPE token IDs", limit=BYTE_BOUND + 1)
    has_tail = len(ids) > 0 and int(ids[-1]) == EOS
    content = ids[:-1] if has_tail else ids
    if has_tail != (eos == 1) or any(int(value) == EOS for value in content):
        raise NumericalFault("INVALID_INPUT", "EOS must occur exactly once at the tail when eos=1, and nowhere when eos=0.")
    for stored in content:
        identifier = int(stored)
        if identifier > 255 and identifier not in expansions:
            raise NumericalFault("INVALID_INPUT", f"Unknown or inactive BPE ID {identifier}.")
    byte_values = []
    for index, stored in enumerate(content):
        identifier = int(stored)
        expansion = [identifier] if identifier <= 255 else expansions[identifier].tolist()
        byte_offset = len(byte_values)
        byte_values.extend(expansion)
        if len(byte_values) > BYTE_BOUND:
            raise NumericalFault("UNSUPPORTED_SIZE", "Decoded BPE expansions exceed 24 bytes.")
        outputs = dict(byteOffset=byte_offset, byteWidth=len(expansion))
        outputs.update({f"byte{i}": byte for i, byte in enumerate(expansion)})
        trace.add(f"{prefix}_expand_{index}", f"{prefix}: expand ID at token {index}", "ID → validated byte expansion",
                  "Byte IDs expand to their own byte; learned IDs expand to their validated concatenated bytes. Concatenate every expansion before strict UTF-8 decoding; no replacement-character guess or input copy is used.",
                  dict(index=index, id=identifier), outputs)
    if eos == 1:
        trace.add(f"{prefix}_strip_eos", f"{prefix}: strip explicit tail EOS", "EOS emits no text bytes",
                  "The decoder has validated the unique required tail marker. Its empty expansion is a control convention, not a lost source character.",
                  dict(index=len(ids) - 1, id=EOS), dict(stripped=1))
    actual_bytes = np.array(byte_values, dtype=np.int32)
    return dict(bytes=actual_bytes, decoded=_token.utf8_decode(actual_bytes, prefix, trace))


def source_self_check():
    """Hand-derived deferred assertions: NEVER called by import or normal CLI.

    The human resource hold forbids invoking this function now. These are
    source checks for later owner validation, not generated expected answers.
    """
    assert __debug__, "Run later checks with assertions enabled."

    def rejects(call, code="INVALID_INPUT"):
        try:
            call()
        except NumericalFault as error:
            assert error.code == code, (error.code, code)
            return error
        raise AssertionError("Invalid boundary was accepted")

    def train(values, merges):
        trace, tensors = _token.TokenTrace(), []
        result = train_bpe(values, merges, trace, tensors)
        return result, trace, tensors

    # Default: abab -> ab/ab -> abab; target ababab -> abab/ab.
    trained, trace, tensors = train([97, 98, 97, 98], 2)
    assert trained["ids"].tolist() == [257]
    assert [(rule["id"], rule["left"], rule["right"]) for rule in trained["rules"]] == [(256, 97, 98), (257, 256, 256)]
    assert [rule["bytes"].tolist() for rule in trained["rules"]] == [[97, 98], [97, 98, 97, 98]]
    ids = encode_bpe([97, 98, 97, 98, 97, 98], trained["rules"], 1, trace, tensors)
    assert ids.tolist() == [257, 256, 512]
    assert decode_bpe_ids(trained["ids"], trained["rules"], 0, "corpus", trace)["decoded"] == "abab"
    assert decode_bpe_ids(ids, trained["rules"], 1, "target", trace)["decoded"] == "ababab"
    assert ids.dtype == np.dtype(np.int32) and trained["ids"].dtype == np.dtype(np.int32)
    assert all(rule["bytes"].dtype == np.dtype(np.int32) for rule in trained["rules"])
    assert all(record["dtype"] == "int32" and record["precision"] == 0 for record in tensors)
    concat = next(step for step in trace.steps if step["id"] == "train_rule_1")
    assert list(concat["inputs"]) == ["id", "left", "right", "leftWidth", "rightWidth", "leftByte0", "leftByte1", "rightByte0", "rightByte1"]
    tail = next(step for step in trace.steps if step["id"] == "encode_replace_1_2")
    assert tail["inputs"]["nextID"] == -1
    assert tail["outputs"] == dict(matched=0, id=256, consumed=1, nextPosition=3, outputLength=2)

    # Count overlaps3, replace disjointly2; every emitted token remains lossless.
    overlap, overlap_trace, _ = train([97, 97, 97, 97], 1)
    assert overlap["ids"].tolist() == [256, 256]
    assert next(step for step in overlap_trace.steps if step["id"] == "train_count_0_2")["outputs"]["countAfter"] == 3
    assert len([step for step in overlap_trace.steps if step["id"].startswith("train_replace_")]) == 2
    last_tie, _, _ = train([98, 98, 97, 97], 1)
    assert (last_tie["rules"][0]["left"], last_tie["rules"][0]["right"]) == (97, 97)
    assert last_tie["ids"].tolist() == [98, 98, 256]

    # Numeric97 precedes257; rank application differs from greedy prefix ab.
    ranked, rank_trace, rank_tensors = train([98, 99, 32, 98, 99, 32, 97, 98], 3)
    assert [(rule["left"], rule["right"]) for rule in ranked["rules"]] == [(98, 99), (256, 32), (97, 98)]
    assert ranked["ids"].tolist() == [257, 257, 258]
    assert encode_bpe([97, 98, 99], ranked["rules"], 0, rank_trace, rank_tensors).tolist() == [97, 256]
    empty, empty_trace, empty_tensors = train([], 4)
    assert not empty["rules"] and empty["ids"].tolist() == []
    assert [step["id"] for step in empty_trace.steps] == ["train_stop"] and empty_tensors == []
    _, zero_trace, _ = train([97, 98], 0)
    assert zero_trace.steps == []
    assert encode_bpe([], [], 1, _token.TokenTrace(), []).tolist() == [512]

    # Malformed IDs/EOS/rules fail before any guessed/replacement decoding.
    for values, eos in (([], 1), ([512], 0), ([512, 65], 1), ([65, 512, 512], 1), ([256], 0), ([384], 0), ([1024], 0), ([True], 0), ([10**1000], 0)):
        rejects(lambda: decode_bpe_ids(values, [], eos, "target", _token.TokenTrace()))
    rejects(lambda: decode_bpe_ids([65] * 25, [], 0, "target", _token.TokenTrace()), "UNSUPPORTED_SIZE")
    for values in ([195], [192, 128], [237, 160, 128], [244, 144, 128, 128]):
        rejects(lambda: decode_bpe_ids(values, [], 0, "target", _token.TokenTrace()))
    assert decode_bpe_ids([239, 187, 191, 0], [], 0, "target", _token.TokenTrace())["decoded"] == "\ufeff\0"
    for bad in (
        [dict(id=257, left=97, right=98, bytes=[97, 98])],
        [dict(id=256, left=256, right=98, bytes=[97, 98])],
        [dict(id=256, left=97, right=98, bytes=[98, 97])],
        [dict(id=256, left=97, right=98, bytes=[97, 98]), dict(id=257, left=97, right=98, bytes=[97, 98])],
    ):
        rejects(lambda: rule_table(bad))

    # Both 7fox/28byte postcheck and 9fox/36byte inherited32 rejection say24.
    for text in ("🦊" * 7, "🦊" * 9):
        error = rejects(lambda: encode_bounded(text, "corpus", "corpus", _token.TokenTrace()), "UNSUPPORTED_SIZE")
        assert "24" in str(error) and "32" not in str(error)
    rejects(lambda: encode_bounded("🦊" * 7 + "\ud800", "corpus", "corpus", _token.TokenTrace()))
    rejects(lambda: bpe_state(dict(corpus=None, text="", merges=0, eos=float("nan"))))
    rejects(lambda: bpe_state(dict(corpus="\ud800", text="", merges=float("nan"), eos=0)), "NONFINITE")
    rejects(lambda: bpe_state(dict(corpus="", text="", merges=10**1000, eos=0)), "NONFINITE")
    rejects(lambda: bpe_state(dict(corpus="", text="", merges=0, eos=10**1000)), "NONFINITE")
    rejects(lambda: bpe_state(dict(corpus="", text="", merges=True, eos=0)), "NONFINITE")
    rejects(lambda: bpe_state(dict(corpus="", text="", merges=0, eos=0, extra=0)))
    rejects(lambda: bpe_state(dict(corpus="", text="", merges=0)))

    class AccessorState:
        @property
        def corpus(self):
            raise AssertionError("Getter must never run")

    class AccessorList(list):
        def __getitem__(self, index):
            raise AssertionError("Custom indexing must never run")

    rejects(lambda: bpe_state(AccessorState()))
    rejects(lambda: decode_bpe_ids(AccessorList([65]), [], 0, "target", _token.TokenTrace()))
    rejects(lambda: rule_table([dict(id=256, left=97, right=98, bytes=AccessorList([97, 98]))]))

3. One complete tokenizer calculation — code/python/p09/iv39.py

The genuine calculation trains on abab, encodes the original prompt and retains both real roundtrips. The capstone calls derive_iv39.__wrapped__ once, preserving that calculation while handling only exact recognized codec faults at its own boundary. TypeScript uses the mechanically extracted strict evaluateIV39 once; the earlier compatibility wrapper keeps its old behavior. Neither path retokenizes appended generated IDs.

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.

"""IV-39 — Byte-Pair Encoding: A Full Merge Trace.

Train adjacent byte-ID pairs on a separate, literal training corpus. Count
ALL adjacent occurrences, including overlaps, choose the greatest count,
then the lexicographically smallest NUMERIC (left ID, right ID) on ties.
Replace matches left to right without overlap. Recount after every rule.
Encode the target with the learned rules in increasing rank, not by taking
the longest dictionary prefix. Only the target can receive explicit EOS512.

Hand default: corpus abab starts [97,98,97,98]. Counts ab2,ba1 select ab256,
so [256,256] becomes rule257=[97,98,97,98]. Target ababab becomes
[256,256,256] then [257,256]; expanding BOTH IDs reconstructs six bytes.
Corpus aaaa has three adjacent aa occurrences but only two replacements.
Corpus bbaa encounters bb,ba,aa once each; numeric order chooses the LAST
encountered aa=(97,97), producing [98,98,256], not insertion-order bb.
Corpus 'bc bc ab' learns bc256,bc-space257,ab258. In its third round
(97,98) beats pairs starting257 numerically, not by decimal string keys.
Target abc becomes [97,256]; greedy longest-prefix ab258 would differ.

All source is authored without imports, execution, fixtures generation or
runtime validation. Keep bpe_reference.py AND token_reference.py beside this
wrapper. File-relative loading supports an arbitrary caller working directory.
"""
import importlib.util
from pathlib import Path

_bpe_spec = importlib.util.spec_from_file_location(
    "_p09_bpe_reference", Path(__file__).resolve().with_name("bpe_reference.py"))
_bpe = importlib.util.module_from_spec(_bpe_spec)
_bpe_spec.loader.exec_module(_bpe)

DEFAULT_IV39 = _bpe.DEFAULT_IV39


@_bpe._token.guarded
def derive_iv39(state):
    """Train a real corpus, encode a separate target, and decode both actual IDs."""
    token = _bpe._token
    s = _bpe.bpe_state(state)
    encoding_trace = token.TokenTrace()
    corpus = _bpe.encode_bounded(s["corpus"], "corpus", "corpus", encoding_trace)
    source = _bpe.encode_bounded(s["text"], "text", "source", encoding_trace)
    trace = token.TokenTrace()
    corpus_units, units = token.utf16_length(s["corpus"]), token.utf16_length(s["text"])
    trace.add("setup", "Declare learned byte-pair encoding and both exact inputs",
              "byte IDs=0..255; learned ID=256+rank; EOS=512; each text field<=24 UTF-8 bytes",
              "Validate every raw field before corpus then target Unicode semantics. Train on the corpus byte stream including spaces; encode the separate target using learned ranks. No normalization, word splitting, inferred EOS or pretrained vocabulary is used.",
              dict(requestedMerges=s["merges"], eos=s["eos"]),
              dict(corpusUnits=corpus_units, corpusScalars=len(corpus["codePoints"]), utf16Units=units,
                   scalarCount=len(source["codePoints"]), byteBound=_bpe.BYTE_BOUND,
                   mergeBase=_bpe.MERGE_BASE, mergeBound=_bpe.MERGE_BOUND, EOS=_bpe.EOS))
    # Scalar records were prepared during validation; keep their actual order.
    trace.steps.extend(encoding_trace.steps)
    tensors = []
    for stem, encoded in (("Corpus", corpus), ("Source", source)):
        for suffix, key, axis, provenance in (
            ("CodePoints", "codePoints", "Scalars", "Validated Unicode scalars in exact input order."),
            ("UTF16Offsets", "offsets", "Scalars", "Zero-based UTF-16 storage offset for each scalar."),
            ("UTF16Widths", "widths", "Scalars", "UTF-16 storage units consumed by each scalar."),
            ("ByteOffsets", "byteOffsets", "Scalars", "Zero-based UTF-8 byte offset for each scalar."),
            ("ByteWidths", "byteWidths", "Scalars", "Actual UTF-8 bytes emitted by each scalar."),
            ("Bytes", "bytes", "Bytes", "Manual UTF-8 encoding in source order, preserving all data."),
        ):
            _bpe.save_tensor(tensors, f"{stem}{suffix}", axis, encoded[key], provenance)
    trained = _bpe.train_bpe(corpus["bytes"], s["merges"], trace, tensors)
    ids = _bpe.encode_bpe(source["bytes"], trained["rules"], s["eos"], trace, tensors)
    # Corpus is NEVER EOS-trained. Both inverse paths expand real saved IDs.
    corpus_decoded = _bpe.decode_bpe_ids(trained["ids"], trained["rules"], 0, "corpus", trace)
    target_decoded = _bpe.decode_bpe_ids(ids, trained["rules"], s["eos"], "target", trace)
    corpus_equal = int(corpus_decoded["decoded"] == s["corpus"])
    equal = int(target_decoded["decoded"] == s["text"])
    if not (corpus_equal and equal):
        raise _bpe.NumericalFault("INVALID_INPUT", "Actual BPE reconstructions did not equal both original strings.")
    trace.add("roundtrip", "Compare both actual strict reconstructions with the original strings",
              "corpusEqual=(corpusDecoded===corpus); equal=(targetDecoded===text)",
              "Expand real corpus and target IDs separately, concatenate real bytes, strictly reconstruct Unicode scalars, and only then compare strings. Empty content reconstructs the empty string; optional target EOS emits no bytes.",
              dict(corpusOriginalUnits=corpus_units, corpusDecodedUnits=token.utf16_length(corpus_decoded["decoded"]),
                   corpusDecodedByteCount=len(corpus_decoded["bytes"]), originalUnits=units,
                   decodedUnits=token.utf16_length(target_decoded["decoded"]), decodedByteCount=len(target_decoded["bytes"])),
              dict(corpusTokens=len(trained["ids"]), tokenCount=len(ids), corpusEqual=corpus_equal, equal=equal))
    _bpe.save_tensor(tensors, "CorpusDecodedBytes", "Bytes", corpus_decoded["bytes"],
                     "Actual final corpus ID expansions passed to strict UTF-8 decoding.")
    _bpe.save_tensor(tensors, "TargetDecodedBytes", "Bytes", target_decoded["bytes"],
                     "Actual final target ID expansions passed to strict UTF-8 decoding.")
    expansions = {rule["id"]: rule["bytes"].tolist() for rule in trained["rules"]}

    def expansion(identifier):
        return [] if identifier == _bpe.EOS else [identifier] if identifier <= 255 else expansions[identifier]

    def labels(token_ids):
        return ["ID 512: EOS (explicit control), bytes []" if int(identifier) == _bpe.EOS else
                f"ID {int(identifier)}, bytes {token.json_text(expansion(int(identifier)))}" for identifier in token_ids]

    def expansion_labels(token_ids):
        return [token.json_text(expansion(int(identifier))) for identifier in token_ids]

    summary = dict(corpusBytes=len(corpus["bytes"]), byteCount=len(source["bytes"]),
                   actualMerges=len(trained["rules"]), tokenCount=len(ids), requestedMerges=s["merges"],
                   corpusTokens=len(trained["ids"]), eos=s["eos"], byteBound=_bpe.BYTE_BOUND,
                   vocabularyItems=256 + len(trained["rules"]) + 1, corpusEqual=corpus_equal, equal=equal)
    texts = dict(corpus=s["corpus"], input=s["text"], corpusDecoded=corpus_decoded["decoded"],
                 decoded=target_decoded["decoded"], corpusLabels=labels(trained["ids"]),
                 corpusExpansions=expansion_labels(trained["ids"]), targetLabels=labels(ids),
                 targetExpansions=expansion_labels(ids),
                 ruleLabels=[f"ID {rule['id']}, bytes {token.json_text(rule['bytes'].tolist())}" for rule in trained["rules"]],
                 ruleExpansions=[token.json_text(rule["bytes"].tolist()) for rule in trained["rules"]],
                 trainingStop="Zero merges requested: no training round or pair selection occurs." if s["merges"] == 0 else
                 "Stopped early: fewer than two current training tokens remain." if len(trained["rules"]) < s["merges"] else
                 "Requested merge budget completed.")
    return trace.result(summary, tensors, texts)


def source_self_check():
    """Deferred hand-literal record checks; never part of the normal CLI path."""
    assert __debug__, "Run later checks with assertions enabled."
    _bpe.source_self_check()
    result = derive_iv39(dict(DEFAULT_IV39))
    assert list(result) == ["status", "outputs", "steps", "tensors", "texts"]
    assert list(result["outputs"])[:11] == ["corpusBytes", "byteCount", "actualMerges", "tokenCount", "requestedMerges", "corpusTokens", "eos", "byteBound", "vocabularyItems", "corpusEqual", "equal"]
    assert [result["outputs"][key] for key in ("corpusBytes", "byteCount", "actualMerges", "tokenCount")] == [4, 6, 2, 2]
    assert len(result["steps"]) == 44 and len(result["tensors"]) == 37
    assert result["texts"]["corpusDecoded"] == "abab" and result["texts"]["decoded"] == "ababab"
    assert result["texts"]["targetLabels"] == ["ID 257, bytes [97,98,97,98]", "ID 256, bytes [97,98]"]
    # Tensor count:12source+1initial+10round+1corpus+3rules+2expansions+
    # 1targetinitial+4targetpasses+1targetfinal+2decoded=37. No program counted it.
    tensor_ids = [record["id"] for record in result["tensors"]]
    for merges, eos, steps in ((2, 1, 46), (3, 0, 45), (3, 1, 47), (4, 0, 45), (4, 1, 47)):
        case = derive_iv39(dict(corpus="abab", text="ababab", merges=merges, eos=eos))
        assert len(case["steps"]) == steps
        assert [record["id"] for record in case["tensors"]] == tensor_ids
    for eos in (0, 1):
        empty = derive_iv39(dict(corpus="", text="", merges=0, eos=eos))
        assert empty["outputs"]["tokenCount"] == eos
        assert len(empty["steps"]) == 2 + 2 * eos
        assert empty["texts"]["decoded"] == empty["texts"]["corpusDecoded"] == ""
    for patch, code in (
        (dict(corpus="\ud800", merges=float("nan")), "NONFINITE"),
        (dict(corpus="a" * 25, text="\ud800"), "UNSUPPORTED_SIZE"),
        (dict(corpus="\ud800", text="a" * 25), "INVALID_INPUT"),
        (dict(text="🦊" * 7), "UNSUPPORTED_SIZE"),
        (dict(text="🦊" * 9), "UNSUPPORTED_SIZE"),
    ):
        bad = derive_iv39({**DEFAULT_IV39, **patch})
        assert list(bad) == ["status", "code", "reason"] and bad["code"] == code


if __name__ == "__main__":
    # No args: defaults; one complete JSON state: replacement; '-': stdin JSON.
    _bpe._token.run(derive_iv39, DEFAULT_IV39)

4. Both unchanged scalar decoder blocks — code/python/p15/decoder_reference.py

Read decoder_block(features,gains,trace,prefix) with its four declared parameters. Each call contains both normalizations, complete causal attention and width-three FFN, including zero products, forbidden-key scores and exact masked probabilities. NumPy supplies ordinary indexed storage; scalar loops keep the declared arithmetic order.

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.

"""Independent IV59 scalar FIRST, with owner-adopted public bindings.

All execution and checks are UNRUN. Saved scalar captures drive serialization.
NumPy is used only for explicitly indexed result storage, never contractions.
"""
import math
import re
from types import MappingProxyType

import numpy as np


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


class _FrozenDict(dict):
    def _readonly(self, *args, **kwargs):
        raise TypeError("Frozen trace record.")
    __setitem__ = __delitem__ = clear = pop = popitem = setdefault = update = __ior__ = _readonly


class _FrozenList(list):
    def _readonly(self, *args, **kwargs):
        raise TypeError("Frozen trace array.")
    __setitem__ = __delitem__ = append = clear = extend = insert = pop = remove = reverse = sort = __iadd__ = __imul__ = _readonly


def _freeze(value):
    if type(value) in (dict, _FrozenDict):
        return _FrozenDict({key: _freeze(child) for key, child in value.items()})
    if type(value) in (list, tuple, _FrozenList):
        return _FrozenList(_freeze(child) for child in value)
    if value is None or type(value) in (str, bool, int, float):
        if type(value) is float and not math.isfinite(value):
            raise TypeError("Trace values must be finite, plain JSON data.")
        return value
    raise TypeError("Copy typed arrays to plain arrays before tracing.")



DEFAULT_IV59 = _freeze(dict(
    token0=97, token1=97, positionScale=0.5,
    q1=1.0, k1=1.0, v1=1.0, o1=0.5, f1=0.5,
    q2=1.0, k2=0.5, v2=1.0, o2=0.25, f2=0.25,
    biasA=0.0, biasB=0.0, biasEOS=0.0))
_FIELDS = tuple(DEFAULT_IV59)
_GAIN_FIELDS = ("q", "k", "v", "o", "f")
_IDS = (97, 98, 512)


def _finite(value, name):
    if not math.isfinite(value):
        raise NumericalFault("NONFINITE", name + " must be finite.")
    return value


def _capture_record(value, fields, label):
    # Exact built-ins exclude custom reflection/getitem/accessor side effects.
    if type(value) not in (dict, _FrozenDict):
        raise NumericalFault("INVALID_INPUT", label + " must be a plain object.")
    keys = tuple(value)
    if len(keys) != len(fields) or any(type(key) is not str for key in keys) or set(keys) != set(fields):
        raise NumericalFault("INVALID_INPUT", label + " must have exactly " + ", ".join(fields) + " as own fields.")
    captured = {key: value[key] for key in fields}
    for key in fields:
        item = captured[key]
        if type(item) not in (int, float) or (type(item) is float and not math.isfinite(item)):
            raise NumericalFault("NONFINITE", label + "." + key + " must be an actual finite number.")
    return captured


def decoder_state(value):
    """Capture raw16 once; check every number before any domain or conversion."""
    captured = _capture_record(value, _FIELDS, "state")
    for key in _FIELDS:
        item = captured[key]
        if key in ("token0", "token1"):
            if item not in _IDS or (type(item) is float and not item.is_integer()):
                raise NumericalFault("INVALID_INPUT", key + " must be an integer token ID in {97,98,512}.")
        else:
            lower, upper = ((0, 1) if key == "positionScale" else
                            (-2, 2) if key.startswith("bias") else (-1, 1))
            if not lower <= item <= upper:
                raise NumericalFault("INVALID_INPUT", f"{key} must be between {lower} and {upper}.")
    return _freeze({key: int(captured[key]) if key in ("token0", "token1") else float(captured[key])
                    for key in _FIELDS})


def _block_inputs(features, gains, prefix):
    if type(features) not in (list, _FrozenList):
        raise NumericalFault("INVALID_INPUT", "features must be an ordinary dense array.")
    if len(features) not in (2, 4, 6):
        raise NumericalFault("INVALID_INPUT", "features must contain 2, 4 or 6 words for B=1,T=1..3,D=2.")
    captured = list(features)
    for i, item in enumerate(captured):
        if type(item) not in (int, float) or (type(item) is float and not math.isfinite(item)):
            raise NumericalFault("NONFINITE", f"features[{i}] must be an actual finite number.")
    for i, item in enumerate(captured):
        if not -16 <= item <= 16:
            raise NumericalFault("INVALID_INPUT", f"features[{i}] must be between -16 and 16.")
    captured_gains = _capture_record(gains, _GAIN_FIELDS, "gains")
    for key in _GAIN_FIELDS:
        if not -1 <= captured_gains[key] <= 1:
            raise NumericalFault("INVALID_INPUT", f"gains.{key} must be between -1 and 1.")
    _prefix(prefix)
    return [float(item) for item in captured], {key: float(captured_gains[key]) for key in _GAIN_FIELDS}


def _prefix(prefix):
    if type(prefix) is not str or re.fullmatch(r"[A-Za-z][A-Za-z0-9_]*", prefix) is None:
        raise NumericalFault("INVALID_INPUT", "prefix must start with an ASCII letter and contain only ASCII letters, digits or underscores.")


class _MechanismTrace:
    """Private captures; labels and schema are NOT the public adopted inventory."""
    def __init__(self):
        self.steps = []
        self.native = []
        self._ids = set()

    def add(self, identifier, inputs, outputs):
        if type(identifier) is not str or not identifier or identifier in self._ids:
            raise NumericalFault("INVALID_INPUT", "Trace IDs must be nonempty and unique.")
        before, after = dict(inputs), dict(outputs)
        for record in (before, after):
            for key, value in record.items():
                if type(key) is not str or type(value) not in (int, float):
                    raise NumericalFault("INVALID_INPUT", "Capture scalar data only.")
                _finite(value, identifier + "/" + key)
        if len(self.steps) >= 512:
            raise NumericalFault("UNSUPPORTED_SIZE", "At most 512 operations are supported.")
        self._ids.add(identifier)
        self.steps.append((identifier, MappingProxyType(before), MappingProxyType(after)))

    def leaf(self, identifier, kind, argument):
        _finite(argument, identifier + " argument")
        lower, upper = (0.25, 4096.0) if kind == "sqrt" else (-256.0, 0.0)
        if not lower <= argument <= upper:
            raise NumericalFault("INVALID_INPUT", "Native argument outside authored scope.")
        if any(record["id"] == identifier for record in self.native):
            raise NumericalFault("INVALID_INPUT", "Native capture ID must be unique.")
        output = _finite(math.sqrt(argument) if kind == "sqrt" else math.exp(argument), identifier)
        if output <= 0:
            raise NumericalFault("NONFINITE", "Native result must be positive.")
        self.native.append(MappingProxyType(dict(id=identifier, kind=kind, input=argument, output=output)))
        return output


def decoder_trace():
    """Create the adopted collector, with no implicit self-check."""
    return _PublicTrace()


def _norm(features, trace, prefix):
    result = []
    for t in range(len(features) // 2):
        x0, x1 = features[2 * t:2 * t + 2]
        total = _finite(x0 + x1, "feature sum")
        mean = _finite(total / 2.0, "feature mean")
        centered0, centered1 = _finite(x0 - mean, "centered0"), _finite(x1 - mean, "centered1")
        square0, square1 = _finite(centered0 * centered0, "square0"), _finite(centered1 * centered1, "square1")
        square_sum = _finite(square0 + square1, "square sum")
        variance = _finite(square_sum / 2.0, "population variance")
        argument = _finite(variance + 0.25, "variance plus epsilon")
        denominator = trace.leaf(f"{prefix}_{t}_sqrt", "sqrt", argument)
        trace.add(f"{prefix}_{t}_statistics", dict(x0=x0, x1=x1, epsilon=0.25),
                  dict(sum=total, mean=mean, centered0=centered0, centered1=centered1,
                       square0=square0, square1=square1, squareSum=square_sum,
                       variance=variance, variancePlusEpsilon=argument, denominator=denominator))
        for d, source in enumerate((centered0, centered1)):
            normalized = _finite(source / denominator, "normalized")
            scaled = _finite(1.0 * normalized, "gamma times normalized")
            value = _finite(scaled + 0.0, "plus beta")
            result.append(value)
            trace.add(f"{prefix}_{t}_feature_{d}", dict(source=source, denominator=denominator, gamma=1.0, beta=0.0),
                      dict(normalized=normalized, scaled=scaled, value=value))
    return result


def _two_products(features, weights, trace, prefix, bias=None, cols=2):
    result = []
    for t in range(len(features) // 2):
        x0, x1 = features[2 * t:2 * t + 2]
        for d in range(cols):
            w0, w1 = weights[d], weights[cols + d]
            product0, product1 = _finite(x0 * w0, "product0"), _finite(x1 * w1, "product1")
            total = _finite(product0 + product1, "two product sum")
            outputs = dict(product0=product0, product1=product1, sum=total)
            inputs = dict(x0=x0, x1=x1, w0=w0, w1=w1)
            value = total
            if bias is not None:
                inputs["bias"] = bias[d]
                value = _finite(total + bias[d], "bias last")
            outputs["value"] = value
            trace.add(f"{prefix}_{t}_{d}", inputs, outputs)
            result.append(value)
    return result


def _softmax(logits, allowed, trace, prefix, positive_zero=True):
    candidates = [value for value, keep in zip(logits, allowed) if keep]
    maximum = candidates[0]
    for value in candidates[1:]:
        # Match Math.max's +0 preference; the shifted native argument keeps sign.
        if value > maximum or (positive_zero and value == 0.0 and maximum == 0.0 and math.copysign(1.0, value) > 0.0):
            maximum = value
    terms = []
    shifted = {}
    denominator = 0.0
    running = []
    for j, (value, keep) in enumerate(zip(logits, allowed)):
        term = 0.0
        if keep:
            argument = _finite(value - maximum, "allowed shifted logit")
            shifted[f"shifted{j}"] = argument
            term = trace.leaf(f"{prefix}_exp_{j}", "exp", argument)
        terms.append(term)
    for term in terms:
        denominator = _finite(denominator + term, "softmax ordered denominator")
        running.append(denominator)
    probabilities = [_finite(term / denominator, "probability") for term in terms]
    inputs = {f"logit{j}": value for j, value in enumerate(logits)}
    inputs.update({f"allowed{j}": int(keep) for j, keep in enumerate(allowed)})
    outputs = dict(max=maximum, denominator=denominator, **shifted)
    outputs.update({f"term{j}": term for j, term in enumerate(terms)})
    outputs.update({f"p{j}": probability for j, probability in enumerate(probabilities)})
    outputs.update({f"running{j}": value for j, value in enumerate(running)})
    trace.add(prefix, inputs, outputs)
    return probabilities


def _accumulate_rows(features, width, weights, cols, trace, prefix, bias=None):
    result = []
    for t in range(len(features) // width):
        for d in range(cols):
            running = 0.0
            inputs, outputs = {}, {}
            for k in range(width):
                value, weight = features[t * width + k], weights[k * cols + d]
                inputs[f"x{k}"], inputs[f"w{k}"] = value, weight
                product = _finite(value * weight, "ordered product")
                running = _finite(running + product, "ordered running sum")
                outputs[f"product{k}"], outputs[f"running{k}"] = product, running
            value = running
            if bias is not None:
                inputs["bias"] = bias[d]
                value = _finite(running + bias[d], "output bias last")
            outputs["value"] = value
            trace.add(f"{prefix}_{t}_{d}", inputs, outputs)
            result.append(value)
    return result


def _residual(left, right, trace, prefix):
    result = []
    for i in range(len(left)):
        value = _finite(left[i] + right[i], "residual")
        trace.add(f"{prefix}_{i}", dict(left=left[i], right=right[i]), dict(value=value))
        result.append(value)
    return result


def _storage(values, rows, cols):
    """No numerical NumPy operation: store already computed Python scalars."""
    stored = np.empty((1, rows, cols), dtype=np.float64)
    for t in range(rows):
        for d in range(cols):
            stored[0, t, d] = values[t * cols + d]
    return stored


def _decoder_block_mechanics(features, gains, trace, prefix):
    """Original independent scalar graph; public metadata is a copy projection."""
    count = len(features) // 2
    norm1 = _norm(features, trace, prefix + "_ln1")
    matrices = {key: [gains[key], 0.0, 0.0, gains[key]] for key in ("q", "k", "v", "o")}
    q = _two_products(norm1, matrices["q"], trace, prefix + "_Q")
    k = _two_products(norm1, matrices["k"], trace, prefix + "_K")
    v = _two_products(norm1, matrices["v"], trace, prefix + "_V")
    # H=1 split is still an actual copy with an explicit coordinate capture.
    heads = []
    for label, source in (("Q", q), ("K", k), ("V", v)):
        copied = []
        for i, value in enumerate(source):
            copied.append(value)
            trace.add(f"{prefix}_{label}_split_{i}", dict(source=value), dict(value=value))
        heads.append(copied)
    q, k, v = heads
    divisor = trace.leaf(prefix + "_attention_sqrt", "sqrt", 2.0)
    raw, scores, logits, allowed = [], [], [], []
    for i in range(count):
        for j in range(count):
            product0 = _finite(q[2 * i] * k[2 * j], "score product0")
            product1 = _finite(q[2 * i + 1] * k[2 * j + 1], "score product1")
            dot = _finite(product0 + product1, "raw score")
            score = _finite(dot / divisor, "scaled score")
            raw.append(dot)
            scores.append(score)
            trace.add(f"{prefix}_score_{i}_{j}", dict(q0=q[2*i], q1=q[2*i+1], k0=k[2*j], k1=k[2*j+1], divisor=divisor),
                      dict(product0=product0, product1=product1, raw=dot, score=score))
    probabilities = []
    for i in range(count):
        row, mask = [], []
        for j in range(count):
            row.append(_finite(scores[i * count + j] + 0.0, "score plus zero common shift"))
            mask.append(j <= i)
        logits.extend(row)
        allowed.extend(mask)
        probabilities.extend(_softmax(row, mask, trace, f"{prefix}_attention_row_{i}"))
    mixed = []
    for i in range(count):
        for d in range(2):
            running = 0.0
            inputs, outputs = {}, {}
            for j in range(count):
                probability, value = probabilities[i * count + j], v[2 * j + d]
                inputs[f"p{j}"], inputs[f"v{j}"] = probability, value
                product = _finite(probability * value, "including forbidden zero product")
                running = _finite(running + product, "attention running sum")
                outputs[f"product{j}"], outputs[f"running{j}"] = product, running
            outputs["value"] = running
            trace.add(f"{prefix}_mix_{i}_{d}", inputs, outputs)
            mixed.append(running)
    joined = []
    for i, value in enumerate(mixed):
        joined.append(value)
        trace.add(f"{prefix}_join_{i}", dict(source=value), dict(value=value))
    attention = _accumulate_rows(joined, 2, matrices["o"], 2, trace, prefix + "_WO")
    residual1 = _residual(features, attention, trace, prefix + "_residual1")
    norm2 = _norm(residual1, trace, prefix + "_ln2")
    w1, w2 = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0], [gains["f"], 0.0, 0.0, gains["f"], 0.0, 0.0]
    preactivation = _two_products(norm2, w1, trace, prefix + "_ffn_hidden", [0.0, 0.0, 0.0], 3)
    hidden = []
    for i, value in enumerate(preactivation):
        activation = value if value > 0.0 else 0.0
        hidden.append(activation)
        trace.add(f"{prefix}_relu_{i}", dict(preactivation=value), dict(activation=activation))
    ffn = _accumulate_rows(hidden, 3, w2, 2, trace, prefix + "_ffn_output", [0.0, 0.0])
    output = _residual(residual1, ffn, trace, prefix + "_residual2")
    return dict(input=list(features), norm1=norm1, matrices=matrices, Q=q, K=k, V=v,
                raw=raw, scores=scores, logits=logits, allowed=allowed, probabilities=probabilities,
                mixed=mixed, joined=joined, attention=attention, residual1=residual1,
                norm2=norm2, W1=w1, W2=w2, b1=[0.0]*3, b2=[0.0]*2,
                preactivation=preactivation, hidden=hidden, ffn=ffn, output=output,
                storage=_storage(output, count, 2))


def _evaluate_decoder_mechanics(state, trace, prefix):
    features, embedding, positions = [], [], []
    table = {97: (1.0, 0.0), 98: (0.0, 1.0), 512: (0.0, 0.0)}
    for t in range(2):
        token = state[f"token{t}"]
        for d in range(2):
            looked_up = table[token][d]
            position = state["positionScale"] if (t, d) == (1, 1) else 0.0
            value = _finite(looked_up + position, "embedding plus position")
            embedding.append(looked_up)
            positions.append(position)
            features.append(value)
            trace.add(f"{prefix}_position_{t}_{d}", dict(token=token, embedding=looked_up, position=position), dict(value=value))
    block1 = _decoder_block_mechanics(features, {key: state[key + "1"] for key in _GAIN_FIELDS}, trace, prefix + "_block1")
    block2 = _decoder_block_mechanics(block1["output"], {key: state[key + "2"] for key in _GAIN_FIELDS}, trace, prefix + "_block2")
    readout = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0]
    bias = [state["biasA"], state["biasB"], state["biasEOS"]]
    logits = _two_products(block2["output"], readout, trace, prefix + "_readout", bias, 3)
    probabilities, winners = [], []
    for t in range(2):
        row = logits[3*t:3*t+3]
        distribution = _softmax(row, [True, True, True], trace, f"{prefix}_class_row_{t}", positive_zero=False)
        probabilities.extend(distribution)
        best = 0
        for index in range(1, 3):
            if row[index] > row[best]:
                best = index
        winner = dict(index=best, token=_IDS[best], probability=distribution[best])
        winners.append(winner)
        trace.add(f"{prefix}_winner_{t}", {f"logit{j}": row[j] for j in range(3)}, winner)
    return dict(embedding=embedding, positions=positions, features=features, block1=block1, block2=block2,
                U=readout, bias=bias, logits=logits, probabilities=probabilities,
                winners=winners, next=winners[-1].copy(), storage=_storage(logits, 2, 3))


def check_mechanism():
    """Explicit bounded FIRST checks only; these do NOT admit public records."""
    if not __debug__:
        raise RuntimeError("Explicit mechanism self-check refuses optimized Python (-O).")
    import struct

    def words(values):
        return [struct.pack(">d", value) for value in values]

    default = decoder_state(dict(DEFAULT_IV59))
    trace = _MechanismTrace()
    result = _evaluate_decoder_mechanics(default, trace, "default")
    assert result["features"] == [1.0, 0.0, 1.0, 0.5]
    assert words(result["block2"]["input"]) == words(result["block1"]["output"])
    assert words(result["block1"]["storage"][0].flat) == words(result["block1"]["output"])
    assert result["block1"]["input"] != result["block2"]["input"]
    assert [winner["token"] for winner in result["winners"]] == [97, 97]
    assert result["next"] == result["winners"][-1] and result["next"] is not result["winners"][-1]
    assert result["block1"]["W1"] == [1.0, 0.0, 0.0, 0.0, 1.0, 0.0]
    assert result["block1"]["W2"] == [0.5, 0.0, 0.0, 0.5, 0.0, 0.0]
    assert result["block2"]["W2"] == [0.25, 0.0, 0.0, 0.25, 0.0, 0.0]
    for block in (result["block1"], result["block2"]):
        assert block["allowed"] == [True, False, True, True]
        assert words(block["probabilities"][:2]) == words([1.0, 0.0])
        assert len(block["raw"]) == 4 and len(block["preactivation"]) == 6
        assert words(block["preactivation"][2::3]) == words([0.0, 0.0])
        assert words(block["hidden"][2::3]) == words([0.0, 0.0])
    frames = {identifier: (inputs, outputs) for identifier, inputs, outputs in trace.steps}
    first = frames["default_block1_ln1_0_statistics"][1]
    assert first["sum"] == 1.0 and first["mean"] == 0.5
    assert first["centered0"] == 0.5 and first["centered1"] == -0.5
    assert first["variancePlusEpsilon"] == 0.5
    second = frames["default_block1_ln1_1_statistics"][1]
    assert second["sum"] == 1.5 and second["mean"] == 0.75
    assert second["centered0"] == 0.25 and second["centered1"] == -0.25
    assert second["variancePlusEpsilon"] == 0.3125
    assert frames["default_block1_mix_0_0"][1]["product1"] == 0.0
    native_ids = [leaf["id"] for leaf in trace.native]
    assert len(set(native_ids)) == len(native_ids)
    for leaf in trace.native:
        if leaf["kind"] == "sqrt":
            assert 0.25 <= leaf["input"] <= 4096.0
            expected = math.sqrt(leaf["input"])
        else:
            assert -256.0 <= leaf["input"] <= 0.0
            expected = math.exp(leaf["input"])
        assert words([leaf["output"]]) == words([expected])
    for layer in (1, 2):
        leaf = next(item for item in trace.native if item["id"] == f"default_block{layer}_attention_sqrt")
        for i in range(2):
            for j in range(2):
                copied = frames[f"default_block{layer}_score_{i}_{j}"][0]["divisor"]
                assert words([copied]) == words([leaf["output"]])

    zero = dict(default, o1=0.0, f1=0.0, o2=0.0, f2=0.0)
    zero_trace = _MechanismTrace()
    identity = _evaluate_decoder_mechanics(zero, zero_trace, "zero")
    for key in ("block1", "block2"):
        assert words(identity[key]["output"]) == words([1.0, 0.0, 1.0, 0.5])
        assert len(identity[key]["hidden"]) == 6
    assert words(identity["logits"]) == words([1.0, 0.0, 0.0, 1.0, 0.5, 0.0])
    for t, arguments in enumerate(((0.0, -1.0, -1.0), (0.0, -0.5, -1.0))):
        terms = [math.exp(argument) for argument in arguments]
        denominator = ((0.0 + terms[0]) + terms[1]) + terms[2]
        expected = [term / denominator for term in terms]
        assert words(identity["probabilities"][3*t:3*t+3]) == words(expected)
    assert len(zero_trace.native) == len(trace.native)
    assert len(zero_trace.steps) == len(trace.steps)

    # A changed future token cannot change any first-row result in either block.
    future_trace = _MechanismTrace()
    future = _evaluate_decoder_mechanics(dict(default, token1=98), future_trace, "future")
    assert words(future["logits"][:3]) == words(result["logits"][:3])
    assert words(future["block2"]["output"][:2]) == words(result["block2"]["output"][:2])
    tied = _evaluate_decoder_mechanics(dict(zero, token0=512, token1=512, positionScale=0.0), _MechanismTrace(), "tie")
    assert words(tied["logits"]) == words([0.0] * 6)
    assert [winner["index"] for winner in tied["winners"]] == [0, 0]
    assert [winner["token"] for winner in tied["winners"]] == [97, 97]
    for length in (2, 4, 6):
        features = [16.0, -16.0] * (length // 2)
        gains = dict(q=-1.0, k=1.0, v=-1.0, o=0.0, f=0.0)
        captured, checked_gains = _block_inputs(features, gains, "bounded")
        block = _decoder_block_mechanics(captured, checked_gains, _MechanismTrace(), "bounded")
        assert words(block["output"]) == words(features)
        assert len(block["hidden"]) == (length // 2) * 3
    captured, gains = _block_inputs([-0.0, 0.0], dict(q=-0.0, k=1, v=1, o=0, f=0), "signed")
    assert words([captured[0], gains["q"]]) == words([-0.0, -0.0])
    detached = _MechanismTrace()
    before, after = dict(x=-0.0), dict(y=1.0)
    detached.add("capture", before, after)
    before["x"], after["y"] = 8.0, 9.0
    assert words([detached.steps[0][1]["x"]]) == words([-0.0])
    assert detached.steps[0][2]["y"] == 1.0

    signed_trace = _MechanismTrace()
    _softmax([-0.0, 0.0, -1.0], [True, True, True], signed_trace, "signed_max")
    assert words([signed_trace.steps[0][2]["max"]]) == words([0.0])
    assert words([signed_trace.native[0]["input"]]) == words([-0.0])
    assert words([signed_trace.native[1]["input"]]) == words([0.0])


# Public binding projects the independent FIRST captures; it never recomputes floats.

def _numeric(value, label):
    if type(value) is int:
        # Compare before conversion: huge Python integers must not raise OverflowError.
        if not -1.7976931348623157e308 <= value <= 1.7976931348623157e308:
            raise NumericalFault("NONFINITE", label + " must be an actual finite number.")
        return value if -9007199254740991 <= value <= 9007199254740991 else float(value)
    if type(value) is not float or not math.isfinite(value):
        raise NumericalFault("NONFINITE", label + " must be an actual finite number.")
    return value


def _trace_entries(value):
    """Capture trusted items once, then use JavaScript's canonical-index order."""
    if type(value) in (list, str):
        entries = [(str(index), item) for index, item in enumerate(value)]
    elif type(value) in (int, float, bool):
        entries = []
    else:
        entries = list(value.items())  # Preserve trusted observers and their exception identity.
    indices, rest = [], []
    for key, item in entries:
        if type(key) is not str:
            raise TypeError("Trusted trace operand keys must be strings.")
        index = (bool(key) and len(key) <= 10 and all(c in "0123456789" for c in key)
                 and (key == "0" or key[0] != "0") and int(key) < 4294967295)
        (indices if index else rest).append((key, item))
    return sorted(indices, key=lambda pair: int(pair[0])) + rest


class _PublicTrace:
    """Frozen observer container, mutable collector, immutable saved frames."""
    __slots__ = ("outputs", "steps", "_ids")

    def __init__(self):
        object.__setattr__(self, "outputs", {})
        object.__setattr__(self, "steps", [])
        object.__setattr__(self, "_ids", set())

    def __setattr__(self, name, value):
        raise TypeError("Frozen trace observer.")

    def __delattr__(self, name):
        raise TypeError("Frozen trace observer.")

    def add(self, identifier, label, equation, explanation, inputs, outputs):
        if type(identifier) is not str or not identifier or identifier in self._ids:
            raise NumericalFault("INVALID_INPUT", "Trace IDs must be nonempty and unique.")
        before = {key: _numeric(value, identifier + ".inputs." + key) for key, value in _trace_entries(inputs)}
        after = {key: _numeric(value, identifier + ".outputs." + key) for key, value in _trace_entries(outputs)}
        if len(self.steps) >= 512:
            raise NumericalFault("UNSUPPORTED_SIZE", "At most 512 operations are supported.")
        frame = _freeze(dict(id=identifier, label=label, equation=equation, explanation=explanation,
                             inputs=before, outputs=after))
        self.steps.append(frame)
        self._ids.add(identifier)
        for key, value in after.items():
            alias = identifier + "_" + key
            # The actual ordinary JS object ignores numeric assignments to its inherited setter.
            if alias != "__proto__":
                self.outputs[alias] = value


_STAT_FIELDS = ("sum", "mean", "centered0", "centered1", "square0", "square1", "squareSum",
                "variance", "variancePlusEpsilon", "denominator")


def _tensor(identifier, shape, axes, values, provenance, dtype="float64"):
    return dict(id=identifier, shape=list(shape), axes=list(axes), dtype=dtype, values=list(values),
                provenance=provenance, precision=0 if dtype == "int32" else 8)


def _native_tensors(prefix, natives):
    return [
        _tensor(prefix + "_NativeArguments", [len(natives), 2], ["Native", "NativeField"],
                [value for leaf in natives for value in (leaf["input"], leaf["output"])],
                "Ordered actual native input,output words; IDs and kinds are recorded in texts.nativeIds and texts.nativeKinds. No native evaluation occurs while serializing."),
        _tensor(prefix + "_NativeKinds", [len(natives)], ["Native"],
                [0 if leaf["kind"] == "sqrt" else 1 for leaf in natives],
                "Native kind codes in native occurrence order: sqrt=0, exp=1.", "int32"),
    ]


def _native_texts(natives):
    return dict(nativeIds=[leaf["id"] for leaf in natives], nativeKinds=[leaf["kind"] for leaf in natives],
                nativeFields=["input", "output"])


def _norm_binding(mechanism, captures, trace, prefix, stage):
    T = len(mechanism["input"]) // 2
    private = prefix + ("_ln1" if stage == 1 else "_ln2")
    public = prefix + f"_n{stage}"
    statistics, centered, normalized = [], [], []
    for t in range(T):
        before, after = captures[f"{private}_{t}_statistics"]
        trace.add(f"{public}_0_{t}_statistics", f"0_{t}: feature-only mean and population variance",
                  "sum=x0+x1; mean=sum/2; centered=x-mean; squareSum=centered0²+centered1²; variance=squareSum/2; denominator=sqrt(variance+epsilon)",
                  "Only these two features contribute. Epsilon is inside the square root; no batch or token statistics are mixed.",
                  dict(before), dict(after))
        statistics.extend(after[key] for key in _STAT_FIELDS)
        centered.extend((after["centered0"], after["centered1"]))
        for d in range(2):
            before, after = captures[f"{private}_{t}_feature_{d}"]
            trace.add(f"{public}_0_{t}_feature_{d}", f"0_{t}: affine feature {d}",
                      "normalized=source/denominator; scaled=gamma*normalized; value=scaled+beta",
                      "The source is the saved centered feature. Gamma and beta may change output mean and variance.",
                      dict(d=d, **before), dict(after))
            normalized.append(after["normalized"])
    shape, axes = [1, T, 2], ["B", "T", "D"]
    return [
        _tensor(public + "_Gamma", [2], ["D"], [1.0, 1.0], "Shared literal feature scales [1,1]."),
        _tensor(public + "_Beta", [2], ["D"], [0.0, 0.0], "Shared literal feature offsets [+0,+0]."),
        _tensor(public + "_Statistics", [1, T, 10], ["B", "T", "NormStatistic"], statistics,
                "Actual sum,mean,centered0,centered1,square0,square1,squareSum,variance,variancePlusEpsilon,denominator in token order."),
        _tensor(public + "_Centered", shape, axes, centered, "Actual saved input feature minus feature mean, before division."),
        _tensor(public + "_Normalized", shape, axes, normalized, "Actual centered/denominator words before gamma multiplication and beta addition."),
        _tensor(public + "_Output", shape, axes, mechanism[f"norm{stage}"], "Actual per-position feature LayerNorm affine output; gamma=[1,1], beta=[0,0], epsilon=1/4."),
    ]


def _block_natives(captured, prefix, T):
    names = {f"{prefix}_ln1_{t}_sqrt": f"{prefix}_n1_0_{t}_sqrt" for t in range(T)}
    names[prefix + "_attention_sqrt"] = prefix + "_attn_sqrt"
    for i in range(T):
        for j in range(i + 1):
            names[f"{prefix}_attention_row_{i}_exp_{j}"] = f"{prefix}_attn_exp_0_0_{i}_{j}"
    names.update({f"{prefix}_ln2_{t}_sqrt": f"{prefix}_n2_0_{t}_sqrt" for t in range(T)})
    return [dict(id=names[leaf["id"]], kind=leaf["kind"], input=leaf["input"], output=leaf["output"])
            for leaf in captured]


def _residual_binding(mechanism, captures, trace, prefix, stage, left_id, right_id):
    T = len(mechanism["input"]) // 2
    identifier = prefix + ("_R1" if stage == 1 else "_Output")
    for t in range(T):
        for d in range(2):
            before, after = captures[f"{prefix}_residual{stage}_{2*t+d}"]
            trace.add(f"{prefix}_r{stage}_0_{t}_{d}", f"{identifier}[0,{t},{d}]: skip plus branch", "value=skip+branch",
                      "The unchanged same-shape primitive performs this actual feature addition. Both residuals are always on; no broadcasting or zero-gain bypass occurs.",
                      dict(b=0, t=t, d=d, skip=before["left"], branch=before["right"]), dict(after))
    return _tensor(identifier, [1, T, 2], ["B", "T", "D"],
                   mechanism["residual1" if stage == 1 else "output"],
                   f"Exact named-shape addition of {left_id} and {right_id}; no broadcasting.")


def _bind_block(features, gains, mechanism, captured, trace, prefix):
    T = len(features) // 2
    captures = {identifier: (before, after) for identifier, before, after in captured.steps}
    natives = _block_natives(captured.native, prefix, T)
    tensors = [
        _tensor(prefix + "_Features", [1, T, 2], ["B", "T", "D"], features,
                "Actual captured per-position block features; repeated token IDs do not merge positions."),
        _tensor(prefix + "_Gains", [5], ["Gain"], [gains[key] for key in _GAIN_FIELDS],
                "Actual q,k,v,o,f gain words; diagonal slots copy these words and off-diagonal slots are literal +0."),
    ]
    tensors.extend(_norm_binding(mechanism, captures, trace, prefix, 1))
    a = prefix + "_attn"
    setup = dict(B=1, T=T, H=1, Dk=2, Dv=2)
    for name in ("x000", "x001", "x010", "x011", "x020", "x021", "x100", "x101", "x110", "x111", "x120", "x121"):
        setup[name] = 0.0
    for kind in ("q", "k", "v"):
        for name in ("000", "001", "010", "011", "100", "101", "110", "111"):
            setup["w" + kind + name] = gains[kind] if name in ("000", "101") else 0.0
    setup.update(mode=1, valid0=1, valid1=1, valid2=1, shift=0.0)
    for name in ("000", "001", "010", "011", "100", "101", "110", "111"):
        setup["wo" + name] = gains["o"] if name in ("000", "011") else 0.0
    for t in range(T):
        for d in range(2):
            setup[f"x0{t}{d}"] = mechanism["norm1"][2*t+d]
    trace.add(a + "_setup", "Validate every scalar slot, then select active dimensions",
              "D=2; X[B,T,2]; WQ,WK[2,H*Dk]; WV[2,H*Dv]",
              "All inactive fields remain finite and bounded. Parameter names identify input d, head h and feature f, so changing width never relabels a head’s weights.",
              setup, dict(B=1, T=T, D=2, H=1, Dk=2, Dv=2))
    for kind in ("Q", "K", "V"):
        for t in range(T):
            for f in range(2):
                before, after = captures[f"{prefix}_{kind}_{t}_{f}"]
                trace.add(f"{a}_project_{kind}_0_{t}_0_{f}", f"{kind}[0,{t},head 0,feature {f}]: both input contributions",
                          "product0=x0*w0; product1=x1*w1; value=product0+product1",
                          "One token row times the packed column h*F+f, keeping both input-feature rows. Weights are hand-set; no bias, activation or learning is hidden.",
                          dict(b=0, t=t, h=0, f=f, **before),
                          dict(product0=after["product0"], product1=after["product1"], value=after["value"]))
    for kind in ("Q", "K", "V"):
        trace.add(f"{a}_reshape_{kind}", f"{kind}: reshape the packed feature axis",
                  "[B,T,H*F] → [B,T,H,F]; feature=h*F+f",
                  "Reshaping preserves every flat value and its order. H counts attention heads; F counts features within each head. No projection feature is dropped.",
                  dict(B=1, T=T, H=1, F=2, features=2, elements=2*T), dict(elements=2*T))
        for t in range(T):
            for f in range(2):
                before, after = captures[f"{prefix}_{kind}_split_{2*t+f}"]
                trace.add(f"{a}_permute_{kind}_0_0_{t}_{f}", f"{kind}: copy [0,{t},0,{f}] to [0,0,{t},{f}]",
                          "axes [0,2,1,3]; destination[b,h,t,f]=source[b,t,h,f]",
                          "Moving the head axis is a declared permutation, separate from reshape. The recorded offsets are actual row-major flat indices; this indexed value is copied unchanged.",
                          dict(b=0, h=0, t=t, f=f, feature=f, sourceOffset=2*t+f, destinationOffset=2*t+f, sourceValue=before["source"]), dict(after))
    for i in range(T):
        for j in range(T):
            before, after = captures[f"{prefix}_score_{i}_{j}"]
            trace.add(f"{a}_score_0_0_{i}_{j}", f"Batch 0, head 0: query {i} against key {j}",
                      "product0=q0*k0; product1=q1*k1; raw=product0+product1; score=raw/sqrt(Dk)",
                      "Matching features are multiplied inside this batch and head only. Dk, not H or T or Dv, supplies the scaling width. Signed scores are not probabilities.",
                      dict(b=0, h=0, i=i, j=j, Dk=2, divisor=before["divisor"], q0=before["q0"], k0=before["k0"], q1=before["q1"], k1=before["k1"]), dict(after))
    for i in range(T):
        before, after = captures[f"{prefix}_attention_row_{i}"]
        inputs = dict(b=0, h=0, i=i, mode=1, shift=0.0)
        inputs.update({f"score{j}": mechanism["scores"][i*T+j] for j in range(T)})
        inputs.update({f"allowed{j}": before[f"allowed{j}"] for j in range(T)})
        outputs = dict(max=after["max"], denominator=after["denominator"])
        outputs.update({f"shifted{j}": after[f"shifted{j}"] for j in range(i+1)})
        outputs.update({f"term{j}": after[f"term{j}"] for j in range(T)})
        outputs.update({f"p{j}": after[f"p{j}"] for j in range(T)})
        trace.add(f"{a}_row_0_0_{i}", f"Batch 0, head 0, query {i}: key-axis stable softmax",
                  "logit_j=score_j+shift; max=max(allowed logits); term_j=allowed_j?exp(logit_j-max):0; denominator=sum_j term_j; p_j=term_j/denominator",
                  "Each head has its own probabilities. Key validity is shared across batches and heads; queries remain. Forbidden terms are exactly zero, without an infinity sentinel or invented shifted value. Allowed terms can underflow; a large common shift can change low bits.", inputs, outputs)
    for i in range(T):
        for f in range(2):
            before, after = captures[f"{prefix}_mix_{i}_{f}"]
            outputs = {f"product{j}": after[f"product{j}"] for j in range(T)}
            outputs.update({f"running{j}": after[f"running{j}"] for j in range(T)})
            outputs["value"] = after["value"]
            trace.add(f"{a}_head_mix_0_0_{i}_{f}", f"OHeads[0,0,{i},{f}]: this head’s weighted values",
                      "product_j=p_j*v_j; running starts at 0; running_j=previous+product_j; value=last running sum",
                      "Use the real probability row and values in the same head and batch. Compute each product, then immediately accumulate in ascending key order, including actual zero times V for forbidden keys. No averaging across heads or extra division.",
                      dict(b=0, h=0, i=i, f=f, **before), outputs)
    for t in range(T):
        for f in range(2):
            before, after = captures[f"{prefix}_join_{2*t+f}"]
            trace.add(f"{a}_concat_0_{t}_0_{f}", f"Join head 0, feature {f} into C[0,{t},{f}]", "C[b,t,h*Dv+f]=OHeads[b,h,t,f]",
                      "Copy one actual head output unchanged. Concatenate in head order then within-head feature order; never average heads or mix batches.",
                      dict(b=0, t=t, h=0, f=f, concatFeature=f, sourceOffset=2*t+f, destinationOffset=2*t+f, sourceValue=before["source"]), dict(after))
    for t in range(T):
        for d in range(2):
            before, after = captures[f"{prefix}_WO_{t}_{d}"]
            inputs = dict(b=0, t=t, d=d, c0=before["x0"], w0=before["w0"], c1=before["x1"], w1=before["w1"])
            outputs = {key: after[key] for key in ("product0", "product1", "running0", "running1", "value")}
            trace.add(f"{a}_output_0_{t}_{d}", f"Y[0,{t},{d}]: explicit output projection",
                      "product_c=C_c*WO[c,d]; running starts at 0; running_c=previous+product_c; Y=last running sum",
                      "WO rows preserve named head/feature identity when Dv changes. Every joined feature contributes one recorded product and running sum. Y may be signed; no output softmax, bias, residual, dropout or normalization is added.", inputs, outputs)
    tensors.extend(_attention_tensors(mechanism, a, T))
    tensors.append(_residual_binding(mechanism, captures, trace, prefix, 1, prefix + "_Features", a + "_Y"))
    tensors.extend(_norm_binding(mechanism, captures, trace, prefix, 2))
    tensors.extend(_ffn_binding(mechanism, captures, trace, prefix, T))
    output = _residual_binding(mechanism, captures, trace, prefix, 2, prefix + "_R1", prefix + "_ffn_F")
    tensors.extend([output, *_native_tensors(prefix, natives)])
    texts = dict(**_native_texts(natives), gainFields=list(_GAIN_FIELDS), normStatisticFields=list(_STAT_FIELDS),
        featurePolicy="One batch, one to three positions, two features per position. Block output keeps B,T,D axes and feeds the next block directly; it is never a token lookup.",
        kernelPolicy="Unchanged p07 featureNorm, p06 projectHeads/attendHeads/joinHeads, p07 feedForward and sameShapeAdd perform all scalar arithmetic. All inactive attention state slots are explicit +0 except validity=1; active dimensions are B1,H1,Dk2,Dv2,mode1,shift+0. Every matrix coordinate and all three FFN hidden coordinates are computed at every gain.",
        nativePolicy="Occurrence order is LN1 sqrt by token, one sqrt(Dk), allowed attention exp by query/key, then LN2 sqrt by token. LN arguments/outputs and attention divisor/terms copy actual primitive records. Old stableSoftmax trace shifted values repeat the same subtraction of immutable logit and max operands as its exp arguments: functional reconstruction, not a physical instruction trace. Masked cells have no exp occurrence. No native math occurs in serialization.",
        zeroPolicy="Feature words, gain words, arithmetic results and every copy retain binary64 WORD, including allowed -0. Diagonal weights copy gains; every off-diagonal or inactive weight is literal +0. Dimensions, indices, mask decisions and native kind codes use VALUE.",
        limitsPolicy="Forward-only authored toy. No differentiated loss, training, optimizer, dropout, sampling, KV cache, physical timing or production-model claim. Public input features are bounded [-16,16], gains [-1,1]; epsilon=1/4, gamma=[1,1], beta=[0,0], width-three ReLU FFN.")
    return _freeze(dict(features=features, gains=gains, output=output, natives=natives, tensors=tensors, texts=texts))


def _attention_tensors(m, prefix, T):
    shape, axes = [1, T, 2], ["B", "T", "D"]
    result = [_tensor(prefix + "_X", shape, axes, m["norm1"], "Active token rows; D=2 input features always retained.")]
    for kind, feature, provenance in (
        ("Q", "QueryFeature", "Query columns packed by h*Dk+f from wq{d}{h}{f}."),
        ("K", "KeyFeature", "Key columns packed by h*Dk+f from wk{d}{h}{f}."),
        ("V", "ValueFeature", "Value columns packed by h*Dv+f from wv{d}{h}{f}.")):
        result.append(_tensor(prefix + "_W" + kind, [2, 2], ["D", feature], m["matrices"][kind.lower()], provenance))
    for kind, feature, provenance in (
        ("Q", "QueryFeature", "XWQ; each packed coordinate has two products and one sum."),
        ("K", "KeyFeature", "XWK; each packed coordinate has two products and one sum."),
        ("V", "ValueFeature", "XWV; values are projected separately from queries and keys.")):
        result.append(_tensor(prefix + "_" + kind + "Concat", shape, ["B", "T", feature], m[kind], provenance))
    for kind in ("Q", "K", "V"):
        width = "Dv" if kind == "V" else "Dk"
        result.extend([
            _tensor(prefix + "_" + kind + "Split", [1, T, 1, 2], ["B", "T", "H", width], m[kind],
                    kind + "Concat reshaped without changing flat order; feature=h*F+f."),
            _tensor(prefix + "_" + kind + "Heads", [1, 1, T, 2], ["B", "H", "T", width], m[kind],
                    kind + "Split permuted by axes [0,2,1,3]; every copied source/destination offset is traced."),
        ])
    shape, axes = [1, 1, T, T], ["B", "H", "Query", "Key"]
    for key, provenance, dtype in (
        ("raw", "Separate QHeads KHeads transpose products within every batch and head.", "float64"),
        ("scores", "raw/sqrt(Dk); the two-product order matches IV25 for H1,Dk2.", "float64"),
        ("allowed", "Causal and/or valid-key mask; shared validity across B and H; every query retained.", "bool"),
        ("logits", "Finite score+shift, including forbidden cells; mask applied separately.", "float64"),
        ("probabilities", "Stable allowed-key softmax for each B/H/query independently; forbidden probabilities exactly zero.", "float64")):
        result.append(_tensor(prefix + "_" + key, shape, axes, m[key], provenance, dtype))
    result.extend([
        _tensor(prefix + "_OHeads", [1, 1, T, 2], ["B", "H", "Query", "Dv"], m["mixed"], "Actual per-head P times VHeads; every product and running sum is traced."),
        _tensor(prefix + "_C", [1, T, 2], ["B", "T", "JoinedValue"], m["joined"], "OHeads permuted to token-major order then joined by c=h*Dv+f; values unchanged."),
        _tensor(prefix + "_WO", [2, 2], ["JoinedValue", "D"], m["matrices"]["o"], "wo{h}{f}{d} packed in h,f,d order, preserving parameter identity."),
        _tensor(prefix + "_Y", [1, T, 2], ["B", "T", "D"], m["attention"], "Y=C WO, summing products in ascending joined-feature order from zero; no normalization."),
    ])
    return result


def _ffn_binding(m, captures, trace, prefix, T):
    f = prefix + "_ffn"
    for t in range(T):
        for hidden in range(3):
            before, after = captures[f"{prefix}_ffn_hidden_{t}_{hidden}"]
            trace.add(f"{f}_hidden_0_{t}_{hidden}", f"Hidden affine [0,{t},{hidden}]",
                      "product0=x0*w0; product1=x1*w1; sum=product0+product1; preactivation=sum+bias",
                      "The same W1 and b1 apply separately to each token. Add bias after the two input products; no token sum occurs.",
                      dict(b=0, t=t, m=hidden, **before),
                      dict(product0=after["product0"], product1=after["product1"], sum=after["sum"], preactivation=after["value"]))
    for t in range(T):
        for hidden in range(3):
            before, after = captures[f"{prefix}_relu_{3*t+hidden}"]
            trace.add(f"{f}_relu_0_{t}_{hidden}", f"ReLU [0,{t},{hidden}]", "activation=max(0,preactivation)",
                      "ReLU means rectified linear unit: keep a positive value and replace a nonpositive value with zero, including zero itself.",
                      dict(b=0, t=t, m=hidden, **before), dict(after))
    for t in range(T):
        for d in range(2):
            before, after = captures[f"{prefix}_ffn_output_{t}_{d}"]
            inputs = dict(b=0, t=t, d=d)
            for hidden in range(3):
                inputs[f"h{hidden}"] = before[f"x{hidden}"]
                inputs[f"w{hidden}"] = before[f"w{hidden}"]
            inputs["bias"] = before["bias"]
            outputs = {f"product{hidden}": after[f"product{hidden}"] for hidden in range(3)}
            outputs.update({f"running{hidden}": after[f"running{hidden}"] for hidden in range(3)})
            outputs.update(sum=after["running2"], value=after["value"])
            trace.add(f"{f}_output_0_{t}_{d}", f"FFN output [0,{t},{d}]",
                      "product_m=h_m*w_m; running starts at 0; running_m=previous+product_m; sum=running2; value=sum+bias",
                      "Multiply then immediately accumulate hidden features in ascending order 0,1,2. Add b2 last. Output may be signed; there is no softmax or residual inside the FFN.", inputs, outputs)
    return [
        _tensor(f + "_W1", [2, 3], ["D", "HiddenFeature"], m["W1"], "Shared input-to-hidden weights, f1{d}{m}; M=3 hidden features."),
        _tensor(f + "_b1", [3], ["HiddenFeature"], m["b1"], "Shared hidden bias, added after the two products."),
        _tensor(f + "_Z", [1, T, 3], ["B", "T", "HiddenFeature"], m["preactivation"], "Hidden preactivations X W1+b1; no batch or token mixing."),
        _tensor(f + "_Hidden", [1, T, 3], ["B", "T", "HiddenFeature"], m["hidden"], "ReLU(Z)=max(0,Z), before the second affine layer."),
        _tensor(f + "_W2", [3, 2], ["HiddenFeature", "D"], m["W2"], "Shared hidden-to-output weights, f2{m}{d}."),
        _tensor(f + "_b2", [2], ["D"], m["b2"], "Shared output bias, added after all three running sums."),
        _tensor(f + "_F", [1, T, 2], ["B", "T", "D"], m["ffn"], "ReLU(X W1+b1) W2+b2, independently per token with shared parameters."),
    ]


def decoder_block(features, gains, trace, prefix):
    """Adopted helper, scalar FIRST plus complete metadata/copy projection."""
    features, gains = _block_inputs(features, gains, prefix)
    captured = _MechanismTrace()
    mechanism = _decoder_block_mechanics(features, gains, captured, prefix)
    return _bind_block(features, gains, mechanism, captured, trace, prefix)


def _head_binding(mechanism, captures, captured_natives, trace, prefix):
    logits, probabilities = mechanism["logits"], mechanism["probabilities"]
    maxima, shifted, terms, denominators, readout = [], [], [], [], []
    for t in range(2):
        for c in range(3):
            before, after = captures[f"{prefix}_readout_{t}_{c}"]
            trace.add(f"{prefix}_readout_{t}_{c}", f"Readout at position {t}, class {c}",
                      "product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias",
                      "Both final block features contribute through actual products for every class, including zero weights. Add that class bias last. U is hand-set, not trained.",
                      dict(t=t, c=c, x0=before["x0"], x1=before["x1"], u0=before["w0"], u1=before["w1"], bias=before["bias"]),
                      dict(product0=after["product0"], product1=after["product1"], sum=after["sum"], logit=after["value"]))
            readout.extend((after["product0"], after["product1"], after["sum"], after["value"]))
    for t in range(2):
        before, after = captures[f"{prefix}_class_row_{t}"]
        maximum = after["max"]
        maxima.append(maximum)
        trace.add(f"{prefix}_classMax_{t}", f"Stable class maximum at position {t}",
                  "max=logit0; scan class1,class2; replace only on strict greater",
                  "The maximum is selected from the actual saved logits. Class order is a,b,EOS with ascending IDs 97,98,512.",
                  {f"logit{c}": logits[3*t+c] for c in range(3)}, dict(max=maximum))
        for c in range(3):
            argument, term = after[f"shifted{c}"], after[f"term{c}"]
            shifted.append(argument)
            terms.append(term)
            trace.add(f"{prefix}_classExp_{t}_{c}", f"Stable class exponential at position {t}, class {c}",
                      "shifted=logit-max; term=exp(shifted)",
                      "Save the exact argument and output at this native exp call. The argument is nonpositive; there is no logarithm or hidden loss.",
                      dict(logit=logits[3*t+c], max=maximum), dict(shifted=argument, term=term))
        for c in range(3):
            previous = 0.0 if c == 0 else after[f"running{c-1}"]
            trace.add(f"{prefix}_classSum_{t}_{c}", f"Ordered class denominator at position {t}, class {c}", "sum=previous+term",
                      "Start from literal +0 and immediately add terms in class order 0,1,2. Keep this actual running sum; do not simplify equal terms.",
                      dict(previous=previous, term=after[f"term{c}"]), dict(sum=after[f"running{c}"]))
        denominators.append(after["denominator"])
        for c in range(3):
            trace.add(f"{prefix}_classProbability_{t}_{c}", f"Class probability at position {t}, class {c}", "probability=term/denominator",
                      "Divide the saved class term by the final saved ordered denominator. Display rounding is never an operand.",
                      dict(term=after[f"term{c}"], denominator=after["denominator"]), dict(probability=probabilities[3*t+c]))
        winner = mechanism["winners"][t]
        inputs = {f"logit{c}": logits[3*t+c] for c in range(3)}
        inputs.update({f"probability{c}": probabilities[3*t+c] for c in range(3)})
        trace.add(f"{prefix}_argmax_{t}", f"Greedy recommendation from position {t}",
                  "index=first maximum logit; tokenId=IDS[index]; probability=probabilities[index]",
                  "Strict-greater scanning retains the smallest actual token ID on an exact logit tie. This row recommends the next token after this observed prefix; it does not append it.",
                  inputs, dict(index=winner["index"], tokenId=winner["token"], probability=winner["probability"]))
    natives = []
    for leaf in captured_natives:
        # Only readout leaves are supplied; each name is a direct occurrence copy.
        suffix = leaf["id"].removeprefix(prefix + "_class_row_")
        t, c = suffix.split("_exp_")
        natives.append(dict(id=f"{prefix}_readout_exp_{t}_{c}", kind=leaf["kind"], input=leaf["input"], output=leaf["output"]))
    return dict(readout=readout, maxima=maxima, shifted=shifted, terms=terms, denominators=denominators, natives=natives)


def evaluate_decoder(value, trace, prefix):
    """All actual scalar values are captured before metadata projection."""
    state = decoder_state(value)
    _prefix(prefix)
    captured = _MechanismTrace()
    mechanism = _evaluate_decoder_mechanics(state, captured, prefix)
    captures = {identifier: (before, after) for identifier, before, after in captured.steps}
    for t in range(2):
        token_id = state[f"token{t}"]
        row = _IDS.index(token_id)
        for d in range(2):
            before, after = captures[f"{prefix}_position_{t}_{d}"]
            trace.add(f"{prefix}_embedding_{t}_{d}", f"Observed position {t}, feature {d}: lookup then add position", "feature=embedding+position",
                      "Look up this observed token ID in the authored E table and add the displayed absolute-position coordinate. An observed EOS has its explicit zero row; no token is generated or silently stopped.",
                      dict(t=t, d=d, tokenId=token_id, row=row, embedding=before["embedding"], position=before["position"]), dict(feature=after["value"]))
    blocks = []
    for layer in (1, 2):
        block_prefix = prefix + f"_block{layer}"
        block_capture = _MechanismTrace()
        block_capture.steps = [frame for frame in captured.steps if frame[0].startswith(block_prefix + "_")]
        block_capture.native = [leaf for leaf in captured.native if leaf["id"].startswith(block_prefix + "_")]
        m = mechanism[f"block{layer}"]
        gains = {key: state[key + str(layer)] for key in _GAIN_FIELDS}
        blocks.append(_bind_block(m["input"], gains, m, block_capture, trace, block_prefix))
    block1, block2 = blocks
    head = _head_binding(mechanism, captures, [leaf for leaf in captured.native if leaf["id"].startswith(prefix + "_class_row_")], trace, prefix)
    natives = [*block1["natives"], *block2["natives"], *head["natives"]]
    indices = [winner["index"] for winner in mechanism["winners"]]
    ids = [winner["token"] for winner in mechanism["winners"]]
    selected = [winner["probability"] for winner in mechanism["winners"]]
    tensors = _evaluation_tensors(state, mechanism, block1, block2, head, natives, prefix, indices, ids, selected)
    texts = _evaluation_texts(natives)
    return _freeze(dict(state=state, features=mechanism["features"], block1=block1, block2=block2,
                        logits=mechanism["logits"], probabilities=mechanism["probabilities"], argmaxIndices=indices,
                        argmaxIds=ids, selectedProbabilities=selected, nextTokenId=ids[1], nextTokenProbability=selected[1],
                        natives=natives, tensors=tensors, texts=texts))


def _evaluation_tensors(state, m, block1, block2, head, natives, p, indices, ids, selected):
    return [
        _tensor(p + "_Raw", [16], ["RawField"], [state[key] for key in _FIELDS], "Captured raw16 in declared field order; token0/token1 cells are integer VALUE, all other cells binary64 WORD."),
        _tensor(p + "_TokenIds", [1, 2], ["B", "T"], [state["token0"], state["token1"]], "Both observed input token IDs; EOS is an ordinary explicit lookup row here.", "int32"),
        _tensor(p + "_VocabularyIds", [3], ["Vocab"], _IDS, "Class order and strict-tie ID order: a=97,b=98,EOS=512.", "int32"),
        _tensor(p + "_E", [3, 2], ["Vocab", "D"], [1.0, 0.0, 0.0, 1.0, 0.0, 0.0], "Authored embedding rows [1,0],[0,1],[0,0] for a,b,EOS."),
        _tensor(p + "_Positions", [1, 2, 2], ["B", "T", "D"], m["positions"], "Literal P0=[+0,+0], P1=[+0,positionScale]; disclosed absolute position addition."),
        _tensor(p + "_Embeddings", [1, 2, 2], ["B", "T", "D"], m["embedding"], "Actual E lookup copies before position addition."),
        _tensor(p + "_Features", [1, 2, 2], ["B", "T", "D"], m["features"], "Actual lookup plus position sums; first block input, retained on its residual skip."),
        *block1["tensors"], *block2["tensors"],
        _tensor(p + "_U", [2, 3], ["D", "Vocab"], m["U"], "Authored feature-last readout rows [1,0,0],[0,1,0]."),
        _tensor(p + "_Bias", [3], ["Vocab"], m["bias"], "Actual biasA,biasB,biasEOS words, added after both feature products."),
        _tensor(p + "_Readout", [1, 2, 3, 4], ["B", "T", "Vocab", "ReadoutField"], head["readout"], "Actual product0,product1,sum,logit per position and class."),
        _tensor(p + "_Logits", [1, 2, 3], ["B", "T", "Vocab"], m["logits"], "Actual final readout logits before stable class softmax."),
        _tensor(p + "_ClassMaxima", [1, 2], ["B", "T"], head["maxima"], "Actual selected maximum logit per observed position."),
        _tensor(p + "_ClassShifted", [1, 2, 3], ["B", "T", "Vocab"], head["shifted"], "Actual direct exp arguments, each saved once as logit minus row maximum."),
        _tensor(p + "_ClassTerms", [1, 2, 3], ["B", "T", "Vocab"], head["terms"], "Actual native exp outputs; no log native exists in this family."),
        _tensor(p + "_ClassDenominators", [1, 2], ["B", "T"], head["denominators"], "Final ordered +0 then term0,term1,term2 running sums."),
        _tensor(p + "_Probabilities", [1, 2, 3], ["B", "T", "Vocab"], m["probabilities"], "Actual term/final denominator probabilities at every observed position."),
        _tensor(p + "_ArgmaxIndices", [1, 2], ["B", "T"], indices, "Smallest class index on exact actual-logit ties.", "int32"),
        _tensor(p + "_ArgmaxIds", [1, 2], ["B", "T"], ids, "Actual selected token IDs in observed-position order.", "int32"),
        _tensor(p + "_SelectedProbabilities", [1, 2], ["B", "T"], selected, "Unchanged copies of the actual selected class probabilities."),
        *_native_tensors(p, natives),
    ]


def _evaluation_texts(natives):
    return dict(**_native_texts(natives), rawFields=list(_FIELDS), vocabularyLabels=["a", "b", "EOS"],
        gainFields=list(_GAIN_FIELDS), normStatisticFields=list(_STAT_FIELDS), readoutFields=["product0", "product1", "sum", "logit"],
        inputPolicy="Exact own-data raw16 on a plain/null-prototype object: all descriptors, then all actual finite numbers, then domains in raw order, then ASCII prefix. Tokens are integer members {97,98,512}; positionScale [0,1]; ten gains [-1,1]; three biases [-2,2]. No coercion, clamping, partial defaults or skipped inactive computation.",
        architecturePolicy="B1,T2,D2,H1,Dk2,Dv2. Look up both observed IDs, add absolute positions, compute two distinct pre-norm causal blocks on actual per-position features, then compute all three readout logits and class probabilities at both positions. Block2 consumes block1 output words, never token IDs or re-embedded values.",
        headPolicy="U rows [1,0,0],[0,1,0]; each logit uses two products, sum, bias last. Stable class softmax saves exp arguments/outputs, ordered +0 term sum and divisions. Greedy strict-greater scan over ascending IDs keeps the smallest token ID on exact logit ties. Only the last observed row supplies nextTokenId and nextTokenProbability; no token is appended.",
        nativePolicy="Both complete block-native ledgers precede output-head exp occurrences in token/class order. LN sqrt and attention sqrt(Dk) save actual outputs. Old attention shifted arguments repeat the identical immutable-operand subtraction used internally by stableSoftmax: functional word reconstruction, not a physical instruction trace. Output-head exp arguments are captured directly. No log, sin, cos or native call during serialization.",
        numericPolicy="Separate finite binary64 scalar operations retain primitive order without contraction or reassociation. Every numeric operand/result/copy uses WORD including admitted -0, except explicit token IDs, indices, dimensions, mask decisions, kind codes and counts use VALUE. Display precision8 is presentation only. Root Raw token cells are VALUE and its other fourteen cells are WORD.",
        nativeAdmissionPolicy="Declared future independent policy: positive finite sqrt outputs with argument [1/4,4096] and exp outputs with argument [-256,0], at most four ordered binary64 word steps from an independently isolated RN-even reference. Admit each complete TS/canonical record separately, then require exact scalar/copy words inside it. This is neither bit-exact libm parity nor validation evidence.",
        limitsPolicy="Authored forward-only toy with hand-set embeddings, gains, norms, FFN and readout. Two blocks are neither two generated tokens nor two optimizer steps. An observed EOS is an input embedding; generated-EOS stopping is not implemented. No loss, gradient, training, sampling, cache, latency, production intelligence or physical-trace claim. Runtime validation remains deferred under the FluxGeo hold.",
        provenance="Owner-chosen IV59 toy within the human full-book source authorization; these concrete model choices are not attributed to the human or the dossier. No external model or dataset.")


def _check_native_copies(natives, tensors, texts, frames, prefix):
    if not __debug__:
        raise RuntimeError("Explicit native-copy self-check refuses optimized Python (-O).")
    import struct

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

    table = {record["id"]: record for record in tensors}
    arguments = table[prefix + "_NativeArguments"]["values"]
    kinds = table[prefix + "_NativeKinds"]["values"]
    assert texts["nativeFields"] == ["input", "output"]
    assert texts["nativeIds"] == [leaf["id"] for leaf in natives]
    assert texts["nativeKinds"] == [leaf["kind"] for leaf in natives]
    assert len(arguments) == 2 * len(natives) and len(kinds) == len(natives)
    for n, leaf in enumerate(natives):
        assert tuple(leaf) == ("id", "kind", "input", "output")
        assert word(arguments[2*n]) == word(leaf["input"])
        assert word(arguments[2*n+1]) == word(leaf["output"])
        assert kinds[n] == (0 if leaf["kind"] == "sqrt" else 1)
        identifier = leaf["id"]
        if leaf["kind"] == "sqrt" and "_attn_sqrt" not in identifier:
            statistics_id = identifier.removesuffix("_sqrt") + "_statistics"
            frame = frames[statistics_id]
            assert word(leaf["input"]) == word(frame["outputs"]["variancePlusEpsilon"])
            assert word(leaf["output"]) == word(frame["outputs"]["denominator"])
            norm_prefix, t = identifier.removesuffix("_sqrt").rsplit("_0_", 1)
            row = table[norm_prefix + "_Statistics"]["values"][10*int(t):10*int(t)+10]
            assert word(row[8]) == word(leaf["input"]) and word(row[9]) == word(leaf["output"])
            for d in range(2):
                copied = frames[f"{norm_prefix}_0_{t}_feature_{d}"]["inputs"]["denominator"]
                assert word(copied) == word(leaf["output"])
        elif leaf["kind"] == "sqrt":
            attention = identifier.removesuffix("_sqrt")
            assert leaf["input"] == 2.0
            for key, frame in frames.items():
                if key.startswith(attention + "_score_"):
                    assert word(frame["inputs"]["Dk"]) == word(leaf["input"])
                    assert word(frame["inputs"]["divisor"]) == word(leaf["output"])
        elif "_readout_exp_" in identifier:
            evaluation, coordinates = identifier.split("_readout_exp_")
            t, c = (int(index) for index in coordinates.split("_"))
            frame = frames[f"{evaluation}_classExp_{t}_{c}"]
            assert word(frame["outputs"]["shifted"]) == word(leaf["input"])
            assert word(frame["outputs"]["term"]) == word(leaf["output"])
            assert word(table[evaluation + "_ClassShifted"]["values"][3*t+c]) == word(leaf["input"])
            assert word(table[evaluation + "_ClassTerms"]["values"][3*t+c]) == word(leaf["output"])
            assert word(frames[f"{evaluation}_classSum_{t}_{c}"]["inputs"]["term"]) == word(leaf["output"])
            assert word(frames[f"{evaluation}_classProbability_{t}_{c}"]["inputs"]["term"]) == word(leaf["output"])
        else:
            attention, coordinates = identifier.split("_exp_0_0_")
            i, j = (int(index) for index in coordinates.split("_"))
            frame = frames[f"{attention}_row_0_0_{i}"]
            assert frame["inputs"][f"allowed{j}"] == 1
            assert word(frame["outputs"][f"shifted{j}"]) == word(leaf["input"])
            assert word(frame["outputs"][f"term{j}"]) == word(leaf["output"])


def check_public():
    """Explicit complete helper/native/copy checks; not an independent oracle."""
    if not __debug__:
        raise RuntimeError("Explicit public-helper self-check refuses optimized Python (-O).")
    import struct

    def words(values):
        return [struct.pack(">d", value) for value in values]

    ordered = decoder_trace()
    operands = {"2": -0.0, "1": 1.0, "01": 2.0, "4294967295": 3.0, "4294967294": 4.0}
    ordered.add("order", "", "", "", operands, operands)
    expected_keys = ["1", "2", "4294967294", "01", "4294967295"]
    assert list(ordered.steps[0]["inputs"]) == list(ordered.steps[0]["outputs"]) == expected_keys
    assert list(ordered.outputs) == ["order_" + key for key in expected_keys]
    assert words([ordered.steps[0]["inputs"]["2"]]) == words([-0.0])
    reused = decoder_trace()
    reused.add("frozen", "", "", "", ordered.steps[0]["inputs"], ordered.steps[0]["outputs"])
    assert list(reused.steps[0]["inputs"]) == expected_keys
    assert words(reused.steps[0]["inputs"].values()) == words(ordered.steps[0]["inputs"].values())
    proto = decoder_trace()
    proto.add("__proto", "", "", "", {}, {"_": 1.0})
    assert proto.outputs == {} and proto.steps[0]["outputs"] == {"_": 1.0}
    proto.add("ordinary", "", "", "", {}, {"__proto__": 2.0})
    assert proto.outputs == {"ordinary___proto__": 2.0}
    large = decoder_trace()
    large.add("large", "", "", "", {"x": 2**53 + 1, "y": 10**300}, {"z": -0.0})
    assert words(large.steps[0]["inputs"].values()) == words([9007199254740992.0, 1e300])
    for huge in (10**400, -(10**400)):
        for side in ("inputs", "outputs"):
            try:
                large.add("bad", "", "", "", {"x": huge} if side == "inputs" else {}, {"x": huge} if side == "outputs" else {})
            except NumericalFault as error:
                assert error.code == "NONFINITE" and str(error) == "bad." + side + ".x must be an actual finite number."
            else:
                raise AssertionError("Huge trace integer must fail before conversion.")
    assert len(large.steps) == 1

    gains = dict(q=-0.0, k=0.5, v=-1.0, o=0.0, f=0.0)
    for T, frame_count, alias_count, native_count in ((1, 42, 127, 4), (2, 82, 266, 8), (3, 124, 426, 13)):
        features = [16.0, -16.0] * T
        trace = decoder_trace()
        block = decoder_block(features, gains, trace, "bounded")
        assert tuple(block) == ("features", "gains", "output", "natives", "tensors", "texts")
        assert len(trace.steps) == frame_count and len(trace.outputs) == alias_count
        assert len(block["tensors"]) == 47 and len(block["natives"]) == native_count
        assert len(block["texts"]) == 10 and tuple(block["gains"]) == _GAIN_FIELDS
        assert block["output"]["id"] == "bounded_Output"
        assert block["output"] == block["tensors"][44]
        assert words(block["output"]["values"]) == words(features)
        assert words(block["features"]) == words(features)
        features[0] = 3.0
        assert block["features"][0] == 16.0
        table = {record["id"]: record for record in block["tensors"]}
        frames = {frame["id"]: frame for frame in trace.steps}
        assert len(table) == 47 and len(frames) == frame_count
        assert tuple(block["texts"]) == ("nativeIds", "nativeKinds", "nativeFields", "gainFields", "normStatisticFields",
                                         "featurePolicy", "kernelPolicy", "nativePolicy", "zeroPolicy", "limitsPolicy")
        for record in block["tensors"]:
            assert tuple(record) == ("id", "shape", "axes", "dtype", "values", "provenance", "precision")
            assert len(record["shape"]) == len(record["axes"])
            assert record["precision"] == (0 if record["dtype"] == "int32" else 8)
        mask = table["bounded_attn_allowed"]
        assert mask["dtype"] == "bool" and mask["precision"] == 8
        assert mask["values"] == [j <= i for i in range(T) for j in range(T)]
        assert all(type(value) is bool for value in mask["values"])
        assert words(table["bounded_attn_WQ"]["values"]) == words([-0.0, 0.0, 0.0, -0.0])
        for stage in (1, 2):
            p = f"bounded_n{stage}"
            for t in range(T):
                statistics = frames[f"{p}_0_{t}_statistics"]["outputs"]
                assert words(table[p + "_Statistics"]["values"][10*t:10*t+10]) == words(statistics.values())
                for d in range(2):
                    frame = frames[f"{p}_0_{t}_feature_{d}"]
                    assert words([frame["inputs"]["source"]]) == words([table[p + "_Centered"]["values"][2*t+d]])
                    assert words([frame["outputs"]["normalized"]]) == words([table[p + "_Normalized"]["values"][2*t+d]])
                    assert words([frame["outputs"]["value"]]) == words([table[p + "_Output"]["values"][2*t+d]])
        for i in range(T):
            row = frames[f"bounded_attn_row_0_0_{i}"]["outputs"]
            for j in range(T):
                probability = table["bounded_attn_probabilities"]["values"][i*T+j]
                assert words([probability]) == words([row[f"p{j}"]])
                if j > i:
                    assert f"shifted{j}" not in row
                    assert words([probability, row[f"term{j}"]]) == words([0.0, 0.0])
            for d in range(2):
                mixed = frames[f"bounded_attn_head_mix_0_0_{i}_{d}"]["outputs"]["value"]
                assert words([mixed]) == words([table["bounded_attn_OHeads"]["values"][2*i+d]])
                assert words([mixed]) == words([table["bounded_attn_C"]["values"][2*i+d]])
                for suffix, source in (("r1", "R1"), ("r2", "Output")):
                    assert words([frames[f"bounded_{suffix}_0_{i}_{d}"]["outputs"]["value"]]) == words([table["bounded_" + source]["values"][2*i+d]])
            for hidden in range(3):
                index = 3*i+hidden
                assert words([frames[f"bounded_ffn_hidden_0_{i}_{hidden}"]["outputs"]["preactivation"]]) == words([table["bounded_ffn_Z"]["values"][index]])
                assert words([frames[f"bounded_ffn_relu_0_{i}_{hidden}"]["outputs"]["activation"]]) == words([table["bounded_ffn_Hidden"]["values"][index]])
        for frame in trace.steps:
            assert tuple(frame) == ("id", "label", "equation", "explanation", "inputs", "outputs")
            for key, value in frame["outputs"].items():
                assert words([value]) == words([trace.outputs[frame["id"] + "_" + key]])
        _check_native_copies(block["natives"], block["tensors"], block["texts"], frames, "bounded")
        try:
            block["output"]["values"][0] = 0.0
        except TypeError:
            pass
        else:
            raise AssertionError("Saved tensor must be immutable.")

    trace = decoder_trace()
    evaluated = evaluate_decoder(DEFAULT_IV59, trace, "observed")
    assert tuple(evaluated) == ("state", "features", "block1", "block2", "logits", "probabilities", "argmaxIndices", "argmaxIds",
                                "selectedProbabilities", "nextTokenId", "nextTokenProbability", "natives", "tensors", "texts")
    assert len(trace.steps) == 196 and len(trace.outputs) == 592
    assert len(evaluated["tensors"]) == 115 and len(evaluated["texts"]) == 16
    assert sum(len(record["values"]) for record in evaluated["tensors"]) == 640
    assert words(evaluated["block2"]["features"]) == words(evaluated["block1"]["output"]["values"])
    assert evaluated["argmaxIds"] == [97, 97]
    assert evaluated["nextTokenId"] == evaluated["argmaxIds"][1]
    assert words([evaluated["nextTokenProbability"]]) == words([evaluated["selectedProbabilities"][1]])
    frames = {frame["id"]: frame for frame in trace.steps}
    _check_native_copies(evaluated["natives"], evaluated["tensors"], evaluated["texts"], frames, "observed")
    assert [frame["id"] for frame in trace.steps if "_readout_" in frame["id"]] == [f"observed_readout_{t}_{c}" for t in range(2) for c in range(3)]
    assert next(i for i, frame in enumerate(trace.steps) if "_classMax_" in frame["id"]) > next(i for i, frame in enumerate(trace.steps) if frame["id"] == "observed_readout_1_2")

    # A fabricated logit row isolates strict-FIRST head max, even if unreachable by a particular preset.
    for first, second in ((-0.0, 0.0), (0.0, -0.0)):
        capture = _MechanismTrace()
        _softmax([first, second, -1.0], [True]*3, capture, "head", positive_zero=False)
        assert words([capture.steps[0][2]["max"]]) == words([first])
    # Serialization must consume captures even when native evaluation is disabled.
    source = [1.0, 0.0, 1.0, 0.5]
    capture = _MechanismTrace()
    mechanism = _decoder_block_mechanics(source, gains, capture, "serialized")
    saved_sqrt, saved_exp = math.sqrt, math.exp
    def forbidden(argument):
        raise AssertionError("Native evaluation during serialization.")
    try:
        math.sqrt = math.exp = forbidden
        projected = _bind_block(source, gains, mechanism, capture, decoder_trace(), "serialized")
        assert len(projected["tensors"]) == 47
    finally:
        math.sqrt, math.exp = saved_sqrt, saved_exp

5. Actual text-to-output composition — code/python/p15/capstone_reference.py

Read raw admission, once-only preparation, full forwards, stop dispositions and saved-record projection. Each forward writes positioned features into a real NumPy array and reads those indexed values into block 1. A second fresh array receives the actual block-1 output and its indexed values feed block 2. These two consumed handoffs are additional to the two unchanged block-result arrays. Position is not added again between blocks; no BLAS reduction replaces scalar arithmetic. The final selected tail is decoded without another forward.

Public projection copies saved scalar, codec and native evidence after private computation; it does not recompute floating arithmetic or native functions for display. The canonical record must undergo independent admission of its own native leaves. Host Python and browser native functions are not assumed to produce identical words. A displayed source panel alone does not establish parity or independent admission of an actual record.

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.

"""IV66 independent scalar/codec FIRST with signed actual public bindings.

SOURCE ONLY: every check UNRUN. Ordinary queries invoke no explicit checks.
The signed two-block model is computed privately before any public observer.
NumPy is ordinary indexed storage, never a contraction or arithmetic backend.
"""
import importlib.util
import math
from pathlib import Path
import sys
from types import CodeType, FunctionType, ModuleType


_CACHE_NAMES = ("_book_iv66_capstone", "_book_iv66_generic59", "_book_iv66_codec39")
_SOURCE_CERTIFICATES = {}


def _membership(snapshot, owned):
    additions = dict(owned)
    for name, present, incumbent in snapshot:
        expected_present = present or name in additions
        expected = additions[name] if name in additions else incumbent
        if (name in sys.modules) != expected_present or (expected_present and sys.modules[name] is not expected):
            raise ImportError("IV66 cache membership changed before or during loading.")


def _source_defaults(function, path, name):
    # shortcut: literal six-file defaults; update this inventory if declarations change.
    expected = {
        ("decoder_reference.py", "_two_products"): (None, 2),
        ("decoder_reference.py", "_softmax"): (True,),
        ("decoder_reference.py", "_accumulate_rows"): (None,),
        ("decoder_reference.py", "_tensor"): ("float64",),
        ("token_reference.py", "int_array"): (0, 2147483647, "integer array", 32),
        ("token_reference.py", "utf8_encode"): ("source", None),
        ("token_reference.py", "utf8_decode"): ("utf8", None),
        ("token_reference.py", "decode_byte_ids"): ("byte", None),
        ("token_reference.py", "decode_subword_ids"): ("subword", None),
        ("token_reference.py", "decode_character_ids"): ("char", None),
        ("bpe_reference.py", "dense_data"): (True,),
    }.get((path.name, name))
    actual = function.__defaults__
    if type(actual) is not type(expected) or function.__kwdefaults__ is not None:
        raise ImportError("IV66 declaring defaults/keyword defaults differ from source.")
    if expected is not None and (len(actual) != len(expected) or any(
            type(value) is not type(literal) or
            (value.hex() != literal.hex() if type(value) is float else value != literal)
            for value, literal in zip(actual, expected))):
        raise ImportError("IV66 declaring default types/values differ from source.")


def _source_aliases(module, path):
    imports = {
        "decoder_reference.py": (("math", "math", None), ("re", "re", None),
            ("MappingProxyType", "types", "MappingProxyType"), ("np", "numpy", None)),
        "token_reference.py": (("argparse", "argparse", None), ("wraps", "functools", "wraps"),
            ("json", "json", None), ("math", "math", None), ("sys", "sys", None),
            ("MappingProxyType", "types", "MappingProxyType"), ("np", "numpy", None)),
        "bpe_reference.py": (("importlib", "importlib", None), ("Path", "pathlib", "Path"),
            ("MappingProxyType", "types", "MappingProxyType"), ("np", "numpy", None)),
        "iv39.py": (("importlib", "importlib", None), ("Path", "pathlib", "Path")),
        "capstone_reference.py": (("importlib", "importlib", None), ("math", "math", None),
            ("Path", "pathlib", "Path"), ("sys", "sys", None), ("CodeType", "types", "CodeType"),
            ("FunctionType", "types", "FunctionType"), ("ModuleType", "types", "ModuleType")),
        "iv66.py": (("importlib", "importlib", None), ("json", "json", None), ("math", "math", None),
            ("Path", "pathlib", "Path"), ("sys", "sys", None), ("CodeType", "types", "CodeType"),
            ("FunctionType", "types", "FunctionType"), ("MethodType", "types", "MethodType"),
            ("ModuleType", "types", "ModuleType")),
    }
    for alias, origin, member in imports[path.name]:
        dependency = sys.modules.get(origin)
        if type(dependency) is not ModuleType or vars(dependency).get("__name__") != origin:
            raise ImportError("IV66 external dependency origin is unavailable or foreign.")
        expected = dependency if member is None else vars(dependency).get(member)
        if expected is None or vars(module).get(alias) is not expected:
            raise ImportError("IV66 imported alias differs from its actual dependency origin.")
        if alias == "importlib" and ("importlib.util" not in sys.modules
                or vars(dependency).get("util") is not sys.modules["importlib.util"]):
            raise ImportError("IV66 importlib.util dependency origin changed.")


def _certificate(module, path):
    """Bind actual source, functions, class methods and complete local namespace.

    This is an ordinary source-identity guard, not an explicit numerical check.
    Certificates live ONLY in owned66 modules; readonly modules are not stamped.
    """
    if type(module) is not ModuleType:
        raise ImportError("IV66 requires actual source modules, including on warm reuse.")
    namespace = vars(module)
    spec = namespace.get("__spec__")
    if (type(namespace.get("__file__")) is not str or Path(module.__file__).resolve() != path
            or spec is None or type(spec.origin) is not str or Path(spec.origin).resolve() != path
            or namespace.get("__name__") != spec.name or namespace.get("__loader__") is not spec.loader):
        raise ImportError("IV66 module/file/spec source identity mismatch.")
    _source_aliases(module, path)
    if path.name == "capstone_reference.py":
        support = namespace.get("_support")
        if (type(support) is not ModuleType or support.__name__ != "_book_iv66_generic59"
                or sys.modules.get("_book_iv66_generic59") is not support):
            raise ImportError("IV66 requires the actual admitted support59 module alias.")
        _certificate(support, path.with_name("decoder_reference.py"))
        if namespace.get("NumericalFault") is not vars(support).get("NumericalFault"):
            raise ImportError("IV66 fault alias must be the actual admitted support59 class.")
    elif path.name == "bpe_reference.py":
        token = namespace.get("_token")
        _certificate(token, path.with_name("token_reference.py"))
        if namespace.get("NumericalFault") is not vars(token).get("NumericalFault"):
            raise ImportError("IV66 BPE fault alias must be the actual source token class.")
    elif path.name == "iv66.py":
        reference = namespace.get("_reference")
        if sys.modules.get("_book_iv66_capstone") is not reference:
            raise ImportError("IV66 entry reference alias changed.")
        _certificate(reference, path.with_name("capstone_reference.py"))
        if (namespace.get("NumericalFault") is not vars(reference).get("NumericalFault")
                or namespace.get("CapstoneFault") is not vars(reference).get("CapstoneFault")):
            raise ImportError("IV66 entry fault aliases changed.")
    source = path.read_bytes()
    compiled = compile(source, str(path), "exec", dont_inherit=True)
    codes = {code.co_name: code for code in compiled.co_consts if type(code) is CodeType}
    declarations, classes = [], []
    # SOURCE declarations are required even if missing or replaced by foreign code.
    for name, code in codes.items():
        if name.startswith("<"):
            continue
        item = namespace.get(name)
        if code.co_flags & 2:
            if type(item) is not FunctionType or item.__module__ != module.__name__:
                raise ImportError("IV66 required source function is missing or foreign.")
            actual = getattr(item, "__wrapped__", None) if path.name == "iv39.py" and name == "derive_iv39" else item
            if (type(actual) is not FunctionType or actual.__code__ != code
                    or actual.__globals__ is not namespace or actual.__module__ != module.__name__
                    or actual.__closure__ is not None
                    or Path(actual.__code__.co_filename).resolve() != path):
                raise ImportError("IV66 declaring function does not match its actual source.")
            for function in (item,) if actual is item else (item, actual):
                _source_defaults(function, path, name)
                declarations.append((function, function.__code__, function.__globals__, function.__defaults__,
                    function.__kwdefaults__, function.__closure__,
                    None if function.__closure__ is None else tuple(cell.cell_contents for cell in function.__closure__),
                    function.__module__, function.__name__, function.__qualname__))
        else:
            if type(item) is not type or item.__module__ != module.__name__:
                raise ImportError("IV66 required source class is missing or foreign.")
            expected_base = {
                ("decoder_reference.py", "NumericalFault"): Exception,
                ("decoder_reference.py", "_FrozenDict"): dict,
                ("decoder_reference.py", "_FrozenList"): list,
                ("decoder_reference.py", "_MechanismTrace"): object,
                ("decoder_reference.py", "_PublicTrace"): object,
                ("token_reference.py", "NumericalFault"): ValueError,
                ("token_reference.py", "TokenTrace"): object,
                ("capstone_reference.py", "CapstoneFault"): namespace.get("NumericalFault"),
                ("iv66.py", "_JsonInputError"): ValueError,
            }.get((path.name, name))
            if expected_base is None or len(item.__bases__) != 1 or item.__bases__[0] is not expected_base:
                raise ImportError("IV66 required class bases differ from their literal source.")
            methods = {child.co_name: child for child in code.co_consts
                       if type(child) is CodeType and not child.co_name.startswith("<")}
            for key, expected in methods.items():
                method = vars(item).get(key)
                if (type(method) is not FunctionType or method.__code__ != expected
                        or method.__globals__ is not namespace or method.__module__ != module.__name__):
                    raise ImportError("IV66 required class method is missing or foreign.")
                if expected.co_freevars == ("__class__",):
                    closure = method.__closure__
                    try:
                        declaring_class = closure[0].cell_contents if closure is not None and len(closure) == 1 else None
                    except ValueError as error:
                        raise ImportError("IV66 declaring class cell is empty.") from error
                    if declaring_class is not item:
                        raise ImportError("IV66 method class cell differs from its declaring class.")
                elif expected.co_freevars or method.__closure__ is not None:
                    raise ImportError("IV66 required method has a foreign closure.")
                _source_defaults(method, path, expected.co_name)
                declarations.append((method, method.__code__, method.__globals__, method.__defaults__,
                    method.__kwdefaults__, method.__closure__,
                    None if method.__closure__ is None else tuple(cell.cell_contents for cell in method.__closure__),
                    method.__module__, method.__name__, method.__qualname__))
            if name in ("_FrozenDict", "_FrozenList"):
                aliases = (("__setitem__", "__delitem__", "clear", "pop", "popitem", "setdefault", "update", "__ior__")
                           if name == "_FrozenDict" else
                           ("__setitem__", "__delitem__", "append", "clear", "extend", "insert", "pop", "remove", "reverse", "sort", "__iadd__", "__imul__"))
                if any(vars(item).get(key) is not vars(item).get("_readonly") for key in aliases):
                    raise ImportError("IV66 frozen-container method aliases changed.")
            classes.append((item, item.__bases__, tuple(vars(item).items())))
    return (module, path, source, tuple(namespace.items()), tuple(declarations), spec, tuple(classes))


def _identity(certificate):
    module, path, source, namespace, declarations, spec, classes = certificate
    if (type(module) is not ModuleType or path.read_bytes() != source
            or type(vars(module).get("__file__")) is not str or Path(module.__file__).resolve() != path
            or module.__spec__ is not spec or spec is None or type(spec.origin) is not str
            or Path(spec.origin).resolve() != path or module.__loader__ is not spec.loader
            or module.__name__ != spec.name or tuple(vars(module)) != tuple(key for key, _ in namespace)
            or any(vars(module)[key] is not value for key, value in namespace)):
        raise ImportError("IV66 saved module/source/namespace identity changed.")
    _source_aliases(module, path)
    for cls, bases, attributes in classes:
        if (cls.__bases__ != bases or set(vars(cls)) != {key for key, _ in attributes}
                or any(vars(cls)[key] is not value for key, value in attributes)):
            raise ImportError("IV66 saved class/method identity changed.")
    for function, code, namespace, defaults, kwdefaults, closure, cells, module_name, name, qualname in declarations:
        if (function.__code__ is not code or function.__globals__ is not namespace
                or function.__module__ != module_name or function.__name__ != name or function.__qualname__ != qualname
                or function.__defaults__ is not defaults or function.__kwdefaults__ is not kwdefaults
                or function.__closure__ is not closure
                or (closure is not None and any(cell.cell_contents is not value for cell, value in zip(closure, cells)))):
            raise ImportError("IV66 saved declaring function/code identity changed.")
    return module


def _load_source(name, path, transaction):
    snapshot = tuple((key, key in sys.modules, sys.modules.get(key)) for key in _CACHE_NAMES)
    if name in sys.modules:
        incumbent = sys.modules[name]
        certificate = _SOURCE_CERTIFICATES.get(incumbent) if type(incumbent) is ModuleType else None
        if certificate is None:
            certificate = _certificate(incumbent, path)
            _SOURCE_CERTIFICATES[incumbent] = certificate
        _membership(snapshot, [])
        return _identity(certificate)
    spec = importlib.util.spec_from_file_location(name, str(path))
    _membership(snapshot, [])
    if (spec is None or spec.loader is None or spec.name != name or type(spec.origin) is not str
            or Path(spec.origin).resolve() != path):
        raise ImportError("IV66 adjacent source specification is unavailable.")
    staged = importlib.util.module_from_spec(spec)
    _membership(snapshot, [])
    if (type(staged) is not ModuleType or staged.__spec__ is not spec or staged.__name__ != name
            or type(vars(staged).get("__file__")) is not str or Path(staged.__file__).resolve() != path):
        raise ImportError("IV66 created source identity mismatch.")
    sys.modules[name] = staged
    transaction.append((name, staged))
    try:
        spec.loader.exec_module(staged)
        _membership(snapshot, [(name, staged)])
        certificate = _certificate(staged, path)
        _SOURCE_CERTIFICATES[staged] = certificate
        return _identity(certificate)
    except BaseException:
        if name in sys.modules and sys.modules[name] is staged:
            del sys.modules[name]
        raise


def _load_dependencies():
    transaction = globals().get("_IV66_TRANSACTION")
    transaction = [] if transaction is None else transaction
    start = len(transaction)
    try:
        root = Path(__file__).resolve().parent
        before = tuple((key, key in sys.modules, sys.modules.get(key)) for key in _CACHE_NAMES)
        # Reject ALL known-bad incumbents BEFORE any dependency spec/create/execute.
        for name, path in (("_book_iv66_generic59", root / "decoder_reference.py"),
                           ("_book_iv66_codec39", root.parent / "p09" / "iv39.py")):
            if name in sys.modules:
                incumbent = sys.modules[name]
                certificate = _SOURCE_CERTIFICATES.get(incumbent) if type(incumbent) is ModuleType else None
                if certificate is None:
                    certificate = _certificate(incumbent, path)
                    _SOURCE_CERTIFICATES[incumbent] = certificate
                _identity(certificate)
                if name == "_book_iv66_codec39":
                    bpe, token = incumbent._bpe, incumbent._bpe._token
                    for child, child_path in ((bpe, root.parent / "p09" / "bpe_reference.py"),
                                              (token, root.parent / "p09" / "token_reference.py")):
                        child_certificate = _SOURCE_CERTIFICATES.get(child)
                        if child_certificate is None:
                            child_certificate = _certificate(child, child_path)
                            _SOURCE_CERTIFICATES[child] = child_certificate
                        _identity(child_certificate)
                    _codec_identity(incumbent, bpe, token)
        _membership(before, [])
        support = _load_source("_book_iv66_generic59", root / "decoder_reference.py", transaction)
        codec = _load_source("_book_iv66_codec39", root.parent / "p09" / "iv39.py", transaction)
        # Old39 deliberately creates these two REAL child modules without caching them.
        bpe, token = codec._bpe, codec._bpe._token
        for module, path in ((bpe, root.parent / "p09" / "bpe_reference.py"),
                             (token, root.parent / "p09" / "token_reference.py")):
            certificate = _SOURCE_CERTIFICATES.get(module)
            if certificate is None:
                certificate = _certificate(module, path)
                _SOURCE_CERTIFICATES[module] = certificate
            _identity(certificate)
        _codec_identity(codec, bpe, token)
        return support, codec, bpe, token
    except BaseException:
        for name, module in reversed(transaction[start:]):
            if name in sys.modules and sys.modules[name] is module:
                del sys.modules[name]
        raise


def _codec_identity(codec, bpe, token):
    wrapped = codec.derive_iv39
    actual = getattr(wrapped, "__wrapped__", None)
    wrapper_codes = tuple(code for code in token.guarded.__code__.co_consts if type(code) is CodeType)
    if (codec._bpe is not bpe or bpe._token is not token or bpe.NumericalFault is not token.NumericalFault
            or type(wrapped) is not FunctionType or type(actual) is not FunctionType
            or actual.__globals__ is not vars(codec) or wrapped.__globals__ is not vars(token)
            or actual.__module__ != codec.__name__ or wrapped.__module__ != codec.__name__
            or wrapped.__code__ not in wrapper_codes or wrapped.__closure__ is None
            or len(wrapped.__closure__) != 1 or wrapped.__closure__[0].cell_contents is not actual):
        raise ImportError("IV66 requires genuine wraps-preserved readonly39 calculation identity.")


_support, _codec, _bpe, _token = _load_dependencies()
NumericalFault = _support.NumericalFault
_freeze = _support._freeze
capstone_trace = _support.decoder_trace
DEFAULT_IV66 = _freeze(dict(text="ab", merges=1, outputs=2, positionScale=.5,
    q1=1., k1=1., v1=1., o1=.5, f1=.5, q2=1., k2=1., v2=1., o2=.25, f2=.25,
    biasA=0., biasB=0., biasAB=0., biasABAB=0., biasEOS=0.))
_FIELDS = tuple(DEFAULT_IV66)
_IDS = (97, 98, 256, 257, 512)
_EMBEDDING = ((1., 0.), (0., 1.), (1., 1.), (-1., 1.), (0., 0.))
_READOUT = (1., 0., 1., -1., 0., 0., 1., 1., 1., 0.)
_BIASES = ("biasA", "biasB", "biasAB", "biasABAB", "biasEOS")


class CapstoneFault(NumericalFault):
    """Only locally modeled raw/preparation faults become public unavailable."""
    def __init__(self, code, reason):
        super().__init__(code, reason)


def _dependencies_identity():
    for certificate in _SOURCE_CERTIFICATES.values():
        _identity(certificate)
    if ("_book_iv66_generic59" not in sys.modules or sys.modules["_book_iv66_generic59"] is not _support
            or "_book_iv66_codec39" not in sys.modules or sys.modules["_book_iv66_codec39"] is not _codec):
        raise ImportError("IV66 dependency cache identity changed.")
    _codec_identity(_codec, _bpe, _token)


def capstone_state(value):
    """Raw19 only; exact same-support frozen dict, ALL finite before domains."""
    if type(value) not in (dict, _support._FrozenDict):
        raise CapstoneFault("INVALID_INPUT", "state must be a plain object.")
    keys = tuple(value)
    if (len(keys) != len(_FIELDS) or any(type(key) is not str for key in keys)
            or set(keys) != set(_FIELDS)):
        raise CapstoneFault("INVALID_INPUT", "state must have exactly " + ", ".join(_FIELDS) + " as own fields.")
    captured = {key: value[key] for key in _FIELDS}
    if type(captured["text"]) is not str:
        raise CapstoneFault("INVALID_INPUT", "text must be an actual string, without coercion.")
    for key in _FIELDS[1:]:
        item = captured[key]
        if (type(item) not in (int, float)
                or not -1.7976931348623157e308 <= item <= 1.7976931348623157e308):
            raise CapstoneFault("NONFINITE", "state." + key + " must be an actual finite number.")
    for key in _FIELDS[1:]:
        item = captured[key]
        if key in ("merges", "outputs"):
            lower, upper = (0, 2) if key == "merges" else (1, 2)
            if not lower <= item <= upper or (type(item) is float and not item.is_integer()):
                raise CapstoneFault("INVALID_INPUT", f"{key} must be an integer from {lower} to {upper}.")
        else:
            lower, upper = (0, 1) if key == "positionScale" else (-2, 2) if key.startswith("bias") else (-1, 1)
            if not lower <= item <= upper:
                raise CapstoneFault("INVALID_INPUT", f"{key} must be between {lower} and {upper}.")
    if _token.utf16_length(captured["text"]) > 2:
        raise CapstoneFault("UNSUPPORTED_SIZE", "text must contain at most 2 UTF-16 units before strict UTF-8 encoding.")
    return _freeze({key: captured[key] if key == "text" else int(captured[key]) if key in ("merges", "outputs")
                    else float(captured[key]) for key in _FIELDS})


_CODEC_FAULTS = frozenset(
    ("tokenize", "INVALID_INPUT", f"Unpaired {kind} surrogate at UTF-16 offset {offset}.")
    for kind in ("high", "low") for offset in (0, 1))

def _codec_call(stage, function, *args):
    try:
        return function(*args)
    except _token.NumericalFault as error:
        # Exact old fault only. Subtypes and unknown/resource failures retain identity.
        if (type(error) is not _token.NumericalFault or type(vars(error).get("code")) is not str
                or vars(error)["code"] != "INVALID_INPUT"
                or type(error.args) is not tuple or len(error.args) != 1 or type(error.args[0]) is not str
                or (stage, error.code, error.args[0]) not in _CODEC_FAULTS):
            raise
        raise CapstoneFault(error.code, error.args[0]) from error


def _prepare(value, prefix):
    state = capstone_state(value)
    # Match JS UTF-16 pairs while retaining lone surrogates for the strict codec fault.
    text = state["text"].encode("utf-16-le", errors="surrogatepass").decode("utf-16-le", errors="surrogatepass")
    tokenizer = _codec_call("tokenize", _codec.derive_iv39.__wrapped__, dict(corpus="abab", text=text, merges=state["merges"], eos=0))
    records = {record["id"]: record for record in tokenizer["tensors"]}

    def values(identifier):
        if identifier not in records:
            raise RuntimeError(f"IV39 did not retain required tensor {identifier}.")
        return list(records[identifier]["values"])

    source = [] if tokenizer["outputs"]["byteCount"] == 0 else values("SourceBytes")
    if len(source) > 2:
        raise CapstoneFault("UNSUPPORTED_SIZE", "The actual prompt UTF-8 encoding exceeds 2 bytes.")
    if any(byte not in (97, 98) for byte in source):
        raise CapstoneFault("UNAVAILABLE", "This hand-set capstone supports only actual a/b UTF-8 bytes.")
    if not source:
        raise CapstoneFault("UNAVAILABLE", "A nonempty prompt is required for the first observed row.")
    ids = values("TargetIDs")
    active = [True, True, state["merges"] >= 1, state["merges"] == 2, True]
    if not 1 <= len(ids) <= 2:
        raise CapstoneFault("UNSUPPORTED_SIZE", "The actual prompt must have 1 or 2 BPE token IDs.")
    if any(identifier == 512 or identifier not in _IDS or not active[_IDS.index(identifier)] for identifier in ids):
        raise CapstoneFault("UNAVAILABLE", "Every observed BPE ID must be active and have a disclosed embedding row.")
    rules = []
    if state["merges"]:
        for rank, identifier in enumerate(values("RuleIDs")):
            rules.append(dict(id=identifier, left=values("RuleLeft")[rank],
                right=values("RuleRight")[rank], bytes=values(f"Rule{identifier}Bytes")))
    if (type(prefix) is not str or not prefix or prefix[0] not in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
            or any(char not in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_" for char in prefix)):
        raise CapstoneFault("INVALID_INPUT", "prefix must start with an ASCII letter and contain only ASCII letters, digits or underscores.")
    return dict(state=state, tokenizer=tokenizer, sourceBytes=source, promptIDs=ids, rules=rules, active=active)


def _storage_handoff(values):
    stored = _support._storage(values, len(values) // 2, 2)
    consumed = [float(stored[0, t, d]) for t in range(len(values) // 2) for d in range(2)]
    return dict(input=list(values), storage=stored, consumed=consumed)


def _forward(state, ids, active, prefix):
    embedding, positions, features, coordinates = [], [], [], []
    for t, identifier in enumerate(ids):
        row = _IDS.index(identifier)
        for d in range(2):
            looked_up = _EMBEDDING[row][d]
            position = 0.0 if d == 0 else _support._finite(float(t) * state["positionScale"], "absolute position product")
            value = _support._finite(looked_up + position, "embedding plus position")
            embedding.append(looked_up)
            positions.append(position)
            features.append(value)
            coordinates.append(dict(t=t, d=d, id=identifier, row=row, embedding=looked_up,
                position=position, positionScale=state["positionScale"], value=value))
    before1 = _storage_handoff(features)
    block1_trace = capstone_trace()
    block1 = _support.decoder_block(before1["consumed"], {key: state[key + "1"] for key in ("q", "k", "v", "o", "f")}, block1_trace, prefix + "_block1")
    before2 = _storage_handoff(block1["output"]["values"])
    block2_trace = capstone_trace()
    block2 = _support.decoder_block(before2["consumed"], {key: state[key + "2"] for key in ("q", "k", "v", "o", "f")}, block2_trace, prefix + "_block2")
    capture = _support._MechanismTrace()
    bias = [state[key] for key in _BIASES]
    # All positions/all five columns FIRST, including inactive columns and zeros.
    logits = _support._two_products(block2["output"]["values"], list(_READOUT), capture, prefix + "_readout", bias, 5)
    distributions, probabilities = [], []
    for t in range(len(ids)):
        row = logits[5*t:5*t+5]
        distribution = _support._softmax(row, active, capture, f"{prefix}_class_row_{t}", positive_zero=True)
        probabilities.extend(distribution)
        distributions.append(dict(logits=list(row), probabilities=list(distribution)))
    row, distribution = logits[-5:], probabilities[-5:]
    best, candidates = None, []
    for index, identifier in enumerate(_IDS):
        before = best
        take = bool(active[index] and (best is None or row[index] > row[best]))
        if take:
            best = index
        candidates.append(dict(index=index, id=identifier, active=active[index], logit=row[index],
            probability=distribution[index], before=-1 if before is None else before, take=int(take), after=best))
    selected = dict(index=best, id=_IDS[best], logit=row[best], probability=distribution[best])
    head_ids = {f"{prefix}_class_row_{t}_exp_{c}": f"{prefix}_head_exp_{t}_{c}"
                for t in range(len(ids)) for c in range(5) if active[c]}
    natives = [*block1["natives"], *block2["natives"],
        *[dict(id=head_ids[leaf["id"]], kind=leaf["kind"], input=leaf["input"], output=leaf["output"]) for leaf in capture.native]]
    return dict(ids=list(ids), embedding=embedding, positions=positions, features=features,
        coordinates=coordinates, beforeBlock1=before1, block1=block1, block1Steps=list(block1_trace.steps),
        beforeBlock2=before2, block2=block2, block2Steps=list(block2_trace.steps),
        U=list(_READOUT), bias=bias, logits=logits, probabilities=probabilities, distributions=distributions,
        captures=list(capture.steps), candidates=candidates, selected=selected, natives=natives)


def _first(value, prefix):
    """Independent complete private capture, before public metadata projection."""
    prepared = _prepare(value, prefix)
    state, logical = prepared["state"], list(prepared["promptIDs"])
    forwards, transitions, natives = [], [], []
    for decision in range(state["outputs"]):
        forward = _forward(state, logical, prepared["active"], f"{prefix}_forward{decision}")
        forwards.append(forward)
        natives.extend(forward["natives"])
        before = list(logical)
        identifier = forward["selected"]["id"]
        logical.append(identifier)
        stop = "EOS" if identifier == 512 else "budget" if decision + 1 == state["outputs"] else "continue-full-recompute"
        transitions.append(dict(decision=decision, beforeIDs=before, afterIDs=list(logical), selected=dict(forward["selected"]),
            beforeCount=len(before), afterCount=len(logical), disposition=stop))
        if stop != "continue-full-recompute":
            break
    decode_trace = _token.TokenTrace()
    decoded = _bpe.decode_bpe_ids(logical, prepared["rules"], int(logical[-1] == 512), prefix + "_decode", decode_trace)
    return dict(prepared=prepared, state=state, forwards=forwards, transitions=transitions,
        logicalIDs=logical, natives=natives, decodeSteps=list(decode_trace.steps),
        decodedBytes=decoded["bytes"].tolist(), decoded=decoded["decoded"])


def _project(saved, trace, prefix):
    """Copy only saved scalar/codec evidence; finish snapshots before callbacks."""
    prepared, state = saved["prepared"], saved["state"]
    tokenizer, ids, allowed = prepared["tokenizer"], prepared["promptIDs"], prepared["active"]
    work, tensors, texts = capstone_trace(), [], {}
    active_indices = [c for c in range(5) if allowed[c]]
    A = len(active_indices)
    raw = {key: state[key] for key in _FIELDS[1:]}
    bias = [state[key] for key in _BIASES]
    work.add(prefix + "_setup", "Capture the bounded text-to-output computation", "one actual BPE preparation; each decision=lookup+position+block1+block2+all-position head; final real ID decode",
        "The hand-set, untrained model uses full uncached recomputation. Two blocks are not two generated tokens. No hidden service, learned answer table or compatible KV cache is present.",
        dict(utf16Units=_token.utf16_length(state["text"]), merges=state["merges"], outputs=state["outputs"]),
        dict(rawInputCount=19, numericInputCount=18, promptTokens=len(ids), activeClasses=A, requestedOutputs=state["outputs"]))
    work.add(prefix + "_raw", "Retain all eighteen captured numeric controls", "rawNumeric=raw19 without text",
        "The two counts are VALUE; every other numeric field is a binary64 WORD, including admitted signed zero. Original text is retained separately without normalization.", raw, raw)
    vocab = {}
    for c, identifier in enumerate(_IDS):
        vocab[f"id{c}"], vocab[f"allowed{c}"] = identifier, int(allowed[c])
    embedding_table = [word for row in _EMBEDDING for word in row]
    vocab.update({f"e{i}": word for i, word in enumerate(embedding_table)})
    vocab.update({f"u{i}": word for i, word in enumerate(_READOUT)})
    vocab.update({f"bias{c}": word for c, word in enumerate(bias)})
    work.add(prefix + "_vocabulary", "Declare ascending public classes and hand-set tables", "IDs=[97,98,256,257,512]; E[Vocab,D]; U[D,Vocab]; active97,98,512 plus learned merge IDs",
        "Public token IDs are distinct from compact class rows. Every class logit is computed, but inactive merge classes are neither exponentiated nor eligible for greedy selection.", vocab,
        dict(vocabularySize=5, featureWidth=2, hiddenWidth=3, blockCount=2, activeCount=A))
    tensors.extend([
        _support._tensor(prefix + "_Raw", [18], ["RawNumericField"], list(raw.values()), "Raw order excluding text; merges/outputs cells VALUE, remaining sixteen cells WORD including -0."),
        _support._tensor(prefix + "_VocabularyIds", [5], ["Vocab"], _IDS, "Ascending public IDs and exact greedy tie order: 97,98,256,257,512.", "int32"),
        _support._tensor(prefix + "_ActiveMask", [5], ["Vocab"], allowed, "True means active; merge IDs require their actual learned rank.", "bool"),
        _support._tensor(prefix + "_ActiveIndices", [A], ["ActiveClass"], active_indices, "Compact class indices of active public IDs, in full class order; maps sparse shifted-argument columns.", "int32"),
        _support._tensor(prefix + "_E", [5, 2], ["Vocab", "D"], embedding_table, "Hand-set embedding rows [1,0],[0,1],[1,1],[-1,1],[+0,+0]."),
        _support._tensor(prefix + "_U", [2, 5], ["D", "Vocab"], _READOUT, "Hand-set feature-last readout rows [1,0,1,-1,0] and [0,1,1,1,0]."),
        _support._tensor(prefix + "_Bias", [5], ["Vocab"], bias, "Captured biasA,biasB,biasAB,biasABAB,biasEOS words; inactive columns retain their real biases."),
    ])
    for frame in tokenizer["steps"]:
        work.add(prefix + "_tokenizer_" + frame["id"], frame["label"], frame["equation"], frame["explanation"], frame["inputs"], frame["outputs"])
    work.add(prefix + "_tokenizer_outputs", "Copy the whole actual tokenizer output record", "copy every actual IV39 primary summary and frame-output alias",
        "This is a copy of the one saved tokenizer result, including all byte/BPE/roundtrip evidence. No encoder, training pass or decoder is replayed for this projection.", {}, tokenizer["outputs"])
    tensors.extend(dict(record, id=prefix + "_tokenizer_" + record["id"]) for record in tokenizer["tensors"])
    texts.update({prefix + "_tokenizer_" + key: entry for key, entry in tokenizer["texts"].items()})
    selected_ids, dispositions = [], []
    for decision, forward in enumerate(saved["forwards"]):
        f, T = f"{prefix}_forward{decision}", len(forward["ids"])
        for coordinate in forward["coordinates"]:
            t, d = coordinate["t"], coordinate["d"]
            work.add(f"{f}_feature_{t}_{d}", f"Position {t}, feature {d}: actual lookup and position", "position=d=0?+0:t*positionScale; feature=embedding+position",
                "Look up the actual observed public ID, multiply its absolute position by the captured scale for feature one, then add each position coordinate once before block1. A generated terminal tail has no feature row.",
                dict(t=t, d=d, tokenId=coordinate["id"], row=coordinate["row"], embedding=coordinate["embedding"], positionScale=coordinate["positionScale"]),
                dict(position=coordinate["position"], feature=coordinate["value"]))
        for key in ("block1Steps", "block2Steps"):
            for frame in forward[key]:
                work.add(frame["id"], frame["label"], frame["equation"], frame["explanation"], frame["inputs"], frame["outputs"])
        tensors.extend([
            _support._tensor(f + "_ObservedIds", [T], ["T"], forward["ids"], "Actual complete prefix forwarded at this decision; no EOS or final pending tail is forwarded.", "int32"),
            _support._tensor(f + "_Positions", [1, T, 2], ["B", "T", "D"], forward["positions"], "Actual absolute P_t=[+0,t*positionScale] words before the first block only."),
            _support._tensor(f + "_Embeddings", [1, T, 2], ["B", "T", "D"], forward["embedding"], "Actual indexed embedding word copies in observed-position order."),
            _support._tensor(f + "_Features", [1, T, 2], ["B", "T", "D"], forward["features"], "Actual coordinate-wise E+P words, passed unchanged to block1."),
            *forward["block1"]["tensors"], *forward["block2"]["tensors"],
        ])
        for block in ("block1", "block2"):
            texts.update({f + "_" + block + "_" + key: entry for key, entry in forward[block]["texts"].items()})
        captures = {identifier: (before, after) for identifier, before, after in forward["captures"]}
        readout = []
        for t in range(T):
            for c in range(5):
                before, after = captures[f"{f}_readout_{t}_{c}"]
                work.add(f"{f}_readout_{t}_{c}", f"Readout at position {t}, class {c}", "product0=x0*u0; product1=x1*u1; sum=product0+product1; logit=sum+bias",
                    "Compute every class at every observed position, including zero products and inactive merge columns. Bias is added last; there is no reassociation or fused contraction.",
                    dict(t=t, c=c, tokenId=_IDS[c], x0=before["x0"], x1=before["x1"], u0=before["w0"], u1=before["w1"], bias=before["bias"]),
                    dict(product0=after["product0"], product1=after["product1"], sum=after["sum"], logit=after["value"]))
                readout.extend((after["product0"], after["product1"], after["sum"], after["value"]))
        maxima, shifted, terms, partials, denominators = [], [], [], [], []
        for t in range(T):
            before, after = captures[f"{f}_class_row_{t}"]
            inputs = dict(t=t)
            inputs.update({f"logit{c}": before[f"logit{c}"] for c in range(5)})
            inputs.update({f"allowed{c}": before[f"allowed{c}"] for c in range(5)})
            outputs = dict(max=after["max"])
            outputs.update({f"shifted{c}": after[f"shifted{c}"] for c in active_indices})
            outputs.update({f"term{c}": after[f"term{c}"] for c in range(5)})
            outputs.update({f"partial{c}": after[f"running{c}"] for c in range(5)})
            outputs["denominator"] = after["denominator"]
            outputs.update({f"p{c}": after[f"p{c}"] for c in range(5)})
            work.add(f"{f}_softmax_{t}", f"Active-class softmax at observed position {t}", "max=Math.max(allowed logits); term=allowed?exp(logit-max):+0; denominator=ordered +0 fold over all five terms; p=term/denominator",
                "The unchanged stableSoftmax supplies the actual terms, denominator and five divisions. Shifted arguments and denominator partials repeat the same immutable-operand operations for functional evidence, as in IV59 attention. Inactive classes have no shifted field or native occurrence; their terms and probabilities are policy +0.", inputs, outputs)
            maxima.append(after["max"])
            shifted.extend(after[f"shifted{c}"] for c in active_indices)
            terms.extend(after[f"term{c}"] for c in range(5))
            partials.extend(after[f"running{c}"] for c in range(5))
            denominators.append(after["denominator"])
        tensors.extend([
            _support._tensor(f + "_Readout", [1, T, 5, 4], ["B", "T", "Vocab", "ReadoutField"], readout, "Actual product0,product1,sum,logit at every position and all five classes."),
            _support._tensor(f + "_Logits", [1, T, 5], ["B", "T", "Vocab"], forward["logits"], "All actual logits, including inactive merge columns; only active last-row logits select."),
            _support._tensor(f + "_ClassMaxima", [1, T], ["B", "T"], maxima, "Actual Math.max over allowed logits; mixed signed zeros prefer +0."),
            _support._tensor(f + "_ClassShifted", [1, T, A], ["B", "T", "ActiveClass"], shifted, "Only executed allowed-class exp arguments, in position/ActiveIndices order; no fabricated inactive argument."),
            _support._tensor(f + "_ClassTerms", [1, T, 5], ["B", "T", "Vocab"], terms, "Actual allowed exp outputs and literal inactive +0 policy terms."),
            _support._tensor(f + "_ClassPartials", [1, T, 5], ["B", "T", "Vocab"], partials, "Functional reconstruction of identical ordered +0 term folds, including inactive zero terms; no native recomputation."),
            _support._tensor(f + "_ClassDenominators", [1, T], ["B", "T"], denominators, "Actual final ordered denominator supplied by stableSoftmax."),
            _support._tensor(f + "_Probabilities", [1, T, 5], ["B", "T", "Vocab"], forward["probabilities"], "Actual five term/denominator divisions, including inactive exact zero probabilities."),
        ])
        selected = forward["selected"]
        candidates = dict(position=T - 1)
        for candidate in forward["candidates"]:
            c = candidate["index"]
            candidates[f"logit{c}"], candidates[f"allowed{c}"], candidates[f"p{c}"] = candidate["logit"], int(candidate["active"]), candidate["probability"]
        selection = dict(index=selected["index"], tokenId=selected["id"], logit=selected["logit"], probability=selected["probability"])
        work.add(f + "_select", "Choose the actual last-row active logit maximum", "strict greater scan over ascending active public IDs; retain first on exact tie",
            "Rounded probabilities never choose the token. Inactive logits remain visible candidates with allowed=0. The chosen probability is copied from the saved actual distribution.", candidates, selection)
        transition = saved["transitions"][decision]
        selected_ids.append(selected["id"])
        eos, budget = int(transition["disposition"] == "EOS"), int(transition["disposition"] == "budget")
        before = dict(beforeCount=transition["beforeCount"], selectedId=selected["id"], requestedOutputs=state["outputs"])
        before.update({f"id{i}": identifier for i, identifier in enumerate(transition["beforeIDs"])})
        after = dict(afterCount=transition["afterCount"], decisions=len(selected_ids), eos=eos, budget=budget, continueForward=int(transition["disposition"] == "continue-full-recompute"))
        after.update({f"id{i}": identifier for i, identifier in enumerate(transition["afterIDs"])})
        disposition = ("EOS: stop before forwarding the selected control ID; it emits no bytes." if eos else
            "Budget: stop before forwarding the final pending selected ID." if budget else
            "Continue: append this actual ID without retokenization, then recompute the full observed prefix uncached.")
        dispositions.append(disposition)
        work.add(f + "_disposition", "Append the actual selected ID and decide whether another forward exists", "logicalAfter=observedBefore+[selectedId]; stop=EOS before budget; continue only when neither", disposition, before, after)
        tensors.extend([
            _support._tensor(f + "_Selection", [4], ["SelectionField"], list(selection.values()), "Actual selected class index and public ID are VALUE; selected logit and probability are unchanged WORD copies."),
            _support._tensor(f + "_AfterIds", [len(transition["afterIDs"])], ["LogicalToken"], transition["afterIDs"], "Actual complete logical IDs after this decision, including its unforwarded tail; EOS can occur only at the final tail.", "int32"),
        ])
    for frame in saved["decodeSteps"]:
        work.add(frame["id"], frame["label"], frame["equation"], frame["explanation"], frame["inputs"], frame["outputs"])
    logical, natives = saved["logicalIDs"], saved["natives"]
    tensors.extend([
        _support._tensor(prefix + "_LogicalIds", [len(logical)], ["LogicalToken"], logical, "Actual prompt plus actual selected IDs, passed once to final real BPE decoding.", "int32"),
        _support._tensor(prefix + "_SelectedIds", [len(selected_ids)], ["Decision"], selected_ids, "Actual selected public IDs in generation order, including tail EOS if selected.", "int32"),
        _support._tensor(prefix + "_DecodedBytes", [len(saved["decodedBytes"])], ["Bytes"], saved["decodedBytes"], "Actual concatenated BPE ID expansions passed to strict UTF-8 decoding, not copied from original text.", "int32"),
    ])
    native_tensor_ids = []
    for chunk, offset in enumerate(range(0, len(natives), 64)):
        leaves = natives[offset:offset + 64]
        argument_id, kind_id = f"{prefix}_NativeArguments{chunk}", f"{prefix}_NativeKinds{chunk}"
        native_tensor_ids.extend((argument_id, kind_id))
        tensors.extend([
            _support._tensor(argument_id, [len(leaves), 2], ["Native", "NativeField"], [word for leaf in leaves for word in (leaf["input"], leaf["output"])], "Contiguous global native input/output WORD copies, chunks of at most64 in nativeIds order; no native evaluation while serializing."),
            _support._tensor(kind_id, [len(leaves)], ["Native"], [0 if leaf["kind"] == "sqrt" else 1 for leaf in leaves], "Aligned VALUE native kind codes: sqrt=0, exp=1; global occurrence offset is64 times the chunk index.", "int32"),
        ])
    summary = dict(promptTokens=len(ids), decisions=len(selected_ids), forwardPasses=len(saved["forwards"]), observedTokens=T,
        logicalTokens=len(logical), decodedBytes=len(saved["decodedBytes"]), decodedUnits=_token.utf16_length(saved["decoded"]),
        eos=eos, budgetReached=budget, lastTokenId=selected["id"], lastClassIndex=selected["index"], lastLogit=selected["logit"], lastProbability=selected["probability"],
        activeClasses=A, blockCount=2, featureWidth=2, hiddenWidth=3,
        sqrtCalls=sum(leaf["kind"] == "sqrt" for leaf in natives), expCalls=sum(leaf["kind"] == "exp" for leaf in natives), nativeElementaryCalls=len(natives), frames=len(work.steps) + 1, tensorCount=len(tensors))
    work.add(prefix + "_finish", "Retain the actual decoded output and complete source counts", "copy last selection, stop disposition, actual decoded byte/unit counts and saved evidence sizes",
        "The final selected tail is decoded but never forwarded. These are source-graph counts, not measured timing, quality or hardware instruction counts. Every copied frame is retained; nothing is truncated to fit the512 limit.",
        dict(index=selected["index"], tokenId=selected["id"], logit=selected["logit"], probability=selected["probability"], decodedBytes=summary["decodedBytes"], decodedUnits=summary["decodedUnits"]), summary)
    texts.update(dict(
        input=state["text"], decoded=saved["decoded"], corpus="abab", stopReason="EOS" if eos else "budget", dispositions=dispositions,
        rawFields=list(_FIELDS), rawNumericFields=list(_FIELDS[1:]), vocabularyLabels=["a", "b", "ab", "abab", "EOS"],
        gainFields=["q", "k", "v", "o", "f"], readoutFields=["product0", "product1", "sum", "logit"], selectionFields=["index", "tokenId", "logit", "probability"],
        nativeIds=[leaf["id"] for leaf in natives], nativeKinds=[leaf["kind"] for leaf in natives], nativeFields=["input", "output"], nativeTensorIds=native_tensor_ids,
        summaryFields=list(summary),
        inputPolicy="Exact raw19 own-data plain/null-prototype record. Acquire all descriptors, inspect all, text type, all18 finite numbers, raw-order domains, outer UTF16<=2; one actual strict evaluateIV39 BPE/codec record; actual bytes<=2 before a/b alphabet, nonempty and active1..2 observed IDs; ASCII prefix last. Counts normalize -0 to +0; remaining16 numeric words preserve -0. No trimming, normalization, coercion, partial defaults or truncation.",
        architecturePolicy="Hand-set untrained E5/U5 in ascending public-ID order. Each actual forward gathers all observed IDs, adds absolute position once, then calls unchanged IV59 decoderBlock twice. Block2 consumes real block1 output words. D2,H1,Dk2,Dv2,M3,epsilon1/4. Compute all five logits and active-class distributions at every observed position.",
        headPolicy="Two separate products, direct sum and bias last for each class. Unchanged stableSoftmax uses Math.max over allowed classes, allowed-only shifted exp, literal +0 inactive terms, an ordered +0 fold over all five terms and five divisions. ClassShifted contains only active occurrences. Last-row greedy compares actual logits with strict greater over ascending active IDs, so lowest active public ID wins exact ties.",
        generationPolicy="One or two decisions unless EOS stops sooner. Append actual public ID without retokenization. Recompute full prefix only for a remaining decision. EOS wins stop precedence and is never forwarded; the final budget tail is never forwarded. Final decodeBPEIDs expands the actual complete logical stream once and strictly reconstructs its bytes. No cached engine or generated-string lookup exists.",
        nativePolicy="Forward order: complete block1 ledger, complete block2 ledger, head exp in position/active-class order. Native IDs/kinds/arguments/results and all block duplicates are retained. Shifted arguments and softmax partials are same-immutable-operand functional reconstructions, never physical instruction attestation. Serialization performs no sqrt/exp. Global native tensors use contiguous chunks<=64 to retain up to67 occurrences without violating platform dimensions.",
        nativeAdmissionPolicy="Future independent authority must bind each occurrence ID/kind/input WORD before admitting its own positive finite sqrt or exp output within four ordered binary64 words of isolated RN-even reference; sqrt input[1/4,4096], exp input[-256,0], exp(+0/-0)=+1 exactly. TS and canonical admit their own leaves; no bitwise cross-libm parity or whole-output tolerance is assumed.",
        rolePolicy="WORD: all sixteen real raw fields, E/U/bias/gains/features/positions, float arithmetic/native/logit/probability/partial results and their copies. VALUE: merges,outputs,public IDs,class/position/feature indices,dimensions,masks,flags,bytes,UTF16/scalars,rule counts/ranks,source counts. Raw float tensor cells0,1 alone are VALUE. Selection cells0,1 VALUE; cells2,3 WORD. All other float64 cells WORD, all int32/bool cells VALUE. Frame aliases inherit original roles; inactive floating policy zeros remain WORD.",
        copyPolicy="All computation and codec/scalar/native evidence is completed and snapshotted privately before publishing any external frame. Each callback receives only frozen detached six-field frames. Every tokenizer frame/tensor/text is copied once under prefix_tokenizer, and its whole actual output record is copied in one frame. All block tensors/texts survive with unique forward/block prefixes. No StepRecord.state or hidden state field is used.",
        emptyPolicy="Successful prompts/decisions/native/decoded-byte families are nonempty. At merges0, actual tokenizer rule/candidate/pass families are absent exactly as in IV39: no zero-size tensor or padding row is invented. Inactive head shifted/native occurrences are absent by policy, while full logits/terms/probabilities remain present. EOS has no byte/feature/native row.",
        closurePolicy="Static TS closure: iv66,capstone,decoder,p09 iv39/bpe/text/unicode,p06 heads,p07 components/ffn,platform numerics/trace. No loader, module cache, compatible KV cache, network, API framework, dependency change, RNG, log, sin, cos, timer, optimizer, gradient or training path is added.",
        limitsPolicy="Prompt UTF16<=2 and actual a/b bytes1..2; merges0..2; outputs1..2; forwarded T<=3; logical IDs<=4; decoded bytes<=10. Full real block and codec work stays under512 frames by the manual source-family proof in H_AUTHOR_NOTES. The older one-block/cache paper is a different model. IV60-65 variants, quantization, timings and evaluation are not computed in this run.",
        validationPolicy="SOURCE IMPLEMENTATION ONLY. All checks/imports/parsers/counters/numerical programs/tests/type/build/browser/accessibility/offline checks are UNRUN under the FluxGeo hold. Actual owner adoption and independent full-record/source/native validation remain pending. The owner-provided strict evaluateIV39 entry preserves unknown codec exceptions; only exact known stage/class/code/reason faults normalize.",
        provenance="Owner-selected IV66 hand-set toy composed from unchanged real IV39 BPE/strict codecs and two unchanged IV59 blocks; no external model, training dataset or learned capability claim.",
    ))
    evaluated = _freeze(dict(state=state, summary=summary, natives=natives, tensors=tensors, texts=texts))
    frames = _freeze(work.steps)
    for frame in frames:
        trace.add(frame["id"], frame["label"], frame["equation"], frame["explanation"], frame["inputs"], frame["outputs"])
    return evaluated

def evaluate_capstone(value, trace, prefix):
    saved = _first(value, prefix)
    return _project(saved, trace, prefix)


def check_hand_anchors():
    if not __debug__:
        raise RuntimeError("Explicit IV66 hand-anchor check refuses optimized Python (-O).")
    zero = dict(DEFAULT_IV66, o1=0., f1=0., o2=0., f2=0.)
    saved = _first(zero, "zero")
    assert saved["prepared"]["promptIDs"] == [256]
    assert [(rule["id"], rule["left"], rule["right"], rule["bytes"]) for rule in saved["prepared"]["rules"]] == [(256, 97, 98, [97, 98])]
    assert [item["selected"]["id"] for item in saved["forwards"]] == [256, 256]
    assert saved["forwards"][0]["logits"] == [1., 1., 2., 0., 0.]
    assert saved["forwards"][1]["logits"] == [1., 1., 2., 0., 0., 1., 1.5, 2.5, .5, 0.]
    assert saved["logicalIDs"] == [256, 256, 256] and saved["decodedBytes"] == [97, 98, 97, 98, 97, 98]
    assert saved["decoded"] == "ababab" and saved["transitions"][-1]["disposition"] == "budget"
    assert len(saved["forwards"]) == 2 and len(saved["forwards"][-1]["ids"]) == 2
    eos = _first(dict(zero, outputs=1, biasAB=-2., biasEOS=2.), "eos")
    assert eos["logicalIDs"] == [256, 512] and eos["decoded"] == "ab"
    assert len(eos["forwards"]) == 1 and eos["transitions"][-1]["disposition"] == "EOS"
    masked = dict(zero, outputs=1, biasAB=-2., biasABAB=2.)
    assert _first(masked, "masked")["logicalIDs"] == [256, 97]
    assert _first(dict(masked, merges=2), "active")["logicalIDs"] == [256, 257]
    default = _first(DEFAULT_IV66, "default")
    assert default["forwards"][0]["logits"] == [1., 1., 2., 0., 0.]
    assert default["logicalIDs"] == [256, 256, 256] and default["decoded"] == "ababab"
    assert len(default["natives"]) == 36
    assert [item["kind"] for item in default["natives"]].count("sqrt") == 16
    for state, expected in ((dict(zero, text="aa", merges=0), 20), (dict(zero, text="aa", merges=1), 29),
                            (dict(zero, text="aa", merges=2), 35), (dict(zero, text="ab", merges=1), 27),
                            (dict(zero, text="ab", merges=2), 32)):
        assert len(_prepare(state, "budget")["tokenizer"]["steps"]) == expected
    for text in ("aa", "ba", "bb"):
        worst = _first(dict(DEFAULT_IV66, text=text, merges=2), "worst")
        assert len(worst["prepared"]["tokenizer"]["steps"]) == 35
        assert [len(item["ids"]) for item in worst["forwards"]] == [2, 3]
        assert len(worst["natives"]) == 67


def check_guards_and_codec():
    if not __debug__:
        raise RuntimeError("Explicit IV66 guard/codec check refuses optimized Python (-O).")
    import struct
    assert type(capstone_state(DEFAULT_IV66)) is _support._FrozenDict
    signed = capstone_state(dict(DEFAULT_IV66, merges=-0.0, q1=-0.0, biasABAB=-0.0))
    assert type(signed["merges"]) is int and signed["merges"] == 0
    assert struct.pack(">d", signed["q1"]) == struct.pack(">d", -0.0)
    assert struct.pack(">d", signed["biasABAB"]) == struct.pack(">d", -0.0)
    for value, code in (({}, "INVALID_INPUT"), ([], "INVALID_INPUT"),
            (dict(DEFAULT_IV66, text=0, q1=float("nan")), "INVALID_INPUT"),
            (dict(DEFAULT_IV66, merges=4, biasEOS=float("nan")), "NONFINITE"),
            (dict(DEFAULT_IV66, q1=10**1000), "NONFINITE"),
            (dict(DEFAULT_IV66, q1=True), "NONFINITE"),
            (dict(DEFAULT_IV66, outputs=0), "INVALID_INPUT"),
            (dict(DEFAULT_IV66, merges=.5), "INVALID_INPUT"),
            (dict(DEFAULT_IV66, biasABAB=3), "INVALID_INPUT"),
            (dict(DEFAULT_IV66, text="aaa"), "UNSUPPORTED_SIZE")):
        try:
            capstone_state(value)
        except NumericalFault as error:
            assert type(error) is CapstoneFault and error.code == code
        else:
            raise AssertionError("Invalid raw state must reject.")
    # Raw admission is separate from semantic codec/model admission.
    for text, code in (("", "UNAVAILABLE"), ("é", "UNAVAILABLE"), ("éa", "UNSUPPORTED_SIZE"),
                       ("\ufeff", "UNSUPPORTED_SIZE"), ("🦊", "UNSUPPORTED_SIZE"), ("\ud800", "INVALID_INPUT")):
        capstone_state(dict(DEFAULT_IV66, text=text))
        try:
            _prepare(dict(DEFAULT_IV66, text=text), "invalid-prefix!")
        except NumericalFault as error:
            assert type(error) is CapstoneFault and error.code == code
        else:
            raise AssertionError("Semantic fault must precede helper-prefix fault.")
    try:
        _prepare(DEFAULT_IV66, "invalid-prefix!")
    except NumericalFault as error:
        assert error.code == "INVALID_INPUT" and "prefix" in error.reason
    else:
        raise AssertionError("Prefix must reject after valid semantic capture.")
    trace = _token.TokenTrace()
    assert _codec_call("decode", _bpe.decode_bpe_ids, [195, 169], [], 0, "unicode", trace)["decoded"] == "é"
    try:
        _codec_call("decode", _bpe.decode_bpe_ids, [195], [], 0, "truncated", _token.TokenTrace())
    except _token.NumericalFault as error:
        assert type(error) is _token.NumericalFault and error.code == "INVALID_INPUT"
    else:
        raise AssertionError("Piece boundary cannot invent a missing continuation byte.")

    class CodecSubtype(_token.NumericalFault):
        pass

    def failing():
        if not __debug__:
            raise RuntimeError("Explicit IV66 codec-fault hook refuses optimized Python (-O).")
        raise unknown

    for unknown in (CodecSubtype("INVALID_INPUT", "subtype"), _token.NumericalFault("UNKNOWN", "unknown"),
                    _token.NumericalFault("INVALID_INPUT", 0), _token.NumericalFault("INVALID_INPUT", "unknown reason"), MemoryError("resource"), AssertionError("programmer")):
        try:
            _codec_call("tokenize", failing)
        except BaseException as error:
            assert error is unknown
        else:
            raise AssertionError("Unknown codec object must retain identity.")
    unknown = _token.NumericalFault("INVALID_INPUT", "Unpaired high surrogate at UTF-16 offset 0.")
    try:
        _codec_call("tokenize", failing)
    except NumericalFault as error:
        assert type(error) is CapstoneFault and error.reason == "Unpaired high surrogate at UTF-16 offset 0." and error.__cause__ is unknown
    else:
        raise AssertionError("Exact codec fault must map into canonical class.")


def check_storage_and_capture():
    if not __debug__:
        raise RuntimeError("Explicit IV66 storage/capture check refuses optimized Python (-O).")
    import struct
    original = _support._storage
    calls, reads = [], []

    class Storage:
        def __init__(self, actual, ordinal):
            if not __debug__:
                raise RuntimeError("Explicit IV66 storage wrapper refuses optimized Python (-O).")
            self.actual, self.ordinal = actual, ordinal

        def __getitem__(self, index):
            if not __debug__:
                raise RuntimeError("Explicit IV66 indexed-storage hook refuses optimized Python (-O).")
            reads.append((self.ordinal, index))
            # Ordinary handoff0 and handoff2 are the two REQUIRED consumption boundaries.
            return self.actual[index] + .125 if self.ordinal in (0, 2) else self.actual[index]

    def storage(values, rows, cols):
        if not __debug__:
            raise RuntimeError("Explicit IV66 storage hook refuses optimized Python (-O).")
        ordinal = len(calls)
        calls.append((list(values), rows, cols))
        return Storage(original(values, rows, cols), ordinal)

    try:
        _support._storage = storage
        forward = _forward(capstone_state(DEFAULT_IV66), [256], [True, True, True, False, True], "storage")
        assert forward["beforeBlock1"]["consumed"] == [1.125, 1.125]
        assert forward["block1"]["features"] == [1.125, 1.125]
        assert forward["beforeBlock2"]["consumed"] == [1.25, 1.25]
        assert forward["block2"]["features"] == [1.25, 1.25]
        assert forward["logits"] == [1.25, 1.25, 2.5, 0., 0.]
        assert [(ordinal, index) for ordinal, index in reads if ordinal in (0, 2)] == [
            (0, (0, 0, 0)), (0, (0, 0, 1)), (2, (0, 0, 0)), (2, (0, 0, 1))]
        assert len(calls) == 4  # Two handoffs plus unchanged59's two output storage arrays.
    finally:
        _support._storage = original
    saved = _first(DEFAULT_IV66, "capture")
    for forward in saved["forwards"]:
        for handoff, block in ((forward["beforeBlock1"], forward["block1"]), (forward["beforeBlock2"], forward["block2"])):
            assert [struct.pack(">d", word) for word in handoff["consumed"]] == [struct.pack(">d", word) for word in block["features"]]
            assert type(handoff["storage"]) is _support.np.ndarray
        assert forward["beforeBlock2"]["input"] == list(forward["block1"]["output"]["values"])
    assert len({leaf["id"] for leaf in saved["natives"]}) == len(saved["natives"])
    assert all(leaf["output"] == 1. for leaf in saved["natives"] if leaf["kind"] == "exp" and leaf["input"] == 0.)
    first_head = saved["forwards"][0]["natives"][-4:]
    assert [leaf["input"] for leaf in first_head] == [-1., -1., 0., -2.]
    assert first_head[0]["id"] != first_head[1]["id"]
    signed_max = _support._MechanismTrace()
    _support._softmax([-0.0, 0.0, -1.0, 0.0, -2.0], [True, True, True, False, True], signed_max, "signed_max")
    assert struct.pack(">d", signed_max.steps[0][2]["max"]) == struct.pack(">d", 0.0)
    assert struct.pack(">d", signed_max.native[0]["input"]) == struct.pack(">d", -0.0)
    assert "shifted3" not in signed_max.steps[0][2]


def check_public_binding():
    if not __debug__:
        raise RuntimeError("Explicit IV66 public-binding check refuses optimized Python (-O).")
    import struct
    trace = capstone_trace()
    trace.add("existing", "Existing", "copy", "Keep existing evidence.", {}, {"value": -0.0})
    result = evaluate_capstone(DEFAULT_IV66, trace, "public")
    assert tuple(result) == ("state", "summary", "natives", "tensors", "texts")
    assert tuple(result["state"]) == _FIELDS and capstone_trace is _support.decoder_trace
    summary = result["summary"]
    assert tuple(summary) == ("promptTokens", "decisions", "forwardPasses", "observedTokens", "logicalTokens", "decodedBytes", "decodedUnits", "eos", "budgetReached", "lastTokenId", "lastClassIndex", "lastLogit", "lastProbability", "activeClasses", "blockCount", "featureWidth", "hiddenWidth", "sqrtCalls", "expCalls", "nativeElementaryCalls", "frames", "tensorCount")
    assert [summary[key] for key in ("frames", "tensorCount", "nativeElementaryCalls", "sqrtCalls", "expCalls")] == [317, 257, 36, 16, 20]
    assert len(trace.steps) == 318 and len(result["texts"]) == 80
    assert sum(len(record["values"]) for record in result["tensors"]) == 1157
    assert result["texts"]["decoded"] == "ababab" and summary["lastTokenId"] == 256
    assert list(trace.outputs)[:1] == ["existing_value"]
    assert trace.steps[1]["id"] == "public_setup" and trace.steps[-1]["id"] == "public_finish"
    assert tuple(trace.steps[1]) == ("id", "label", "equation", "explanation", "inputs", "outputs")
    records = {record["id"]: record for record in result["tensors"]}
    assert records["public_LogicalIds"]["values"] == [256, 256, 256]
    assert records["public_SelectedIds"]["values"] == [256, 256]
    assert records["public_ActiveMask"]["values"] == [True, True, True, False, True]
    assert records["public_ActiveMask"]["precision"] == 8
    assert records["public_ActiveIndices"]["values"] == [0, 1, 2, 4]
    assert records["public_forward0_ClassShifted"]["shape"] == [1, 1, 4]
    head = [leaf for leaf in result["natives"] if leaf["id"].startswith("public_forward0_head_")]
    assert [leaf["id"] for leaf in head] == [f"public_forward0_head_exp_0_{c}" for c in (0, 1, 2, 4)]
    assert [leaf["input"] for leaf in head] == [-1., -1., 0., -2.]
    for chunk, offset in enumerate(range(0, len(result["natives"]), 64)):
        copied = records[f"public_NativeArguments{chunk}"]["values"]
        words = [word for leaf in result["natives"][offset:offset + 64] for word in (leaf["input"], leaf["output"])]
        assert [struct.pack(">d", word) for word in copied] == [struct.pack(">d", word) for word in words]
    for decision in (0, 1):
        first = records[f"public_forward{decision}_block1_Output"]["values"]
        second = records[f"public_forward{decision}_block2_Features"]["values"]
        assert [struct.pack(">d", word) for word in first] == [struct.pack(">d", word) for word in second]
    before = tuple(trace.steps)
    for invalid in (dict(DEFAULT_IV66, text=""), dict(DEFAULT_IV66, text="é")):
        try:
            evaluate_capstone(invalid, trace, "public")
        except CapstoneFault as error:
            assert type(error) is CapstoneFault and error.code == "UNAVAILABLE"
        else:
            raise AssertionError("Invalid preflight must not publish.")
        assert tuple(trace.steps) == before
    for prefix in ("A\n", "A\r", "A\u2028", "A!", "0A", "", None):
        try:
            evaluate_capstone(DEFAULT_IV66, trace, prefix)
        except CapstoneFault as error:
            assert type(error) is CapstoneFault and "prefix" in error.reason
        else:
            raise AssertionError("Every forbidden prefix must reject before publication.")
        assert tuple(trace.steps) == before
    for patch in (dict(outputs=1), dict(outputs=1, biasAB=-2., biasEOS=2.), dict(text="aa", merges=2)):
        collector = capstone_trace()
        bounded = evaluate_capstone(dict(DEFAULT_IV66, **patch), collector, "bounded")
        counts = bounded["summary"]
        assert len(collector.steps) == counts["frames"] <= 510
        assert len(bounded["tensors"]) == counts["tensorCount"] <= 267
        assert sum(len(record["values"]) for record in bounded["tensors"]) <= 1809
        assert len(bounded["texts"]) <= 80 and len(bounded["natives"]) <= 67
        assert all(max(record["shape"]) <= 64 and len(record["values"]) <= 4096 for record in bounded["tensors"])
        if patch.get("text") == "aa":
            assert counts["nativeElementaryCalls"] == 67
            by_id = {record["id"]: record for record in bounded["tensors"]}
            assert by_id["bounded_NativeArguments0"]["shape"] == [64, 2]
            assert by_id["bounded_NativeArguments1"]["shape"] == [3, 2]
        if patch.get("biasEOS") == 2.:
            assert counts["eos"] == 1 and counts["budgetReached"] == 0 and counts["forwardPasses"] == 1
    signed = evaluate_capstone(dict(DEFAULT_IV66, outputs=1, q1=-0.0, biasABAB=-0.0), capstone_trace(), "signed")
    raw = next(record for record in signed["tensors"] if record["id"] == "signed_Raw")
    assert struct.pack(">d", raw["values"][3]) == struct.pack(">d", -0.0)
    assert struct.pack(">d", raw["values"][16]) == struct.pack(">d", -0.0)
    try:
        result["tensors"][0]["values"][0] = 99
    except TypeError:
        pass
    else:
        raise AssertionError("Published result must be detached and frozen.")


def check_projection_capture():
    if not __debug__:
        raise RuntimeError("Explicit IV66 saved-projection check refuses optimized Python (-O).")
    import inspect
    saved = _first(DEFAULT_IV66, "capture")
    original = (math.sqrt, math.exp, _support._two_products, _support._softmax, _support._storage,
                _support.decoder_block, _codec.derive_iv39.__wrapped__, _bpe.decode_bpe_ids)

    def forbidden(*args, **kwargs):
        if not __debug__:
            raise RuntimeError("Explicit IV66 no-recomputation hook refuses optimized Python (-O).")
        raise AssertionError("Public projection cannot perform arithmetic/native/codec/storage work.")

    source = inspect.getsource(_project)
    for spelling in ("math.sqrt(", "math.exp(", "float(", "_finite(", "_two_products(", "_softmax(", "_storage(", "decoder_block(", "decode_bpe_ids("):
        assert spelling not in source
    try:
        math.sqrt = math.exp = _support._two_products = _support._softmax = _support._storage = forbidden
        _support.decoder_block = _codec.derive_iv39.__wrapped__ = _bpe.decode_bpe_ids = forbidden
        collector = capstone_trace()
        result = _project(saved, collector, "capture")
        assert result["summary"]["frames"] == 317 and result["texts"]["decoded"] == saved["decoded"]
    finally:
        (math.sqrt, math.exp, _support._two_products, _support._softmax, _support._storage,
         _support.decoder_block, _codec.derive_iv39.__wrapped__, _bpe.decode_bpe_ids) = original
    expected_steps, expected_tensors = list(collector.steps), result["tensors"]
    unknown = MemoryError("External callback must retain identity.")

    class Observer:
        def __init__(self, stop):
            if not __debug__:
                raise RuntimeError("Explicit IV66 observer wrapper refuses optimized Python (-O).")
            self.trace, self.stop = capstone_trace(), stop

        def add(self, identifier, label, equation, explanation, inputs, outputs):
            if not __debug__:
                raise RuntimeError("Explicit IV66 publication hook refuses optimized Python (-O).")
            # All scalar/codec/native work AND public snapshots must already exist.
            if not self.trace.steps:
                saved["decoded"] = "changed after private snapshots"
                saved["natives"][0] = dict(saved["natives"][0], output=123.)
                saved["forwards"][0]["features"][0] = 123.
            if self.stop is not None and len(self.trace.steps) == self.stop:
                raise unknown
            assert type(inputs) is _support._FrozenDict and type(outputs) is _support._FrozenDict
            self.trace.add(identifier, label, equation, explanation, inputs, outputs)

    observer = Observer(None)
    result2 = _project(saved, observer, "capture")
    assert observer.trace.steps == expected_steps and result2["tensors"] == expected_tensors
    assert result2["texts"]["decoded"] == "ababab"
    # Fresh capture: the prior observer deliberately changed private test-owned data.
    saved = _first(DEFAULT_IV66, "capture")
    observer = Observer(3)
    try:
        _project(saved, observer, "capture")
    except BaseException as error:
        assert error is unknown and observer.trace.steps == expected_steps[:3]
    else:
        raise AssertionError("Observer failure must preserve only its complete prior prefix.")
    collector = capstone_trace()
    collector.add("capture_raw", "Collision", "copy", "Existing frame.", {}, {})
    try:
        evaluate_capstone(DEFAULT_IV66, collector, "capture")
    except NumericalFault as error:
        assert type(error) is NumericalFault and error.code == "INVALID_INPUT"
        assert [frame["id"] for frame in collector.steps] == ["capture_raw", "capture_setup"]
    else:
        raise AssertionError("Generic collector fault must escape after its genuine prefix.")

def source_self_check():
    if not __debug__:
        raise RuntimeError("Explicit IV66 reference checks refuse optimized Python (-O).")
    check_hand_anchors()
    check_guards_and_codec()
    check_storage_and_capture()
    check_public_binding()
    check_projection_capture()
    check_source_identity()
    check_loader_preflight()
    check_once_capture()


def check_source_identity():
    if not __debug__:
        raise RuntimeError("Explicit IV66 source-inventory check refuses optimized Python (-O).")
    original = _support.decoder_trace
    saved_method = _support._MechanismTrace.add
    saved_alias = _support._FrozenDict.__setitem__
    saved_namespace = tuple(vars(_support).items())
    path = Path(__file__).resolve().with_name("decoder_reference.py")

    def foreign():
        if not __debug__:
            raise RuntimeError("Explicit IV66 foreign-declaration hook refuses optimized Python (-O).")
        raise AssertionError("Foreign declaration must never run.")

    foreign.__module__ = "foreign"
    try:
        for missing in (False, True):
            if missing:
                del _support.decoder_trace
            else:
                _support.decoder_trace = foreign
            try:
                _certificate(_support, path)
            except ImportError:
                pass
            else:
                raise AssertionError("Missing/foreign SOURCE declaration must reject.")
            finally:
                _support.decoder_trace = original
        # Only genuine39 may use a foreign-declaring wraps-preserved wrapper.
        foreign.__module__, foreign.__wrapped__ = _support.__name__, original
        _support.decoder_trace = foreign
        try:
            _certificate(_support, path)
        except ImportError:
            pass
        else:
            raise AssertionError("Unrelated functions must not gain the intentional39 wrapper exception.")
        finally:
            _support.decoder_trace = original
            foreign.__module__ = "foreign"
            del foreign.__wrapped__
        for missing in (False, True):
            if missing:
                del _support._MechanismTrace.add
            else:
                _support._MechanismTrace.add = foreign
            try:
                _certificate(_support, path)
            except ImportError:
                pass
            else:
                raise AssertionError("Missing/foreign source class method must reject.")
            finally:
                _support._MechanismTrace.add = saved_method
        del _support._FrozenDict.__setitem__
        try:
            _certificate(_support, path)
        except ImportError:
            pass
        else:
            raise AssertionError("Missing declared freeze alias must reject.")
        finally:
            _support._FrozenDict.__setitem__ = saved_alias
        _codec_identity(_codec, _bpe, _token)
        assert _codec.derive_iv39.__wrapped__.__globals__ is vars(_codec)
        assert _codec.derive_iv39.__globals__ is vars(_token)
        assert Path(_codec.derive_iv39.__wrapped__.__code__.co_filename).resolve() == Path(_codec.__file__).resolve()
        assert Path(_codec.derive_iv39.__code__.co_filename).resolve() == Path(_token.__file__).resolve()
    finally:
        _support.decoder_trace = original
        _support._MechanismTrace.add = saved_method
        _support._FrozenDict.__setitem__ = saved_alias
        vars(_support).clear()
        vars(_support).update(saved_namespace)


def check_loader_preflight():
    if not __debug__:
        raise RuntimeError("Explicit IV66 dependency preflight check refuses optimized Python (-O).")
    original_spec, original_create = importlib.util.spec_from_file_location, importlib.util.module_from_spec
    support_name, codec_name = _CACHE_NAMES[1:]
    original_support, original_codec = sys.modules[support_name], sys.modules[codec_name]
    called = []

    def forbidden_spec(name, path):
        if not __debug__:
            raise RuntimeError("Explicit IV66 no-spec hook refuses optimized Python (-O).")
        called.append(name)
        raise AssertionError("No specification may run before ALL incumbents are admitted.")

    def forbidden_create(spec):
        if not __debug__:
            raise RuntimeError("Explicit IV66 no-create hook refuses optimized Python (-O).")
        called.append(spec.name)
        raise AssertionError("No module may be created before ALL incumbents are admitted.")

    try:
        for target, absent in ((support_name, codec_name), (codec_name, support_name)):
            for unknown in (None, object(), ModuleType(target)):
                sys.modules.pop(absent, None)
                sys.modules[target] = unknown
                importlib.util.spec_from_file_location = forbidden_spec
                importlib.util.module_from_spec = forbidden_create
                try:
                    _load_dependencies()
                except ImportError:
                    assert target in sys.modules and sys.modules[target] is unknown and called == []
                    assert absent not in sys.modules
                else:
                    raise AssertionError("Bad incumbent must reject before any dependency spec/create.")
                finally:
                    importlib.util.spec_from_file_location, importlib.util.module_from_spec = original_spec, original_create
                    sys.modules[support_name], sys.modules[codec_name] = original_support, original_codec
        cases = (
            (_support, _support.NumericalFault, "__bases__", (ValueError,)),
            (_token, _token.NumericalFault, "__bases__", (Exception,)),
            (_support, _support.NumericalFault.__init__.__closure__[0], "cell_contents", _token.NumericalFault),
            (_token, _token.NumericalFault.__init__.__closure__[0], "cell_contents", _support.NumericalFault),
            (_bpe, _bpe, "NumericalFault", _support.NumericalFault),
            (_support, _support._two_products, "__defaults__", (None, 1)),
            (_support, _support._softmax, "__defaults__", (False,)),
            (_support, _support._two_products, "__defaults__", (None, 2.)),
            (_support, _support.decoder_trace, "__defaults__", (None,)),
            (_support, _support.NumericalFault.__init__, "__defaults__", (None,)),
            (_support, _support._softmax, "__kwdefaults__", {}),
            (_codec, _codec.derive_iv39, "__defaults__", (None,)),
            (_codec, _codec.derive_iv39.__wrapped__, "__kwdefaults__", {"state": None}),
            (_bpe, _bpe.dense_data, "__defaults__", (1,)),
            (_token, _token.int_array, "__defaults__", (False, 2147483647, "integer array", 32)),
            (_token, _token.utf8_encode, "__kwdefaults__", {}),
        )
        cases += tuple((module, module, alias, object()) for module, aliases in (
            (_support, ("np", "math", "re", "MappingProxyType")),
            (_codec, ("importlib", "Path")),
            (_bpe, ("importlib", "Path", "MappingProxyType", "np")),
            (_token, ("argparse", "wraps", "json", "math", "sys", "MappingProxyType", "np"))) for alias in aliases)
        certificates = dict(_SOURCE_CERTIFICATES)
        for module, subject, attribute, changed in cases:
            target, absent = ((support_name, codec_name) if module is _support else (codec_name, support_name))
            incumbent = sys.modules[target]
            original = getattr(subject, attribute)
            try:
                _SOURCE_CERTIFICATES.clear()  # Cold admission must not trust a prior seal.
                sys.modules.pop(absent, None)
                setattr(subject, attribute, changed)
                importlib.util.spec_from_file_location, importlib.util.module_from_spec = forbidden_spec, forbidden_create
                try:
                    _load_dependencies()
                except ImportError:
                    assert called == [] and sys.modules[target] is incumbent and absent not in sys.modules
                    assert getattr(subject, attribute) is changed
                else:
                    raise AssertionError("Cold source defaults/keyword defaults/dependency aliases must reject before staging.")
            finally:
                setattr(subject, attribute, original)
                importlib.util.spec_from_file_location, importlib.util.module_from_spec = original_spec, original_create
                sys.modules[support_name], sys.modules[codec_name] = original_support, original_codec
                _SOURCE_CERTIFICATES.clear()
                _SOURCE_CERTIFICATES.update(certificates)
    finally:
        importlib.util.spec_from_file_location, importlib.util.module_from_spec = original_spec, original_create
        sys.modules[support_name], sys.modules[codec_name] = original_support, original_codec



def check_once_capture():
    if not __debug__:
        raise RuntimeError("Explicit IV66 once-capture check refuses optimized Python (-O).")
    original_calculation = _codec.derive_iv39.__wrapped__
    original_decode = _bpe.decode_bpe_ids
    calls = []

    def calculation(state):
        if not __debug__:
            raise RuntimeError("Explicit IV66 genuine39 capture hook refuses optimized Python (-O).")
        calls.append("tokenize")
        return original_calculation(state)

    def decode(ids, rules, eos, prefix, trace):
        if not __debug__:
            raise RuntimeError("Explicit IV66 final-decode capture hook refuses optimized Python (-O).")
        calls.append("final-decode")
        return original_decode(ids, rules, eos, prefix, trace)

    try:
        _codec.derive_iv39.__wrapped__ = calculation
        # The original39 body also resolves this decoder for its TWO real roundtrips.
        _bpe.decode_bpe_ids = decode
        saved = _first(DEFAULT_IV66, "once")
        assert calls == ["tokenize", "final-decode", "final-decode", "final-decode"]
        assert saved["decoded"] == "ababab" and len(saved["forwards"]) == 2
        assert [step["disposition"] for step in saved["transitions"]] == ["continue-full-recompute", "budget"]
    finally:
        _codec.derive_iv39.__wrapped__ = original_calculation
        _bpe.decode_bpe_ids = original_decode

6. Complete canonical request and result — code/python/p15/iv66.py

The entry loads its file-relative dependencies, parses a complete replacement input and constructs the whole five-field result: status,outputs,steps,tensors,texts. An expected modeled failure has status,code,reason. The strict parser and loader identity guards belong to ordinary production boundaries; named explicit checks are separate from ordinary derivation. The helper’s five fields are instead state,summary,natives,tensors,texts; they must not be mistaken for the root schema. Every frame has six fields and no hidden state; every tensor retains all seven declared fields.

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.

"""IV66 canonical entry; independent FIRST and signed actual public bindings.

All checks UNRUN. CLI: default, COMPLETE replacement JSON, stdin '-', or sole
--self-check. Queries publish the complete adopted root5 with exact local fault3 gating.
"""
import importlib.util
import json
import math
from pathlib import Path
import sys
from types import CodeType, FunctionType, MethodType, ModuleType


_CACHE_NAMES = ("_book_iv66_capstone", "_book_iv66_generic59", "_book_iv66_codec39")
_REFERENCE_CERTIFICATE = None


def _source_defaults(function, path, name):
    # shortcut: literal six-file defaults; update this inventory if declarations change.
    expected = {
        ("decoder_reference.py", "_two_products"): (None, 2),
        ("decoder_reference.py", "_softmax"): (True,),
        ("decoder_reference.py", "_accumulate_rows"): (None,),
        ("decoder_reference.py", "_tensor"): ("float64",),
        ("token_reference.py", "int_array"): (0, 2147483647, "integer array", 32),
        ("token_reference.py", "utf8_encode"): ("source", None),
        ("token_reference.py", "utf8_decode"): ("utf8", None),
        ("token_reference.py", "decode_byte_ids"): ("byte", None),
        ("token_reference.py", "decode_subword_ids"): ("subword", None),
        ("token_reference.py", "decode_character_ids"): ("char", None),
        ("bpe_reference.py", "dense_data"): (True,),
    }.get((path.name, name))
    actual = function.__defaults__
    if type(actual) is not type(expected) or function.__kwdefaults__ is not None:
        raise ImportError("IV66 declaring defaults/keyword defaults differ from source.")
    if expected is not None and (len(actual) != len(expected) or any(
            type(value) is not type(literal) or
            (value.hex() != literal.hex() if type(value) is float else value != literal)
            for value, literal in zip(actual, expected))):
        raise ImportError("IV66 declaring default types/values differ from source.")


def _source_aliases(module, path):
    imports = {
        "decoder_reference.py": (("math", "math", None), ("re", "re", None),
            ("MappingProxyType", "types", "MappingProxyType"), ("np", "numpy", None)),
        "token_reference.py": (("argparse", "argparse", None), ("wraps", "functools", "wraps"),
            ("json", "json", None), ("math", "math", None), ("sys", "sys", None),
            ("MappingProxyType", "types", "MappingProxyType"), ("np", "numpy", None)),
        "bpe_reference.py": (("importlib", "importlib", None), ("Path", "pathlib", "Path"),
            ("MappingProxyType", "types", "MappingProxyType"), ("np", "numpy", None)),
        "iv39.py": (("importlib", "importlib", None), ("Path", "pathlib", "Path")),
        "capstone_reference.py": (("importlib", "importlib", None), ("math", "math", None),
            ("Path", "pathlib", "Path"), ("sys", "sys", None), ("CodeType", "types", "CodeType"),
            ("FunctionType", "types", "FunctionType"), ("ModuleType", "types", "ModuleType")),
        "iv66.py": (("importlib", "importlib", None), ("json", "json", None), ("math", "math", None),
            ("Path", "pathlib", "Path"), ("sys", "sys", None), ("CodeType", "types", "CodeType"),
            ("FunctionType", "types", "FunctionType"), ("MethodType", "types", "MethodType"),
            ("ModuleType", "types", "ModuleType")),
    }
    for alias, origin, member in imports[path.name]:
        dependency = sys.modules.get(origin)
        if type(dependency) is not ModuleType or vars(dependency).get("__name__") != origin:
            raise ImportError("IV66 external dependency origin is unavailable or foreign.")
        expected = dependency if member is None else vars(dependency).get(member)
        if expected is None or vars(module).get(alias) is not expected:
            raise ImportError("IV66 imported alias differs from its actual dependency origin.")
        if alias == "importlib" and ("importlib.util" not in sys.modules
                or vars(dependency).get("util") is not sys.modules["importlib.util"]):
            raise ImportError("IV66 importlib.util dependency origin changed.")


def _source_identity(module, path, name):
    """Validate REQUIRED own declarations before calling any incumbent function."""
    if type(module) is not ModuleType:
        raise ImportError("IV66 reference cache must contain an actual module.")
    namespace, spec = vars(module), vars(module).get("__spec__")
    if (namespace.get("__name__") != name or type(namespace.get("__file__")) is not str
            or Path(module.__file__).resolve() != path or spec is None or spec.name != name
            or type(spec.origin) is not str or Path(spec.origin).resolve() != path
            or namespace.get("__loader__") is not spec.loader):
        raise ImportError("IV66 reference file/spec identity mismatch.")
    _source_aliases(module, path)
    if path.name == "capstone_reference.py":
        support = namespace.get("_support")
        if type(support) is not ModuleType or sys.modules.get("_book_iv66_generic59") is not support:
            raise ImportError("IV66 requires the actual admitted support59 module alias.")
        _source_identity(support, path.with_name("decoder_reference.py"), "_book_iv66_generic59")
        if namespace.get("NumericalFault") is not vars(support).get("NumericalFault"):
            raise ImportError("IV66 fault alias must be the actual admitted support59 class.")
    elif path.name == "bpe_reference.py":
        token = namespace.get("_token")
        _source_identity(token, path.with_name("token_reference.py"), "_p09_bpe_token_reference")
        if namespace.get("NumericalFault") is not vars(token).get("NumericalFault"):
            raise ImportError("IV66 BPE fault alias must be the actual source token class.")
    elif path.name == "iv66.py":
        reference = namespace.get("_reference")
        if sys.modules.get("_book_iv66_capstone") is not reference:
            raise ImportError("IV66 entry reference alias changed.")
        _source_identity(reference, path.with_name("capstone_reference.py"), "_book_iv66_capstone")
        if (namespace.get("NumericalFault") is not vars(reference).get("NumericalFault")
                or namespace.get("CapstoneFault") is not vars(reference).get("CapstoneFault")):
            raise ImportError("IV66 entry fault aliases changed.")
    source = path.read_bytes()
    compiled = compile(source, str(path), "exec", dont_inherit=True)
    for code in compiled.co_consts:
        if type(code) is not CodeType or code.co_name.startswith("<"):
            continue
        item = namespace.get(code.co_name)
        if code.co_flags & 2:
            actual = (getattr(item, "__wrapped__", None) if path.name == "iv39.py" and code.co_name == "derive_iv39"
                      else item) if type(item) is FunctionType else None
            if (type(item) is not FunctionType or item.__module__ != module.__name__
                    or type(actual) is not FunctionType or actual.__module__ != module.__name__
                    or actual.__globals__ is not namespace or actual.__code__ != code
                    or actual.__closure__ is not None):
                raise ImportError("IV66 required reference function/source identity mismatch.")
            _source_defaults(item, path, code.co_name)
            if actual is not item:
                _source_defaults(actual, path, code.co_name)
        else:
            if type(item) is not type or item.__module__ != module.__name__:
                raise ImportError("IV66 required reference class/source identity mismatch.")
            expected_base = {
                ("decoder_reference.py", "NumericalFault"): Exception,
                ("decoder_reference.py", "_FrozenDict"): dict,
                ("decoder_reference.py", "_FrozenList"): list,
                ("decoder_reference.py", "_MechanismTrace"): object,
                ("decoder_reference.py", "_PublicTrace"): object,
                ("token_reference.py", "NumericalFault"): ValueError,
                ("token_reference.py", "TokenTrace"): object,
                ("capstone_reference.py", "CapstoneFault"): namespace.get("NumericalFault"),
                ("iv66.py", "_JsonInputError"): ValueError,
            }.get((path.name, code.co_name))
            if expected_base is None or len(item.__bases__) != 1 or item.__bases__[0] is not expected_base:
                raise ImportError("IV66 required class bases differ from their literal source.")
            for child in code.co_consts:
                if type(child) is CodeType and not child.co_name.startswith("<"):
                    method = vars(item).get(child.co_name)
                    if (type(method) is not FunctionType or method.__module__ != module.__name__
                            or method.__globals__ is not namespace or method.__code__ != child):
                        raise ImportError("IV66 required reference class method/source identity mismatch.")
                    if child.co_freevars == ("__class__",):
                        closure = method.__closure__
                        try:
                            declaring_class = closure[0].cell_contents if closure is not None and len(closure) == 1 else None
                        except ValueError as error:
                            raise ImportError("IV66 declaring class cell is empty.") from error
                        if declaring_class is not item:
                            raise ImportError("IV66 method class cell differs from its declaring class.")
                    elif child.co_freevars or method.__closure__ is not None:
                        raise ImportError("IV66 required method has a foreign closure.")
                    _source_defaults(method, path, child.co_name)
            if code.co_name in ("_FrozenDict", "_FrozenList"):
                aliases = (("__setitem__", "__delitem__", "clear", "pop", "popitem", "setdefault", "update", "__ior__")
                           if code.co_name == "_FrozenDict" else
                           ("__setitem__", "__delitem__", "append", "clear", "extend", "insert", "pop", "remove", "reverse", "sort", "__iadd__", "__imul__"))
                if any(vars(item).get(key) is not vars(item).get("_readonly") for key in aliases):
                    raise ImportError("IV66 required frozen-container method alias/source mismatch.")
    return module


def _preflight_dependencies():
    root = Path(__file__).resolve().parent
    for name, path in (("_book_iv66_generic59", root / "decoder_reference.py"),
                       ("_book_iv66_codec39", root.parent / "p09" / "iv39.py")):
        if name not in sys.modules:
            continue
        module = _source_identity(sys.modules[name], path, name)
        if name == "_book_iv66_codec39":
            bpe = _source_identity(module._bpe, root.parent / "p09" / "bpe_reference.py", "_p09_bpe_reference")
            token = _source_identity(bpe._token, root.parent / "p09" / "token_reference.py", "_p09_bpe_token_reference")
            wrapped = module.derive_iv39
            actual = wrapped.__wrapped__
            codes = tuple(code for code in token.guarded.__code__.co_consts if type(code) is CodeType)
            if (bpe.NumericalFault is not token.NumericalFault or wrapped.__globals__ is not vars(token)
                    or wrapped.__code__ not in codes or wrapped.__closure__ is None
                    or len(wrapped.__closure__) != 1 or wrapped.__closure__[0].cell_contents is not actual):
                raise ImportError("IV66 old39 wrapper/calculation/child identity mismatch.")


def _load_reference():
    global _REFERENCE_CERTIFICATE
    name, path = _CACHE_NAMES[0], Path(__file__).resolve().with_name("capstone_reference.py")
    if _REFERENCE_CERTIFICATE is not None:
        module = _REFERENCE_CERTIFICATE[0]
        if name not in sys.modules or sys.modules[name] is not module:
            raise ImportError("IV66 warm reference cache identity changed.")
        _source_identity(module, path, name)
        module._identity(_REFERENCE_CERTIFICATE)
        module._dependencies_identity()
        return module
    if name in sys.modules:
        module = _source_identity(sys.modules[name], path, name)
        module._dependencies_identity()
        certificate = module._certificate(module, path)
        _REFERENCE_CERTIFICATE = certificate
        return module
    snapshot = tuple((key, key in sys.modules, sys.modules.get(key)) for key in _CACHE_NAMES)
    _preflight_dependencies()
    for key, present, incumbent in snapshot:
        if (key in sys.modules) != present or (present and sys.modules[key] is not incumbent):
            raise ImportError("IV66 cache changed during planned dependency admission.")
    spec = importlib.util.spec_from_file_location(name, str(path))
    for key, present, incumbent in snapshot:
        if (key in sys.modules) != present or (present and sys.modules[key] is not incumbent):
            raise ImportError("IV66 cache changed during reference specification creation.")
    if (spec is None or spec.loader is None or spec.name != name or type(spec.origin) is not str
            or Path(spec.origin).resolve() != path):
        raise ImportError("IV66 adjacent reference specification unavailable.")
    module = importlib.util.module_from_spec(spec)
    for key, present, incumbent in snapshot:
        if (key in sys.modules) != present or (present and sys.modules[key] is not incumbent):
            raise ImportError("IV66 cache changed during reference module creation.")
    if (type(module) is not ModuleType or module.__spec__ is not spec
            or module.__name__ != name or type(vars(module).get("__file__")) is not str
            or Path(module.__file__).resolve() != path):
        raise ImportError("IV66 created reference identity mismatch.")
    owned = [(name, module)]
    module._IV66_TRANSACTION = owned
    sys.modules[name] = module
    try:
        spec.loader.exec_module(module)
        module._membership(snapshot, owned)
        _source_identity(module, path, name)
        module._dependencies_identity()
        module.__dict__.pop("_IV66_TRANSACTION", None)
        certificate = module._certificate(module, path)
        _REFERENCE_CERTIFICATE = certificate
        return module
    except BaseException:
        for key, dependency in reversed(owned):
            if key in sys.modules and sys.modules[key] is dependency:
                del sys.modules[key]
        raise


_reference = _load_reference()
NumericalFault = _reference.NumericalFault
CapstoneFault = _reference.CapstoneFault
DEFAULT_IV66 = _reference.DEFAULT_IV66
capstone_state = _reference.capstone_state
capstone_trace = _reference.capstone_trace
evaluate_capstone = _reference.evaluate_capstone
_KNOWN_CODES = ("INVALID_INPUT", "NONFINITE", "UNSUPPORTED_SIZE", "UNAVAILABLE")


class _JsonInputError(ValueError):
    """Local strict transport fault, never a foreign parser/resource exception."""


def _integer(token):
    digits = token[1:] if token.startswith("-") else token
    if len(digits) > 309:
        raise _JsonInputError("JSON integer exceeds the local 309-digit limit.")
    return _real(token)


def _real(token):
    value = float(token)
    if not math.isfinite(value):
        raise _JsonInputError("JSON numbers must be finite binary64 values.")
    return value


def _constant(token):
    raise _JsonInputError("Non-JSON numeric constant: " + token)


def _object(pairs):
    result = {}
    for key, value in pairs:
        if key in result:
            raise _JsonInputError("Duplicate JSON object field: " + key)
        result[key] = value
    return result


_JSON_DECODER, _JSON_ERROR = json.JSONDecoder, json.JSONDecodeError
_JSON_DECODE_METHOD, _JSON_RAW_METHOD = _JSON_DECODER.decode, _JSON_DECODER.raw_decode
_JSON_PARSE_CODES = (_JSON_DECODE_METHOD.__code__, _JSON_RAW_METHOD.__code__,
    json.decoder.JSONObject.__code__, json.decoder.JSONArray.__code__, json.decoder.py_scanstring.__code__)
_JSON_HOOKS = (_integer, _real, _constant, _object)
_JSON_LOCAL_CODES = tuple(function.__code__ for function in _JSON_HOOKS)


def strict_json(source):
    """Admit only this actual invocation's original parser/hook faults."""
    admitted_error = None
    if type(source) is not str:
        admitted_error = CapstoneFault("INVALID_INPUT", "JSON source must be an actual string.")
        raise admitted_error
    hook_error = None

    def wrapped(callback):
        def invoke(value):
            nonlocal hook_error
            try:
                return callback(value)
            except BaseException as error:
                hook_error = (error, callback)
                raise
        return invoke

    decoder = json.JSONDecoder(parse_int=wrapped(_integer), parse_float=wrapped(_real),
        parse_constant=wrapped(_constant), object_pairs_hook=wrapped(_object))
    decode = decoder.decode
    raw = decoder.raw_decode if type(decoder) is _JSON_DECODER else None
    try:
        return decode(source)
    except (_JsonInputError, _JSON_ERROR) as error:
        original = (json.JSONDecoder is _JSON_DECODER and type(decoder) is _JSON_DECODER
            and type(decode) is MethodType and decode.__self__ is decoder and decode.__func__ is _JSON_DECODE_METHOD
            and type(raw) is MethodType and raw.__self__ is decoder and raw.__func__ is _JSON_RAW_METHOD)
        if (not original or any(actual is not saved or actual.__code__ is not code
                for actual, saved, code in zip((_integer, _real, _constant, _object), _JSON_HOOKS, _JSON_LOCAL_CODES))):
            raise
        tail = error.__traceback__
        while tail.tb_next is not None:
            tail = tail.tb_next
        if (type(error) is _JsonInputError and hook_error is not None and hook_error[0] is error
                and any(hook_error[1] is function for function in _JSON_HOOKS)
                and tail.tb_frame.f_code in _JSON_LOCAL_CODES):
            admitted_error = CapstoneFault("INVALID_INPUT", str(error))
            raise admitted_error from error
        if (type(error) is _JSON_ERROR and error.doc is source
                and (hook_error is None or hook_error[0] is not error)
                and tail.tb_frame.f_code in _JSON_PARSE_CODES):
            admitted_error = CapstoneFault("INVALID_INPUT", "Expected one finite strict JSON value.")
            raise admitted_error from error
        raise


_STRICT_JSON_CODE = strict_json.__code__


def _fault_record(error):
    if type(error) is not CapstoneFault:
        raise error
    fields = vars(error)
    code, reason = fields.get("code"), fields.get("reason")
    if type(code) is not str or code not in _KNOWN_CODES or type(reason) is not str or not reason:
        raise error
    return _reference._freeze(dict(status="unavailable", code=code, reason=reason))


def derive_iv66(value):
    """Complete adopted root5; only exact locally modeled faults normalize."""
    try:
        trace = capstone_trace()
        evaluated = evaluate_capstone(value, trace, "capstone")
        outputs = dict(evaluated["summary"])
        for frame in trace.steps:
            for key, word in frame["outputs"].items():
                alias = frame["id"] + "_" + key
                if alias in outputs:
                    raise RuntimeError("IV66 output aliases must be unique.")
                outputs[alias] = word
        return _reference._freeze(dict(status="defined", outputs=outputs, steps=trace.steps,
            tensors=evaluated["tensors"], texts=evaluated["texts"]))
    except CapstoneFault as error:
        return _fault_record(error)


def run():
    args = sys.argv[1:]
    if args == ["--self-check"]:
        source_self_check()
        print("IV66 explicit source checks completed; owner validation remains separate.")
        return 0
    if len(args) > 1 or (args and args[0].startswith("--")):
        print("Usage: iv66.py [JSON|-|--self-check]", file=sys.stderr)
        return 2
    # Foreign I/O failures are outside modeled parser/producer fault handling.
    source = sys.stdin.read() if args == ["-"] else None
    try:
        value = dict(DEFAULT_IV66) if not args else strict_json(source if args[0] == "-" else args[0])
    except CapstoneFault as error:
        # Only the immediate CURRENT parser invocation may admit a transport fault.
        invocation = error.__traceback__.tb_next
        if (invocation is None or invocation.tb_frame.f_code is not _STRICT_JSON_CODE
                or invocation.tb_frame.f_locals.get("admitted_error") is not error):
            raise
        result = _fault_record(error)
    else:
        result = derive_iv66(value)
    print(json.dumps(result, allow_nan=False))
    return 0


def check_parser():
    if not __debug__:
        raise RuntimeError("Explicit IV66 parser check refuses optimized Python (-O).")
    from contextlib import redirect_stdout
    from io import StringIO
    original_argv = sys.argv
    for text in ("-0", "-0.0", "-0e0"):
        assert math.copysign(1., strict_json(text)) == -1.
    assert strict_json("1" + "0" * 308) == 1e308
    for text in ("1" + "0" * 309, "9" * 309, "1e309", "NaN", "Infinity", "-Infinity",
                 '{"x":0,"x":1}', '{"x":{"m":0,"m":1}}', '{"p0":0,"p\\u0030":1}', "{} {}", "[1,]", "", "01", None, 0):
        try:
            strict_json(text)
        except NumericalFault as error:
            assert type(error) is CapstoneFault and error.code == "INVALID_INPUT"
        else:
            raise AssertionError("Strict transport must reject invalid input.")
    original_factory, original_integer, original_real = json.JSONDecoder, globals()["_integer"], globals()["_real"]
    original_decode = _JSON_DECODER().decode
    source = "{"
    try:
        original_decode(source)
    except _JSON_ERROR as error:
        replay_syntax = error
    else:
        raise AssertionError("Original decoder must reject incomplete JSON.")
    try:
        _constant("NaN")
    except _JsonInputError as error:
        replay_local = error
    else:
        raise AssertionError("Original hook must reject nonstandard constants.")

    try:
        strict_json("NaN")
    except CapstoneFault as error:
        replay_capstone = error
    else:
        raise AssertionError("Capture a genuine earlier admitted parser fault.")

    def foreign(value):
        if not __debug__:
            raise RuntimeError("Explicit IV66 parser-replay hook refuses optimized Python (-O).")
        raise unknown

    def factory(**options):
        if not __debug__:
            raise RuntimeError("Explicit IV66 decoder-factory hook refuses optimized Python (-O).")
        decoder = original_factory(**options)
        decoder.decode = foreign
        return decoder

    def foreign_factory(**options):
        if not __debug__:
            raise RuntimeError("Explicit IV66 foreign-factory replay hook refuses optimized Python (-O).")
        raise unknown

    unknowns = (ValueError("parser implementation"), MemoryError("parser resource"), _JsonInputError("foreign local"),
                _JSON_ERROR("foreign syntax", "x", 0), replay_syntax, replay_local, replay_capstone)
    try:
        for unknown in unknowns:
            for target in ("factory", "decode", "integer", "real"):
                if target in ("factory", "decode"):
                    json.JSONDecoder = foreign_factory if target == "factory" else factory
                    text = source
                elif target == "integer":
                    globals()["_integer"] = foreign
                    text = "1"
                else:
                    globals()["_real"] = foreign
                    text = "1"  # Original integer hook calls the replaced real hook.
                try:
                    try:
                        strict_json(text)
                    except BaseException as error:
                        assert error is unknown
                    else:
                        raise AssertionError("Unknown/replayed parser objects must escape unchanged.")
                    sys.argv = ["iv66.py", text]
                    output = StringIO()
                    try:
                        with redirect_stdout(output):
                            run()
                    except BaseException as error:
                        assert error is unknown and output.getvalue() == ""
                    else:
                        raise AssertionError("Ordinary CLI must preserve parser-phase replay identity with no stdout.")
                finally:
                    json.JSONDecoder = original_factory
                    globals()["_integer"], globals()["_real"] = original_integer, original_real
    finally:
        sys.argv = original_argv
        json.JSONDecoder = original_factory
        globals()["_integer"], globals()["_real"] = original_integer, original_real


def check_faults_and_binding():
    if not __debug__:
        raise RuntimeError("Explicit IV66 fault/root-binding check refuses optimized Python (-O).")
    for value in ({}, [], dict(DEFAULT_IV66, q1=True), dict(DEFAULT_IV66, outputs=0)):
        result = derive_iv66(value)
        assert tuple(result) == ("status", "code", "reason") and result["status"] == "unavailable"
    result = derive_iv66(DEFAULT_IV66)
    assert tuple(result) == ("status", "outputs", "steps", "tensors", "texts")
    assert result["status"] == "defined" and len(result["steps"]) == 317
    assert len(result["outputs"]) == 1309 and len(result["tensors"]) == 257 and len(result["texts"]) == 80
    outputs = result["outputs"]
    keys = list(outputs)[:22]
    assert keys == result["texts"]["summaryFields"]
    aliases = [frame["id"] + "_" + key for frame in result["steps"] for key in frame["outputs"]]
    assert list(outputs)[22:] == aliases and len(aliases) == len(set(aliases))
    import struct
    for frame in result["steps"]:
        for key, value in frame["outputs"].items():
            assert struct.pack(">d", outputs[frame["id"] + "_" + key]) == struct.pack(">d", value)
    bounded = derive_iv66(dict(DEFAULT_IV66, text="aa", merges=2))
    assert bounded["status"] == "defined" and len(bounded["outputs"]) <= 2106
    assert bounded["outputs"]["nativeElementaryCalls"] == 67
    original = _reference._project

    class FaultSubtype(CapstoneFault):
        pass

    def failing(saved, trace, prefix):
        if not __debug__:
            raise RuntimeError("Explicit IV66 producer-fault hook refuses optimized Python (-O).")
        raise unknown

    modeled = CapstoneFault("UNAVAILABLE", "exact known fault")
    assert _fault_record(modeled) == dict(status="unavailable", code="UNAVAILABLE", reason="exact known fault")
    missing = CapstoneFault("INVALID_INPUT", "missing reason")
    del missing.reason
    inherited = CapstoneFault("UNAVAILABLE", "missing own code")
    del inherited.code
    try:
        _reference._project = failing
        for unknown in (missing, inherited, CapstoneFault(0, "bad code type"), CapstoneFault("UNKNOWN", "bad code"),
                        CapstoneFault("INVALID_INPUT", 0), CapstoneFault("INVALID_INPUT", ""),
                        FaultSubtype("UNAVAILABLE", "subtype"), NumericalFault("INVALID_INPUT", "generic59 kernel/provider fault"),
                        _reference._token.NumericalFault("INVALID_INPUT", "Unpaired high surrogate at UTF-16 offset 0."),
                        MemoryError("resource"), AssertionError("programmer")):
            try:
                derive_iv66(DEFAULT_IV66)
            except BaseException as error:
                assert error is unknown
            else:
                raise AssertionError("Unknown/generic/subtype producer objects must escape SAME.")
        unknown = modeled
        assert derive_iv66(DEFAULT_IV66) == dict(status="unavailable", code="UNAVAILABLE", reason="exact known fault")
    finally:
        _reference._project = original
    for text, code, reason in (
        ("", "UNAVAILABLE", "A nonempty prompt is required for the first observed row."),
        ("é", "UNAVAILABLE", "This hand-set capstone supports only actual a/b UTF-8 bytes."),
        ("éa", "UNSUPPORTED_SIZE", "The actual prompt UTF-8 encoding exceeds 2 bytes."),
        ("aaa", "UNSUPPORTED_SIZE", "text must contain at most 2 UTF-16 units before strict UTF-8 encoding."),
        ("\ud800", "INVALID_INPUT", "Unpaired high surrogate at UTF-16 offset 0.")):
        assert derive_iv66(dict(DEFAULT_IV66, text=text)) == dict(status="unavailable", code=code, reason=reason)


def check_ordinary_paths():
    if not __debug__:
        raise RuntimeError("Explicit IV66 ordinary-path separation check refuses optimized Python (-O).")
    from contextlib import redirect_stdout
    from io import StringIO
    entry_hooks = {name: value for name, value in globals().items() if name.startswith("check_") or name == "source_self_check"}
    helper_hooks = {name: value for name, value in vars(_reference).items() if name.startswith("check_") or name == "source_self_check"}
    original_argv = sys.argv

    def forbidden(*args, **kwargs):
        if not __debug__:
            raise RuntimeError("Explicit IV66 zero-implicit-check hook refuses optimized Python (-O).")
        raise AssertionError("Ordinary production must invoke zero explicit checks.")

    try:
        globals().update({name: forbidden for name in entry_hooks})
        vars(_reference).update({name: forbidden for name in helper_hooks})
        state = capstone_state(DEFAULT_IV66)
        assert len(state) == 19
        trace = capstone_trace()
        assert evaluate_capstone(state, trace, "ordinary")["summary"]["frames"] == 317
        assert derive_iv66(state)["status"] == "defined"
        assert derive_iv66({})["status"] == "unavailable"
        assert strict_json("-0") == 0
        sys.argv = ["iv66.py"]
        with redirect_stdout(StringIO()):
            assert run() == 0
    finally:
        globals().update(entry_hooks)
        vars(_reference).update(helper_hooks)
        sys.argv = original_argv

def check_cli():
    if not __debug__:
        raise RuntimeError("Explicit IV66 CLI check refuses optimized Python (-O).")
    from contextlib import redirect_stderr, redirect_stdout
    from io import StringIO
    original_argv, original_stdin = sys.argv, sys.stdin
    original_derive, original_checks = globals()["derive_iv66"], globals()["source_self_check"]
    received, checked = [], []

    def capture(value):
        if not __debug__:
            raise RuntimeError("Explicit IV66 CLI capture hook refuses optimized Python (-O).")
        received.append(value)
        return dict(status="unavailable", code="UNAVAILABLE", reason="Explicit CLI harness only.")

    def explicit():
        if not __debug__:
            raise RuntimeError("Explicit IV66 CLI check hook refuses optimized Python (-O).")
        checked.append(True)

    try:
        globals()["derive_iv66"], globals()["source_self_check"] = capture, explicit
        for args, stdin, expected in (([], "", dict(DEFAULT_IV66)), (["{}"], "", {}),
                                       (["-"], '{"q1":-0}', dict(q1=-0.0))):
            sys.argv, sys.stdin = ["iv66.py"] + args, StringIO(stdin)
            output, errors = StringIO(), StringIO()
            with redirect_stdout(output), redirect_stderr(errors):
                assert run() == 0
            assert received[-1] == expected and checked == [] and errors.getvalue() == ""
        assert math.copysign(1., received[-1]["q1"]) == -1.
        before = len(received)
        for args in (["--verify"], ["--self-check", "{}"], ["{}", "{}"], ["--unknown"]):
            sys.argv = ["iv66.py"] + args
            with redirect_stdout(StringIO()), redirect_stderr(StringIO()):
                assert run() == 2
            assert len(received) == before and checked == []
        for text in ("NaN", '{"q1":0,"q1":1}', "{", "{} {}"):
            sys.argv = ["iv66.py", text]
            output = StringIO()
            with redirect_stdout(output):
                assert run() == 0
            assert strict_json(output.getvalue())["code"] == "INVALID_INPUT" and len(received) == before
        globals()["derive_iv66"] = original_derive
        sys.argv = ["iv66.py", "{}"]
        output = StringIO()
        with redirect_stdout(output):
            assert run() == 0
        assert strict_json(output.getvalue())["code"] == "INVALID_INPUT"
        sys.argv = ["iv66.py"]
        output = StringIO()
        with redirect_stdout(output):
            assert run() == 0
        published = strict_json(output.getvalue())
        assert published["status"] == "defined" and len(published["steps"]) == 317
        assert published["texts"]["decoded"] == "ababab"
        try:
            strict_json("NaN")
        except CapstoneFault as error:
            replayed_input = error
        else:
            raise AssertionError("Capture a genuine earlier parser fault.")

        class Reader:
            def read(self):
                if not __debug__:
                    raise RuntimeError("Explicit IV66 foreign-input hook refuses optimized Python (-O).")
                raise replayed_input

        sys.argv, sys.stdin = ["iv66.py", "-"], Reader()
        try:
            run()
        except BaseException as error:
            assert error is replayed_input
        else:
            raise AssertionError("A foreign reader's earlier modeled fault must escape SAME.")
        sys.stdin = original_stdin
        sys.argv = ["iv66.py", "--self-check"]
        with redirect_stdout(StringIO()):
            assert run() == 0
        assert checked == [True]
    finally:
        sys.argv, sys.stdin = original_argv, original_stdin
        globals()["derive_iv66"], globals()["source_self_check"] = original_derive, original_checks


def check_loader_identity():
    if not __debug__:
        raise RuntimeError("Explicit IV66 loader-identity check refuses optimized Python (-O).")
    names = _CACHE_NAMES
    modules = tuple(sys.modules[name] for name in names)
    saved_certificate = globals()["_REFERENCE_CERTIFICATE"]
    assert _load_reference() is _reference
    _reference._dependencies_identity()
    try:
        for name, original in zip(names, modules):
            for unknown in (None, object(), ModuleType(name)):
                sys.modules[name] = unknown
                try:
                    _load_reference()
                except ImportError:
                    assert name in sys.modules and sys.modules[name] is unknown
                else:
                    raise AssertionError("Unknown warm slots, including None, must reject.")
                finally:
                    sys.modules[name] = original
            sys.modules.pop(name)
            try:
                _load_reference()
            except ImportError:
                assert name not in sys.modules
            else:
                raise AssertionError("Deleted warm source must not silently reload.")
            finally:
                sys.modules[name] = original
        # Bootstrap validation must also require declarations BEFORE a new certificate.
        function = _reference._first
        namespace = tuple(vars(_reference).items())
        original_module = function.__module__
        try:
            globals()["_REFERENCE_CERTIFICATE"] = None
            for missing in (False, True):
                if missing:
                    del _reference._first
                else:
                    function.__module__ = "foreign"
                try:
                    _load_reference()
                except ImportError:
                    pass
                else:
                    raise AssertionError("Foreign/missing source declaration must reject before sealing.")
                finally:
                    function.__module__ = original_module
                    vars(_reference).clear()
                    vars(_reference).update(namespace)
        finally:
            globals()["_REFERENCE_CERTIFICATE"] = saved_certificate
        constructor = _reference.CapstoneFault.__init__
        try:
            _reference.CapstoneFault.__init__ = _JsonInputError.__init__
            try:
                _source_identity(_reference, Path(_reference.__file__).resolve(), _reference.__name__)
            except ImportError:
                pass
            else:
                raise AssertionError("The new local fault constructor must match REQUIRED compiled source.")
        finally:
            _reference.CapstoneFault.__init__ = constructor
        original_spec, original_create = importlib.util.spec_from_file_location, importlib.util.module_from_spec
        called = []

        def forbidden_spec(name, path):
            if not __debug__:
                raise RuntimeError("Explicit IV66 cold-incumbent no-spec hook refuses optimized Python (-O).")
            called.append(name)
            raise AssertionError("Cold incumbent rejection must precede ANY new specification.")

        def forbidden_create(spec):
            if not __debug__:
                raise RuntimeError("Explicit IV66 cold-incumbent no-create hook refuses optimized Python (-O).")
            called.append(spec.name)
            raise AssertionError("Cold incumbent rejection must precede ANY new module creation.")

        support, codec, bpe, token = _reference._support, _reference._codec, _reference._bpe, _reference._token
        cases = (
            (support, support.NumericalFault, "__bases__", (ValueError,)),
            (token, token.NumericalFault, "__bases__", (Exception,)),
            (_reference, _reference.CapstoneFault, "__bases__", (type("ForeignNumericalFault", (support.NumericalFault,), {}),)),
            (_reference, _reference, "NumericalFault", token.NumericalFault),
            (bpe, bpe, "NumericalFault", support.NumericalFault),
            (support, support.NumericalFault.__init__.__closure__[0], "cell_contents", token.NumericalFault),
            (token, token.NumericalFault.__init__.__closure__[0], "cell_contents", support.NumericalFault),
            (_reference, _reference.CapstoneFault.__init__.__closure__[0], "cell_contents", support.NumericalFault),
            (_reference, _reference._first, "__defaults__", (None,)),
            (_reference, _reference.CapstoneFault.__init__, "__kwdefaults__", {}),
            (support, support._two_products, "__defaults__", (None, 1)),
            (support, support._softmax, "__defaults__", (False,)),
            (support, support._two_products, "__defaults__", (None, True)),
            (support, support.decoder_trace, "__kwdefaults__", {}),
            (support, support.NumericalFault.__init__, "__defaults__", (None,)),
            (codec, codec.derive_iv39, "__defaults__", (None,)),
            (codec, codec.derive_iv39.__wrapped__, "__kwdefaults__", {}),
            (bpe, bpe.dense_data, "__defaults__", (1,)),
            (token, token.int_array, "__defaults__", (0., 2147483647, "integer array", 32)),
        )
        cases += tuple((module, module, alias, object()) for module, aliases in (
            (_reference, ("importlib", "math", "Path", "sys", "CodeType", "FunctionType", "ModuleType")),
            (support, ("np", "math", "re", "MappingProxyType")),
            (codec, ("importlib", "Path")),
            (bpe, ("importlib", "Path", "MappingProxyType", "np")),
            (token, ("argparse", "wraps", "json", "math", "sys", "MappingProxyType", "np"))) for alias in aliases)
        try:
            for module, subject, attribute, changed in cases:
                original = getattr(subject, attribute)
                try:
                    globals()["_REFERENCE_CERTIFICATE"] = None
                    if module is not _reference:
                        sys.modules.pop(_CACHE_NAMES[0])
                    setattr(subject, attribute, changed)
                    importlib.util.spec_from_file_location, importlib.util.module_from_spec = forbidden_spec, forbidden_create
                    try:
                        _load_reference()
                    except ImportError:
                        assert called == [] and getattr(subject, attribute) is changed
                        assert all(name in sys.modules and sys.modules[name] is incumbent
                            for name, incumbent in zip(_CACHE_NAMES[1:], modules[1:]))
                        if module is _reference:
                            assert sys.modules[_CACHE_NAMES[0]] is _reference
                        else:
                            assert _CACHE_NAMES[0] not in sys.modules
                    else:
                        raise AssertionError("Cold defaults/keyword defaults/foreign dependency must reject with incumbent retained.")
                finally:
                    setattr(subject, attribute, original)
                    importlib.util.spec_from_file_location, importlib.util.module_from_spec = original_spec, original_create
                    for name, incumbent in zip(_CACHE_NAMES, modules):
                        sys.modules[name] = incumbent
                    globals()["_REFERENCE_CERTIFICATE"] = saved_certificate
        finally:
            importlib.util.spec_from_file_location, importlib.util.module_from_spec = original_spec, original_create
        codec = _reference._codec
        assert codec.derive_iv39.__wrapped__.__globals__ is vars(codec)
        assert codec.derive_iv39.__globals__ is vars(_reference._token)
        assert codec._bpe is _reference._bpe and codec._bpe._token is _reference._token
        # Uncached children are bound by object/source, never their incidental name slot.
        child_name = _reference._token.__name__
        present, incumbent = child_name in sys.modules, sys.modules.get(child_name)
        try:
            sys.modules[child_name] = None
            _reference._dependencies_identity()
        finally:
            if present:
                sys.modules[child_name] = incumbent
            else:
                sys.modules.pop(child_name, None)
    finally:
        for name, module in zip(names, modules):
            sys.modules[name] = module
        globals()["_REFERENCE_CERTIFICATE"] = saved_certificate


def check_loader_staging():
    if not __debug__:
        raise RuntimeError("Explicit IV66 loader-staging check refuses optimized Python (-O).")
    original_spec, original_create = importlib.util.spec_from_file_location, importlib.util.module_from_spec
    modules = tuple(sys.modules[name] for name in _CACHE_NAMES)
    certificate = globals()["_REFERENCE_CERTIFICATE"]

    def appearing_spec(name, path):
        if not __debug__:
            raise RuntimeError("Explicit IV66 specification-stage hook refuses optimized Python (-O).")
        result = original_spec(name, path)
        sys.modules[target] = None
        return result

    def appearing_create(spec):
        if not __debug__:
            raise RuntimeError("Explicit IV66 module-create hook refuses optimized Python (-O).")
        result = original_create(spec)
        sys.modules[target] = None
        return result

    try:
        for target in _CACHE_NAMES:
            for phase in ("spec", "create"):
                for name in _CACHE_NAMES:
                    sys.modules.pop(name, None)
                globals()["_REFERENCE_CERTIFICATE"] = None
                importlib.util.spec_from_file_location = appearing_spec if phase == "spec" else original_spec
                importlib.util.module_from_spec = appearing_create if phase == "create" else original_create
                try:
                    _load_reference()
                except ImportError:
                    assert target in sys.modules and sys.modules[target] is None
                    assert all(name == target or name not in sys.modules for name in _CACHE_NAMES)
                else:
                    raise AssertionError("New None incumbents at BOTH prestage phases must survive rejection.")
                finally:
                    importlib.util.spec_from_file_location, importlib.util.module_from_spec = original_spec, original_create
                    for name, module in zip(_CACHE_NAMES, modules):
                        sys.modules[name] = module
                    globals()["_REFERENCE_CERTIFICATE"] = certificate
    finally:
        importlib.util.spec_from_file_location, importlib.util.module_from_spec = original_spec, original_create
        for name, module in zip(_CACHE_NAMES, modules):
            sys.modules[name] = module
        globals()["_REFERENCE_CERTIFICATE"] = certificate


def check_loader_rollback():
    if not __debug__:
        raise RuntimeError("Explicit IV66 loader-rollback check refuses optimized Python (-O).")
    modules = tuple(sys.modules[name] for name in _CACHE_NAMES)
    certificate, original_spec = globals()["_REFERENCE_CERTIFICATE"], importlib.util.spec_from_file_location
    replacement, unknown = object(), MemoryError("IV66 owned loading failure")

    class FailingLoader:
        def __init__(self, actual):
            if not __debug__:
                raise RuntimeError("Explicit IV66 rollback loader wrapper refuses optimized Python (-O).")
            self.actual = actual

        def create_module(self, spec):
            if not __debug__:
                raise RuntimeError("Explicit IV66 rollback-create hook refuses optimized Python (-O).")
            return self.actual.create_module(spec)

        def exec_module(self, module):
            if not __debug__:
                raise RuntimeError("Explicit IV66 rollback-execute hook refuses optimized Python (-O).")
            self.actual.exec_module(module)
            if mutation == "replace":
                sys.modules[target] = replacement
            elif mutation == "none":
                sys.modules[target] = None
            elif mutation == "delete":
                sys.modules.pop(target, None)
            raise unknown

    def failing_spec(name, path):
        if not __debug__:
            raise RuntimeError("Explicit IV66 rollback-spec hook refuses optimized Python (-O).")
        spec = original_spec(name, path)
        if name == target:
            spec.loader = FailingLoader(spec.loader)
        return spec

    try:
        for target in _CACHE_NAMES:
            for mutation in ("keep", "replace", "none", "delete"):
                for name in _CACHE_NAMES:
                    sys.modules.pop(name, None)
                globals()["_REFERENCE_CERTIFICATE"] = None
                importlib.util.spec_from_file_location = failing_spec
                try:
                    _load_reference()
                except BaseException as error:
                    assert error is unknown
                else:
                    raise AssertionError("BaseException must escape and unwind owned cache entries.")
                finally:
                    importlib.util.spec_from_file_location = original_spec
                for name in _CACHE_NAMES:
                    if name == target and mutation == "replace":
                        assert sys.modules[name] is replacement
                    elif name == target and mutation == "none":
                        assert name in sys.modules and sys.modules[name] is None
                    else:
                        assert name not in sys.modules
                for name, module in zip(_CACHE_NAMES, modules):
                    sys.modules[name] = module
                globals()["_REFERENCE_CERTIFICATE"] = certificate
    finally:
        importlib.util.spec_from_file_location = original_spec
        for name, module in zip(_CACHE_NAMES, modules):
            sys.modules[name] = module
        globals()["_REFERENCE_CERTIFICATE"] = certificate


def source_self_check():
    if not __debug__:
        raise RuntimeError("Explicit IV66 checks refuse optimized Python (-O).")
    _reference.source_self_check()
    check_parser()
    check_faults_and_binding()
    check_ordinary_paths()
    check_cli()
    check_loader_identity()
    check_loader_staging()
    check_loader_rollback()


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

Five concepts, already graded in the lab

The lab above owns the only five questions and their corrective feedback. This reading guide explains their mechanisms without adding a second grader or exercise inventory.

  1. iv66-id-row — ID, row, activity. EOS 512 is row 4 of the ascending table. A computed logit for 257 does not make that ID active with one merge.
  2. iv66-bpe — Real bytes and rules. Derive [97,98] → [256] → [97,98] for ab and one merge. Rank 0 supplies the actual reversible pair; prompt EOS is off.
  3. iv66-position — Shape and position. Appended 256 at position one receives [1,3/2], and two observed tokens give input shape [1,2,2]. Block 2 consumes actual block-1 features, without a new lookup or position addition.
  4. iv66-whole-stop — Current whole result. Read the actual current raw19, prompt/logical/selected IDs, decoded bytes/text, selection candidates and all 22 summary fields quoted in the question. Its three accounts are EOS, one-decision budget and two-decision budget. EOS takes precedence even if the requested budget ends on the same decision. A replay cursor does not change the whole-run answer; an input edit creates a new run and clears stale grading.
  5. iv66-limits — Transfer through a counterexample. In the stated one-merge, one-decision zero-output handcase [1,1,0,2,0], inactive 257 loses and 97 keeps the active tie. An EOS would add no bytes; a budget-final ID has no later forward. The old one-block cache cannot supply it. Different histories can decode to the same string.

You can now follow original bytes through positioned features, two real blocks and an active-logit decision back to reconstructed bytes. The manual worksheets explain this chain; the saved record supplies the actual current evidence. Displaying this lesson alone does not establish numerical correctness, canonical parity, accessible interaction or installed offline behavior; each needs its own validation evidence.