ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Float32 normalization of vision-attention logits

Softmax across the final key-position axis turns each query’s masked logits into relative nonnegative weights. The source calculates the normalization in float32 and casts its result to the query dtype. At least one finite eligible key is required per row.

Donor model implementationhistorical source recovered; expression not executed in this website audit
Learn with the Atlas

Understand the scale

See what normalization changes and which assumptions it introduces.

Open guided lesson
donor-eq-7ee1a616cbd818source-code mathematical expression
attnweight=torch.softmax(attnweight,dim=−1,dtype=torch.float32).to(q.dtype)attn_weight = torch.softmax(attn_weight, dim=-1, dtype=torch.float32).to(q.dtype)

Read the equation

Softmax across the final key-position axis turns each query’s masked logits into relative nonnegative weights. The source calculates the normalization in float32 and casts its result to the query dtype. At least one finite eligible key is required per row.

Terms & definitions

The recovered passage does not supply a separate symbol table. Read the source context for the notation used in this version; familiar letters may carry different meanings in other builds.

How it works

Read the definition from its right-hand expression to the quantity on the left. Its surrounding source records the intended input, state, or parameter context. Where the source leaves an operation unspecified, this page preserves that gap.

Assumptions & limits

Source recovery establishes that the expression appears in this record. Its mathematical validity, implementation behavior, and interpretation must be assessed separately. See the linked source and research notes for the checks available for this version.

Original context

Read the surrounding source passage
attn_weight = q @ k.transpose(-2, -1) / math.sqrt(q.shape[-1])
    attn_weight += attention_mask
    attn_weight = torch.softmax(attn_weight, dim=-1,
                                dtype=torch.float32).to(q.dtype)

    attn_output = attn_weight @ v
    attn_output = attn_output.transpose(0, 1)
Exact original notation
attn_weight = torch.softmax(attn_weight, dim=-1,
                                dtype=torch.float32).to(q.dtype)

Related builds

Sources & provenance

01
kimi source tree.txt
lines 1191–1192 · Aug 5, 2026
attn_weight = torch.softmax(attn_weight, dim=-1, dtype=torch.float32).to(q.dtype)
02
kimi source tree.txt
lines 1191–1192 · Aug 5, 2026
attn_weight = torch.softmax(attn_weight, dim=-1, dtype=torch.float32).to(q.dtype)

Search equations, builds, manuscript text, and recovered sources.