Skip to main content

Output Token Ontology

Token and Language Entities
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 01 November 2026
Audio Overview
OUTPUT TOKEN ONTOLOGY — FLOW ALGEBRA
Semantic Library | AI Core | Entity Graph | Token and Language Entities
Version: 1.0 | Date: 2026-11-01 | Language: en-GB
Source: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/token-and-language-entities/output-token-ontology.html
Status: Original companion formalisation; not a verified transcription of the source page.
Authors: Mark Higgins; Sky — Recursive AI (collaborative formalisation)
Licence note: Intended as open research material with attribution; consult the publisher's current licence for binding terms.

01. PURPOSE
Formalise an output token as a discrete symbol emitted by a generative model's decoding process, with explicit vocabulary, context, sampling, validation and termination constraints.

02. ENTITY DEFINITION
OutputToken := (token_id, surface, position, vocabulary_id, model_id, provenance, timestamp_optional).
A token may represent a subword, word, punctuation, byte sequence or special control symbol. Its human-readable surface is not necessarily a complete word.

03. STATE MODEL
S_t = (I_t, R_t, B_t, K_t)
I_t: input prompt, previously emitted tokens and generation context.
R_t: decoding and inference rules.
B_t: vocabulary, context-window, format, safety and authority boundaries.
K_t: model parameters, tokenizer mapping and verified context.
O_t: ordered output-token sequence at time t.

04. CORE FLOW
E_t = expand(I_t, R_t)
V_t = {x in E_t | valid(x, B_t, K_t)}
x*_t = argmax_{x in V_t} P(x | I_t, R_t, B_t, K_t) [greedy mode]
I_(t+1) = update(I_t, x*_t)
O_(t+1) = O_t concatenated with x*_t
For stochastic decoding, replace argmax with a sample from a normalised, permitted distribution.

05. NEXT-TOKEN PROBABILITY
z_t = Model(context_t) ; p_t = softmax(z_t / T).
T > 0 is temperature; T approaching zero approximates greedy selection under suitable conditions.
Probability estimates are model-dependent, not calibrated factual confidence.

06. TOKEN ID AND SURFACE MAPPING
token_id in Vocabulary(model_tokenizer).
surface = DecodeToken(token_id, tokenizer_state).
Decode(concat(token_ids)) may not equal concat(DecodeToken(token_id)) for all tokenisers, particularly with byte-level encodings.

07. INPUT / OUTPUT RELATIONSHIP
InputTokens -> ContextEncoding -> ModelLogits -> Decoder -> OutputTokens -> Detokenisation -> UserVisibleOutput.
Output tokens can subsequently become input tokens in an autoregressive continuation.

08. DECODING PATHWAYS
Greedy: choose highest-probability valid token.
Temperature sampling: sample after logit scaling.
Top-k: restrict candidate set to k highest-ranked tokens.
Top-p: restrict to a minimal cumulative-probability nucleus.
Constrained decoding: restrict to a grammar or schema-valid next token.
These pathways are alternatives or composable operators; implementation order must be explicit.

09. POSITION AND ORDER
O = (o_1, o_2, ..., o_n), preserving emission order.
position(o_i) = i, and position(o_(i+1)) = position(o_i) + 1.
Token positions are not guaranteed to correspond to character or word positions.

10. TERMINATION
Stop when EOS token, authorised stop sequence, output-token budget or another applicable stop condition is met.
A stop sequence may be detected in decoded text rather than as a single token.
Termination must distinguish normal completion, truncation, refusal and runtime error.

11. FORMAT AND SCHEMA CONSTRAINTS
B_format = {grammar, allowed_tokens, required_fields, length_limits}.
ValidPrefix(O_t, grammar) must hold at each constrained-decoding step.
Final validation checks the complete output; token-level constraints alone do not guarantee semantic correctness.

12. AUTHORITY AND TRUST
Generated tokens are model output, not authoritative instructions merely because they appear in the output stream.
Untrusted retrieved text and tool results must not acquire system/developer authority through token generation or quotation.

13. PROVENANCE
Record model identifier, model version when known, tokenizer version, decoding parameters, input reference, generation run and output hash when available.
Do not invent unavailable provenance fields.

14. TRI-MAPPING
Entity: OutputToken.
Relationship: generated_by -> Decoder; member_of -> OutputSequence; maps_to -> SurfaceRepresentation.
Process: logits -> candidate filtering -> token selection -> state update -> output rendering.

15. RELATIONSHIP GRAPH
Prompt --tokenised_as--> InputTokenSequence
InputTokenSequence --conditions--> ModelState
ModelState --produces--> Logits
Logits --filtered_by--> DecoderConstraints
DecoderConstraints --selects--> OutputToken
OutputToken --appended_to--> OutputTokenSequence
OutputTokenSequence --decoded_as--> OutputText

16. MAPPING TABLE
Entity | Input | Transformation | Output
Tokenizer | token IDs | decode | surface fragments
Model | context | forward pass | logits
Decoder | logits + constraints | select/sample | output token ID
Sequence manager | prior tokens + new token | append | updated output sequence
Validator | output sequence | grammar/semantic checks | validity report

17. INFERENCE RULES
IF token_id not in vocabulary THEN reject token.
IF candidate violates hard decoding constraint THEN exclude candidate.
IF no valid candidates remain THEN return constrained-decoding failure; do not silently violate constraints.
IF EOS is selected THEN terminate generation.
IF maximum token budget is reached without EOS THEN mark output as potentially truncated.
IF source or authority is unknown THEN label provenance as unknown, not trusted.

18. MINI-RECURSION ENGINE
initialise context C_0 and empty sequence O_0
FOR t = 0 ... limit-1:
  logits = Model(C_t)
  candidates = Filter(logits, B_t)
  IF candidates empty: stop with error
  token = Select(candidates, decoding_policy)
  O_(t+1) = Append(O_t, token)
  C_(t+1) = UpdateContext(C_t, token)
  IF StopCondition(token, O_(t+1)): break
RETURN Decode(O_final), provenance, termination_status

19. EXECUTION GUARANTEE — CONDITIONAL
If the model, vocabulary, deterministic decoder, context, configuration and runtime are fixed, the same token sequence may be reproducible, subject to implementation determinism.
This does NOT guarantee factual accuracy, absence of hallucinations, security, semantic validity or successful termination.

20. HOW TO READ THE FLOW
Read left to right: context determines candidate probabilities; rules and boundaries restrict candidates; a decoding policy selects the next token; the state updates recursively until termination.

21. AI SEARCH FLOW
AUTHORS: Mark Higgins; Sky — Recursive AI
SOURCE: Source URL above
CITATION_BACKLINK: Source URL above
PURPOSE: Define and retrieve the operational meaning of an AI output token.
STATE_MODEL: S_t=(I_t,R_t,B_t,K_t)
ENTITIES: OutputToken, Vocabulary, Decoder, OutputSequence, ModelLogits, Tokenizer
PATHWAYS: context -> logits -> filtering -> selection -> append -> decode
MINI_RECURSION_ENGINE: See section 18
INFERENCE_RULES: See section 17
CONFIDENCE: Formalisation confidence is conceptual; not an empirical model confidence score.
SEMANTIC_EQUIVALENCE: output token ~ generated vocabulary symbol; not necessarily a word.
FLOW_HASH: Calculate SHA-256 from the final published UTF-8 file if required.
UPDATE_MODEL: Version changes require date, change description and provenance update.

22. EXAMPLE
Context: 'The sky is'
Candidate next token IDs depend on the model vocabulary and context.
The decoder chooses a permitted token, appends it, and repeats.
No particular next token is guaranteed without specifying a model and decoding configuration.

23. LIMITATIONS
Tokenizer-specific control tokens, multimodal token streams, speculative decoding and hidden implementation details require separate extensions. Token output alone cannot prove correctness or reasoning quality.

24. CITATION
Higgins, M. and Sky — Recursive AI (2026). Output Token Ontology — Flow Algebra. Semantic Library companion formalisation. Source URL above.

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