Kernelized Bayesian Softmax for Text Generation

Ning Miao, Hao Zhou, Chengqi Zhao, Wenxian Shi, Lei Li

TL;DR

KerBS (Kernelized Bayesian Softmax) improves text generation by replacing the standard "one-vector-per-word" softmax layer with a Bayesian composition of multiple word senses and a learnable kernel. This allows models to better capture polysemy (multiple meanings), account for varying semantic breadths, and remain robust against outliers in context space.

The Softmax Bottleneck

In modern neural text generation tasks—such as machine translation or conversational AI—the final step is almost always a softmax layer. This layer takes a "context vector" (the model's internal state) and compares it to a list of word embeddings using a simple dot product to predict the next word.

The authors argue this standard approach suffers from a "bottleneck" caused by three flawed assumptions:

  1. The Single-Point Assumption: It assumes every word corresponds to exactly one point in space. In reality, a polysemous word like "monitor" can be a noun (a computer screen) or a verb (to observe), meaning it should occupy distinct regions of the embedding space.
  2. The Uniform Variance Assumption: It assumes all words have the same "semantic spread." However, a highly specific word like "car" has a much tighter cluster of contexts than a broad, overarching word like "vehicle."
  3. Lack of Robustness: Standard dot-product similarity is highly sensitive to outliers. A single strange usage of a word can pull its entire embedding away from its primary meaning.

By projecting BERT context vectors into 2D space, the authors empirically proved these flaws. Words like "monitor" clearly form two distinct clusters, while "computer" forms one. Furthermore, "vehicle" covers a much wider area than "car," directly contradicting the uniform variance assumption.

Introducing KerBS

To overcome these limitations, the authors propose KerBS, which introduces two major innovations to the output layer:

1. Bayesian Composition of Senses

Instead of assigning one embedding per word, KerBS represents each word as a weighted combination of multiple "senses." The model calculates the probability of each sense individually and then sums them up to get the final word probability. Because it is difficult to know exactly how many senses a word has (e.g., "the" vs. "bank"), the authors developed an algorithm that dynamically reallocates "sense slots" during training. If a word is being predicted poorly, the model allocates it more senses; if a sense is rarely used, it is reassigned to a more difficult word.

2. Kernelized Embedding Matching

KerBS replaces the standard inner product with a specifically designed kernel function. This function includes a learnable parameter ($\theta$) for each sense that controls its "variance" or "reach" in the embedding space.

This parameter acts as a proxy for semantic breadth. The model successfully learns that broad concepts (like "earth" or "animal") require larger kernels than specific ones (like "Jeep" or "Beijing"). Furthermore, this kernel is mathematically designed to be more robust to high-dimensional outliers than a standard Gaussian distribution.

Key Results

The researchers evaluated KerBS across three distinct text generation tasks: Machine Translation (IWSLT’16 German-to-English), Language Modeling (One-Billion-Word Corpus subset), and Dialog Generation (DailyDialog).

KerBS consistently outperformed both standard Softmax and the previous state-of-the-art "Mixture-of-Softmax" (MoS):

  • Machine Translation: Achieved a BLEU-4 score of 27.28 (Seq2Seq) and 30.90 (Transformer), significantly higher than the baselines.
  • Language Modeling: Reduced Perplexity (PPL) to 102.17, demonstrating better fluency without overfitting.
  • Dialog Generation: Showed a massive jump in BLEU-1 (from 16.56 to 17.85). Human evaluators also preferred KerBS responses, rating them higher for both fluency and relevance.

An ablation study confirmed that removing either the kernel or the multi-sense capability led to a drop in performance, proving that both components are necessary. Simply adding more layers (like MoS) isn't enough if you don't address the underlying geometry of the embedding space; KerBS succeeds by changing how similarity is measured.

Limitations and Future Work

While powerful, KerBS comes with a computational cost. Because it effectively expands the vocabulary by maintaining multiple senses per word, training takes about twice as long per epoch compared to a standard softmax. Additionally, while sense allocation is dynamic, the total number of senses available to the model remains a fixed hyper-parameter that requires tuning.

Future directions suggested by the authors include exploring even more sophisticated kernels and utilizing meta-learning to improve the dynamic reallocation of senses.

Summary updated

BibTeX
@inproceedings{miao2019kernelized,
  author = {Ning Miao and Hao Zhou and Chengqi Zhao and Wenxian Shi and Lei Li},
  title = {{Kernelized Bayesian Softmax for Text Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
}
Figure