Elamur Research

RegaVAE: A Retrieval-Augmented Gaussian Mixture Variational Auto-Encoder for Language Modeling

Paper · 2023 · Jingcheng Deng, Liang Pang, Huawei Shen et al.

Summary

A passage can look like a good match for the beginning of a text and still offer little help with what comes next. RegaVAE addresses that problem by changing both what a text generator searches for and how it uses what it finds. The authors train an encoder to represent source passages in a space shaped by the task of predicting their continuations. They search that space for useful neighbors, then give the generator a probability distribution that combines the source with the retrieved neighbors. The work belongs to the field of retrieval-augmented generation.

A variational autoencoder, or VAE, makes this approach possible. It represents a passage through a latent variable, an internal numerical representation whose distribution is learned during training. The authors first use source and target texts to establish a space in which those variables are useful for generation. The retrieval database then stores representations in that same space. At generation time, the source supplies the query, so the system can search for passages with potentially useful continuations before it knows the continuation it will write. The retrieved representations become components of a Gaussian mixture, alongside a component for the source. This gives the generator access to several plausible regions of the latent space without using the retrieved passages as extra text in its input.

The authors evaluate RegaVAE on Yelp, Yahoo, and WritingPrompts. It records the lowest reported test perplexity on Yelp and Yahoo, at 8.62 and 6.99, respectively, and leads the reported comparisons on both datasets' automatic diversity measures. On WritingPrompts, its BERTScore is 84.31, the highest reported, while several baselines score higher on ROUGE-1. In a separate Yelp experiment, RegaVAE leads on most of the automated indicators of possible hallucination. Human evaluators give it the highest average scores for fluency, diversity, and the favorable end of the hallucination rating, while DELLA leads on coherence.

The Yelp ablation gives a direct indication of why the representation matters. Removing the VAE makes perplexity worse, and within that altered setup, adding retrieval gives worse perplexity than leaving retrieval out. A separate neighbor-count experiment finds lower perplexity as the search expands over the tested range on all three datasets. Together, the comparisons support retrieval in the learned space as a useful part of this design. The hallucination results concern the specific evaluation on Yelp, and the authors also report that the underlying VAE remains sensitive to a training failure in which the decoder learns to ignore its latent input.

Deep dive: RegaVAE: A Retrieval-Augmented Gaussian Mixture Variational Auto-Encoder for Language Modeling

RegaVAE retrieves text using representations shaped by likely continuations, then combines the results in a Gaussian mixture to guide generation. · about 35 minutes to read

The problem and its context

A similar passage can lead somewhere different

The paper starts from a practical difficulty in text generation. A generator can draw on patterns acquired during training, but some of the information it needs may be time-sensitive or difficult to reproduce faithfully from its parameters. The authors describe retrieval as a way to make additional information available at the time of generation. A retriever searches a collection for material relevant to the source, and the generator can use the result when composing the target. The paper presents this as a possible response to difficulties with outdated information and factual hallucination.

The search needs a criterion for relevance. Suppose the source is the beginning of a scene. A passage with a similar setting or cast of characters might make a convincing match to that beginning. Its continuation can still develop the scene in an unrelated direction. For a generator, the value of the match depends in part on the relationship between the source and what could follow it. A ranking that rewards resemblance between beginnings can therefore put plausible-looking but unhelpful candidates near the top. The paper's concern is how to make the retrieval score reflect the demands of generation.

The distinction is easier to see by assigning each part of retrieval a separate role. The query represents what the system is looking for. A key is the representation against which the query is compared. A value is the information the system receives when the corresponding key is selected. The key and value can come from the same material, or the value can contain information that the key leaves out. The choice determines what can affect the search score and what only becomes available after the search.

The authors discuss methods that use a passage for both its key and its value. This makes the information returned by a successful search similar to the information that the query already expresses. A method can instead attach a later span to the value. In that case the generator can see what followed the retrieved passage, but selection is still guided by whatever the key represents. The continuation can be useful by chance or because resemblance between beginnings tends to carry over. The search has limited means to prefer one continuation over another when their keys look equally promising.

RETRO provides the paper's main example of this arrangement. It puts a continuation on the value side so that information about succeeding text is available to the generator. RegaVAE asks whether information about succeeding text can also shape the query and the key. Its proposal depends on learning a representation from examples of sources and continuations. During generation, the query can then carry expectations acquired during training. The actual held-out target remains unknown. The earlier retrieval design is described in the work introducing RETRO.

The paper also discusses KNN-LM. Its retrieved value supplies the next token associated with a matching context. This demonstrates another way to make future information available after a search. In the authors' account, the relationship used to choose a neighbor is still computed from the query and the key, leaving the token supplied as the value outside that comparison. The contrast between a next token and a longer continuation also helps explain why RegaVAE treats future information as something to represent in a latent space. The design is meant to preserve clues useful for prediction without assigning a fixed length to the retrieved wording that the generator can use.

How retrieved material reaches the generator

The paper's other question concerns aggregation, the operation that combines retrieved information with the original input. The authors call an approach explicit when it includes retrieved wording in the augmented text fed into generation. They discuss RAG and REALM as examples in their related-work account. They also describe EPR, where the material being retrieved consists of prompts, and Re2G, which improves retrieval by combining retrieval methods. These examples show that systems can change the source of the retrieved material and the way it is selected before addressing how to fit that material into the generator.

The immediate issue with explicit aggregation is that input space is finite. Including a passage consumes part of that space, and some of its sentences may have little relevance to the requested continuation. Retrieving more passages can therefore turn into a choice about which wording to keep. The authors also emphasize noise. A passage may contain a useful fragment alongside details the generator has no reason to follow. Appending the entire text makes all of that material available at once.

Implicit aggregation gives the generator a numerical representation or a distribution. The authors describe FiD as retrieving candidate passages, encoding them together with the source, and making the result available to the generator in vector form. EMDR2 likewise works with retrieved material in a generator and trains its retriever and generator together. In the account given in the paper, neither design explicitly represents future content across the query, key, and value in the way RegaVAE proposes. The category of implicit aggregation is broad enough to include several quite different ways of representing and combining candidates.

A vector can summarize a passage compactly, but compactness alone places few demands on the geometry of the space. If a pair of vectors scores highly under a similarity measure, the retrieval stage treats them as neighbors. The generator then needs that neighborhood to correspond to information it can use. The authors argue that an irregular space can make this assumption unreliable. Their design uses a VAE to organize the space before search and tries to preserve that organization as the retrieval and generation stages are trained together.

This leaves a pair of linked questions. The first is whether generation-trained representations yield more useful matches than retrieval representations designed around the source alone. The second is whether distributions associated with those matches can be combined in a way that preserves useful alternatives. RegaVAE answers both with the same latent space. The training setup teaches that space through source and target text, and the aggregation step represents the retrieved candidates as components of a probability distribution. The paper's experiments assess the assembled design, then alter parts of it to see which changes matter.

The method, step by step

Establishing a space for retrieval and generation

RegaVAE begins with paired text. A source is the part available to the system when it must generate, and a target is the part it is asked to produce. A WritingPrompts item makes the roles tangible. The prompt establishes a situation, and the target provides an example of a continuation. A representation learned solely to identify similar prompts can prioritize the wording or subject of the situation. A representation learned through the task of producing the continuation receives a training signal about which information is useful beyond the prompt.

The authors use an encoder to turn text into a distribution over latent vectors. A vector sampled from that distribution is an internal description the decoder can use. The decoder assigns probabilities to possible output text using that description. During training, the observed text supplies a way to judge whether the description retained information that helps the decoder. A VAE also regularizes the distribution so that each training example has some relationship to a common reference distribution, called the prior.

The paper presents the ordinary VAE objective before explaining its conditional application. In the ordinary formulation, the same observed text appears on the encoding and reconstruction sides. RegaVAE's motivating task starts with the source and asks the decoder to predict the target. The authors use that predictive setting to explain why the learned representation can carry information about a possible continuation. In particular, future information in a query means information learned from source–target relationships. The query for a new prompt is formed from the available source.

The authors initialize this space with DELLA, the VAE-based system from which they also take a technique for injecting latent information into the decoder. They use the training material for this phase. Once the space has been initialized, they encode the searchable training material and construct a similarity index. The vectors in the index act as both the keys used to find neighbors and the values used to construct the distribution for generation. The encoder has the same role across these stages, so the index and the query are built using a common representation.

How RegaVAE trains, retrieves, and generates

The steps in order.

How RegaVAE trains, retrieves, and generatesStep 1: Train the VAE on source and target text1. Train the VAE on source and target textStep 2: Encode training passages for the search index2. Encode training passages for the search indexStep 3: Encode the input source as a query3. Encode the input source as a queryStep 4: Retrieve neighbors by latent cosine similarity4. Retrieve neighbors by latent cosine similarityStep 5: Weight the source and retrieved Gaussian components5. Weight the source and retrieved Gaussian componentsStep 6: Condition the decoder on the latent mixture6. Condition the decoder on the latent mixtureStep 7: Refresh the search index periodically during training7. Refresh the search index periodically during training

From retrieved documents to latent distributions

A conventional source-to-target mapping can be written as follows.

y = f(x)

Here, x is the source text, y is the target output, and f denotes the function used to produce the output. This expression describes the relationship at the level of inputs and outputs, leaving the generator's internal operations unspecified.

Adding retrieval changes the inputs to that mapping.

y = f(x, r)

Here, r is material retrieved for source x, and f is the generation function that uses both x and r to produce y. The paper describes a retriever R that searches a collection S using a retrieval measure D. A generator G then uses the source and the retrieved material through an integration procedure I. These symbols describe the general architecture. RegaVAE realizes the integration through a latent probability distribution.

The authors also express retrieval-augmented generation as a probability calculation over candidates.

p(y | x) = ∑ᵣ∈topₖ(p(· | x)) p(y | x, r) p(r | x)

Here, p(y | x) is the probability of target y given source x. The vertical bar marks conditioning. The term p(y | x, r) is the generator's probability for y when x and candidate r are available, and p(r | x) gives that candidate's retrieval weight in the probabilistic description. The centered dot stands for the candidate argument of the retrieval distribution. The operator topₖ selects the k highest-ranked candidates, and the sum combines the contributions of candidates in that set. The expression supplies the motivation for the latent mixture. It describes how predictions can take account of alternatives and the relative support for each.

A Gaussian component has a center and a spread. The center locates a typical latent vector for the corresponding text. The spread describes variation around that location. In RegaVAE, the source contributes a component of its own, and each retrieved item supplies another. A weight determines how much a component contributes to the mixture. The components can place probability in different regions, so the mixture can keep several plausible directions for generation in play. This is the reason the authors use a mixture of distributions in their formal account of aggregation.

A decoder working with such latent information needs a reason to pay attention to it. An expressive decoder can learn to predict text from the signals it already receives and mostly disregard the latent variable. This behavior is known as posterior collapse. If it occurs, the encoder can produce a distribution that is close to the prior for many inputs, while the decoder receives little useful information about the particular text through that route. A search in the resulting space would then be of limited use for generation. RegaVAE inherits a mechanism from DELLA to expose the latent variable within the decoder's layers, and the training setup also uses KL annealing.

Learning the underlying VAE

The ordinary VAE objective in the paper is the evidence lower bound, or ELBO. The evidence is the probability assigned to the observed text after accounting for the unobserved latent variable. The lower bound gives a quantity that can be optimized using an encoder distribution.

log p(x) ≥ L_ELBO = E[qϕ(z | x)]{log pθ(x | z)} − KL(qϕ(z | x) ∥ p(z))

In this formula, x is the observed text and z is its latent variable. The function log takes the logarithm, and p(x) is the probability of the observed text under the generative construction. L_ELBO is the bound. The notation E[qϕ(z | x)] means an expectation over z drawn according to qϕ(z | x), the encoder's approximation to the posterior p(z | x). The symbol ϕ denotes encoder parameters. The term pθ(x | z) is the decoder's probability for x given z, with θ denoting decoder parameters. The prior p(z) is the reference distribution for the latent variable before a text is observed. KL denotes Kullback–Leibler divergence, with the two distributions it compares separated by ∥. The inequality states that the expression on the right is a lower bound on the log probability.

The expected log probability rewards an encoder and decoder that work together to explain the observed text. The divergence subtracts a cost when the encoder assigns a distribution far from the prior. These demands encourage a representation that is specific enough to support prediction and regular enough to share a space with other inputs. Optimizing the bound establishes the representation used to start retrieval. It does not on its own determine which neighbors will be useful, since that depends on what the decoder can do with the indexed representations and how the representations are ranked.

To improve the connection between latent variables and the decoder, the paper uses the following layer operation from DELLA.

ṽᵢ⁽ˡ⁾ = (∑ⱼ₌₁ʳ Wᵥ⁽ˡ˒ʲ⁾ vᵢ⁽ˡ⁾) ◦ (∑ⱼ₌₁ʳ W_z⁽ˡ˒ʲ⁾ zₗ)

Here, l identifies a decoder layer, i identifies a token position, and j indexes terms in a low-rank construction controlled by the hyper-parameter r. The vector vᵢ⁽ˡ⁾ is the hidden representation for token i in layer l, and zₗ is the latent variable used in that layer. The trainable projections Wᵥ⁽ˡ˒ʲ⁾ and W_z⁽ˡ˒ʲ⁾ operate on the hidden and latent vectors, respectively. Their parameters are shared across token positions within a layer and differ across layers. Each sum runs over the rank terms, and ◦ multiplies the resulting vectors element by element. The vector ṽᵢ⁽ˡ⁾ is the resulting representation at that token position. The r in this layer equation is distinct from the retrieved document denoted by r in the earlier mapping.

Elementwise multiplication makes the output depend on the latent vector and on the token representation simultaneously. A single latent input can therefore affect different token positions through their different hidden vectors, even though the learned projections are shared across positions. This gives the latent representation an entry point within the decoder rather than relying on its influence at a single boundary. The paper pairs the layer operation with annealing, which changes the influence of the KL term during training to mitigate its disappearance. It leaves the precise annealing schedule unspecified in its experiment settings.

Searching and weighting the index

After initialization, the encoder maps the source to a query vector and each searchable passage to a representation stored in the index. The paper writes the similarity as cosine similarity. This compares the directions of the vectors, so a large vector norm alone does not make a candidate a better match. The prose also refers to an inner product. Cosine similarity is an inner product on normalized vectors, and the equation specifies cosine as the score used in the formulation. This is the paper's operational measure of semantic similarity.

D(zˣ, zᵣⁱ) = cos(zˣ, zᵣⁱ)

Here, D is the retrieval score, zˣ is the latent representation for source x, and zᵣⁱ is the representation of retrieval candidate i. The superscripts mark the source and the candidate position. The function cos computes cosine similarity between the two representations.

The paper describes each retrieved candidate with a Gaussian.

zᵣⁱ ∼ N(μᵢ, σᵢ²)

Here, ∼ means that the latent vector zᵣⁱ is distributed according to N, the Gaussian distribution. The parameter μᵢ is the mean for candidate i, σᵢ is its standard deviation in the notation, and σᵢ² is the corresponding variance term. The candidate represents one neighborhood in the shared space and also supplies the component used if that candidate is retrieved.

The encoder keeps changing during the retrieval-augmented training phase. That creates a practical issue for the index. A candidate encoded at an earlier stage may have a somewhat different position from the one it would occupy under the current encoder. Recomputing the index after every parameter update would require continually re-encoding the searchable collection. The authors instead rebuild it at intervals determined by training steps, following the precedent they describe for REALM. The search then uses a fixed index between refreshes. The paper describes the interval as fixed without specifying its length in the training settings.

The weights are constructed from the similarity scores with a softmax.

wᵢ = softmaxᵢ(D(zˣ, zᵣⁱ))

Here, wᵢ is the weight associated with retrieved component i, D is the cosine score, and zˣ and zᵣⁱ are the query and candidate representations. The notation softmaxᵢ indicates the entry for candidate i in a normalization over the scores. Softmax gives greater weight to a higher score and makes the entries of the normalized set sum to one. The mixture also contains a source component with weight w₀. The paper requires the full set of weights, including the source weight, to sum to one. Its displayed weight rule gives the retrieved score and leaves the separate construction of the source weight implicit.

Building an objective for the mixture

The paper introduces the retrieval-augmented objective by treating x as the text available to the encoder and y as the target whose probability the generator should explain. It uses latent contributions zʳ from retrieval and zˣ from the source. The probability of y averages over those latent contributions.

log p(y) = log ∬ p(y, zʳ, zˣ) dzʳ dzˣ

Here, p(y) is the target's marginal probability, and p(y, zʳ, zˣ) is the joint probability density for the target y and the retrieval and source latent variables. The double integral averages over the respective latent spaces, with dzʳ and dzˣ denoting integration over each variable. The function log is applied to the resulting marginal probability.

The authors use a variational distribution to obtain a lower bound. The inequality is the usual direction for the logarithm, with the log of an expectation at least as large as the expectation of the log.

log p(y) ≥ E[q(zʳ, zˣ | x)]{log[p(y, zʳ, zˣ) / q(zʳ, zˣ | x)]}

Here, q(zʳ, zˣ | x) is the variational distribution given the source x, and E takes the expectation under that distribution. The ratio inside log compares the joint density of the target and latent variables with the density used to average over the latent variables. The denominator allows the joint to be averaged using the variational distribution. Jensen's inequality supplies the lower-bound step.

The joint density separates into a term for the target and a term for the latent variables.

p(y, zʳ, zˣ) = p(y | zʳ, zˣ) p(zʳ, zˣ)

Here, the first factor on the right is the probability of y given retrieval latent zʳ and source latent zˣ. The second factor is the prior density for the latent variables. Multiplying them gives the joint density on the left.

Separating the logarithm of the product yields a reconstruction term and a divergence term. The expectation introduced by the derivation is under the source-conditioned distribution. The paper's displayed objective labels the expectation with y while retaining x in the divergence, and it repeats those labels in the final objective. The displayed form is as follows.

L_ELBO = E[q(zʳ, zˣ | y)]{log p(y | zʳ, zˣ)} − KL(q(zʳ, zˣ | x) ∥ p(zʳ, zˣ))

Here, L_ELBO labels the retrieval-augmented bound. The term inside the expectation rewards latent information that gives the decoder high probability for the target y. The notation q(zʳ, zˣ | y) explicitly conditions that expectation on y as written in the objective, whereas the preceding bound uses q(zʳ, zˣ | x). In the divergence, q is the variational distribution conditioned on source x, and p(zʳ, zˣ) is the prior. The difference in the conditioning labels matters for a precise reading of the equations. The paper's description of search consistently generates the query from the source.

The variational distribution is built as a mixture.

q(zʳ, zˣ | x) = w₀ q(zˣ | x) + ∑ᵢ₌₁ⁿ wᵢ q(zᵣⁱ | x)

Here, the expression on the left names the aggregated variational distribution. On the right, q(zˣ | x) is the source component and q(zᵣⁱ | x) is the component associated with retrieved candidate i in the notation of the paper. The weight w₀ belongs to the source, wᵢ belongs to candidate i, and n is the number of retrieved items included in the sum. The plus sign and summation combine weighted component densities. The components operate in a shared latent space. The expression uses the source and retrieval variables to label the contributions to that mixture.

The paper pairs this variational mixture with a prior mixture.

p(zʳ, zˣ) = ŵ₀ p(zˣ) + ∑ᵢ₌₁ⁿ ŵᵢ p(zᵣⁱ)

Here, p(zʳ, zˣ) denotes the prior used in the divergence term, p(zˣ) is its source component, and p(zᵣⁱ) is its component associated with candidate i. The weights ŵ₀ and ŵᵢ belong to the prior, and the sum runs over n retrieved components. The paper gives the individual reference components standard Gaussian distributions.

Bounding the divergence and training on it

The return to a mixture makes the regularization term harder to evaluate. The divergence between mixtures involves logarithms of sums of densities, so the divergence of a pair of mixture distributions does not reduce directly to a sum of the divergences of their Gaussian components. The authors instead optimize using an upper bound. The bound compares the mixture weights with each other and pairs the component densities by index.

p = ∑ᵢ₌₁ⁿ πᵢ gᵢ,   p̂ = ∑ᵢ₌₁ⁿ π̂ᵢ ĝᵢ

Here, p and p̂ stand for any pair of mixtures with corresponding components indexed by i. The number n counts the components in this general comparison. The densities gᵢ and ĝᵢ are the corresponding components, and πᵢ and π̂ᵢ are their weights in the respective mixtures. In the application to RegaVAE, one of the corresponding pairs is the source component.

The bound used in the paper is as follows.

KL(p ∥ p̂) ≤ KL(π ∥ π̂) + ∑ᵢ₌₁ⁿ πᵢ KL(gᵢ ∥ ĝᵢ)

Here, KL(p ∥ p̂) is the divergence between the full mixtures. The vectors π and π̂ collect the component weights, so KL(π ∥ π̂) measures the divergence between the two distributions over component identities. Each KL(gᵢ ∥ ĝᵢ) compares the paired component densities, and πᵢ weights that comparison. The inequality gives a quantity at least as large as the mixture divergence. Its derivation compares the densities component by component before averaging, which accounts for both the weight and density comparisons.

For RegaVAE, the authors express the resulting upper bound with a contribution from the weights, a Gaussian divergence for the source, and a constant for terms they treat as independent of the parameter update.

KL(q(zʳ, zˣ | x) ∥ p(zʳ, zˣ)) ≤ ∑ᵢ₌₀ⁿ KL(wᵢ ∥ ŵᵢ) + KL(q(zˣ | x) ∥ N(0, I)) + C

Here, q and p are the variational and prior mixtures, and x is the source. The sum starts at the source entry i equal to 0 and includes all n retrieval entries. The paper uses KL(wᵢ ∥ ŵᵢ) in this sum to denote the contribution from comparing mixture weights. The preceding general bound writes the weight contribution as a divergence between the full weight distributions. The second divergence compares the source component q(zˣ | x) with a standard Gaussian N having mean 0 and identity covariance I. The symbol C collects contributions that the paper treats as constant for parameter updates.

For its final simplification, the paper treats the retrieval weights as fixed within the periodic index update setup.

KL(q(zʳ, zˣ | x) ∥ p(zʳ, zˣ)) ≤ KL(q(zˣ | x) ∥ N(0, 1)) + C

Here, the left side is again the divergence between the mixtures. On the right, q(zˣ | x) is the source distribution and N(0, 1) is the paper's shorthand for its standard Gaussian reference, with zero mean and unit variance. The constant C represents terms treated as independent of the updates. Replacing the mixture divergence with an upper bound gives a conservative objective because the divergence is subtracted from the expected decoder score.

The final expression drops the additive constant.

L = E[q(zʳ, zˣ | y)]{log p(y | zʳ, zˣ)} − KL(q(zˣ | x) ∥ N(0, 1))

Here, L is the objective optimized in the paper. The expected log probability measures how well the decoder explains y with latent information from retrieval and source. Its expectation carries the target-conditioned label q(zʳ, zˣ | y) printed in the paper. The remaining penalty regularizes the source-conditioned component q(zˣ | x) toward the standard Gaussian. Retrieval still affects the information used to predict the target. The simplification concerns the penalty needed for training, so the objective can use retrieved components even when it omits a separate trainable divergence for each of them.

The training setup

RegaVAE uses GPT2 as the backbone, a latent dimension of 32, and a fixed learning rate of 5×10⁻⁵. The authors train the initial DELLA system for 10 epochs to establish the VAE space. They then train RegaVAE for approximately fifteen epochs, by which point they report convergence. The construction of the mixture, the injection of latent information into the decoder, and KL annealing address different parts of training. The mixture controls how retrieved information is represented. The layer operation gives the decoder access to it. Annealing addresses the pressure towards a latent representation that carries too little about the input.

The authors precompute embeddings of training documents for fast similarity search and use FAISS to index them. In the retrieval-augmented phase, a source is encoded, its top-ranked neighbors are found, and the source and retrieved distributions are combined for the decoder. The database is refreshed intermittently as training changes the encoder. Since the training set also supplies the retrieval corpus, the procedure uses material from the same data source for training and for indexed retrieval. The authors released the RegaVAE implementation.

Experiments and results

Data, comparisons, and measures

The generation experiments use Yelp, Yahoo, and WritingPrompts. For Yelp and Yahoo, the authors sample 100,000 training instances from each dataset, following the comparison setup used in earlier VAE work and citing computing constraints. The retrieval experiments use training-set material as the search collection. This choice makes the comparison about how the systems use retrieval within the training data available to them. WritingPrompts adds a task in which systems generate continuations from story prompts and can be evaluated against reference text.

The paper compares RegaVAE with methods built around a VAE and with methods built around retrieval. The VAE comparisons include DELLA, the source of RegaVAE's initialization procedure and layer-wise use of latent input. Embed, Memory, and Softmax provide other comparisons using the same pretrained backbone as RegaVAE. Optimus and ADAVAE expand the VAE comparison. The Optimus entries come from its original paper at λ = 0.5. GPT2 supplies a reference without the RegaVAE retrieval and latent mixture machinery.

RAG, FiD, and RETRO are the main retrieval comparisons. In the paper's classification they cover explicit aggregation, implicit aggregation without the future-aware representation proposed by the authors, and implicit aggregation that attaches future material to the retrieved value. The authors reproduce these systems at the same parameter size for their comparison. KNN-LM uses training data as its retrieval corpus and has reported perplexity entries on Yelp and Yahoo. The baseline groups help answer whether the combined approach improves over an established VAE design and whether it competes with other ways to retrieve and incorporate text.

Perplexity, abbreviated PPL, measures the probability assigned to the evaluation text. Lower perplexity means the system assigns higher probability to the observed text under the evaluation. This measures a predictive property. Diversity metrics address a different question about what the system actually produces when generating text. Self-BLEU treats generated texts as reference material for other generated texts, so high overlap among outputs gives higher Self-BLEU. The paper favors lower Self-BLEU for diversity. Its other diversity measure, Dist2, rewards variety in adjacent word pairs and is better when higher. Self-BLEU uses the overlap measure known as BLEU.

The Yelp and Yahoo table also reports AU, or activation units, for the VAE systems. This measures the dimensions of the latent representation judged active according to the threshold used in the evaluation. The threshold is 0.2. The measure speaks to the concern about posterior collapse. If the learned distributions change very little across inputs, few dimensions will register as active. A higher AU result is evidence of more use of the latent representation under the criterion, alongside the separate question of whether the resulting text improves.

WritingPrompts has additional metrics that compare generated text with reference text. BLEU scores overlap with the reference, while ROUGE-1 emphasizes individual word overlap and ROUGE-2 emphasizes overlap in consecutive word pairs. ROUGE-L uses the longest common subsequence, so it can reflect word order even when matching words are separated. BERTScore compares representations of words in the generated and reference texts, giving it a different basis for judging resemblance from exact string overlap. The paper reports these measures alongside diversity scores, allowing a system to do well on reference similarity while also varying its generated outputs.

Yelp and Yahoo generation

The Yelp perplexity results place RegaVAE ahead of both comparison groups. Its Yelp test perplexity is 8.62, while DELLA records 12.35 and FiD records 14.08. ADAVAE at 15.49 also beats several retrieval comparisons, illustrating that the presence of a retriever is only part of what determines the result. Among the reproduced retrieval systems, FiD has the lowest Yelp perplexity. The comparison therefore covers retrieval systems with substantially different standings under the same predictive metric.

Test perplexity on Yelp across generation systems

RegaVAE has lower perplexity than the VAE and retrieval baselines shown.

Test perplexity on Yelp across generation systemsGPT2: 22.13GPT222.13RAG: 20.68RAG20.68RETRO: 16.53RETRO16.53ADAVAE: 15.49ADAVAE15.49FiD: 14.08FiD14.08DELLA: 12.35DELLA12.35RegaVAE (this paper): 8.62RegaVAE (this paper)8.62
The numbers
System or settingperplexity
GPT222.13
RAG20.68
RETRO16.53
ADAVAE15.49
FiD14.08
DELLA12.35
RegaVAE (this paper)8.62

The diversity results on Yelp favor RegaVAE as well. Its Self-BLEU is 36.10, compared with 42.26 for FiD, 46.65 for RETRO, and 60.02 for DELLA. RegaVAE's Yelp Dist2 is 28.83. RAG reaches 28.16 on Yelp Dist2 even though its Self-BLEU is 58.53. The relative performance of RAG on these measures shows why the paper reports both. Variety in adjacent word pairs and overlap across complete generated texts capture different properties of the output.

On Yahoo, RegaVAE's test perplexity is 6.99. DELLA records 11.49, RETRO records 13.27, and ADAVAE records 14.23. FiD, the lowest-perplexity retrieval baseline on Yelp, has Yahoo perplexity of 14.71. The ordering within the retrieval comparison can therefore change with the dataset, while RegaVAE leads on both. GPT2 has Yahoo perplexity of 24.17 and KNN-LM has 62.30 in the reported comparison. These results concern the corpus and training setup used in the paper.

The Yahoo diversity scores show the same direction of advantage for RegaVAE. It reports 30.74 Self-BLEU and 33.03 Dist2. RETRO has 38.64 Self-BLEU and 28.83 Dist2, and FiD has 42.84 Self-BLEU and 26.49 Dist2. DELLA's Yahoo results are 48.53 Self-BLEU and 21.88 Dist2. The comparisons are consistent across the two automatic diversity measures for RegaVAE. They leave room for differences in how readers judge the resulting text, which the paper explores separately on Yelp.

RegaVAE registers 52 active units on Yelp and 56 on Yahoo. DELLA registers 23 and 21, respectively, on those datasets. The authors read the larger AU counts alongside the perplexity and diversity gains as evidence that the retrieval and aggregation procedure makes the latent information more relevant to generation. AU measures activity under the chosen threshold. Its relationship to generation quality is supported here by the other results and by the component comparisons, rather than established by the count on its own.

WritingPrompts continuations

The WritingPrompts comparisons include GPT2, Embed, Memory, and Softmax entries taken from the DELLA paper. DELLA supplies the closest baseline for the architecture. RegaVAE attains WritingPrompts test perplexity of 1.18, and DELLA has 2.16. RegaVAE also leads on the diversity indicators, with Self-BLEU of 52.70 and Dist2 of 23.28. GPT2 is close on those two measures, at 53.78 Self-BLEU and 22.99 Dist2, while DELLA records 56.28 Self-BLEU and 20.91 Dist2.

The reference-based metrics give a varied account of the continuations. RegaVAE reaches WritingPrompts BLEU of 43.83, compared with 41.39 for DELLA and 41.04 for Softmax. Its ROUGE-2 is 9.62 and its ROUGE-L is 30.57, both the highest reported. DELLA reaches 8.78 on ROUGE-2 and 17.20 on ROUGE-L. RegaVAE's BERTScore also leads the comparison. The breadth of those measures matters in a continuation task, where the generated text can resemble the reference in different ways.

BERTScore for generated continuations on WritingPrompts

RegaVAE leads the reported comparisons on similarity to the reference under BERTScore.

BERTScore for generated continuations on WritingPromptsGPT2: 78.12GPT278.12Embed: 81.64Embed81.64Memory: 81.68Memory81.68Softmax: 81.75Softmax81.75DELLA: 81.77DELLA81.77RegaVAE (this paper): 84.31RegaVAE (this paper)84.31
The numbers
System or settingBERTScore
GPT278.12
Embed81.64
Memory81.68
Softmax81.75
DELLA81.77
RegaVAE (this paper)84.31

ROUGE-1 is the exception to the pattern across the reference metrics. RegaVAE's WritingPrompts ROUGE-1 is 32.21, compared with 36.17 for Embed, 36.13 for Memory, and 36.14 for Softmax. DELLA scores 35.46. The measure rewards overlap at the level of individual words, whereas the other metrics count different forms of correspondence. The paper's results support a gain across several aspects of similarity and diversity, with reduced unigram overlap relative to several of the VAE-based comparisons.

Automated and human evaluation on Yelp

The paper uses SelfCheckGPT to assess possible hallucinations in the Yelp outputs. For that evaluation, the authors generate text three times from the same latent variable and provide the samples to the evaluator. Fixing the latent variable gives the samples a common starting representation, while sampling allows the resulting texts to vary. SelfCheckGPT supplies four scores, labeled S_BERT, S_QA, S_an, and S_mn. The paper reads higher values as indications of a greater likelihood of hallucination.

On Yelp, RegaVAE scores 37.82 on S_QA, 4.42 on S_an, and 4.89 on S_mn, the lowest values in those columns. FiD has the nearest S_QA result at 37.99. RETRO has the nearest S_an result at 4.89, and DELLA has the nearest S_mn result at 5.30. On S_BERT, RETRO has the lowest value, 7.94. RegaVAE follows at 8.01. The results thus favor RegaVAE on most indicators, with the relative order depending on which indicator is used. Each score describes behavior under the sample-based evaluation on Yelp.

The human evaluation uses a random selection of 50 Yelp test samples. Five professionals score outputs for fluency, coherence, diversity, and hallucination. The scale goes from 1, the lowest assessment, to 5, the highest. The table treats the higher hallucination rating as the favorable outcome, unlike the direction of the automated hallucination scores. The paper reports averages across the ratings. This setup allows readers to assess properties such as coherence that can be hard to infer from overlap scores.

RegaVAE has the highest human fluency mean at 3.78, while DELLA has 3.67 and FiD has 3.64. RegaVAE's 3.47 leads on diversity, with RETRO at 3.32. On the human hallucination rating, RegaVAE scores 4.11, compared with 4.01 for RETRO and 3.99 for RAG. Coherence is the exception. DELLA leads at 3.31 and RegaVAE follows at 3.21. The human results therefore distinguish ease of reading and variety from how well a text hangs together as a whole.

The authors also compare the human ratings with the automatic generation measures using Pearson correlation. The correlations are calculated using the results of the systems in the human evaluation. The table takes the absolute values and scales them by one hundred, so the displayed entries give the magnitude and leave out the sign. Perplexity has a displayed correlation of 94 with fluency, with a p-value of 0.02, and 86 with coherence, with a p-value of 0.07. The latter is a large displayed magnitude alongside a larger p-value.

The remaining reported relationships carry greater uncertainty in this comparison. For human diversity, the displayed correlation is 66 with Self-BLEU, with a p-value of 0.23, and 67 with Dist2, with a p-value of 0.21. For the human hallucination rating, the displayed correlation with Dist2 is 58, with a p-value of 0.30. The results offer a check on how automatic scores and human judgments move across the systems evaluated. The design gives each correlation a small collection of system-level observations, so the table is most informative as a description of this evaluation.

What the ablations show

Retrieval depends on the representation

The Yelp ablation compares the full system with altered versions of the aggregation procedure and with other retrieval methods. Removing the VAE space leaves a system that still attempts to use retrieval. Removing both the space and retrieval provides a comparison for what retrieval contributes in that altered architecture. The paper also starts from a RegaVAE base without its original retrieval and equips it with either BM25 or DPR. BM25 is the term-based retrieval alternative in the study, and DPR is the dense passage retriever.

Yelp test perplexity when retrieval or the VAE space changes

RegaVAE leads the tested variants, and retrieval without the VAE space has the highest perplexity.

Yelp test perplexity when retrieval or the VAE space changesWithout VAE: 20.13Without VAE20.13Without VAE and retrieval: 17.95Without VAE and retrieval17.95Base with BM25: 13.49Base with BM2513.49Base with DPR: 12.58Base with DPR12.58RegaVAE (this paper): 8.62RegaVAE (this paper)8.62
The numbers
System or settingperplexity
Without VAE20.13
Without VAE and retrieval17.95
Base with BM2513.49
Base with DPR12.58
RegaVAE (this paper)8.62

The order of the variants without the VAE is particularly informative. With retrieval, their Yelp perplexity is 20.13. With retrieval removed as well, it is 17.95. In this part of the ablation, access to neighboring items hurts predictive performance when those items come from a space without the VAE structure. The Self-BLEU comparison points in the same direction, at 62.48 with retrieval and 53.24 without it. Dist2 moves in the other direction, at 17.04 with retrieval and 16.46 without it. Both Dist2 values are below the full system's 28.83.

The authors suggest that the space in the variant without the VAE fails to organize candidates so that cosine neighbors give the decoder useful samples. That interpretation is consistent with the direction of the perplexity and Self-BLEU changes. The experiment measures output behavior after changing the representation and retrieval. A direct test of the proposed geometry would require observations of the latent space or of which candidates the retriever makes available. The comparison supports a narrower conclusion that the contribution of the retrieval mechanism depends on the space in which it operates.

Replacing the full retriever with BM25 or DPR also weakens the Yelp results. With BM25, Self-BLEU is 55.37 and Dist2 is 20.72. With DPR, Self-BLEU is 58.46 and Dist2 is 20.54. The full system records 36.10 Self-BLEU and 28.83 Dist2. DPR is stronger than BM25 on perplexity in this ablation, while BM25 has the more favorable of their two diversity results. RegaVAE leads both across the reported metrics. The paper attributes this advantage to a representation that lets information about likely continuations influence retrieval and generation together.

The retrieval substitutions establish how those particular alternatives perform in the adapted system. They also change several aspects of candidate selection at once. For example, changing a retriever can change which candidates are returned as well as how scores distinguish them. The experiment therefore speaks directly to the value of the full retrieval design in this setup. It offers less resolution about the separate contribution of future information in the query, key, or value.

More neighbors within the tested range

The neighbor-count analysis changes the number of retrieved items while retaining RegaVAE's method of combining them. The authors report what happens as that count rises from 5 to 100. Over this range, test perplexity decreases by 0.64 on Yelp and by 0.69 on Yahoo. On WritingPrompts, the reported test perplexity decrease is 0.59. These are the paper's reported changes over the tested range.

Increasing the neighbor count can be helpful if relevant alternatives remain available below the highest-ranked candidates. It can also introduce material with a weaker relationship to the source. RegaVAE can assign such a candidate a smaller weight, and a retrieved component can occupy a distinct part of the latent distribution. Either feature makes it plausible that the system can accommodate additional neighbors. The measured outcome is that more neighbors were useful for perplexity over the range evaluated.

The authors interpret the result as evidence that implicit aggregation filters noise effectively. The analysis varies the count within RegaVAE, so its direct evidence concerns how RegaVAE behaves as the count increases. A comparison in which explicit aggregators also changed their neighbor counts would answer the separate question of which design is more resistant to irrelevant material. The paper's generation results compare aggregation designs under their reported settings, while the neighbor sweep gives evidence about one design's sensitivity to the size of its retrieved set.

A continuation from a story prompt

The paper also looks at an individual output from the WritingPrompts test set. The prompt describes a woman who has watched a knight fail repeatedly and decides to handle the problem herself. The generated continuation creates a scene with people gathered at a door, references to a curse, and a knight who returns after traveling through a wooded area. These details show how the generator develops a brief setup into a more specific sequence of events.

The figure highlights material from the continuation of a retrieved document and marks related wording in RegaVAE's output. The authors use that correspondence to illustrate how information from later in a retrieved passage can reappear after going through the latent representation. The example makes the claimed route for information concrete. The retriever contributes a latent representation, the mixture incorporates it, and the decoder can produce details connected to the retrieved continuation.

The example concerns a single generated scene, and it shows the kind of influence retrieval can have on the output. It does not estimate how frequently the same process happens. It also brings out a distinction between local coherence and following the whole premise. The generated scene expands the material about the knight and his failure, while the prompt's decision that the woman will act for herself is less prominent in the displayed continuation. The correspondence with retrieved material and the fit to every part of the prompt are separate features of the example.

Limitations

Limits identified by the authors

The authors identify computing resources as a constraint on the scale at which they can pretrain RegaVAE. The study initializes and evaluates the method within the reported backbone and data setup. Large-scale pretraining of the complete retrieval-augmented system remains outside their experiments. They expect the restriction to affect performance and state that they want to explore transferring the design to larger language generators. Their results therefore establish what happened under the reported training conditions, while the behavior of the method at another scale is still open.

They also identify posterior collapse as an unresolved problem. The low-rank layer operation and KL annealing give the decoder more opportunity and incentive to use the latent variables. A training run can still become unstable as the decoder learns to operate with little information from those variables. The activation-unit results give a measure of how much of the space was active in the reported experiments. The authors' stated limitation concerns the reliability of getting a useful latent space during training, which matters because retrieval and generation both depend on it.

Limits visible in the evaluation

The results about hallucination are drawn from Yelp. SelfCheckGPT scores sampled outputs from a shared latent variable, and the human study rates a set of test items on that dataset. The reported setup provides evidence about the outputs under those evaluation procedures. It leaves open how well RegaVAE would preserve facts in a task with independently verified answers or with a collection deliberately updated to correct outdated information. The authors motivate retrieval in part through the challenge of time-sensitive knowledge, but the use of training-set retrieval collections gives the study a different empirical focus.

The SelfCheckGPT scores also describe agreement and disagreement among generated outputs as used by the evaluator. A stable generation pattern can support a favorable consistency result, while establishing the truth of a claim would require checking the claim against evidence. The human rating adds judgments of the text itself, and the automated indicators give several views of the sampled output. Neither procedure is reported as an independent audit of every individual claim. The lowest scores on most automated indicators and the favorable human mean are the appropriate scope of the hallucination result.

The evaluation quantifies several useful properties of generated text. Lower perplexity shows better probability assigned to evaluation text, and the diversity measures quantify aspects of repetition and variety. Reference metrics on WritingPrompts give a further check on correspondence to the expected continuation. Reader judgments contribute a different perspective, as DELLA's lead in Yelp coherence illustrates. Taken together, the results describe a system that does well on a range of measures with some exceptions. They leave questions about quality in settings with different requirements for consistency, factual grounding, or adherence to detailed instructions.

The human evaluation is limited to 50 test samples and uses averaged ratings. Those averages show the observed rankings of the systems. The paper gives a correlation analysis for human and automatic scores, but it does not report uncertainty intervals around the differences between the system means. The p-values in the correlation table address associations across the evaluated systems and cannot establish how stable the human ranking would be across a fresh sample of outputs or evaluators.

The generation comparisons control some factors, including the use of the same parameter size for the reproduced retrieval baselines and a shared pretrained backbone for several VAE comparisons. Some other entries come from earlier reports. Results that mix reproduced and previously reported values give a broader comparison, while shared experimental conditions are clearest for the subset explicitly trained under the paper's matched setup. WritingPrompts also has a different baseline set from Yelp and Yahoo. Its findings chiefly establish the comparison against the alternatives presented there.

Limits visible in the method and analysis

The ablation supports the usefulness of the VAE space for retrieval in this architecture. The alternate retrievers support the full system's choice of retrieval representation. The study leaves the contributions of the individual future-aware features entangled. It does not report separate experiments in which the query, key, or value alone loses the information associated with later text. It also does not present a matched comparison that holds the retrieved candidates fixed and changes only the form of aggregation between a mixture and another way of combining the same candidates. Such omissions limit causal attribution to specific design choices within the full system.

The derivation also leaves some practical details open. Its expectation changes conditioning labels between the variational derivation and the displayed training objective. The treatment of the retrieval weights as constant is an assumption of the simplified training description. Periodic index refresh holds the stored candidates fixed between updates, while the query depends on a trainable encoder. An unchanged index alone does not make all query-to-candidate scores invariant. The general upper bound explains why componentwise terms can replace a difficult mixture divergence, while the final form also depends on the update assumptions the authors make for the implemented training procedure.

The computational motivation concerns avoiding the need to append the raw text of every neighbor. The approach instead incurs the work of encoding the corpus, building and periodically updating an index, retrieving neighbors, and constructing the latent mixture. The neighbor experiment provides evidence of useful aggregation at the tested counts, and the paper reports training-time information for the comparisons it gives. It does not provide a systematic account of retrieval latency, index storage, or generation cost as the collection and neighbor count grow. The results support a particular way of representing retrieved material without establishing a general efficiency ranking across deployment sizes.

What came after

The paper closes with a proposed extension to larger language generators. That direction would test whether source-conditioned retrieval and Gaussian mixture aggregation remain useful at a scale where the authors could not pretrain RegaVAE. It is an open direction in the paper. There are no later studies to discuss here that report building on the method.

Cite

Cite as Jingcheng Deng, Liang Pang, Huawei Shen and Xueqi Cheng. 2023. RegaVAE: A Retrieval-Augmented Gaussian Mixture Variational Auto-Encoder for Language Modeling. Findings of the Association for Computational Linguistics: EMNLP 2023.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2023.findings-emnlp.164

@inproceedings{deng2023regavae,
  title = {{RegaVAE: A Retrieval-Augmented Gaussian Mixture Variational Auto-Encoder for Language Modeling}},
  author = {Jingcheng Deng, Liang Pang, Huawei Shen and Xueqi Cheng},
  booktitle = {Findings of the Association for Computational Linguistics: EMNLP 2023},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.164},
  url = {https://doi.org/10.18653/v1/2023.findings-emnlp.164}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/deng-2023-regavae-retrieval-augmented-gaussian-mixture/