Enter why you can share weights in the embedded and output table project

The language model input end reads the embedded line by token numbering, while the output end uses hidden vectors to project word table fractions.

• Step by stepCollate in 2 self-measured2 First-hand sources
Start Body
Learning objectives and first steps2 objectives . 1 first fix

Try to do it after reading

  • Mechanisms and prerequisites to explain why input embedded and output table projectors can share weights
  • Positioning the mechanism ' s fault limits with fixed examples

Suggested first

  • Embedded Matrix and Matrix Conversion

Issues and mechanisms

The language model input end reads the embedded line by token numbering, while the output end uses hidden vectors to project word table fractions. If the two ports use compatible dimensions, they can be shared with the same parameter matrix. Share the reduction parameters and link input expressions to output scoring; It does not reproduce the input token directly to the answer, nor does it mean that the output probability is equal to all explanations of embedded similarities.

Sets the array E as the size of the vocabulary V multiplied by the hidden dimension d, where the input checker gets a line of d vectors; Output hides h and E converts to get V fractions. When sharing, the same parameter receives the gradient of the input path and the output path, and the general update is the sum of these contributions. If the two places are only initialized and the values are not shared, they may still be separated after training and cannot be called weighting.

A concrete example

The rows for the three token and E in the composite table are [10], [0,1] and [1]. Hide h = [2,1] and three rows accumulate[2,1,3], with the third highest probability of being consolidated. Read No. 1 token received [10], without forcing the next entry to remain No. 1. The matrix has only six parameters; If the input output saves the same size matrix separately, 12 are required, and deviations and other network parameters should be counted separately.

Borders and checks

Some of the structures are inputted to different peacekeeping output dimensions and require additional projection, which is not necessarily directly applicable. An extension of the vocabulary, special sign training and adaptor preservation is also checked for the maintenance of the shared relationship. Export files may weigh the shared storage or copy values and should therefore be checked from model definitions to parameter identities rather than just looking at file sizes.

A method of verification

A gradient for shared parameters also requires an detectable experiment: only the input path is enabled, only the output path is enabled, and simultaneously, confirming that the total gradient is equal to two parts. Freezing the head of the output, if it actually freezes the shared object, will also freeze the input embedded; This is different from freezing an independent copy. When expanding the glossary, two lines should be reconciled with the new line identity instead of expanding a matrix and relying on loaders to speculate on shared relationships. The list of parameters and the fixed input output together will allow the contract to be checked.

Check understanding

Did the weights just initially become the same number, just to bind them?

No, it's not. The binding requires the same training parameters or clear shared constraints; Two separate parameters will receive different updates. Tests check object relationships and updated synchronisation.

You don't need to calculate the fractions of the vocabulary when you tie the output head?

Still calculates the matching of hidden vectors to the word sheet line and the uniscription. Savings are achieved by storing parameters and statistical structures, without automatically eliminating the calculations associated with the dictionary dimensions.

Sources and reconciliations

Definitions, methods and interfaces are available.

  1. Attention Is All You Need
  2. Stanford CS336 — Language Modeling from Scratch, Spring 2025

Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.

← Back to the knowledge directory
Ask Max Ask about this site
Ask Max ↗

Opening the assistant…

Paper figure

Photo comments

LEAVE A NOTE

About this photograph

Connecting to the discussion board…

    Comments become public after moderation. You can delete your own comments from this browser.
    No email is required. Clearing cookies prevents this browser from claiming earlier comments.

    MAX WANG / INDEX

    Find something

    Enter a keyword, or explore the directory below.