Appendix · language encoding

How a sentence becomes a vector in this project, what each symbol in the equations means, and what that vector can and cannot justify.

What an encoder does

An embedding is a numeric fingerprint of a sentence: a fixed-length list of numbers. The model used here is paraphrase-multilingual-MiniLM-L12-v2 (Sentence-Transformers checkpoint; Reimers and Gurevych 2019), built from a twelve-layer MiniLM encoder (Wang et al. 2021) over a multilingual transformer stack (Vaswani et al. 2017). Text is split into WordPiece tokens (Devlin et al. 2019). Weights are frozen on the Montreal corpus (not fine-tuned on your documents). Implementation: SentenceTransformer.encode in scripts/run_semiosphere_feature_space.py.

Two fingerprints that sit close together usually share topic. They do not reliably preserve register (scare quotes, gathering-not-symposium, which shell a stretch belongs to). That is why the Lotman reading treats the encoder as an instrument on the primary language layer - good at translation-equivalence, weak at institutional shell by itself.

Sentence text→ Tokens→ 12-layer transformer→ Mean pool→ 384 numbers (one vector)

Mean pooling equation

e = (1/n) Σi=1n hi   ∈ ℝ384
What this equation says

Take every token's internal vector from the last layer, add them up, divide by how many tokens there were. The result e is the sentence fingerprint stored for the probe and retriever.

SymbolStands forWhat happens to it
eSentence embeddingBuilt once per scored stretch; one row in the embedding matrix.
nToken countLonger sentences have larger n; each token counts equally in the average.
hiHidden vector for token iComes out of layer 12; already mixes context from the whole sentence.
ΣSumAdd all n token vectors component-wise (384 additions per dimension).
1/nDivide by countTurns a sum into an average so length does not automatically scale the arrow.
ℝ384384-dimensional spaceEach e is a point (arrow from origin) with 384 coordinates.
Plain-language walkthrough
  1. Tokenize the sentence into WordPiece subwords (Devlin et al. 2019).
  2. Run pieces through the transformer; keep the last layer's vector for each piece (Vaswani et al. 2017).
  3. Mean-pool token vectors into one sentence vector (Reimers and Gurevych 2019, default in Sentence-Transformers).
  4. Store the resulting e as this stretch's fingerprint.

Toy example (2 numbers instead of 384): three tokens with hidden vectors (1,0), (1,2), (3,2). Sum = (5,4). Divide by 3 → e ≈ (1.67, 1.33). One sentence, one arrow.

Cosine similarity

The retriever and probe compare fingerprints by cosine similarity: how much two arrows point the same way, not how long they are (standard vector-space measure; Manning, Raghavan, and Schütze 2008; computed via scikit-learn in the probe script).

Step 1 · Dot product

x · y = Σk=1384 xk yk
What this part does

Multiply matching coordinates and add the products. Large positive value → many coordinates push together; mixed signs → directions disagree.

SymbolMeaning
x, yTwo sentence fingerprints (query vs candidate, or secret vs outward).
xkThe kth number in vector x (one coordinate).
x · yA single score from the whole vector - not itself the cosine yet.

2D example: x = (0.8, 0.6), y = (0.6, 0.8). Dot = 0.8×0.6 + 0.6×0.8 = 0.96.

Step 2 · Length (norm)

‖x‖ = √(x · x)
What this part does

Dot the vector with itself, take the square root - Pythagoras in 384 dimensions. Norm is how long the arrow is before you compare direction.

Cosine divides by ‖x‖ and ‖y‖ so a very long vector does not automatically look "more similar."

Step 3 · Cosine (the score we report)

cos(θ) = (x · y) / (‖x‖ ‖y‖)
What happens in order
  1. Compute x · y (overlap of coordinates).
  2. Compute lengths ‖x‖ and ‖y‖.
  3. Divide: dot product divided by both lengths → a number from −1 to 1.
  4. Interpret: near 1 = same direction (often same topic); near 0 = unrelated angle; negative = opposite direction.

Before comparing secret and outward clouds in the probe, vectors pass VecMap-style preprocessing: L2 normalize, subtract the training-side mean, L2 normalize again (Artetxe, Labaka, and Agirre 2016; Artetxe, Labaka, and Agirre 2018; function artetxe_preprocess in run_semiosphere_feature_space.py). That is the centering and normalization step so cosine tracks angle cleanly. Cross-lingual maps on top of those vectors follow the Mikolov → Xing → Artetxe chain documented on Semiotic coordinate plain §5 (Mikolov, Le, and Sutskever 2013; Xing et al. 2015; orthogonal Procrustes: Schönemann 1966).

Montreal retriever: flat search returned the internal memo at cosines about 0.48-0.76 to outward-clip questions - high theme overlap, wrong shell. Scoped by shell → tier confusion 0.

Figure A · Two fingerprints as arrows (schematic 2D)

Orange and blue share a topic direction (high cosine). Grey is perpendicular (cosine ≈ 0). Real work uses 384 dimensions; this is a teaching projection.

What the space looks like (schematic)

Multilingual training pulls translation mates together. Register is not an axis the frozen encoder labels for you.

Figure B · Topic gravity vs shell (illustration only)

Shared famine/film topic clumps; shell differs. Separation needs typing, scoped retrieval, or pair-read - not raw cosine across Russian and English alone.

What encoders justify on the Montreal plate

QuestionEncoder aloneWith typed archive
Same topic, different week?Often yes (high cosine)Pair-read dates the relay
Scare quotes stayed internal?Partly (forbidden-operator probe)L2 tensor + pair-read
Secret → embassy recoding?Not a global map (Procrustes retraction)Operator table, misses
Newspaper proving forgery?Flat retrieval: memo wins (6/6)Shell scope + halt: 0 tier confusion

Sources · where these techniques come from

This appendix covers the encoding and similarity layer only; historical claims still require pair-read. Each step below maps to its source and to the lab script.

Step on this pageWhat the project doesDerived from
Encoder checkpointparaphrase-multilingual-MiniLM-L12-v2, frozenReimers and Gurevych 2019; Wang et al. 2021
TokenizationModel tokenizer (WordPiece)Devlin et al. 2019
Contextual vectors hiLast hidden layer, 12 blocksVaswani et al. 2017
Mean pool → eSentenceTransformer.encode default poolingReimers and Gurevych 2019
Dot product & cosinesklearn.metrics.pairwise.cosine_similarityManning, Raghavan, and Schütze 2008
L2 → center → L2artetxe_preprocess on train/test/inventoryArtetxe, Labaka, and Agirre 2016; Artetxe, Labaka, and Agirre 2018
Secret→outward map (not re-derived here)Orthogonal Procrustes + ridge + controlsSchönemann 1966; Mikolov, Le, and Sutskever 2013; Xing et al. 2015; probe logic Hewitt and Manning 2019; controls Hewitt and Liang 2019
Flat retrieval (E4)Rank by cosine over pooled inventoryProject experiment log; failure mode, not a published method claim

Lab trace: peter_htr_experiment/docs/EXPERIMENT_LOG_semiosphere_feature_space.md, 2026-09-10 literature section. Comps placement: reading list · comprehensive lists.

Bibliography

Alain, Guillaume, and Yoshua Bengio. "Understanding Intermediate Layers Using Linear Classifier Probes." International Conference on Learning Representations (ICLR), 2017. Workshop track. (Linear classifier probes on frozen representations.)

Artetxe, Mikel, Gorka Labaka, and Eneko Agirre. "Learning Principled Bilingual Mappings of Word Embeddings while Preserving Monolingual Invariance." In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, 2289-94. Austin, TX: Association for Computational Linguistics, 2016.

Artetxe, Mikel, Gorka Labaka, and Eneko Agirre. "A Robust Self-Learning Method for Fully Unsupervised Cross-Lingual Mappings of Word Embeddings." In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), 789-98. Melbourne: Association for Computational Linguistics, 2018. (VecMap preprocessing recipe used in the probe script.)

Devlin, Jacob, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. "BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding." In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1, 4171-86. Minneapolis, MN: Association for Computational Linguistics, 2019.

Hewitt, John, and Christopher D. Manning. "A Structural Probe for Finding Syntax in Word Representations." In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1, 4129-38. Minneapolis, MN: Association for Computational Linguistics, 2019.

Hewitt, John, and Percy Liang. "Designing and Interpreting Probes with Control Tasks." In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), 2733-43. Hong Kong: Association for Computational Linguistics, 2019.

Manning, Christopher D., Prabhakar Raghavan, and Hinrich Schütze. Introduction to Information Retrieval. Cambridge: Cambridge University Press, 2008. (Cosine similarity as a vector-space retrieval score.)

Mikolov, Tomas, Quoc V. Le, and Ilya Sutskever. "Exploiting Similarities among Languages for Machine Translation." arXiv, 1309.4168 (2013). (Linear map between embedding spaces.)

Reimers, Nils, and Iryna Gurevych. "Sentence-BERT: Sentence Embeddings Using Siamese BERT-Networks." In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), 3982-92. Hong Kong: Association for Computational Linguistics, 2019.

Schönemann, Peter H. "A Generalized Solution of the Orthogonal Procrustes Problem." Psychometrika 31, no. 1 (1966): 1-10.

Vaswani, Ashish, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. "Attention Is All You Need." In Advances in Neural Information Processing Systems 30, 5998-6008. 2017.

Wang, Wenhui, Furu Wei, Li Dong, Hangbo Bao, Nan Yang, and Ming Zhou. "MiniLM: Deep Self-Attention Distillation for Task-Agnostic Knowledge Distillation of Transformer Encoders." In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, 5770-81. Online: Association for Computational Linguistics, 2021.

Xing, Chao, Dong Wang, Chao Liu, and Yiye Lin. "Normalized Word Embedding and Orthogonal Transform for Bilingual Word Translation." In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, 1006-11. Denver, CO: Association for Computational Linguistics, 2015.

Glossary · terms on this page

Dotted words in the text open a short definition; click again or use Full definition ↓ to jump here.

Encoder
Frozen neural model that reads text and outputs vectors. Here: MiniLM-L12, not fine-tuned on the archive.
Embedding
Same as the sentence fingerprint e - one vector per scored stretch.
Token
A word piece after tokenization; each gets a hidden vector hi before pooling.
Transformer
Stack of attention layers; each token's final hidden state depends on the whole sentence context.
Mean pooling
Average token vectors into one sentence vector; equation at #eq-mean-pool.
Vector
Ordered list of numbers treated as an arrow from the origin; 384 entries here.
Dot product
Sum of products of matching coordinates; measures coordinate-wise overlap before normalization.
Norm
Length of a vector, ‖x‖ = √(x · x).
Cosine similarity
Dot product divided by both lengths; equals cos(θ) between arrows. Used in retrieval and probe scores.
Centering / normalization
VecMap-style L2 → mean-center (training mean reused on test) → L2 (Artetxe, Labaka, and Agirre 2016; 2018).
Frozen
Model weights fixed; the archive is measured, not used to retrain the encoder.
Multilingual
Training objective pulls paraphrases and translations in different languages near each other.
Theme / topic
What the sentence is about (famine, film, Canada). Encoders recover this more easily than register.
Register
Document type and audience contract - secret memo vs embassy release vs diaspora weekly.
Shell
Archive typing for which zone a unit lives in (secret, inward, Soviet outward, rival).
Pair-read
Read secret stretch beside dated outward counterpart or record a documented miss - historical warrant.
Probe
Fit maps and controls on frozen embeddings; microscope for theme-level linearity, not oracle for history.