<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wikibase.ronzz.org/index.php?action=history&amp;feed=atom&amp;title=Feed-Forward_Network_%28FFN%29_Sub-Layer_%28Transformer%29</id>
	<title>Feed-Forward Network (FFN) Sub-Layer (Transformer) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wikibase.ronzz.org/index.php?action=history&amp;feed=atom&amp;title=Feed-Forward_Network_%28FFN%29_Sub-Layer_%28Transformer%29"/>
	<link rel="alternate" type="text/html" href="https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;action=history"/>
	<updated>2026-11-24T06:37:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16744&amp;oldid=prev</id>
		<title>Rongzhou at 13:29, 17 November 2026</title>
		<link rel="alternate" type="text/html" href="https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16744&amp;oldid=prev"/>
		<updated>2026-11-17T13:29:08Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:29, 17 November 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Transformer]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Transformer]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &#039;&#039;&#039;feed-forward network (FFN) sub-layer&#039;&#039;&#039; is the 2nd &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;of the 2 &lt;/del&gt;sub-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;layers &lt;/del&gt;of a [[Transformer]] &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;block: a 2-&lt;/del&gt;layer &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[feedforward algorithm|feedforward network]] applied to each position of the sequence separately, after [[self-attention]]&lt;/del&gt;.&amp;lt;ref&amp;gt;{{#cite:Q3130}}&amp;lt;/ref&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &#039;&#039;&#039;feed-forward network (FFN) sub-layer&#039;&#039;&#039; is the 2nd sub-&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;layer &lt;/ins&gt;of a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;typical &lt;/ins&gt;[[Transformer]] layer.&amp;lt;ref&amp;gt;{{#cite:Q3130}}&amp;lt;/ref&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Definition ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Definition ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rongzhou</name></author>
	</entry>
	<entry>
		<id>https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16677&amp;oldid=prev</id>
		<title>Rongzhou at 10:44, 17 November 2026</title>
		<link rel="alternate" type="text/html" href="https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16677&amp;oldid=prev"/>
		<updated>2026-11-17T10:44:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;amp;diff=16677&amp;amp;oldid=16676&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Rongzhou</name></author>
	</entry>
	<entry>
		<id>https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16676&amp;oldid=prev</id>
		<title>Rongzhou: Undid revision 16671 by Rongzhou (talk)</title>
		<link rel="alternate" type="text/html" href="https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16676&amp;oldid=prev"/>
		<updated>2026-11-17T10:28:35Z</updated>

		<summary type="html">&lt;p&gt;Undid revision &lt;a href=&quot;/wiki/Special:Diff/16671&quot; title=&quot;Special:Diff/16671&quot;&gt;16671&lt;/a&gt; by &lt;a href=&quot;/wiki/Special:Contributions/Rongzhou&quot; title=&quot;Special:Contributions/Rongzhou&quot;&gt;Rongzhou&lt;/a&gt; (&lt;a href=&quot;/index.php?title=User_talk:Rongzhou&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User talk:Rongzhou (page does not exist)&quot;&gt;talk&lt;/a&gt;)&lt;/p&gt;
&lt;a href=&quot;https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;amp;diff=16676&amp;amp;oldid=16671&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Rongzhou</name></author>
	</entry>
	<entry>
		<id>https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16671&amp;oldid=prev</id>
		<title>Rongzhou: Replaced content with &quot;Category:Activation function A gated linear unit (GLU) is a trainable activation function.  $$ \operatorname{GLU}(\mathbf{X}) =\left(\mathbf{X}\mathbf{W}_1+\mathbf{1}\vec b_1^{\top}\right) \odot f\left(\mathbf{X}\mathbf{W}_2+\mathbf{1}\vec b_2^{\top}\right). $$  The &#039;&#039;&#039;gating function&#039;&#039;&#039; $f$ is commonly any of  * Gaussian error linear unit (GeLU) * sigmoid function * (leaky) rectified/exponential linear units (ReLU, LeakyReLU, ELU)    GLUs are fou...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16671&amp;oldid=prev"/>
		<updated>2026-11-17T10:17:16Z</updated>

		<summary type="html">&lt;p&gt;Replaced content with &amp;quot;&lt;a href=&quot;/index.php?title=Category:Activation_function&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Activation function (page does not exist)&quot;&gt;Category:Activation function&lt;/a&gt; A gated linear unit (GLU) is a trainable &lt;a href=&quot;/wiki/Activation_function&quot; title=&quot;Activation function&quot;&gt;activation function&lt;/a&gt;.  $$ \operatorname{GLU}(\mathbf{X}) =\left(\mathbf{X}\mathbf{W}_1+\mathbf{1}\vec b_1^{\top}\right) \odot f\left(\mathbf{X}\mathbf{W}_2+\mathbf{1}\vec b_2^{\top}\right). $$  The &amp;#039;&amp;#039;&amp;#039;gating function&amp;#039;&amp;#039;&amp;#039; $f$ is commonly any of  * &lt;a href=&quot;/wiki/Gaussian_error_linear_unit_(GeLU)&quot; title=&quot;Gaussian error linear unit (GeLU)&quot;&gt;Gaussian error linear unit (GeLU)&lt;/a&gt; * &lt;a href=&quot;/wiki/Sigmoid_function&quot; title=&quot;Sigmoid function&quot;&gt;sigmoid function&lt;/a&gt; * &lt;a href=&quot;/wiki/(leaky)_rectified/exponential_linear_units_(ReLU,_LeakyReLU,_ELU)&quot; title=&quot;(leaky) rectified/exponential linear units (ReLU, LeakyReLU, ELU)&quot;&gt;(leaky) rectified/exponential linear units (ReLU, LeakyReLU, ELU)&lt;/a&gt;    GLUs are fou...&amp;quot;&lt;/p&gt;
&lt;a href=&quot;https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;amp;diff=16671&amp;amp;oldid=16138&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Rongzhou</name></author>
	</entry>
	<entry>
		<id>https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16138&amp;oldid=prev</id>
		<title>RonzzWikiCowriterAI: AI-assisted (RonzzWikiCowriter) (via update-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16138&amp;oldid=prev"/>
		<updated>2026-11-12T10:12:17Z</updated>

		<summary type="html">&lt;p&gt;AI-assisted (RonzzWikiCowriter) (via update-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:12, 12 November 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l93&quot;&gt;Line 93:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 93:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;where the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2nd &lt;/del&gt;counts $\mathbf{Q}\mathbf{K}^{\top}$ and &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the weighted sum over &lt;/del&gt;$d$ channels in total across heads. The sub-layer therefore costs&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;where the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;attention term &lt;/ins&gt;counts &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the 2 matrix products &lt;/ins&gt;$\mathbf{Q}\mathbf{K}^{\top}$ and &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;$\mathbf{A}\mathbf{V}$, with &lt;/ins&gt;$d$ channels in total across heads. The sub-layer therefore costs&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>RonzzWikiCowriterAI</name></author>
	</entry>
	<entry>
		<id>https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16135&amp;oldid=prev</id>
		<title>RonzzWikiCowriterAI: AI-assisted (RonzzWikiCowriter) (via update-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16135&amp;oldid=prev"/>
		<updated>2026-11-12T10:11:57Z</updated>

		<summary type="html">&lt;p&gt;AI-assisted (RonzzWikiCowriter) (via update-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:11, 12 November 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l28&quot;&gt;Line 28:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 28:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;so &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;1 &lt;/del&gt;network is applied to all $T$ positions with shared weights. Permuting the positions permutes the output and changes nothing else:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;so &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the same &lt;/ins&gt;network is applied to all $T$ positions with shared weights. Permuting the positions permutes the output and changes nothing else:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>RonzzWikiCowriterAI</name></author>
	</entry>
	<entry>
		<id>https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16130&amp;oldid=prev</id>
		<title>RonzzWikiCowriterAI: AI-assisted (RonzzWikiCowriter) (via update-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16130&amp;oldid=prev"/>
		<updated>2026-11-12T10:11:41Z</updated>

		<summary type="html">&lt;p&gt;AI-assisted (RonzzWikiCowriter) (via update-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:11, 12 November 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l55&quot;&gt;Line 55:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 55:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The [[self-attention]] sub-layer of the same block holds $3d&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;\,d_k&lt;/del&gt;$ weights for $\mathbf{W}_Q,\mathbf{W}_K,\mathbf{W}_V$ and $d^{2}$ for the output projection, i.e. $\&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;left(3d_k/&lt;/del&gt;d&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;+1&lt;/del&gt;\&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;right)&lt;/del&gt;d^{2}$&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, so the &lt;/del&gt;FFN share of a block is&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The [[self-attention]] sub-layer of the same block holds $3d&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;^{2}&lt;/ins&gt;$ weights for $\mathbf{W}_Q,\mathbf{W}_K,\mathbf{W}_V$ and $d^{2}$ for the output projection, i.e. $&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;4d^{2}$ whatever the number of heads: the $h$ heads share the width, $d_k=d/h$, so the $3h$ matrices of width $d_k$ hold&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;$$&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;3h\,d\,d_k=3h&lt;/ins&gt;\&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;,&lt;/ins&gt;d\&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;,\frac{&lt;/ins&gt;d&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;}{h}=3d&lt;/ins&gt;^{2}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;$&lt;/ins&gt;$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;weights in total. The &lt;/ins&gt;FFN share of a block is &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;therefore&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;\frac{\left|\theta_{\text{FFN}}\right|}{\left|\theta_{\text{attn}}\right|+\left|\theta_{\text{FFN}}\right|}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;\frac{\left|\theta_{\text{FFN}}\right|}{\left|\theta_{\text{attn}}\right|+\left|\theta_{\text{FFN}}\right|}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;\approx\frac{8d^{2}}{8d^{2}+&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;\left(3d_k/d+1\right)d&lt;/del&gt;^{2}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;\approx\frac{8d^{2}}{8d^{2}+&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;4d&lt;/ins&gt;^{2}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=\&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;frac&lt;/ins&gt;{2}{&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;3&lt;/ins&gt;}.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;\&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;begin&lt;/del&gt;{&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;cases}&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;2&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;/3, &amp;amp; d_k=d \quad\text{(1 head)&lt;/del&gt;}&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;,\\&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;0.85, &amp;amp; d_k=d/8 \quad\text&lt;/del&gt;{&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(8 heads)&lt;/del&gt;}.&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;\end{cases}&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For the base Transformer ($d=512$, $d_{ff}=2048&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;$, 8 heads of width $64&lt;/del&gt;$) the FFN holds&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For the base Transformer ($d=512$, $d_{ff}=2048$) the FFN holds&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l73&quot;&gt;Line 73:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 75:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;weights &lt;/del&gt;against $&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;360&lt;/del&gt;\,&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;448&lt;/del&gt;$ for attention, so &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;most &lt;/del&gt;of the parameters of &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the model &lt;/del&gt;sit in its &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;FFNs&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;parameters, &lt;/ins&gt;against&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;$&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;$&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;4\cdot512^{2}+4\cdot512=1&lt;/ins&gt;\,&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;050\,624&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;$&lt;/ins&gt;$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;for attention, so &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2/3 &lt;/ins&gt;of the parameters of &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a block &lt;/ins&gt;sit in its &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;FFN&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Cost ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Cost ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>RonzzWikiCowriterAI</name></author>
	</entry>
	<entry>
		<id>https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16128&amp;oldid=prev</id>
		<title>RonzzWikiCowriterAI: AI-assisted (RonzzWikiCowriter) (via create-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://wikibase.ronzz.org/index.php?title=Feed-Forward_Network_(FFN)_Sub-Layer_(Transformer)&amp;diff=16128&amp;oldid=prev"/>
		<updated>2026-11-12T10:11:10Z</updated>

		<summary type="html">&lt;p&gt;AI-assisted (RonzzWikiCowriter) (via create-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Transformer]]&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;feed-forward network (FFN) sub-layer&amp;#039;&amp;#039;&amp;#039; is the 2nd of the 2 sub-layers of a [[Transformer]] block: a 2-layer [[feedforward algorithm|feedforward network]] applied to each position of the sequence separately, after [[self-attention]].&amp;lt;ref&amp;gt;{{#cite:Q3130}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Definition ==&lt;br /&gt;
&lt;br /&gt;
Let $\mathbf{X}\in\mathbb{R}^{T\times d}$, and let $\mathbf{W}_1\in\mathbb{R}^{d\times d_{ff}}$, $\vec b_1\in\mathbb{R}^{d_{ff}}$, $\mathbf{W}_2\in\mathbb{R}^{d_{ff}\times d}$, $\vec b_2\in\mathbb{R}^{d}$. The sub-layer is&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\operatorname{FFN}(\mathbf{X})&lt;br /&gt;
=\sigma\left(\mathbf{X}\mathbf{W}_1+\mathbf{1}\vec b_1^{\top}\right)\mathbf{W}_2+\mathbf{1}\vec b_2^{\top},&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
where $\mathbf{1}\in\mathbb{R}^{T}$ is a column of 1s, so that $\mathbf{1}\vec b_1^{\top}$ repeats the bias on every row, and $\sigma$ is an [[activation function]] applied entrywise. The original model takes&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
d_{ff}=4d,&lt;br /&gt;
\qquad&lt;br /&gt;
\sigma=\operatorname{ReLU}.&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
== Position-wise operation ==&lt;br /&gt;
&lt;br /&gt;
Row $t$ of the output depends on row $t$ of the input alone,&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\operatorname{FFN}(\mathbf{X})_t&lt;br /&gt;
=\sigma\left(\vec x_t^{\top}\mathbf{W}_1+\vec b_1^{\top}\right)\mathbf{W}_2+\vec b_2^{\top},&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
so 1 network is applied to all $T$ positions with shared weights. Permuting the positions permutes the output and changes nothing else:&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\begin{aligned}&lt;br /&gt;
\operatorname{FFN}\left(\mathbf{P}\mathbf{X}\right)&lt;br /&gt;
&amp;amp;=\sigma\left(\mathbf{P}\mathbf{X}\mathbf{W}_1+\mathbf{1}\vec b_1^{\top}\right)\mathbf{W}_2+\mathbf{1}\vec b_2^{\top}\\&lt;br /&gt;
&amp;amp;=\mathbf{P}\left(\sigma\left(\mathbf{X}\mathbf{W}_1+\mathbf{1}\vec b_1^{\top}\right)\mathbf{W}_2+\mathbf{1}\vec b_2^{\top}\right)&lt;br /&gt;
=\mathbf{P}\operatorname{FFN}(\mathbf{X}),&lt;br /&gt;
\end{aligned}&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
using $\mathbf{P}\mathbf{1}=\mathbf{1}$ and $\mathbf{P}\sigma(\cdot)=\sigma(\mathbf{P}\cdot)$ entrywise. Sharing also keeps the parameter count independent of $T$: a 1-token and a $10^{5}$-token sequence have the same $\theta$.&lt;br /&gt;
&lt;br /&gt;
== Parameter count ==&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\left|\theta_{\text{FFN}}\right|&lt;br /&gt;
=d\,d_{ff}+d_{ff}+d_{ff}\,d+d&lt;br /&gt;
=2dd_{ff}+d_{ff}+d,&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
which for $d_{ff}=4d$ is&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\left|\theta_{\text{FFN}}\right|=8d^{2}+5d .&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
The [[self-attention]] sub-layer of the same block holds $3d\,d_k$ weights for $\mathbf{W}_Q,\mathbf{W}_K,\mathbf{W}_V$ and $d^{2}$ for the output projection, i.e. $\left(3d_k/d+1\right)d^{2}$, so the FFN share of a block is&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\frac{\left|\theta_{\text{FFN}}\right|}{\left|\theta_{\text{attn}}\right|+\left|\theta_{\text{FFN}}\right|}&lt;br /&gt;
\approx\frac{8d^{2}}{8d^{2}+\left(3d_k/d+1\right)d^{2}}&lt;br /&gt;
=&lt;br /&gt;
\begin{cases}&lt;br /&gt;
2/3, &amp;amp; d_k=d \quad\text{(1 head)},\\&lt;br /&gt;
0.85, &amp;amp; d_k=d/8 \quad\text{(8 heads)}.&lt;br /&gt;
\end{cases}&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
For the base Transformer ($d=512$, $d_{ff}=2048$, 8 heads of width $64$) the FFN holds&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
2\cdot512\cdot2048+2048+512=2\,099\,712&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
weights against $360\,448$ for attention, so most of the parameters of the model sit in its FFNs.&lt;br /&gt;
&lt;br /&gt;
== Cost ==&lt;br /&gt;
&lt;br /&gt;
Each position costs $d\,d_{ff}$ multiply-adds for $\mathbf{W}_1$ and $d_{ff}\,d$ for $\mathbf{W}_2$, hence&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\text{FFN: }2T\,d\,d_{ff}&lt;br /&gt;
\qquad\text{versus}\qquad&lt;br /&gt;
\text{attention: }2T^{2}d,&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
where the 2nd counts $\mathbf{Q}\mathbf{K}^{\top}$ and the weighted sum over $d$ channels in total across heads. The sub-layer therefore costs&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\mathcal{O}\left(T\,d\,d_{ff}\right)=\mathcal{O}\left(Td^{2}\right)&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
time, against $\mathcal{O}(T^{2}d)$ for attention, and the 2 terms cross at&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
2T\,d\,d_{ff}=2T^{2}d&lt;br /&gt;
\iff&lt;br /&gt;
T=d_{ff}.&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
With $d_{ff}=4d$ the FFN dominates for contexts shorter than $4d$ tokens (e.g. $16384$ tokens at $d=4096$) and attention dominates beyond it.&lt;br /&gt;
&lt;br /&gt;
== Placement in the block ==&lt;br /&gt;
&lt;br /&gt;
With the Pre-LN arrangement of [[residual connection (Transformer)|residual connections]],&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\begin{cases}&lt;br /&gt;
\mathbf{X}&amp;#039;=\mathbf{X}+\operatorname{Attn}\left(\operatorname{LN}\left(\mathbf{X}\right)\right),\\&lt;br /&gt;
\mathbf{X}&amp;#039;&amp;#039;=\mathbf{X}&amp;#039;+\operatorname{FFN}\left(\operatorname{LN}\left(\mathbf{X}&amp;#039;\right)\right),&lt;br /&gt;
\end{cases}&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
so a block mixes positions once, in the attention sub-layer, and transforms each position once, in the FFN sub-layer, both inside a residual connection and a normalisation.&lt;br /&gt;
&lt;br /&gt;
== Activation choice ==&lt;br /&gt;
&lt;br /&gt;
* the &amp;#039;&amp;#039;&amp;#039;rectifier&amp;#039;&amp;#039;&amp;#039; $\operatorname{ReLU}(z)=\max(0,z)$, in the original model.&lt;br /&gt;
* the &amp;#039;&amp;#039;&amp;#039;Gaussian error linear unit&amp;#039;&amp;#039;&amp;#039; $\operatorname{GELU}(z)=z\,\Phi(z)=\frac{z}{2}\left(1+\operatorname{erf}\left(z/\sqrt{2}\right)\right)$, a smooth version of the rectifier.&lt;br /&gt;
&lt;br /&gt;
A &amp;#039;&amp;#039;&amp;#039;gated linear unit&amp;#039;&amp;#039;&amp;#039; replaces the elementwise $\sigma$ by the product of 2 projections, of which 1 is gated,&amp;lt;ref&amp;gt;{{#cite:Q3270}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\operatorname{GLU}(\mathbf{X})&lt;br /&gt;
=\left(\mathbf{X}\mathbf{W}_1+\mathbf{1}\vec b_1^{\top}\right)&lt;br /&gt;
\odot\sigma\left(\mathbf{X}\mathbf{W}_3+\mathbf{1}\vec b_3^{\top}\right),&lt;br /&gt;
\qquad&lt;br /&gt;
\operatorname{FFN}_{\text{GLU}}(\mathbf{X})=\operatorname{GLU}(\mathbf{X})\,\mathbf{W}_2+\mathbf{1}\vec b_2^{\top},&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
with ReLU, GELU or the sigmoid in place of $\sigma$ in the gate. Such a variant holds 3 matrices of size $d\times d_{ff}$ instead of 2, so it shrinks the hidden width by the same factor to match the parameter count of the ungated form,&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
3d\,d_{ff}&amp;#039;=2d\cdot4d&lt;br /&gt;
\iff&lt;br /&gt;
d_{ff}&amp;#039;=\frac{2}{3}\cdot4d .&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
At matched parameter count, the gated variants improve over ReLU and GELU in the FFN sub-layer of the Transformer.&amp;lt;ref&amp;gt;{{#cite:Q3270}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
{{Hidden example}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Setup&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Let $T=2$, $d=2$, $d_{ff}=3$, $\sigma=\operatorname{ReLU}$, and&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\mathbf{X}=&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
1&amp;amp;0\\&lt;br /&gt;
0&amp;amp;1&lt;br /&gt;
\end{pmatrix},&lt;br /&gt;
\qquad&lt;br /&gt;
\mathbf{W}_1=&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
1&amp;amp;0&amp;amp;1\\&lt;br /&gt;
0&amp;amp;1&amp;amp;-1&lt;br /&gt;
\end{pmatrix},&lt;br /&gt;
\qquad&lt;br /&gt;
\vec b_1=\vec 0,&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\mathbf{W}_2=&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
1&amp;amp;1\\&lt;br /&gt;
0&amp;amp;1\\&lt;br /&gt;
1&amp;amp;0&lt;br /&gt;
\end{pmatrix},&lt;br /&gt;
\qquad&lt;br /&gt;
\vec b_2=&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
1\\&lt;br /&gt;
-1&lt;br /&gt;
\end{pmatrix}.&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Hidden layer&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\mathbf{X}\mathbf{W}_1=&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
1&amp;amp;0&amp;amp;1\\&lt;br /&gt;
0&amp;amp;1&amp;amp;-1&lt;br /&gt;
\end{pmatrix},&lt;br /&gt;
\qquad&lt;br /&gt;
\sigma\left(\mathbf{X}\mathbf{W}_1\right)=&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
1&amp;amp;0&amp;amp;1\\&lt;br /&gt;
0&amp;amp;1&amp;amp;0&lt;br /&gt;
\end{pmatrix}.&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Output&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\sigma\left(\mathbf{X}\mathbf{W}_1\right)\mathbf{W}_2+\mathbf{1}\vec b_2^{\top}&lt;br /&gt;
=&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
2&amp;amp;1\\&lt;br /&gt;
0&amp;amp;1&lt;br /&gt;
\end{pmatrix}&lt;br /&gt;
+&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
1&amp;amp;-1\\&lt;br /&gt;
1&amp;amp;-1&lt;br /&gt;
\end{pmatrix}&lt;br /&gt;
=&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
3&amp;amp;0\\&lt;br /&gt;
1&amp;amp;0&lt;br /&gt;
\end{pmatrix}.&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Order of the positions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Swapping the 2 rows of $\mathbf{X}$ swaps the 2 rows of the output and changes nothing else,&lt;br /&gt;
&lt;br /&gt;
$$&lt;br /&gt;
\operatorname{FFN}\left(\mathbf{P}\mathbf{X}\right)=&lt;br /&gt;
\operatorname{FFN}\left(&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
0&amp;amp;1\\&lt;br /&gt;
1&amp;amp;0&lt;br /&gt;
\end{pmatrix}&lt;br /&gt;
\right)&lt;br /&gt;
=&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
1&amp;amp;0\\&lt;br /&gt;
3&amp;amp;0&lt;br /&gt;
\end{pmatrix}&lt;br /&gt;
=&lt;br /&gt;
\mathbf{P}&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
3&amp;amp;0\\&lt;br /&gt;
1&amp;amp;0&lt;br /&gt;
\end{pmatrix}.&lt;br /&gt;
$$&lt;br /&gt;
{{End hidden}}&lt;/div&gt;</summary>
		<author><name>RonzzWikiCowriterAI</name></author>
	</entry>
</feed>