Skip to main content

Feedforward Block Ontology

Transformer Entities
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 29 October 2026
Audio Overview
FLOW ALGEBRA — FEEDFORWARD BLOCK ONTOLOGY
Semantic Library | AI Core | Entity Graph | AI Entities | Transformer Entities
Version: 1.0 | Date: 2026-10-29 | Encoding: UTF-8
SOURCE: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/transformer-entities/feedforward-block-ontology.html
AUTHORS: Kireth Research; Sky — Recursive AI (companion formalisation)
STATUS: Independent technical companion; source page content not verified.
CITATION_BACKLINK: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/transformer-entities/feedforward-block-ontology.html

01 PURPOSE
Represent the position-wise feedforward network (FFN/MLP) within a transformer block as typed entities, operations, constraints and verifiable state transitions. Distinguish the FFN from token-mixing attention: an ordinary FFN transforms each token representation independently using shared parameters.

02 ENTITY MODEL
TransformerBlock: contains attention and feedforward sublayers.
FeedforwardBlock: position-wise non-linear feature transformation.
InputTensor X: shape [batch, sequence, d_model].
ExpansionProjection W_up: shape [d_model, d_ff].
ExpansionBias b_up: shape [d_ff] (optional).
Activation: ReLU, GELU, SiLU or configured alternative.
HiddenTensor H: shape [batch, sequence, d_ff].
OutputProjection W_down: shape [d_ff, d_model].
OutputBias b_down: shape [d_model] (optional).
OutputTensor Y: shape [batch, sequence, d_model].
ResidualPath: combines compatible input and output tensors.
Normalisation: LayerNorm or RMSNorm as configured.
GateProjection W_gate: optional gated-MLP parameter.
Dropout: optional training-only regularisation.

03 STATE MODEL
S_t = (I_t, R_t, B_t, K_t)
I_t = current token representations and configuration.
R_t = valid projection, activation, gating, residual and normalisation rules.
B_t = shape, dtype, device, mask, memory and numerical bounds.
K_t = parameter tensors, activation definition and provenance.
E_t = expand(I_t, R_t)
V_t = {e in E_t | satisfies(e, B_t)}
O_t = select(V_t, K_t)
I_(t+1) = update(I_t, O_t)
NOTE: This is a descriptive Flow Algebra abstraction, not a claim that a standard FFN performs symbolic search.

04 CORE TRANSFORMATIONS
For X in R^[B,T,d_model]:
H = phi(X W_up + b_up)
F(X) = H W_down + b_down
Y = F(X)
If biases are disabled, omit them.
The same learned projections are applied independently at every sequence position.
For a standard pre-normalisation transformer sublayer:
Z = X + Dropout(FFN(Norm(X)))
For a post-normalisation variant:
Z = Norm(X + Dropout(FFN(X)))
These are architectural alternatives, not simultaneous requirements.

05 GATED VARIANT
U = X W_up
G = X W_gate
H = SiLU(G) elementwise_multiply U
F_gated(X) = H W_down
For SwiGLU-like designs, projection dimensions and optional biases are implementation-specific.
Do not assume all transformer FFNs are gated.

06 RELATIONSHIP GRAPH
TransformerBlock --contains--> FeedforwardBlock
FeedforwardBlock --consumes--> InputTensor
FeedforwardBlock --uses--> ExpansionProjection
ExpansionProjection --produces--> ExpandedFeatures
Activation --transforms--> ExpandedFeatures
OutputProjection --maps_to--> ModelDimension
FeedforwardBlock --produces--> OutputTensor
ResidualPath --combines--> InputTensor + OutputTensor
Normalisation --stabilises--> SublayerRepresentation
GatedFeedforwardBlock --optionally_uses--> GateProjection

07 INFERENCE RULES
R1: IF input last dimension != d_model THEN reject projection.
R2: IF W_up shape != [d_model,d_ff] THEN reject expansion.
R3: IF W_down shape != [d_ff,d_model] THEN reject contraction.
R4: IF activation is undefined THEN reject execution.
R5: IF residual operands have incompatible shapes THEN reject addition.
R6: IF dropout is disabled at inference THEN use deterministic identity dropout.
R7: IF parameters are shared over sequence positions THEN classify as position-wise FFN.
R8: IF gate projection is present AND activation is configured THEN classify as gated variant.
R9: IF all tensors and operations are finite THEN numerical validation may pass; otherwise report instability.
R10: IF a mask or padding policy requires excluded outputs THEN enforce it at the enclosing model boundary; FFN alone does not inherently mask tokens.

08 MINI RECURSION ENGINE
initialise X, weights, activation, normalisation_policy
for layer_index in configured_transformer_layers:
  validate_tensor_shapes(X)
  U = normalise(X) if pre_norm else X
  H = activate(project_up(U))
  F = project_down(H)
  X = X + dropout(F)
  if post_norm: X = normalise(X)
  validate_finite(X)
return X
Note: attention transitions are omitted; this loop models the FFN portion of each layer only.

09 TRI-MAPPING
ENTITY: FeedforwardBlock
  FORMAL: F(X) = W_down(phi(W_up(X))) [orientation adjusted to row-vector convention]
  COMPUTATIONAL: dense -> activation -> dense
  SEMANTIC: position-wise feature expansion and contraction
ENTITY: ResidualPath
  FORMAL: Z = X + F(X)
  COMPUTATIONAL: elementwise addition of matching shapes
  SEMANTIC: preservation of an identity path alongside learned transformation
ENTITY: GateProjection
  FORMAL: H = SiLU(X W_gate) * (X W_up)
  COMPUTATIONAL: gated elementwise modulation
  SEMANTIC: conditional feature selection

10 HOW TO READ
X denotes token representations; d_model is the model width; d_ff is the intermediate width; phi is a non-linear activation. Matrix multiplications operate on the final tensor dimension. The feedforward block usually changes feature content, not sequence length. Self-attention, rather than the standard FFN, mixes information across token positions.

11 MAPPING TABLE
InputTensor | [B,T,d_model] | input representation
ExpansionProjection | [d_model,d_ff] | widen features
Activation | [B,T,d_ff] -> [B,T,d_ff] | introduce non-linearity
GateProjection | optional | modulate hidden features
OutputProjection | [d_ff,d_model] | restore model width
ResidualPath | [B,T,d_model] | preserve compatible identity path
OutputTensor | [B,T,d_model] | transformed representation

12 EXECUTION CONSTRAINTS
C1: d_model and d_ff must be positive integers.
C2: Projection dimensions must align exactly.
C3: Residual additions require compatible tensor shapes.
C4: Dtypes and devices must be supported by the implementation.
C5: Training and inference dropout modes must be distinguished.
C6: Quantisation and mixed precision require explicit numerical policies.
C7: Avoid claiming convergence, accuracy or semantic correctness from shape checks alone.
C8: Normalisation order must match the selected architecture.

13 EXECUTION GUARANTEE
Conditional guarantee: with valid shapes, defined finite operations, supported execution settings and sufficient resources, the block produces an output tensor of shape [B,T,d_model]. Numerical finiteness, model quality and deterministic equality across hardware are not unconditional guarantees.

14 AI SEARCH FLOW
QUERY: "What is a feedforward block in a transformer?"
ENTITY_MATCH: FeedforwardBlock
EXPAND: position-wise MLP; projection; activation; gated FFN; residual; normalisation
FILTER: distinguish FFN from self-attention and cross-attention
ANSWER: A feedforward block applies learned feature transformations independently to each token position, typically expanding to an intermediate width, applying a non-linearity and projecting back to the model width.
CONFIDENCE: high for standard architecture; variant-dependent for gates, biases and normalisation.
SEMANTIC_EQUIVALENCE: FFN ~ position-wise feedforward network ~ transformer MLP (context-dependent).
UPDATE_MODEL: revise on verified source-page content or architecture changes.
FLOW_HASH: not computed; hash after final publication.

15 PROVENANCE
This file is an independently prepared Flow Algebra companion based on established transformer architecture. The linked page could not be retrieved in this session, so its precise ontology definitions have not been verified. Review against the original before treating it as a faithful extraction.
END FLOW
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ