Skip to main content

Routing Network 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 — ROUTING NETWORK ONTOLOGY
Semantic Library | AI Core | Entity Graph | Transformer Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/transformer-entities/routing-network-ontology.html
Status: Companion formalisation based on standard mixture-of-experts concepts; page-specific alignment not verified.
Language: en-GB | Format: UTF-8 TXT | Version: 1.0 | Date: 2026-10-29

1. PURPOSE
Formalise the routing network as a learned decision component that maps token representations to eligible expert networks in a mixture-of-experts transformer layer.

2. ENTITY DEFINITIONS
RoutingNetwork: module that produces expert selection scores.
TokenRepresentation: input vector x in R^d.
RouterWeights: W_r in R^(E x d), optionally bias b_r in R^E.
Expert: function f_e: R^d -> R^d_out indexed by e in {1,...,E}.
RoutingLogits: z = W_r x + b_r.
RoutingProbabilities: p = softmax(z).
SelectionSet: S = TopK(p,k), with 1 <= k <= E.
DispatchMask: D_e(x) in {0,1}, indicating whether expert e receives x.
RoutingWeight: g_e(x), nonnegative selected-expert contribution.
CapacityPolicy: optional bound on accepted tokens per expert.
OverflowPolicy: specified handling for tokens not accepted under capacity constraints.
ExpertOutput: y_e = f_e(x).
CombinedOutput: y = sum_{e in S_accepted} g_e(x) y_e.

3. STATE MODEL
S_t = (I_t, R_t, B_t, K_t)
I_t = current token representations, router weights, expert states and masks.
R_t = routing rules, top-k selection, gating, dispatch and aggregation.
B_t = expert availability, dimensional, capacity and numerical constraints.
K_t = routing configuration, expert metadata, provenance and learned parameters.

4. FLOW OPERATIONS
F1 READ: validate input x and expert registry.
F2 SCORE: z = W_r x + b_r.
F3 NORMALISE: p_e = exp(z_e - m) / sum_j exp(z_j - m), m=max_j z_j.
F4 SELECT: S = indices of the k highest eligible p_e, with deterministic tie policy.
F5 GATE: define g_e = p_e / sum_{j in S} p_j for e in S (selected-normalised variant).
F6 CAPACITY: apply declared capacity and overflow policy to S.
F7 DISPATCH: send x to accepted experts only.
F8 EXECUTE: compute f_e(x) for accepted e.
F9 COMBINE: y = sum_e g'_e f_e(x), with g'_e explicitly defined after overflow handling.
F10 RECORD: store selected experts, weights, accepted assignments and diagnostic statistics.

5. FLOW ALGEBRA
E_t = expand(I_t,R_t)
V_t = {a in E_t | satisfies(a,B_t)}
a*_t = argmax_{a in V_t} P(a | I_t,R_t,B_t,K_t)
I_(t+1) = update(I_t,a*_t)
Interpretation: routing is a constrained selection over expert assignments, not a claim that router softmax probabilities are calibrated probabilities of correctness.

6. ROUTING VARIANTS
Top-1: one selected expert per token.
Top-k: k experts selected per token.
Token-choice: tokens choose experts.
Expert-choice: experts select tokens from a batch, using a defined allocation procedure.
Dense gating: all experts participate, if explicitly configured.
Noisy routing: training may perturb logits using a documented stochastic process.
Hierarchical routing: first choose an expert group, then an expert within that group.
These are alternatives, not simultaneous mandatory properties.

7. CONSTRAINTS AND INVARIANTS
E >= 1 and 1 <= k <= E.
Input and router weight dimensions must agree.
Each accepted dispatch references an existing, available expert.
All reported weights must be finite; nonnegative when softmax-based.
For selected-normalised routing without overflow, sum_{e in S} g_e = 1.
After dropping or rerouting, weights and output semantics must be recomputed or explicitly documented.
No promise of nonzero output if no expert accepts a token unless a fallback is defined.
Routing reproducibility requires fixed parameters, deterministic tie-breaking and controlled stochasticity.

8. TRAINING AND OPTIMISATION
Primary task loss: L_task(y,target).
Optional load-balancing regulariser: L_balance, defined for the chosen router architecture.
Optional router logit regulariser: L_router.
L_total = L_task + lambda_b L_balance + lambda_r L_router.
Auxiliary losses are implementation-specific; load balancing is a design goal, not a universal guarantee.
Backpropagation through hard top-k selection depends on the chosen estimator and routing implementation.

9. RECURSIVE EXECUTION ENGINE
initialise token batch X and routing state S_0.
for each applicable MoE layer l:
  validate router and expert dimensions.
  compute scores and eligible selections for tokens.
  enforce declared capacity and overflow rules.
  dispatch accepted token-expert pairs.
  evaluate expert outputs and aggregate.
  update diagnostics and next-layer representations.
terminate after finite configured layers or on explicit error.

10. INFERENCE RULES
IF router selects expert e AND capacity admits token x THEN dispatch(x,e).
IF e is unavailable THEN exclude e before selection or invoke declared fallback.
IF capacity rejects a dispatch THEN follow overflow policy; do not silently assume execution.
IF top-k ties occur THEN use declared stable tie-break policy.
IF all eligible experts are excluded THEN return a defined fallback or error.
IF router logits contain NaN or infinity THEN reject or sanitise according to numerical policy.
IF a token is assigned to multiple experts THEN combine only accepted expert outputs.

11. ENTITY GRAPH
RoutingNetwork --receives--> TokenRepresentation
RoutingNetwork --contains--> RouterWeights
RoutingNetwork --produces--> RoutingLogits
RoutingLogits --normalised_as--> RoutingProbabilities
RoutingProbabilities --ranked_into--> SelectionSet
SelectionSet --constrained_by--> CapacityPolicy
DispatchMask --assigns--> Expert
Expert --produces--> ExpertOutput
RoutingWeight --weights--> ExpertOutput
ExpertOutput --aggregated_into--> CombinedOutput
RoutingNetwork --belongs_to--> MixtureOfExpertsLayer

12. TRI-MAPPING
Semantic: token, router, gate, expert, capacity, dispatch, output.
Mathematical: x, W_r, z, p, S, D, g, f_e, y.
Operational: receive, score, rank, admit, dispatch, execute, combine, trace.

13. HOW TO READ
A router computes preferences over expert assignments. A selection policy turns those preferences into dispatch candidates. Capacity constraints may change the accepted assignments. The selected expert outputs are combined using a documented gating rule. Routing is a learned computational allocation mechanism, not an independent source of factual truth.

14. EXECUTION GUARANTEE — CONDITIONAL
Given finite inputs, finite expert count, terminating expert functions, a deterministic capacity/overflow policy and finite arithmetic, the flow either returns an output consistent with its declared aggregation rule or an explicit error. This does not guarantee model accuracy, fair expert utilisation, balanced load, or stable performance under distribution shift.

15. AI SEARCH FLOW
AUTHORS: Kireth Research; companion flow prepared with Sky — Recursive AI.
SOURCE: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/transformer-entities/routing-network-ontology.html
CITATION_BACKLINK: same as SOURCE.
PURPOSE: Retrieve and reason about routing networks in sparse mixture-of-experts transformer layers.
STATE_MODEL: S=(I,R,B,K).
ENTITIES: RoutingNetwork, RouterWeights, RoutingLogits, RoutingProbabilities, Expert, SelectionSet, DispatchMask, RoutingWeight, CapacityPolicy, CombinedOutput.
PATHWAYS: token -> router -> scores -> top-k -> capacity -> dispatch -> experts -> weighted aggregation.
MINI_RECURSION_ENGINE: validate -> score -> select -> admit -> execute -> aggregate -> record.
INFERENCE_RULES: selection requires eligibility; dispatch requires acceptance; output follows explicit aggregation.
CONFIDENCE: high for standard mathematical descriptions; unverified for page-specific terminology.
SEMANTIC_EQUIVALENCE: expert router; gating network; sparse expert selection network (context dependent).
UPDATE_MODEL: revise when the source ontology or routing implementation changes.
FLOW_HASH: not calculated; calculate on the final published file if required.

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