DH 2026

Daejeon, July 27–31

Fri, July 3109:00–10:30S021105
Long Paper

Selective Reconciliation of Word Embeddings for Corpus Comparison

Nichole Misako Nomura
University of Wyoming, United States of America · nnomura@uwyo.edu
Mark Algee-Hewitt
Stanford University, United States of America · malgeehe@stanford.edu

Introduction

Vector space alignment remains a difficulty for word embedding comparison in humanities research. Many embedding algorithms demonstrate instability--a result of their dependence on stochastic machine learning methods and the subsequent dimensionality reductions imposed on the model outputs (Wendlandt et al. 2018). This instability ramifies when we attempt to compare word embeddings, and even more so when comparing word embeddings trained on significantly different corpora. Approaches to diachronic comparison of embeddings have utilized various methods, including Procrustes alignment, but still face major challenges and tradeoffs (Wevers and Koolen 2020).

Word embedding research in the humanities also faces problems of scale: corpus-centered approaches frequently center on corpora that cannot be easily expanded. There is a cap to the number of Hugo-award-winning novels at any given moment, a permanent limit on the number of 18th- century English novels, and a finite number of lines of ancient Greek poetry available to us. Under the conditions of corpus-centered inquiry, expanding training data via the inclusion of synthetic data is unlikely to be appropriate. Word embedding algorithms and comparison methods that require large corpora, or even corpora of comparable size, may not work for humanistic objects of study.

Given the instability of embedding algorithms and corpus restrictions faced by humanistic researchers, Antoniak and Mimno argue for averaging over multiple bootstrap samples instead of relying on single models (2018), which necessarily requires excluding texts from any given sample--posing an interpretive barrier for humanists seeking to study small groups of texts in relation to the entire corpus.

The current landscape of comparative word embedding research requires tradeoffs and careful design. We offer a new method that still requires such tradeoffs and design--building on the choices humanities researchers frequently make in manipulating the text of the corpora they model under the auspices of “cleaning”--reducing complexity--and inverting them.

Method

We propose a method, selective reconciliation, as an approach for comparing corpus-level contexts in embedding space. In this method, particular tokens are modified to reflect their corpus of origin before the set of corpora is consolidated into a single corpus in the creation of a word embedding (e.g., dog becomes dog_corpus_A, dog_corpus_B, dog_corpus_C, and so on). Unmodified tokens will collapse onto each other in the training of the embedding, but the modified tokens are able to remain distinct. If there is no meaningful difference in contexts across corpora, then the modified tokens will remain near each other in embedding space. If there is, however, a meaningful difference in context, they are free to disambiguate.

Our method replicates the functionality of contextual embedding methods (Liu et al. 2020) that create vector spaces based on tokens rather than types; however, it retains the comparable interpretability of embedding models that collapse these distinctions (Arora et al. 2020). It allows us to selectively create a vocabulary by collapsing tokens within specific context windows (in this case, a series of corpora). It also retains the comparable speed and size advantages of a traditional word embedding model while still providing the contextual information related to our object of interest.

This is a corpus-centered approach (Antoniak and Mimno 2018) that treats modeling as a critical act designed to answer a specific question. It treats embeddings as “models of texts qua texts” (Dobson 2022)--and further, as models of corpora qua corpora--rather than a general-purpose abstraction or something optimized for performance on downstream tasks. We believe that this approach creates a bridge across the dual commitments of centering the corpus-specificity of our task and centering the interactions between hermeneutics and the algorithms that facilitate those hermeneutics. Further, it supports comparison of smaller corpora than we would otherwise be able to align using current methods.

Selective reconciliation allows us to use existing meaning-making strategies for the interpretation of word embeddings--including looking for terms with high cosine similarity, using analogy tests via vector math, or looking for neighborhoods, but extends these interpretation strategies to allow for the comparison of historically or contextually variant tokens of single types.

Pipeline

This method has implications for several stages of embedding training and interpretation.

Corpus selection

This method requires corpus creation and selection in a such a way that annotating tokens for their corpus of origin is meaningful--corpora are therefore assumed to be representative of something at the researcher’s creation/discretion--up to and including representative of themselves (we can think here of the canonical corpora available to researchers). This method requires researchers to consider carefully the implications of repeat texts, if the corpora overlap.

Preprocessing

Researchers frequently take steps to reduce the “noise” in their embeddings, reducing the complexity of the model via tokenization, regularization, and other cleaning approaches such as removing page numbers, boilerplate, tables, etc. Our approach, on the other hand, adds complexity to the model, by including the corpus as a factor in the creation of the vocabulary, ultimately increasing its size. Decisions at this stage therefore need to weigh both the reductions and additions to the vocabulary carefully.

Model Training

By intervening at the preprocessing stage and creating new tokens, there should be no significant impacts to most forms of embedding model training. More work needs to be done to understand the impact of changes in vocabulary size and type-token ratios on the validity of word embeddings, but researchers should be able to use the existing standards for model assessment (e.g. attributional similarity or analogy tests on the unmodified types).

Case Study

This method was developed to explore a specific research question: as critics frequently claim slave and robot are synonymous, what is the measurable relationship between the two in science fiction? Are the two terms substitutable?

We turned to a GloVe model, which, because of its approach to context, captures synonymy and antonymy quite well (Pennington et al. 2014). Corpora (Table 1) were selected because they were hypothesized to provide meaningfully different examples of use for slave and robot. A select list of keyterms were modified to reflect their corpus of origin: robot, android, droid, slave, negro, the n-word, and pluralizations. The rest of the words in the model, after filtering out words that appear fewer than five times, were passed through a dictionary filter. We custom-built the dictionary, including all the words in all of the science fiction, because neologisms were of high interest to us.

We highlight here the deeply idiosyncratic nature of our “cleaning,” our embedding algorithm selection, and our term list for modification--all driven by our experience with the corpora and the scholarly literature, our particular research questions, and our hypotheses. This method is more dependent on researcher choice, not less--and we argue that “cleaning” should likewise be a matter of carefully considered researcher choice for the task at hand.

Table 1: Corpora

Corpus NameCorpus Description
ChicagoA corpus of top United States library fiction holdings, created by researchers at the University of Chicago’s Text Lab
Gale American FictionA corpus of early American Fiction
Hugo NebulaNovels that have won or been nominated for the Hugo and Nebula award
Star TrekA corpus of Star Trek novels (excluding graphic novels)
Star WarsA corpus of Star Wars novels (excluding graphic novels) 
SVRSFNovels from a general science fiction corpus selected because they contained “slave” or “robot” in-text or in-title

Figure 1: Keyterms across corpora, unscaled 

A benefit to the combined corpora can be seen in Figure 1. Many of the keyterms of interest for this particular case are concentrated, or found exclusively, in single corpora--droid being the obvious example, as George Lucas literally owns the word, meaning it only shows up in Star-Wars-affiliated texts. Context connections for droid and other terms would not be easily visible in single-corpus models, and traditional Procrustes alignment would fail, as it requires a consistent vocabulary between corpora.

Figure 2: t-SNE of combined corpus embedding

Figure 3: filtered t-SNE of combined corpus embedding

Figure 2 shows a t-SNE of the full embedding of the combined corpora, and Figure 3 shows that same t-SNE of the same embedding, at the same scale, filtered on the modified keyterms. Not only does this method allow us to rule out synonymy, but it invites us to compare corpus-level usage. It, for example, facilitates close, careful reading of the neighborhood of android_startrek--the visual outlier in Figure 3.

Conclusion

We conclude by presenting our efforts to measure this particular method’s impacts on model stability  (including comparing fixed, shuffled, and bootstrap-sampled corpora). Further validation is needed to understand the relationship of corpus composition to the modified terms. Additionally, different embedding algorithms will ultimately suggest different interpretations--here, GloVe’s context window calculations capture both proximity and emulation--another algorithm would suggest different meaning-making possibilities.

We do think this is most useful on algorithms that we have meaning-making protocols for--it will not work on anything resembling a generic “AI” or proprietary LLMs. Manipulating tokens in this way in corpora before training models affords the collapse of contexts while maintaining a particular, chosen axis of distinction; it also suggests the possibility of collapsing tokens into artificial types, much as we may train a model on a lemmatized corpus, along similar axes of distinction.

References
  1. Antoniak, Maria, and David Mimno. 2018. “Evaluating the Stability of Embedding-Based Word Similarities.” Transactions of the Association for Computational Linguistics 6 (December): 107–19. https://doi.org/10.1162/tacl_a_00008. 
  2. Arora, Simran, Avner May, Jian Zhang, and Christopher Ré. " 2020. Contextual embeddings: When are they worth it?." arXiv preprint arXiv:2005.09117.
  3. Dobson, James E. 2022. “Vector Hermeneutics: On the Interpretation of Vector Space Models of Text.” Digital Scholarship in the Humanities 37 (1): 81–93. https://doi.org/10.1093/llc/fqab079. 
  4. Liu, Qi, Matt J. Kusner, and Phil Blunsom. 2020. "A survey on contextual embeddings." arXiv preprint arXiv:2003.07278.
  5. Pennington, Jeffrey, Richard Socher, and Christopher Manning. 2014. “GloVe: Global Vectors for Word Representation.” Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), 1532–43. https://doi.org/10.3115/v1/D14-1162. 
  6. Wendlandt, Laura, Jonathan K. Kummerfeld, and Rada Mihalcea. 2018. “Factors Influencing the Surprising Instability of Word Embeddings.” Proceedings of the 2018 Conference of the North American Chapter of  the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), 2092–102. https://doi.org/10.18653/v1/N18-1190. 
  7. Wevers, Melvin, and Marijn Koolen. 2020. “Digital Begriffsgeschichte: Tracing Semantic Change Using Word Embeddings.” Historical Methods: A Journal of Quantitative and Interdisciplinary History 53 (4): 226–43. https://doi.org/10.1080/01615440.2020.1760157.