NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Contextually Propagated Term Weights for Document Representation

Casper Hansen, Christian Hansen, Stephen Alstrup, Jakob Grue Simonsen, Christina LiomaarXiv 2019

This paper, presented by researchers from the University of Copenhagen, introduces Contextually Propagated Term Weights (CPTW), a novel method for document representation that bridges the gap between traditional bag-of-words (BoW) models and modern word embeddings.

TL;DR

CPTW improves document representation by redistributing a word's weight to its semantically similar neighbors in an embedding space. This "semantic propagation" allows simple bag-of-words models to capture contextual meaning, outperforming state-of-the-art methods like Word Mover’s Distance (WMD) in text clustering while remaining computationally efficient.

What Problem Does This Paper Address?

Traditional document representations like TF-IDF or BM25 rely on exact word matches. If one document mentions a "boat" and another mentions a "ship," these models treat them as entirely different entities, failing to capture their shared semantic meaning.

While word embeddings (like word2vec) solve this by mapping similar words to nearby points in a vector space, using them for full documents is tricky. Common approaches like averaging all word vectors in a document often wash out discriminative information. More sophisticated methods, such as Word Mover’s Distance (WMD), are highly accurate but computationally expensive—taking days to process medium-sized datasets. The authors sought a method that is both semantically rich and fast enough for large-scale applications.

Methods

The core idea of CPTW is to take the weight of a word (based on its frequency) and "propagate" it to its neighbors in the embedding space.

  1. Embedded Neighborhood: For every word $w_j$ in a document, the model identifies a neighborhood $N(w_j)$ consisting of words that have a cosine similarity $\ge \tau$ (a tunable threshold) in a pre-trained embedding space.
  2. Weight Redistribution: The weight of word $w_j$ is shared with its neighbors. The amount of weight a neighbor $w_k$ receives is proportional to its similarity to $w_j$.
  3. Normalization: A normalization constant $\alpha_j$ ensures that words with many neighbors don't disproportionately inflate the document's total weight compared to words with few neighbors.
  4. CPTW-IDF: The authors also introduce a variant that incorporates an Inverse Document Frequency (IDF) component, ensuring that common, non-discriminative words (like "the" or "and") don't dominate the representation.

Because the word-to-word similarity matrix can be computed offline, the document representation itself can be generated using efficient sparse vector-matrix multiplications.

Datasets

The authors evaluated their model on seven diverse, publicly available datasets commonly used in information retrieval and NLP:

  • bbcsport: Sports news articles.
  • twitter: Short-form social media posts.
  • classic: Academic abstracts.
  • amazon: Product reviews.
  • reuters: News wire stories.
  • 20news: Usenet newsgroup posts.
  • wiki: Long-form Wikipedia articles.

These datasets vary significantly in document length (from 9 to 475 average unique words) and the number of classes (from 3 to 25).

Key Insights and Ideas

  • Semantic Generalization via Sparsity: Unlike dense vector averaging, CPTW maintains a sparse representation (like BoW) but "blurs" the counts across semantically related terms. This allows the model to recognize that a document about "sailing" is related to one about "cruising" without losing the specific identity of the terms.
  • The Power of the Threshold ($\tau$): The threshold $\tau$ is critical. If it's too low, noise is introduced by including unrelated words; if it's too high, the model reverts to standard BoW. The authors found that the optimal $\tau$ often correlates with the Inter vs Intra Class Ratio (IICR)—a measure of how distinct classes are in the vector space.
  • Efficiency Matters: The authors highlight a major bottleneck in current research: WMD was so slow that they had to stop experiments on the 20news and wiki datasets after 5 days of computation. CPTW provides a high-performance alternative that scales.

Key Results

The authors compared CPTW and CPTW-IDF against 8 baselines, including TF-IDF, LDA, and SIF (Smooth Inverse Frequency).

  • Top Performance: CPTW-IDF achieved the best average Micro and Macro F1 scores across all datasets.
  • Clustering Accuracy: On the bbcsport dataset, CPTW-IDF reached a Micro F1 of .985, outperforming WMD (.976) and TF-IDF (.986).
  • Robustness: The model performed consistently well across different document lengths. While LDA performed well on long Wikipedia articles, it struggled on short tweets; CPTW-IDF remained a top performer on both.

The influence of the threshold $\tau$ on the IICR (classification difficulty) is illustrated in the following figures for different datasets:

IICR vs Tau for Reuters IICR vs Tau for Twitter IICR vs Tau for BBCSport

Limitations and Future Work

  • Single Threshold: The current model uses a single global threshold $\tau$ for all words. The authors suggest that using multiple or per-word similarity thresholds might further improve discriminative power.
  • Pre-trained Dependencies: The quality of CPTW is inherently tied to the quality of the underlying word embeddings.
  • Future Directions: The researchers aim to explore how this propagation method might be applied to other structural similarities beyond just cosine similarity in embedding space.

Summary updated

BibTeX
@misc{hansen2019contextually,
  author = {Casper Hansen and Christian Hansen and Stephen Alstrup and Jakob Grue Simonsen and Christina Lioma},
  title = {{Contextually Propagated Term Weights for Document Representation}},
  year = {2019},
  eprint = {1906.00674},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1906.00674},
}
Figure