You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement the final linear layer that produces logits for each token in the vocabulary. BitNet ties the word embedding matrix with this output layer (the weights are shared) huggingface.co.
This means you can use the same embedding weight matrix (from step 5) transposed as the projection matrix to go from hidden state to vocab logits. For each position (typically one focuses on the last position for generation), apply a BitLinear using the transposed embedding weights: input is the final hidden state vector (8-bit) and weights are the quantized embedding vectors (ternary) for each vocab token. This yields a vector of raw logits of size equal to the vocabulary (128k). No bias is used in this output layer. If memory is a concern, you can compute this dot-product for only the last token’s hidden state when generating step-by-step, rather than for all 4096 positions at once. The result is a set of logits for the next token prediction.
Activity
174 implement tokenizer llama3 bpe (#199)
200 improve pr messages (#201)
feat(bitnet): implement token embedding layer (#202)
176 set model constants architecture hyperparameters (#203)
feat(tensor): add BitLinear layer and tests (#178) (#206)
feat(bitnet): implement Sub-Layer Normalization (SubLN) for #179 (#207)
feat(bitnet): implement squared ReLU activation (ReLU²) (#208)
feat(bitnet): implement QKV projection for attention (#209)
feat(bitnet): implement scaled dot-product attention (#210)
Optimize attention weights multiplication with values (#211)
feat(math): add attention output projection layer (#184) (#212)
feat(math): add FFN sublayer for transformer block (#213)
186 integrate attention sublayer pre norm residual (#214)
feat(bitnet): implement feed-forward sublayer with pre-norm and resid…
188 stack transformer blocks (#216)
feat(bitnet): implement final output layer (LM Head) - Closes #189
feat(math): implement LM head with error handling (#217)