Manuscript Offprint

arXiv:2609.05333

Technical Manual for a Toolkit for Measuring Contextual Individuation in Transformer Language Models

José Luciano Verçosa Marques, Frederico Jorge Heitmann, Daniel Omar Perez, Marcelo Vinicius de Paula, Tárcio André dos Santos Barros

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

José Luciano Verçosa Marques¹

zlvm@unicamp.br

ORCID: 0000-0002-3191-0846

Frederico Jorge Heitmann²

f023863@dac.unicamp.br

ORCID: 0009-0006-5828-8301

Daniel Omar Perez³

doperez@unicamp.br

ORCID: 0000-0002-5965-3490

Marcelo Vinicius de Paula¹

mvpaula@unicamp.br

ORCID: 0000-0002-2213-6086

Tárcio André dos Santos Barros¹

tarcio87@unicamp.br

ORCID: 0000-0001-9413-1279

¹ Center for Electric Mobility Research (CEMOBE) / Power Electronics Laboratories (LEPO), University of Campinas (Unicamp)

² Institute of Computing (IC), University of Campinas (Unicamp)

³ Center for Logic, Epistemology and History of Science (CLE), University of Campinas (Unicamp)

Corresponding author: José Luciano Verçosa Marques (zlvm@unicamp.br)

Abstract

A transformer language model assigns a single, context-independent vector to a word type at its embedding layer, yet is widely believed to individuate that word's occurrences by context in its later layers. Testing this belief cleanly requires a construct that holds the word form fixed while its context and intended sense vary in a controlled, labeled way. This manual documents an open toolkit built around such a construct, which we call a bridge form: a single written word that recurs, unchanged, across two or more subject domains with a different sense in each. We describe, and justify, every stage of the pipeline: the declarative specification of bridge forms and their source domains, corpus acquisition from Wikipedia, occurrence localization, layer-wise representation extraction, a domain-pairwise silhouette measurement of separation in the model's representation space, and a paired visualization protocol. Each design choice is presented together with the methodological failure mode it is meant to avoid (sense contamination from overly broad category labels, the multi-group bias of the silhouette coefficient, subword-tokenization misalignment, and axis-comparability artifacts in dimensionality-reduced plots, among others). This manuscript is a methodological and implementation reference: it does not report or interpret empirical outcomes of running the toolkit on any particular model or bridge-form set. The toolkit, its full source, and the corpora used to exercise it are archived separately (Section 9) under a persistent identifier, and are intended to be cited as an instrument by studies that use it to produce and interpret empirical results.

Keywords: contextual word representations; transformer language models; polysemy; word sense individuation; probing methodology; silhouette coefficient; reproducibility.

1. Introduction

Contextual language models replaced static word embeddings on the premise that a word's representation should depend on where it occurs, not only on which word it is. That premise is easy to state and hard to test cleanly. Most existing evidence for it is indirect: downstream task performance improves when contextual representations are used in place of static ones (Peters et al., 2018), or probing classifiers show that certain properties of a sentence are linearly recoverable from a token's hidden state at some layer (Tenney et al., 2019; Belinkov and Glass, 2019). Such evidence is compatible with context-sensitivity but does not isolate it: a probe trained on annotated data can succeed for reasons that have little to do with a model's spontaneous tendency to keep distinct senses of the same word type apart in its own geometry.

This manual documents a toolkit built to isolate that specific question directly. The construct it relies on, which we call a bridge form, is a single written word that occurs, unchanged, across two or more subject domains, carrying a domain-appropriate sense in each: for instance, current as electric current (physics), a current account (economics), and an ocean current (physical geography). Because every occurrence of a bridge form shares the same entry in a model's vocabulary, the model's static embedding-layer output is, up to positional variation, the same vector for all of them. Any separation between domains that appears in later layers can therefore only be a fact about context, not about word identity. This is a structural guarantee that does not depend on trusting the model's downstream behavior or on any annotated sense inventory.

The toolkit operationalizes this idea end to end: it declares bridge forms and their domains against specific, non-overlapping source categories; builds a corpus from those categories; locates every occurrence of each form; extracts its hidden-state vector at every layer of a chosen transformer; measures domain separation with a pairwise silhouette coefficient computed at full representation width; and visualizes the same occurrences with a paired, axis-comparable projection. Every one of these stages embeds a methodological choice that is not forced by the problem statement, and each choice can silently determine the result if left implicit. The purpose of this manual is to make every one of those choices explicit, and to justify it, so that the toolkit can be reused, audited, and extended without having to reverse-engineer its design from source code alone.

This manuscript is deliberately scoped as a methodological and implementation reference. It does not present, tabulate, or interpret the empirical outcome of running the toolkit against any specific model or bridge-form inventory; it documents an instrument, not a finding.

The remainder of this manual is organized as follows. Section 2 states what kind of questions the toolkit is intended to help answer. Section 3 situates the bridge-form construct relative to static and contextual embedding literatures and to existing probing methodology. Section 4 states and justifies the toolkit's design principles. Section 5 describes the pipeline stage by stage. Section 6 covers implementation and reproducibility. Section 7 explains how the toolkit's output is meant to be read, illustrated with example output. Section 8 states the toolkit's scope and known limitations. Section 9 gives availability and citation information.

References (21)