Posterior sampling of word embeddings
Open Access
- 13 October 2026
- journal article
- research article
- Published by Springer Nature in Statistics and Computing
- Vol. 36 (6) , 232
Abstract
We study Bayesian inference for probabilistic word embedding models, including skip-gram with negative sampling (SGNS) and continuous bag-of-words (CBoW). These models are widely used for inference, but their posteriors are non-identifiable under general linear transformations, which prevents meaningful Bayesian uncertainty quantification. We provide a simple and principled identifiability constraint that yields a well-defined posterior without altering the data model. Building on this, we develop scalable, fully Bayesian posterior sampling algorithms for SGNS and CBoW using Pólya–Gamma augmentation. Our block Gibbs samplers yield exact samples from the posterior and scale well to large corpora due to their straightforward parallelisation. We discuss the efficient implementation of the Gibbs sampler, and provide a fast TensorFlow reference implementation. In a combination of simulations and empirical experiments, we demonstrate that the sampler is both accurate and computationally efficient. It matches the accuracy of NUTS-HMC at a fraction of the computational cost and avoids the variance underestimation of mean-field variational inference. On large real datasets, we show that posterior means yield improved predictive performance, while posterior credible intervals provide meaningful uncertainty quantification for semantic similarity.Keywords
Funding Information
- National Academic Infrastructure for Supercomputing in Sweden (NAISS), partially funded by the Swedish Research Council
- Wallenberg AI, Autonomous Systems and Software Program (WASP) funded by the Knut and Alice Wallenberg Foundation.
This publication has 26 references indexed in Scilit:
- Human languages with greater information density have higher communication speed but lower conversation breadthNature Human Behaviour, 2024
- On the identifiability of Bayesian factor analytic modelsStatistics and Computing, 2022
- Political frames of public health crises: Discussing the opioid epidemic in the US CongressSocial Science & Medicine, 2021
- Do External Threats Unite or Divide? Security Crises, Rivalries, and Polarization in American Foreign PolicyInternational Organization, 2021
- A Timely Intervention: Tracking the Changing Meanings of Political Concepts with Word VectorsPolitical Analysis, 2019
- Revisiting Skip-Gram Negative Sampling Model with Rectification2019
- Word embeddings quantify 100 years of gender and ethnic stereotypesProceedings of the National Academy of Sciences of the United States of America, 2018
- Bayesian analysis of static and dynamic factor models: An ex-post approach towards the rotation problemJournal of Econometrics, 2016
- Rotational Uniqueness Conditions Under Oblique Factor Correlation MetricPsychometrika, 2012
- Bayesian Theory1994