Embedding Cosine Measures Text Length Before It Measures Homogenization

Fengming Liu

TL;DR

Using raw cosine similarity of transformer embeddings to measure "homogenization" in text is highly susceptible to a "length artifact": as text length changes, similarity scores shift mechanically, regardless of content. This paper demonstrates that recent high-profile findings—such as the supposed homogenization of political discourse after ChatGPT—are largely spurious results of people simply writing shorter or longer comments.

What Problem Does This Paper Address?

Computational social scientists increasingly use the mean pairwise cosine similarity of document embeddings to quantify how "similar" a group's ideas are. This metric is used to detect "homogenization"—a narrowing of discourse—often attributed to the influence of generative AI.

The problem is that transformer embeddings (especially mean-pooled outputs from models like DeBERTa) are anisotropic: they don't occupy the embedding space uniformly but are crowded into a narrow cone. Previous representation-learning research noted that longer texts tend to collapse toward each other in this space. This paper bridges the gap between that technical observation and substantive social science, showing that if the average length of text in a time series changes, the similarity measure will report a "trend" or a "break" that has nothing to do with the actual meaning of the words.

Methods

The author, Fengming Liu, re-examines their own previous work and other studies using a suite of rigorous diagnostic "stress tests":

  • Truncation Experiments: Taking the same set of comments and truncating them to various lengths (10 to 150 words) to see how similarity changes when content is held constant but length varies.
  • Length-Only Placebo: A "shuffled" control where each real comment is replaced by a random comment of the same length from the entire corpus. This preserves the length distribution but destroys all topical and ideological signals.
  • Fixed-Content Simulation: Creating synthetic datasets where the content is identical across groups, but the distribution of text lengths is manipulated to mimic observed trends.
  • Spectral Decomposition: Breaking down the similarity measure into its principal components to identify where the "homogenization" signal actually resides.
  • Encoder Comparison: Testing the effect across different models, including standard MLMs (DeBERTa-v3) and dedicated sentence encoders (mpnet, BGE).

Datasets

  • Reddit: 6.06 million comments from r/AskConservatives and r/AskALiberal (2019–2025).
  • Stack Exchange: 575,000 answers from eight different sites (e.g., Super User, Philosophy) to test the effect on technical vs. humanities discourse.
  • Experimental Data: 293 human-written stories from a well-known study on AI-assisted writing (Doshi and Hauser 2024).
  • Literature Census: A review of 31 published and preprinted studies to assess the widespread risk of this artifact.

Key Insights and Ideas

  • The Magnitude of the Artifact: In DeBERTa-v3, simply truncating a comment from 150 words down to 10 reduces its mean cosine similarity by eight times the magnitude of the "break" previously attributed to ChatGPT. Figure 1: Mean pairwise cosine of the same 20,000 comments truncated to k words. Content is held fixed and only length changes.

  • Anisotropy is a "Narrow Cone": Because embeddings are bunched together, unrelated sentences already share high cosine similarity. Longer texts average out "rogue dimensions," causing them to drift toward the center of the cone and appear more similar to one another.

  • The "Conservative Break" was a Length Shift: The original finding that conservative Reddit discourse homogenized after late 2022 was actually caused by comment lengths stabilizing after a long period of shrinking. The "diversification" trend before 2022 was just comments getting shorter.
  • Centering is Not a Panacea: A common fix is "centering" (subtracting the mean vector) and renormalizing. However, the author shows that this can actually reverse a genuine effect by inflating noise in typical documents, potentially manufacturing spurious results in the opposite direction.
Figure 1: Mean pairwise cosine of the same 20,000 comments truncated to k words. Content is held fixed and only length changes.

Key Results

  • Placebo Success: The "length-only placebo"—which contains zero topical information—reproduced 81% of the observed asymmetry in the Reddit data and 100% of the homogenization reported on technical Stack Exchange sites. Figure 2: Observed DeBERTa raw homogeneity (black) and the mean of fifty length-only placebo series (orange). The correlation is nearly perfect (r=0.97).

  • Spectral Dominance: In DeBERTa, the first principal component carries 99.9% of the raw homogeneity signal. This single "length-heavy" direction dominates the entire measure.

  • Corrected Social Findings: Once length is controlled for via stratification, the data shows that political camps actually converged between 2019 and 2022 and stopped converging before ChatGPT was even released. Furthermore, cross-camp replies were found to engage their targets more closely than same-camp replies.
Figure 2: Observed DeBERTa raw homogeneity (black) and the mean of fifty length-only placebo series (orange). The correlation is nearly perfect (r=0.97).

Limitations and Future Work

  • Scope: The study focuses on two major platforms (Reddit and Stack Exchange); the magnitude of the artifact may vary in other contexts (e.g., formal news, short tweets).
  • Encoder Sensitivity: While sentence encoders like mpnet are more robust than mean-pooled MLMs, they are not immune. BGE, for instance, showed a large monotone length effect.
  • Proposed Protocol: The author suggests a new "diagnostic protocol" for future research:
  • Report the variance share of the leading principal components.
  • Use dedicated sentence encoders.
  • Handle length explicitly through stratification (e.g., quintiles).
  • Always run and report the "length-only placebo" alongside main results.

Summary updated

Abstract

Mean pairwise cosine similarity between transformer embeddings is a standard measure of whether online discourse is converging under generative AI. When the embeddings are mean-pooled outputs of an encoder never trained for sentence similarity, this measure mostly tracks text length. In 6.06 million Reddit comments, an uncentered DeBERTa-v3 measure had suggested that only conservative discourse broke toward homogeneity after late 2022. Truncating the same comments from 10 to 150 words raises their mean cosine by eight times the reported break. A placebo that swaps every comment for a random one of equal length reproduces 81% of the asymmetry, and a fixed-content simulation reproduces 78%. The leading principal direction carries 99.9% of raw DeBERTa homogeneity, and once length is handled the asymmetry disappears under every encoder. On 575,000 Stack Exchange answers the measure reports a post-ChatGPT homogenization of technical sites that the placebo fully reproduces, although answers grew longer. A census of 31 studies locates the risk where anisotropic encoders meet time-series or length-unequal designs. A reverse control on a well-known experiment shows that centering with renormalization can reverse a genuine effect. I propose a low-cost diagnostic protocol. Corrected measures show that the two political camps converged between 2019 and 2022 and stopped converging before ChatGPT. Cross-camp replies engage their targets more closely than same-camp replies.
BibTeX
@misc{liu2026embedding,
  author = {Fengming Liu},
  title = {{Embedding Cosine Measures Text Length Before It Measures Homogenization}},
  year = {2026},
  eprint = {2611.21519},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.21519},
}
Figure