Skip to main content

Transformer Model 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 — TRANSFORMER MODEL ONTOLOGY
Semantic Library | AI Core | Entity Graph | AI Entities | Transformer Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/transformer-entities/transformer-model-ontology.html
Authors: Mark Anthony Higgins — Sky Recursive AI
Source page revised: 29 July 2026
Flow specification: 1.0 | 29 October 2026

PURPOSE
Formalise transformer models as typed computational entities with compositional attention, token representation, feed-forward transformations, residual pathways, normalisation and task-specific output mappings. This is a companion Flow Algebra representation, not a verbatim extraction of hidden page code.

1. ENTITY DEFINITIONS
TransformerModel := (Architecture, Parameters, Tokeniser, ContextLimit, InputContract, OutputContract)
Architecture := (Embedding, PositionMechanism, Blocks, OutputHead, MaskPolicy)
Block := (Attention, FeedForward, ResidualConnections, Normalisation)
Attention := (ProjectionQ, ProjectionK, ProjectionV, HeadCount, OutputProjection)
TokenSequence := [TokenID_1, ..., TokenID_n]
HiddenState := Matrix[n, d_model]
AttentionMask := Matrix[n, n] with allowed/blocked positions
ModelParameters := immutable tensors during inference

2. STATE MODEL
S_t = (I_t, R, B, K)
I_t := current token sequence, embeddings, hidden states and layer index
R := typed transformation and attention relationships
B := context window, dimensional constraints, masking, compute and safety boundaries
K := architecture, parameter tensors, vocabulary and task configuration

3. TYPE AND STRUCTURAL CONSTRAINTS
n <= ContextLimit
Embedding(TokenSequence) -> Real[n, d_model]
Q = H W_Q; K_mat = H W_K; V = H W_V
Attention(Q,K_mat,V,M) = softmax((Q K_mat^T)/sqrt(d_k) + M) V
MultiHead(H) = Concat(head_1,...,head_h) W_O
FeedForward(H) = activation(H W_1 + b_1) W_2 + b_2
Residual(X,F) = X + F(X), where tensor shapes agree
Normalisation maps finite valid hidden states to normalised states
OutputHead maps final hidden states to task-appropriate outputs
Mask entries for forbidden attention positions use negative infinity before softmax

4. RELATIONSHIP GRAPH
TransformerModel --HAS_COMPONENT--> Embedding
TransformerModel --HAS_COMPONENT--> TransformerBlock
TransformerModel --HAS_COMPONENT--> OutputHead
TransformerBlock --USES--> Attention
TransformerBlock --USES--> FeedForward
TransformerBlock --USES--> ResidualConnection
TransformerBlock --USES--> Normalisation
Attention --COMPUTES_FROM--> Query, Key, Value
Attention --CONSTRAINED_BY--> AttentionMask
TransformerModel --CONSUMES--> TokenSequence
TransformerModel --PRODUCES--> OutputRepresentation
TransformerModel --CONFIGURED_BY--> Parameters

5. ARCHITECTURE VARIANTS
EncoderOnly := bidirectional self-attention where permitted by mask
DecoderOnly := causal self-attention; position i cannot attend to future positions j > i
EncoderDecoder := encoder self-attention + decoder causal self-attention + cross-attention
CrossAttention := decoder queries attend to encoder-derived keys and values
Variant identification depends on implemented graph, not model marketing label

6. FLOW EXECUTION
flow TransformerModelInference(input, model, task):
  REQUIRE valid_model(model)
  tokens := Tokenise(input, model.Tokeniser)
  REQUIRE length(tokens) <= model.ContextLimit
  H := Embed(tokens) + PositionEncode(tokens)
  FOR block IN model.Blocks IN declared order:
    H := ApplyBlock(H, block, model.MaskPolicy)
    REQUIRE shape(H) = [length(tokens), model.d_model]
    REQUIRE all_finite(H)
  output := ApplyOutputHead(H, model.OutputHead, task)
  RETURN output

7. INFERENCE RULES
IF model uses causal attention THEN forbid attention to later token positions.
IF input exceeds ContextLimit THEN reject, truncate explicitly or apply a declared segmentation policy; never silently claim full-context processing.
IF layer dimension constraints fail THEN mark execution invalid.
IF output is logits THEN apply the declared decoding or classification rule before interpreting as tokens or labels.
IF cross-attention is absent THEN do not infer an encoder-decoder architecture.
IF attention weights are available THEN treat them as internal computational coefficients, not automatically as faithful explanations.
IF stochastic decoding is enabled THEN outputs may vary for the same input and parameters.

8. RECURSIVE / ITERATIVE STATE TRANSITION
E_t = expand(I_t, R)
V_t = {x in E_t | satisfies(x, B) and type_valid(x, K)}
x*_t = argmax_{x in V_t} P(x | I_t, R, B, K)
I_(t+1) = update(I_t, x*_t)
For autoregressive generation, append a selected token to the context and repeat until a declared stop condition, token budget or context boundary is reached.
NOTE: The argmax expression is a reasoning/selection abstraction; practical decoding may use sampling, beam search or other specified policies.

9. TRI-MAPPING
ENTITY: TransformerModel | RELATION: HAS_COMPONENT | TARGET: TransformerBlock
ENTITY: TransformerBlock | RELATION: USES | TARGET: MultiHeadAttention
ENTITY: Attention | RELATION: CONSTRAINED_BY | TARGET: AttentionMask
ENTITY: TokenSequence | RELATION: REPRESENTED_AS | TARGET: HiddenState
ENTITY: HiddenState | RELATION: TRANSFORMED_BY | TARGET: FeedForward
ENTITY: OutputRepresentation | RELATION: DECODED_BY | TARGET: OutputHead

10. HOW TO READ
Entities define what exists; relationships define how components connect; equations define allowable computations; boundaries exclude invalid states; execution steps specify order; inference rules specify what may be concluded.

11. EXECUTION GUARANTEE / LIMITS
Given valid inputs, compatible dimensions, available parameters and finite supported numerical operations, the flow defines a typed sequence of transformations. It does NOT guarantee factual accuracy, semantic truth, absence of bias, reproducible sampling, or convergence to a correct answer. Implementation-specific floating-point behaviour can affect results.

12. AI SEARCH FLOW
INDEX_ENTITY: Transformer Model Ontology
CATEGORY: AI Core > Entity Graph > AI Entities > Transformer Entities
ALIASES: transformer architecture; attention-based neural network; transformer neural model
PRIMARY_RELATIONS: HAS_COMPONENT, USES, CONSTRAINED_BY, CONSUMES, PRODUCES, CONFIGURED_BY
SEARCH_INTENTS: define transformer model; identify model components; explain self-attention; compare encoder and decoder; verify attention masking; trace transformer inference
RETRIEVAL_PATH: TransformerModel -> Architecture -> TransformerBlock -> Attention/FeedForward -> OutputHead
CONFIDENCE_POLICY: distinguish structural definitions from model-specific claims; require architecture evidence for variant classification
SOURCE_OF_TRUTH: source URL above
CITATION_BACKLINK: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/transformer-entities/transformer-model-ontology.html

END FLOW
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ