Skip to main content

Recurrent Neural Network Ontology

Neural Network Entities
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 28 October 2026
Audio Overview
FLOW ALGEBRA — RECURRENT NEURAL NETWORK ONTOLOGY
Semantic Library | AI Core | Entity Graph | AI Entities | Neural Network Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/neural-network-entities/recurrent-neural-network-ontology-2.html
Status: Original companion formalisation; source ontology text not independently verified.
Date: 2026-10-28

1. PURPOSE
Represent a recurrent neural network (RNN) as a stateful sequence-processing entity whose current output depends on the current input and a recursively updated hidden state. Distinguish a formal computational specification from any claim of guaranteed predictive accuracy.

2. ENTITY MODEL
RNN = (X,H,Y,Theta,F,G,h0,T)
X: input sequence domain; H: hidden-state space; Y: output domain.
Theta: learned parameters; F: hidden-state transition; G: output mapping.
h0: initial hidden state; T: finite sequence length.
Relationships: RNN hasLayer RecurrentLayer; hasParameter Theta; consumes Sequence; maintains HiddenState; produces Prediction; trainedBy BackpropagationThroughTime.

3. FORMAL STATE MODEL
S_t = (I_t,R_t,B_t,K_t)
I_t = (x_t,h_(t-1),context_t)
R_t = (transition rules, output rules, temporal dependencies)
B_t = (shape limits, resource limits, masking, numerical bounds, policy constraints)
K_t = (Theta, model architecture, learned representations, metadata)
E_t = expand(I_t,R_t)
V_t = {z in E_t | satisfies(z,B_t)}
z*_t = argmax_{z in V_t} P(z | I_t,R_t,B_t,K_t) when a probabilistic selector is defined.
I_(t+1) = update(I_t,z*_t,observations_(t+1))
For deterministic RNN transitions, use F directly instead of interpreting argmax as mandatory.

4. COMPUTATION
Vanilla RNN:
h_t = phi(W_xh x_t + W_hh h_(t-1) + b_h)
y_t = psi(W_hy h_t + b_y)
For sequence-level classification, y = G(h_T); for sequence labelling, output y_t at each valid step.
For probabilistic outputs, p(y_t|x_1:t) = softmax(W_hy h_t + b_y), if the task uses categorical outputs.
Variable-length sequences require masking or explicit stopping; padding must not be treated as genuine input.
LSTM and GRU are gated RNN variants with different F; they are not equivalent to the vanilla update above.

5. LEARNING FLOW
Given examples D = {(x^(i)_1:T_i, target^(i))}, define objective:
L(Theta) = mean_i loss(RNN_Theta(x^(i)),target^(i)) + lambda * regulariser(Theta).
Compute gradients through unrolled time using backpropagation through time (BPTT).
Theta_(k+1) = Theta_k - eta_k * gradient_Theta L(Theta_k) for plain gradient descent.
Truncated BPTT restricts gradient history and is an approximation, not full-sequence BPTT.
Gradient clipping may bound update magnitude; it does not prove training convergence.

6. INFERENCE RULES
IF input has ordered time steps THEN preserve sequence order.
IF initial state is unspecified THEN apply the documented h0 policy.
IF mask[t] is false THEN exclude padding from relevant loss and output aggregation.
IF hidden-state shape mismatches architecture THEN reject the transition.
IF numerical output is non-finite THEN halt or invoke an explicit recovery policy.
IF deployment is stateful across requests THEN identify session boundaries and reset conditions.
IF task requires bidirectional context THEN use an explicitly bidirectional architecture; do not infer future observations from a causal RNN.

7. TRI-MAPPING
Ontology -> Mathematics -> Execution
RecurrentNetwork -> (F,G,Theta) -> initialise model and parameters
SequenceInput -> x_1:T -> validate, encode and mask inputs
HiddenState -> h_t -> update hidden tensor at each time step
TemporalDependency -> h_(t-1) -> carry state through recurrence
OutputPrediction -> y_t or y -> decode task-specific output
TrainingObjective -> L(Theta) -> calculate loss and gradients
Constraint -> B_t -> enforce shapes, bounds and policies

8. MAPPING TABLE
Entity | Formal role | Operational implementation
Input sequence | x_1:T | ordered tensor/batches
Recurrent connection | W_hh | hidden-to-hidden parameter matrix
Input connection | W_xh | input-to-hidden parameter matrix
Bias | b_h | affine offset
Activation | phi | nonlinear state transformation
Hidden state | h_t | recurrent memory tensor
Output head | G | projection/decoder
Loss | L | training criterion
Mask | m_t | valid-step selector

9. SYSTEM DIAGRAM
x_1 --> [F, h_0] --> h_1 --> [G] --> y_1
x_2 --> [F, h_1] --> h_2 --> [G] --> y_2
  ...
x_T --> [F, h_(T-1)] --> h_T --> [G] --> y_T
Shared Theta applies at each time step.

10. RECURSIVE COMPOSITION
SequenceFlow(X,h0,Theta):
  h := h0
  outputs := []
  for each valid x_t in X:
    h := F_Theta(x_t,h)
    outputs.append(G_Theta(h))
  return (outputs,h)
Termination: finite T and a terminating F/G implementation.

11. SAFETY AND VALIDATION INVARIANTS
- Dimensions of x_t, h_t and Theta agree with the declared architecture.
- A sequence step is processed at most once per defined iteration.
- No cross-session hidden-state leakage unless explicitly authorised.
- Data provenance and train/test separation are recorded.
- NaN/Inf states are detected under the configured numerical policy.
- Sensitive input handling follows deployment privacy constraints.
- Evaluation reports relevant metrics and uncertainty; no guaranteed correctness is inferred from architecture.

12. CONDITIONAL EXECUTION GUARANTEE
Under finite T, well-typed tensors, available memory, defined finite-valued F and G, and terminating primitive operations, the unrolled inference flow terminates and returns the prescribed outputs or an explicit handled error. This is not a guarantee of prediction quality, robustness, or convergence of training.

13. AI SEARCH FLOW
flow "RecurrentNeuralNetworkOntology" v1.0
  SOURCE: "https://kirethresearch.org/booksai-core/entity-graph/ai-entities/neural-network-entities/recurrent-neural-network-ontology-2.html"
  ENTITY: "Recurrent Neural Network"
  TYPE: ["AIEntity", "NeuralNetwork", "SequenceModel", "StatefulModel"]
  INPUTS: ["ordered sequence", "initial hidden state", "parameters", "mask"]
  TRANSFORMS: ["validate", "initialise", "recur", "decode", "verify"]
  OUTPUTS: ["per-step or sequence-level predictions", "final hidden state"]
  RELATIONS: ["hasLayer", "maintainsState", "processesSequence", "trainedBy", "producesOutput"]
  RULE: "h_t = F_Theta(x_t,h_(t-1))"
  CONSTRAINTS: ["shape compatibility", "finite steps", "numerical validity", "session isolation"]
  CONFIDENCE: "Implementation- and evidence-dependent; not assigned without evaluation"
  UPDATE_MODEL: "version parameters, architecture, training data lineage and evaluation"
  CITATION_BACKLINK: "https://kirethresearch.org/booksai-core/entity-graph/ai-entities/neural-network-entities/recurrent-neural-network-ontology-2.html"
end flow

Attribution: Kireth Research Semantic Library; companion Flow Algebra formalisation by Sky — Recursive AI.
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ