The useful part, up front

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]
01

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.

Identify what one vector represents. The represented unit matters: a defined token example, a recommender prefix, and a retrieval passage are different objects.
The represented unit matters: a defined token example, a recommender prefix, and a retrieval passage are different objects. · Ameer Journal — original explanatory diagramOriginal editorial illustration; no third-party artwork reused.
02

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.

03

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.

A hypothetical eight-component lookup. Original illustration: all dimensions and coordinates here are invented. Source [3] describes a separate recommender lookup case.
Original illustration: all dimensions and coordinates here are invented. Source [3] describes a separate recommender lookup case. · Ameer Journal — original explanatory diagramOriginal editorial illustration; no third-party artwork reused.
04

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.

05

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.

06

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.

Check the context supplied to an encoder. Inspect the retained text and count it with the relevant tokenizer. Keep the input within the selected model's documented limits.
Inspect the retained text and count it with the relevant tokenizer. Keep the input within the selected model's documented limits. · Ameer Journal — original explanatory diagramOriginal editorial illustration; no third-party artwork reused.
07

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.

08

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.

Our toy rule: fixed row, different context. Original arithmetic example, not a measured model result. Add river count minus loan count to the second coordinate of the invented row.
Original arithmetic example, not a measured model result. Add river count minus loan count to the second coordinate of the invented row. · Ameer Journal — original explanatory diagramOriginal editorial illustration; no third-party artwork reused.
09

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.

10

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.

A reproducible embedding comparison. Record the object, exact input, output stage, and comparison rule. Keep claims tied to the system and evidence actually examined.
Record the object, exact input, output stage, and comparison rule. Keep claims tied to the system and evidence actually examined. · Ameer Journal — original explanatory diagramOriginal editorial illustration; no third-party artwork reused.
Follow the evidence

Sources & further reading

Explore the references behind this guide. External pages may change after our review.

  1. Chunk Documents - Azure AI Search | Microsoft Learn
    Microsoft · Accessed 6 Nov 2026
  2. Advanced RAG on Hugging Face documentation using LangChain · Hugging Face
    Hugging Face · Accessed 6 Nov 2026
  3. Learning Decomposed Contextual Token Representations from Pretrained and Collaborative Signals for Generative Recommendation
    arXiv paper authors · Accessed 6 Nov 2026
  4. Contextual Morphogenesis in Large Language Models: A Novel Approach to Self-Organizing Token Representations
    arXiv paper authors · Accessed 6 Nov 2026

Article updated 6 Nov 2026.

Found something we should revisit?

Good explanations get better with thoughtful feedback.

Suggest a correction