AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA — EXPERT NETWORK ONTOLOGY
Semantic Library | AI Core | Entity Graph | Transformer Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/transformer-entities/expert-network-ontology.html
Status: Companion formalisation grounded in standard mixture-of-experts principles; source-page specification not verified.
Language: en-GB | Encoding: UTF-8 | Version: 1.0 | Date: 2026-10-29
1. PURPOSE
Represent an expert network as a parameterised computational entity within a mixture-of-experts (MoE) transformer, describing inputs, routing, execution, aggregation, constraints and lifecycle.
2. STATE MODEL
S = (I, R, B, K)
I = input token representations, routing scores, expert parameters and metadata.
R = expert-selection, evaluation, combination and update relations.
B = dimensional, capacity, numerical and access boundaries.
K = expert topology, model configuration, provenance and validation knowledge.
S_t = (I_t, R_t, B_t, K_t)
E_t = expand(I_t, R_t)
V_t = {x in E_t | constraints_B(x) and valid_K(x)}
x*_t = argmax_{x in V_t} P(x | I_t, R_t, B_t, K_t)
I_(t+1) = update(I_t, x*_t)
Note: the argmax is a conceptual selection operator, not a claim that standard MoE routing maximises a calibrated probability.
3. ENTITY CLASSES
ExpertNetwork: trainable function E_i: R^d -> R^d.
ExpertIdentifier: stable identifier for expert i.
ExpertParameters: matrices, biases and optional normalisation parameters.
ExpertInput: token-wise hidden state x.
ExpertOutput: transformed representation E_i(x).
Router: scoring function g(x) -> R^N.
RoutingDecision: selected expert indices and weights.
ExpertCapacity: optional dispatch budget per expert.
DispatchMap: mapping from tokens to selected experts.
CombinationOperator: weighted aggregation of expert outputs.
LoadMetric: counts or weighted traffic per expert.
ExpertSpecialisation: observed response patterns; not guaranteed semantic expertise.
TrainingSignal: gradients and auxiliary objectives.
4. RELATIONSHIPS
ExpertNetwork IS_A NeuralNetworkModule.
ExpertNetwork PART_OF MixtureOfExpertsLayer.
Router SELECTS ExpertNetwork.
DispatchMap ASSIGNS ExpertInput TO ExpertNetwork.
ExpertNetwork PRODUCES ExpertOutput.
CombinationOperator AGGREGATES ExpertOutput.
TrainingSignal UPDATES ExpertParameters.
ExpertCapacity CONSTRAINS DispatchMap when configured.
LoadMetric DESCRIBES ExpertNetwork utilisation.
5. CORE MATHEMATICS
Let x in R^d; N experts; 1 <= k <= N.
Router logits: z = W_r x + b_r, z in R^N.
Routing probabilities: p_i = exp(z_i) / sum_j exp(z_j).
Selected indices: T(x) = TopK(p, k).
Selected weights: a_i = p_i / sum_{j in T(x)} p_j for i in T(x), otherwise 0.
Expert computation: h_i = E_i(x).
MoE output: y = sum_{i in T(x)} a_i h_i.
Common two-layer expert: E_i(x) = W_(i,2) phi(W_(i,1)x + b_(i,1)) + b_(i,2).
Gated alternative: E_i(x) = W_(i,o)[phi(W_(i,g)x) elementwise (W_(i,u)x)].
Actual expert architecture and weight normalisation depend on implementation.
6. DIMENSIONAL INVARIANTS
Input x shape: [d].
Expert output shape: [d] for residual-compatible MoE blocks.
Router output shape: [N].
Selected expert count: k, except explicitly configured dynamic routing.
All aggregated expert outputs must share a compatible shape and dtype.
7. EXECUTION FLOW
INPUT hidden states X [batch, sequence, d].
VALIDATE shape, finite values and configuration.
SCORE each token using router g.
SELECT top-k experts per token.
APPLY capacity or overflow policy if configured.
DISPATCH tokens to selected experts.
EVALUATE each expert on assigned tokens.
WEIGHT outputs with routing coefficients.
COMBINE into original token order.
RETURN transformed states and optional routing diagnostics.
8. MINI RECURSION ENGINE
state_0 = (X, expert_set, router, constraints)
for layer_index in configured_layers:
decisions = route(state.layer_input)
selected = validate_and_dispatch(decisions, constraints)
expert_results = evaluate(selected)
state.layer_output = aggregate(expert_results)
state.layer_input = next_layer_transition(state.layer_output)
stop when configured layers complete or an explicit execution boundary is reached.
This is layer-wise recurrence, not an assertion that each expert itself recurses.
9. INFERENCE RULES
IF an expert is not selected for a token THEN its token-specific forward pass need not execute.
IF k = N THEN routing is dense for that token (subject to other controls).
IF k < N THEN expert evaluation may be sparse.
IF capacity is exceeded THEN apply the configured overflow, drop, reroute or padding policy.
IF expert outputs have incompatible dimensions THEN aggregation is invalid.
IF routing collapses onto few experts THEN report utilisation imbalance.
IF an expert exhibits a task preference THEN describe it as empirical specialisation, not guaranteed domain knowledge.
10. TRAINING AND UPDATE
L_total = L_task + lambda_balance L_balance + lambda_other L_other.
Auxiliary load-balancing objectives are optional and implementation-specific.
Expert parameters receive gradients from their executed paths, subject to framework details.
Router parameters may receive gradients through selected routing weights and surrogate methods.
Monitor load distribution, overflow, numerical stability and training quality.
11. TRI-MAPPING
Entity: ExpertNetwork | Relation: selected_by Router | Operation: route(x).
Entity: ExpertInput | Relation: dispatched_to ExpertNetwork | Operation: dispatch(x, T).
Entity: ExpertNetwork | Relation: produces ExpertOutput | Operation: E_i(x).
Entity: ExpertOutput | Relation: combined_by CombinationOperator | Operation: weighted_sum.
Entity: ExpertParameters | Relation: updated_by TrainingSignal | Operation: optimiser_step.
12. EXECUTION GUARANTEES AND LIMITS
Guarantee only when preconditions hold: shape-compatible expert outputs, finite valid routing weights, defined dispatch policy and successful execution.
No guarantee of semantic expert specialisation, fairness, perfect load balance, deterministic execution across hardware, or calibrated router probabilities.
Sparse routing can reduce active computation but does not necessarily reduce total parameter storage or communication overhead.
13. AI SEARCH FLOW
QUERY: What is an expert network in a transformer MoE?
ENTITY_MATCH: ExpertNetwork -> MixtureOfExpertsLayer -> Router.
RELATION_EXPANSION: selected_by, receives, transforms, produces, aggregated_by.
FORMAL_CHECK: y = sum_{i in TopK(g(x),k)} a_i E_i(x).
BOUNDARY_CHECK: tensor shape, capacity, k range, numerical validity.
ANSWER: An expert network is a trainable subnetwork selected by a router for particular token representations; its output is combined with other selected expert outputs.
CONFIDENCE: architectural explanation high; source-specific ontology alignment unverified.
14. HOW TO READ
Follow ENTITY CLASSES to identify components, RELATIONSHIPS to identify connections, CORE MATHEMATICS to identify transformations, and EXECUTION FLOW to trace token processing. Treat optional mechanisms as configuration-dependent.
15. PROVENANCE AND CITATION
Ontology page: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/transformer-entities/expert-network-ontology.html
Companion Flow Algebra authored for Semantic Library use; not a verbatim extraction of the webpage.