attr2vec: Jointly Learning Word and Contextual Attribute Embeddings with Factorization Machines

Fabio Petroni, Vassilis Plachouras, Timothy Nugent, Jochen L. LeidnerNAACL 2018

Abstract

Traditional word embedding models often overlook the rich metadata associated with text, such as grammatical roles or document topics. We present attr2vec, a novel framework that leverages Factorization Machines to jointly learn dense representations for words and their contextual attributes within a single vector space. By modeling the complex interactions between these features, attr2vec produces more expressive embeddings that significantly outperform standard word-only models in downstream tasks like text classification and functional word similarity.

Introduction

Standard embedding techniques, including word2vec and GloVe, primarily rely on local word-word co-occurrence. While powerful, these methods struggle to integrate "contextual attributes"—extra-linguistic or syntactic information like Part-of-Speech (POS) tags, named entities, or overarching document topics. Previous attempts to incorporate such metadata have often been disjointed, failing to represent attributes in the same latent space as words. The attr2vec framework addresses this by using Factorization Machines (FMs) to capture the "cross-interactions" between words and an arbitrary number of contextual variables.

Methodology: Factorization Machines for Embeddings

The core of attr2vec is the application of Factorization Machines to the embedding problem. Unlike the matrix factorization used in GloVe, FMs are specifically designed to handle the high-dimensional, sparse data characteristic of natural language with metadata.

Figure 1: The attr2vec input representation, showing how words and contextual attributes (POS tags, named entities, years, topics) are encoded into a sparse matrix for Factorization Machine processing.

In this framework, every variable—whether a word or an attribute—is assigned a bias term and a latent factor vector. The model optimizes a weighted least squares loss function that calculates a "score" for feature combinations based on the sum of their biases and the dot products of all pairwise latent vectors. This approach allows for flexible context modeling, supporting both standard linear bag-of-words windows and more complex syntactic dependency-based contexts.

Experimental Setup

The models were trained on the Reuters News Archive, comprising approximately 8 million stories and 3 billion tokens. Evaluation focused on two primary areas:

  1. Text Classification: Using the Reuters-21578 dataset for multi-label topic prediction.
  2. Word Similarity: Using WordSim353 to measure the model's ability to capture functional similarity (words sharing roles) versus mere topical relatedness.

Key Results and Discussion

Experimental results demonstrate that joint learning is superior to independent learning. When training word and POS tag embeddings together, attr2vec achieved an F1 score of 85.5% on the Reuters classification task, surpassing a word-only GloVe baseline (82.7%) and a concatenated GloVe+POS model (84.9%).

Figure 6: Precision-Recall curves for the WordSim353 task, comparing the dependency-based attr2vec model (area = 0.74) against the GloVe baseline (area = 0.57).

In similarity tasks, the dependency-based attr2vec model showed a marked improvement in identifying functionally similar words (e.g., "money" and "currency") over topically related ones. As shown in the Precision-Recall analysis, attr2vec significantly outperforms GloVe in capturing these nuanced relationships.

Conclusion

The attr2vec framework demonstrates that contextual attributes act as "magnets" in the vector space, effectively clustering related words and refining the geometry of the latent space. While adding attributes increases computational complexity and requires careful noise management, the resulting joint embeddings provide a richer, more functional representation of language than traditional word-only approaches. Future work will explore broader context types and additional downstream NLP applications.

Summary updated

BibTeX
@inproceedings{petroni2018attr,
  author = {Fabio Petroni and Vassilis Plachouras and Timothy Nugent and Jochen L. Leidner},
  title = {{attr2vec: Jointly Learning Word and Contextual Attribute Embeddings with Factorization Machines}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2018},
  doi = {10.18653/v1/n18-1042},
}
Figure