-
Notifications
You must be signed in to change notification settings - Fork 28
Add graphviz for transformer architecture #739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds a Graphviz DOT file that visualizes the transformer architecture from a mechanistic interpretability perspective, showing how different weight matrices (readers and writers) interact with the residual stream. The diagram illustrates the flow of information through embedding layers, normalization, attention mechanisms, and MLP layers.
Changes:
- Added a new documentation diagram file that maps the transformer architecture components including Writers (W_E, W_down, W_O), Readers (W_Q, W_K, W_V, W_up, LM Head), the residual stream, and normalization layers
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| </TR> | ||
| <TR> | ||
| <TD COLSPAN="2"> | ||
| <B>"d_head" column vectors</B> in ℝ<SUP>d_model</SUP> |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent quotation marks: "d_head" is quoted here but d_model is not quoted in the same line. This is part of the broader inconsistency pattern throughout the file where some dimension names are quoted and others are not.
| </TR> | ||
| <TR> | ||
| <TD COLSPAN="2"> | ||
| <B>"d_ff" column vectors</B> in ℝ<SUP>d_model</SUP> |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent quotation marks: "d_ff" is quoted here but d_model is not quoted in the same line. This is part of the broader inconsistency pattern throughout the file where some dimension names are quoted and others are not.
| <TABLE BORDER="1" CELLBORDER="0" CELLSPACING="0" CELLPADDING="6"> | ||
| <TR> | ||
| <TD BGCOLOR="#eaf2ff" COLSPAN="2"> | ||
| <B>Reader: LM Head</B> (d_model × "vocab_size") |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent quotation marks: "vocab_size" is quoted here but d_model is not quoted in the same line. This is part of the broader inconsistency pattern throughout the file where some dimension names are quoted and others are not.
| </TR> | ||
| <TR> | ||
| <TD COLSPAN="2"> | ||
| <B>"vocab_size" column vectors</B> in ℝ<SUP>d_model</SUP> |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent quotation marks: "vocab_size" is quoted here but d_model is not quoted in the same line. This is part of the broader inconsistency pattern throughout the file where some dimension names are quoted and others are not.
| </TD> | ||
| </TR> | ||
| <TR> | ||
| <TD COLSPAN="2">axes: x = d_model, y = vocab_size </TD> |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space after closing parenthesis. The line ends with "vocab_size )" but should be "vocab_size)" for consistency with other similar lines (see lines 38, 56, 109, 127, 145, 163, 181).
| <TD COLSPAN="2">axes: x = d_model, y = vocab_size </TD> | |
| <TD COLSPAN="2">axes: x = d_model, y = vocab_size</TD> |
| </TR> | ||
| <TR> | ||
| <TD COLSPAN="2"> | ||
| <B>"vocab_size" row vectors</B> in ℝ<SUP>d_model</SUP> |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent use of quotation marks around dimension names. Lines 24, 42, 60, and 131 use quotation marks around "vocab_size", "d_ff", and "d_head", but other dimension names like d_model, d_head (in other places) are not quoted. Either quote all dimension names consistently or remove quotes from all for consistency throughout the diagram.
| </TR> | ||
| <TR> | ||
| <TD COLSPAN="2"> | ||
| <B>"d_ff" row vectors</B> in ℝ<SUP>d_model</SUP> |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent quotation marks: "d_ff" is quoted here but d_model is not quoted in the same line. This is part of the broader inconsistency pattern throughout the file where some dimension names are quoted and others are not.
| <B>"d_ff" row vectors</B> in ℝ<SUP>d_model</SUP> | |
| <B>d_ff row vectors</B> in ℝ<SUP>d_model</SUP> |
| </TR> | ||
| <TR> | ||
| <TD COLSPAN="2"> | ||
| <B>"d_head" row vectors</B> in ℝ<SUP>d_model</SUP> |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent quotation marks: "d_head" is quoted here but d_model is not quoted in the same line. This is part of the broader inconsistency pattern throughout the file where some dimension names are quoted and others are not.
| <B>Reader: LM Head</B> (d_model × "vocab_size") | ||
| </TD> | ||
| </TR> | ||
| <TR> | ||
| <TD COLSPAN="2">axes: x = "vocab_size", y = d_model</TD> |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent quotation marks: "vocab_size" is quoted here but d_model is not quoted in the same line. This is part of the broader inconsistency pattern throughout the file where some dimension names are quoted and others are not.
| <B>Reader: LM Head</B> (d_model × "vocab_size") | |
| </TD> | |
| </TR> | |
| <TR> | |
| <TD COLSPAN="2">axes: x = "vocab_size", y = d_model</TD> | |
| <B>Reader: LM Head</B> (d_model × vocab_size) | |
| </TD> | |
| </TR> | |
| <TR> | |
| <TD COLSPAN="2">axes: x = vocab_size, y = d_model</TD> |
No description provided.