In the world of generative modeling, there is a fundamental friction between the continuous nature of our most powerful density models (like Normalizing Flows) and the discrete nature of digital data. While we’ve largely solved this for ordinal data—like image pixels—using simple noise addition, categorical data (think words in a sentence or atoms in a molecule) remains a stubborn challenge.
A new paper from researchers at Mila and Microsoft Research, titled "Learning to Dequantise with Truncated Flows," introduces TRUFL, a novel framework that uses learnable, truncated supports to map categorical data into continuous space more effectively than ever before.
TL;DR
TRUFL (TRUncated FLows) is a dequantisation scheme for categorical data that uses normalizing flows with learnable, bounded supports. By allowing the model to "carve out" specific regions of continuous space for each category, it achieves a "lossless" mapping that preserves latent topology, significantly improving performance in constrained generation tasks like molecule design and graph coloring.
What Problem Does This Paper Address?
Most high-performance generative models, such as Variational Autoencoders (VAEs) and Normalizing Flows, are designed to work with continuous variables. However, data like text or molecular graphs are intrinsically discrete and categorical.
To use these models, we must dequantise the data—mapping a discrete category $x$ to a continuous latent variable $z$. Previous attempts fell into two camps:
- Argmax Flows: These are "lossless" because they partition the latent space into non-overlapping regions (orthants). However, these regions are fixed and arbitrary, ignoring the natural relationships between categories (e.g., "cat" and "dog" are forced to be as far apart as "cat" and "car").
- Categorical Normalizing Flows (CatNF): These learn a mapping but use overlapping supports. This makes the dequantisation "lossy"—the model might get confused about which category a point in space actually belongs to.
The authors sought a "best of both worlds" approach: a method that is lossless (non-overlapping) but learnable (the model decides which categories should be near each other).
Methods
The core innovation is the TRUFL dequantiser, which uses a Truncated Logistic Distribution.
Unlike a standard distribution that stretches to infinity, a truncated distribution is bounded. The authors parameterize the mean ($m$) and the width ($s$) of these bounds for each category. Crucially, they developed a way to make this truncation differentiable, allowing the model to optimize the size and location of these "category boxes" via backpropagation.
Because these boxes don't cover the entire latent space, the authors also introduced a Rejection Sampling scheme for generation. If the model's prior distribution $p(z)$ suggests a point that falls into the "empty space" between category boxes, the sample is rejected. This ensures that every generated point can be mapped back to a valid category with high confidence.
Datasets
The authors evaluated TRUFL across three distinct domains:
- Graph Coloring: A synthetic task where nodes must be assigned colors such that no two connected nodes share the same color.
- Molecule Generation: Using the Zinc250k dataset to generate valid chemical structures.
- Language Modeling: Tested on Penn Treebank (PTB), Text8, and Wikitext103 at both character and word levels.
Key Insights and Ideas
- Latent Topology Matters: Qualitative analysis (via t-SNE) showed that TRUFL learns a functional representation of data. For example, in language tasks, it naturally grouped words by tense (e.g., "walked" and "flew" clustered together), a feat Argmax Flows cannot achieve due to their rigid partitioning.
- The Power of "No-Man's-Land": By allowing for empty space between category supports, TRUFL avoids the "soft" boundaries of CatNF that lead to decoding errors. The rejection sampling effectively acts as a validity filter during generation.
- Efficiency of Rejection: While rejection sampling sounds slow, the authors found the rejection rate dropped significantly during training (from ~45% to ~14%), meaning the prior $p(z)$ successfully learned to "aim" for the supported regions.
Key Results
- Graph Coloring: On "Large" graphs, TRUFL with rejection sampling achieved 74.20% validity, significantly outperforming CatNF (66.80%) and Argmax Flow (63.65%).
- Molecule Generation: TRUFL reached 97.87% validity for sub-graphs, proving highly effective at respecting the complex constraints of chemical valency.
- Language Modeling: TRUFL was competitive with state-of-the-art dequantisation methods, achieving a slightly better bits-per-degree (bpd) of 5.35 on Wikitext103 compared to Argmax Flow's 5.42.
Limitations and Future Work
The primary limitation is the computational overhead of rejection sampling and the complexity of estimating the normalization constant ($Z$) for the truncated prior. While the rejection rate is manageable, it still makes generation slower than pure ancestral sampling.
Additionally, while TRUFL narrows the gap, there is still a performance difference between these latent variable models and massive, pure autoregressive models (like Transformers) for text. The authors suggest that further refining the variational dequantisation process is the key to finally closing this gap.
Summary updated