What you’ll take away
- In the worked example, a fixed identifier selects a fixed row; a separate, explicitly defined rule introduces context dependence.
- DECOR's prefix (1,276) and context-guided composition belong to its generative-recommendation case study. [3]
- A token row and a passage embedding represent different units. Record the text or identifiers behind each comparison. [2][3]
- Inspect token counts and retained context for the selected model, and distinguish character counts from tokenizer counts. [1][2]
- Keep changes to token boundaries separate from changes to numeric representations; neither alone proves the other. [4]
Start with the object a vector represents
Before comparing vectors, find out what one vector stands for. It might describe one token in a worked example, an item prefix in a recommendation system, or a passage stored for search. Those are different units. The Hugging Face retrieval tutorial computes embeddings for document chunks, while the DECOR research paper studies representations used to recommend items [2][3]. A list of numbers on its own does not tell you which of those jobs it performs.
A lookup table gives us a manageable way to examine the distinction. We will define a small imaginary table, choose one identifier, and read its row. Later, we will introduce an equally explicit rule that uses surrounding tokens. The numbers and rules are invented teaching examples, so their behaviour can be checked directly. A separate discussion of DECOR shows how its authors describe fixed lookup and context-guided composition in their particular recommender [3]. Keeping the example and the reported research separate lets you learn the mechanism without assuming that every language model uses the same design.
An embedding claim is incomplete until its represented unit and processing stage are specified. In the Hugging Face cookbook, the indexed embeddings represent document chunks; in the DECOR paper, token representations participate in generative recommendation of items [2][3]. Neither an array's length nor its visual appearance identifies its unit. A token-level vector, a representation associated with an item prefix, and an encoder's passage output should therefore be named explicitly before their properties are compared.
The example below defines lookup as a mathematical row-selection operation. We stipulate its vocabulary size, dimension, identifiers, and values, then add a separate context-dependent operation. These assumptions describe the exercise rather than an observed deployment. The DECOR paper supplies an independently attributed example involving a fixed prefix embedding and a contextual composition mechanism [3]. The purpose of comparing them is to distinguish what follows from a defined operation from what a particular paper actually reports. No result about the exercise establishes the architecture, semantic behaviour, or quality of an unspecified production model.
Separate text segmentation from identifier assignment
A word on the page need not be the unit a tokenizer produces. The contextual-morphogenesis paper discusses BPE and WordPiece as methods that divide text into subword units, and it describes constraints imposed by fixed segmentation rules [4]. That gives us a reason to inspect the actual pieces before drawing a picture with one box per word. The same paper distinguishes token boundaries from the contextual representations discussed later; a boundary says where a unit starts and ends.
For our exercise, assume that the lowercase sentence 'the river bank was steep' becomes exactly five tokens. Assign them the identifiers 11, 82, 417, 32, and 94, in that order. This is a definition of our example, not a tokenizer output measured from a real model. We also define identifier 417 as the address of the row labelled 'bank'. The address tells us where to look. It supplies no additional information in this exercise about river edges, money, or the relationships among the other addresses.
Segmentation and indexing answer different questions. Segmentation identifies the units in the input sequence; an identifier then names a unit within the vocabulary used by the exercise. The morphogenesis paper describes BPE and WordPiece segmentation and discusses how fixed subword vocabularies constrain processing of rare and domain-specific forms [4]. Its account of unchanged boundaries during inference concerns segmentation. It does not, by itself, establish which numerical values an arbitrary embedding implementation returns.
Define a hypothetical five-position sequence x = (11, 82, 417, 32, 94) for the text 'the river bank was steep'. We stipulate the word-sized segmentation and assign the displayed numbers as labels. Reassigning these labels while consistently reassigning the table rows would leave the subsequent lookup results unchanged in this defined system. That observation follows from the construction, rather than a claim about how a real vocabulary was trained. In an actual inspection, record the tokenizer's output instead of assuming that spaces identify its token boundaries.
Read one row from a fixed eight-component table
Now define a table containing 1,000 rows, each with eight numbers. Put the invented row (2, 0, 1, 0, 0, 0, 0, 0) at address 417. Our lookup rule simply returns the row at the supplied address. Looking up 417 twice returns those same eight numbers because we have kept the table unchanged. No sentence interpretation happens inside this rule: it has only an address and a table to use.
Looking up all five identifiers produces five eight-number rows. There are therefore 40 numbers in the result, arranged as five rows rather than one passage vector. This is arithmetic about our defined table, not a report of a model's dimensions. A separate real research example appears in DECOR: its authors describe one fixed representation for the item prefix (1,276), attributing that result to deterministic lookup in their recommendation case study [3]. That prefix should not be relabelled as an ordinary word or used to prove how every text embedding works.
Let E be the hypothetical table with shape 1,000 by 8. Define the lookup L(c) = E[c], and set row 417 to (2, 0, 1, 0, 0, 0, 0, 0). For a fixed E, L(417) is fixed by definition. Neither the surrounding sequence nor a sentence meaning is an argument of L. Applying L independently to the five stipulated identifiers yields a 5 by 8 collection of values. The dimensions, coordinates, and row label are assumptions of the exercise.
This construction illustrates a specific kind of operation without asserting that the entire model is context independent. A later operation could take both E[c] and the sequence as arguments. DECOR provides a separate empirical context for the lookup distinction: its Scientific-dataset case study describes a single fixed embedding for prefix (1,276) before contextual composition [3]. The reported object is an item prefix in a generative recommender. Its representation and the paper's visual comparison should not be treated as measurements of the illustrative table or of a natural-language word.
Compare direction and magnitude with a stated measure
Having a vector does not yet specify how to compare it with another. The Hugging Face tutorial contrasts cosine similarity, which compares direction, with a dot product that also depends on magnitude [2]. A comparison needs a named measure and a clear treatment of normalization. It also needs the represented unit: comparing two passage outputs is a different exercise from examining the two rows we invented for a token table.
Here is a separate arithmetic example using just two numbers per vector. Let a = (1, 0), b = (2, 0), and c = (-1, 0). The dot product of a with b is 2, while the dot product of a with c is -1. Doubling c changes that second result to -2, not a higher similarity score. Cosine similarity for these nonzero pairs is 1 and -1 respectively because it removes the effect of length. These are calculated values for invented vectors. They do not establish whether two words or passages have similar meanings.
The cookbook's distance discussion distinguishes angular comparison from magnitude-sensitive comparison [2]. For nonzero vectors, cosine similarity divides their dot product by the product of their Euclidean norms. Computing a dot product after both vectors have been normalized to unit norm yields the same cosine value. Stating this relationship avoids confusing a mathematical normalization in the cosine formula with a claim that every API requires pre-normalized inputs.
For the hypothetical vectors a = (1, 0), b = (2, 0), and c = (-1, 0), a·b = 2 and a·c = -1. Scaling c by two produces a·(2c) = -2; positive scaling preserves its cosine with a at -1. Magnitude sensitivity therefore does not mean that lengthening a vector increases its dot product with every possible vector. A zero vector also has no defined cosine under the ordinary formula because its norm is zero. These calculations clarify the measure, while any claim about useful semantic rankings still requires evaluation of the particular embeddings being compared.
A token row and a passage embedding represent different units
The five rows in our table exercise should not be confused with the vector a search system stores for a passage. The Hugging Face example computes embeddings for chunks of its knowledge base [2]. Microsoft also notes that a page covering several topics may be poorly represented as one vector, even when the page fits the input limit; smaller chunks may help [1]. Those examples concern the choice of text represented by each search record.
Imagine a retrieval design that stores one vector for a paragraph about river paths and another for a paragraph about bank fees. Under that stated design, there are two passage records. Their token counts need not be two, and the example does not specify how the encoder produces either vector. To compare the records, keep each passage attached to its vector and give it a stable label. That makes it possible to ask what text a result represents, rather than guessing from a coordinate or a familiar word inside the passage.
Representation granularity is independent of the shape of an individual numeric array. The cookbook embeds knowledge-base chunks for retrieval [2]; the toy table instead maps individual identifiers to rows. Microsoft's chunking guidance explains why a multi-topic page can be an unsuitable unit for one vector and suggests considering finer units [1]. This is a selection of the represented text, not evidence that a passage embedding is an average of the token rows illustrated here.
For an explicitly hypothetical collection with two passages and one stored embedding per passage, define two records with their own text and identifiers. The number of records follows from that indexing choice. It says nothing about the passages' token counts, internal token representations, pooling method, or embedding dimension. Those properties belong to the chosen encoder and configuration. Keeping the representation unit in the record makes the comparison inspectable: a query can retrieve a specific passage, and an evaluator can inspect that passage rather than treating all uses of the word 'embedding' as the same operation.
Inspect the context that actually reaches the encoder
The available context starts with the text you supply. Suppose a document heading says 'Weekend workshop' and a sentence below it says 'Registration closes on Friday'. A chunk containing only the sentence omits the event name; a chunk including the heading supplies it. That is an observation about the two inputs, not a prediction of their vector coordinates. Microsoft gives appending a document title to a middle chunk as one way to reduce context loss, and discusses overlap between chunks for continuity [1].
Length is another part of this inspection. Microsoft's guidance distinguishes character counts from model token counts [1]. The Hugging Face example checks a selected embedding model's maximum sequence length and warns that longer chunks in that setup are truncated [2]. Count with the relevant tokenizer, inspect the resulting chunk, and adjust it if necessary. A chunking rule that preserves a useful heading but cuts away the important sentence has not achieved the intended input. Keep the actual text so the comparison can be repeated.
Context availability is an input property that can be inspected before reasoning about output geometry. In the hypothetical heading-and-sentence example, adding 'Weekend workshop' changes the supplied character sequence and includes information absent from the isolated sentence. The example makes no measured claim about cosine distance, retrieval rank, or disambiguation accuracy. Microsoft's discussion of title attachment and overlapping chunks motivates inspecting which contextual information is retained [1].
The cookbook describes recursive splitting and uses a tokenizer-aware length function to keep chunks within the selected embedding model's sequence budget [2]. Microsoft's guidance also warns that character length is not the same as token length [1]. Record the exact chunk, tokenizer, measured count, and configured limit; then inspect what the encoder is actually asked to process. When the input must be changed, compare the retained content rather than assuming that any shorter string preserves the same question. The cited cookbook's truncation behaviour should remain attributed to that setup instead of being asserted for every embedding service.
A research example: context-guided composition in DECOR
DECOR studies generative recommendation, where item representations are used to generate recommendations. Its authors describe a pipeline that creates semantic identifiers from item information, followed by recommender training on interactions. They argue that the objectives of these stages can be misaligned and that fixed assignments can be too inflexible for different uses of an item [3]. This is a claim about the recommendation setting investigated in the paper.
Their composition method uses historical embeddings to build a context vector, then uses that context when combining candidate token embeddings [3]. In a case study on the Scientific dataset, the authors contrast a fixed representation for prefix (1,276) with contextually composed prefix representations. They report a more coherent relationship to valid next-token candidates in their visualization [3]. The useful lesson is to identify which operation changed and what evidence was shown. A case study of a recommender prefix is not a measured demonstration of the imaginary 'bank' row or a guarantee about another model.
The DECOR paper separates item tokenization from recommender training and attributes limitations to their differing reconstruction and interaction-modelling objectives [3]. Its contextualized token composition is a specified mechanism within that framework. The context computation aggregates fused embeddings from the historical sequence using attention-based pooling, followed by a learned transformation into a context vector [3]. This description should retain the framework's scope rather than being presented as the universal implementation of contextual language-model embeddings.
For composition, the paper selects candidate token embeddings from the same RQ-VAE codebook layer and combines them under the guidance of the computed context [3]. Its Scientific-dataset case study visualizes the prefix (1,276) before and after that operation, reporting improved coherence with valid next-token candidates [3]. The visualization is evidence the authors use for that case; it supplies neither the coordinates in our toy table nor a general claim about word senses. Evaluating a different system would require its own representation definitions, procedure, and results.
Change context with an explicit arithmetic rule
Return to our invented row for identifier 417: (2, 0, 1, 0, 0, 0, 0, 0). Define a new rule that copies this row and changes only its second number. Add the number of occurrences of 'river' in the input, then subtract the number of occurrences of 'loan'. All other numbers stay unchanged. This is a deliberately simple calculation for the exercise, not an implementation of attention or DECOR.
For 'the river bank was steep', there is one 'river' and no 'loan', so the result is (2, 1, 1, 0, 0, 0, 0, 0). For 'the bank approved the loan', the result is (2, -1, 1, 0, 0, 0, 0, 0). The original lookup row is identical in both calculations. If both counted words occur once, the changes cancel and the second number remains zero. The exercise therefore shows exactly when its defined rule changes an output, including a case where the presence of extra context produces no net change.
Define a toy transformation F(c, x) = E[c] + δ(x)u, where u = (0, 1, 0, 0, 0, 0, 0, 0) and δ(x) is the count of the stipulated token 'river' minus the count of 'loan'. This definition makes F depend on the input sequence while L(c) = E[c] remains unchanged. For c = 417, the base row is (2, 0, 1, 0, 0, 0, 0, 0). The rule and every coordinate are invented for this demonstration.
The river sentence gives δ = 1 and output (2, 1, 1, 0, 0, 0, 0, 0); the loan sentence gives δ = -1 and output (2, -1, 1, 0, 0, 0, 0, 0). Equal counts give δ = 0, providing a useful boundary case. Thus context dependence permits different outputs without requiring every context change to produce one. This is an algebraic consequence of the defined function. It makes no claim that a real model performs token counting this way, that these coordinates encode word senses, or that the procedure has been trained or evaluated.
Keep token boundaries separate from vector changes
Changing numbers and changing text boundaries are two different operations. In our exercise, the five tokens remain the same when the arithmetic rule changes the second number in one output. A boundary-changing rule would instead alter which pieces count as tokens. The contextual-morphogenesis paper makes a related distinction in its account of existing approaches: attention can model contextual dependencies while the segmentation established before inference remains fixed [4].
That paper then proposes dynamic changes to token structures and describes replacing standard embedding components with dynamic encoding components [4]. These are the authors' proposed architectural changes, not a feature this article assumes is present in ordinary models. When reading such a claim, look for evidence of the specific change: displayed token boundaries for a segmentation claim, or defined representations for a vector claim. Unchanged boundaries alone do not demonstrate that initial numeric values are fixed; a changing vector alone does not demonstrate that token boundaries have moved.
The morphological segmentation and the numeric representation are distinct objects. The toy transformation changes the second coordinate of row 417 in the output without modifying the stipulated input token sequence. This gives an explicit example in which representational variation does not entail re-tokenization. Conversely, knowing that a segmentation is unchanged places no complete specification on the function used to produce numerical representations at those positions.
The morphogenesis paper describes contextual attention and unchanged initial segmentation as separate aspects of the conventional approaches it discusses [4]. It proposes dynamic segmentation and reports architectural modifications intended to restructure token boundaries during inference [4]. Keep that proposal attributed to its authors; it is not evidence that every contextual embedding system dynamically retokenizes. A meaningful comparison should state the object being changed, the intervention, and the evidence observed. That prevents fixed-boundary evidence from being used as a substitute for a documented lookup operation, or contextual-vector evidence from being used as a substitute for observed segmentation changes.
Make an embedding comparison reproducible
A useful record begins with the represented unit and the input: one token in a defined exercise, an item prefix in a particular study, or a passage in a search collection. Keep the text or identifiers needed to repeat the comparison. For an embedding application, record the selected model and tokenizer, count the supplied tokens, and inspect chunk boundaries. Microsoft's examples show why character counts and token counts should be distinguished, while the Hugging Face example ties chunk sizing to its chosen model [1][2].
Next, name the output stage and the comparison measure. State whether you inspected a starting row or another representation, and whether the score was cosine similarity or a dot product [2]. If the claim concerns DECOR, identify the recommender setting and the composition step actually studied [3]. If it concerns segmentation, inspect that separately from changing vector values [4]. Finally, label original demonstrations as demonstrations. The eight-component example is useful because every assumption and calculation is visible; judging a deployed model requires observations from that model.
For reproducibility, retain the representation unit, exact input, model identifier and configuration, tokenizer, measured token count, and any chunking operation. The practical reason for recording input preparation is supported by the cited guides: model token counts can differ from character counts, and the cookbook's chosen encoder imposes a sequence limit [1][2]. These records describe the compared object more precisely than a bare claim that two 'embeddings' are close.
Document the extracted stage, metric, and normalization alongside the result. A cosine score and a raw dot product have different magnitude behaviour [2]. A DECOR prefix representation should be tied to the recommendation framework and the composition operation its authors evaluate [3]. A token-boundary claim should be evaluated as a segmentation claim rather than inferred from numeric changes [4]. Separating these records makes disagreements testable: two analyses may use different units, inputs, stages, or measures. It also keeps a transparent mathematical illustration from being mistaken for an empirical result or an architectural promise.
Sources & further reading
Explore the references behind this guide. External pages may change after our review.
- Chunk Documents - Azure AI Search | Microsoft LearnMicrosoft · Accessed 6 Nov 2026
- Advanced RAG on Hugging Face documentation using LangChain · Hugging FaceHugging Face · Accessed 6 Nov 2026
- Learning Decomposed Contextual Token Representations from Pretrained and Collaborative Signals for Generative RecommendationarXiv paper authors · Accessed 6 Nov 2026
- Contextual Morphogenesis in Large Language Models: A Novel Approach to Self-Organizing Token RepresentationsarXiv paper authors · Accessed 6 Nov 2026
Article updated 6 Nov 2026.
Found something we should revisit?
Good explanations get better with thoughtful feedback.