AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
SEMANTIC LIBRARY — END TOKEN ONTOLOGY
FLOW ALGEBRA COMPANION | 2026-11-01 | en-GB
==================================================================
01. PURPOSE
-------
Formalise end-of-sequence token semantics, validation and controlled termination in token streams.
02. STATE MODEL
-----------
S_t = (I_t, R_t, B_t, K_t)
I_t: token stream and decoder state; R_t: termination rules; B_t: sequence and trust boundaries; K_t: vocabulary and model knowledge.
03. ENTITY DEFINITION
-----------------
EndToken = (token_id, token_form, vocabulary_id, role, position, provenance).
Role denotes a sequence terminator; actual token forms vary by model.
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)
I_(t+1) = update(I_t,x*_t).
05. END TOKEN RECOGNITION
---------------------
is_end(x) = (id(x) in EOS_IDS) subject to active tokenizer configuration.
06. SEQUENCE GRAMMAR
----------------
Sequence ::= START? CONTENT* END?
Whether END is mandatory depends on the protocol; do not assume every stream ends with EOS.
07. TERMINATION RULE
----------------
If EOS is generated as a designated terminal symbol, stop the current decoding sequence according to model and application rules.
08. BOUNDARY RULES
--------------
Distinguish end of sequence, end of message, end of turn, and end of stream. These may use different token identifiers.
09. VALIDATION
----------
Check vocabulary membership, token role, placement, permitted multiplicity and surrounding message framing.
10. DECODING PATHWAY
----------------
Logits -> token selection -> EOS classification -> either terminate or append token -> update state.
11. STREAMING PATHWAY
-----------------
A transport stream may end without an explicit EOS token; transport closure alone is not proof of semantic EOS.
12. PADDING INTERACTION
-------------------
EOS and PAD may share an ID in some configurations; attention masks and lengths must preserve intended meaning.
13. TRAINING INTERACTION
--------------------
EOS may act as a target token in autoregressive training; loss masking and sequence packing affect interpretation.
14. MULTIMODAL INTERACTION
----------------------
Image, audio and video protocols may have modality-specific boundary markers; avoid treating them as interchangeable.
15. TRI-MAPPING
-----------
Entity: EndToken -> Relation: terminates -> Process: DecodeSequence.
Entity: Sequence -> Relation: hasBoundary -> Process: ValidateSequence.
Entity: Tokeniser -> Relation: defines -> Process: ResolveEOS.
16. RELATIONSHIP GRAPH
------------------
Tokenizer --defines--> EOS_ID
TokenStream --contains--> EndToken
EndToken --signals--> SequenceTermination
Decoder --evaluates--> TerminationCondition
SequenceTermination --updates--> DecoderState
17. MAPPING TABLE
-------------
Token ID | tokeniser vocabulary | lexical identity
Position | sequence index | boundary location
EOS status | protocol validation | termination decision
Provenance | source/model | traceability
18. INFERENCE RULES
---------------
R1: If token_id is configured EOS and occurs in a permitted context, classify as EndToken.
R2: If EOS classified and stop policy permits, terminate sequence generation.
R3: If token is merely a textual spelling of EOS, do not classify without token-ID evidence.
R4: If protocol distinguishes message-end and turn-end, retain distinct meanings.
19. MINI-RECURSION ENGINE
---------------------
state <- initial_state
while budget_remaining(state):
candidate <- decode_next(state)
classification <- classify(candidate, tokenizer, protocol)
state <- update(state, candidate)
if classification == EOS and termination_allowed(state): break
return state
20. HOW TO READ
-----------
Read entity definition first; then the core flow; then boundary and validation rules; finally apply the inference and recursion steps.
21. EXECUTION CONDITIONS
--------------------
Guarantee is conditional: correct tokeniser mapping, explicit protocol, valid stop policy and finite resource budget. No guarantee of model correctness is implied.
22. AI SEARCH FLOW
--------------
QUERY: end token ontology, EOS token, sequence termination
ENTITIES: EndToken, TokenStream, Decoder, Tokenizer, SequenceBoundary
PATHWAYS: recognise -> validate -> classify -> terminate/update
CONFIDENCE: derived from configured vocabulary and verified stream metadata
UPDATE_MODEL: revise token IDs and rules when model/tokeniser versions change.
23. EXAMPLE
-------
Given IDs [BOS, 18, 42, EOS], EOS is recognised by configured ID and closes decoding. A literal string "<eos>" within text does not necessarily represent an EOS token.
24. PROVENANCE AND LIMITATIONS
--------------------------
Source URL: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/token-and-language-entities/end-token-ontology.html
Original companion formalisation, not a verified transcription of the webpage. Token conventions are implementation-specific.
25. AUTHORS AND LICENCE
-------------------
Companion Flow Algebra prepared for Semantic Library. Cite the source ontology and this formalisation when reusing. No claim of formal verification.