[Paper Review] Fast Amortized Inference and Learning in Log-linear Models with Randomly Perturbed Nearest Neighbor Search
This paper proposes a sublinear amortized inference and learning method for large discrete log-linear models using Gumbel perturbations and Maximum Inner Product Search (MIPS). By lazily sampling only $O(\sqrt{n})$ top candidates via MIPS and uniform sampling from the tail, it achieves $5\text{--}10\times$ speedups over exact inference with provable accuracy guarantees on ImageNet and word embeddings.
Inference in log-linear models scales linearly in the size of output space in the worst-case. This is often a bottleneck in natural language processing and computer vision tasks when the output space is feasibly enumerable but very large. We propose a method to perform inference in log-linear models with sublinear amortized cost. Our idea hinges on using Gumbel random variable perturbations and a pre-computed Maximum Inner Product Search data structure to access the most-likely elements in sublinear amortized time. Our method yields provable runtime and accuracy guarantees. Further, we present empirical experiments on ImageNet and Word Embeddings showing significant speedups for sampling, inference, and learning in log-linear models.
Motivation & Objective
- To address the high computational cost of inference and learning in log-linear models with large but enumerable output spaces.
- To reduce the amortized runtime of sampling and gradient computation from linear to sublinear in the size of the output space.
- To maintain high accuracy while significantly accelerating inference and learning in NLP and computer vision applications.
- To provide provable runtime and accuracy guarantees for approximate inference and learning in large-scale log-linear models.
Proposed method
- Leverages the Gumbel max trick to convert sampling from a log-linear model into maximizing perturbed unnormalized log-probabilities.
- Introduces a lazy instantiation of Gumbel variables, only computing them for the top $O(\sqrt{n})$ most likely states to reduce computation.
- Uses Maximum Inner Product Search (MIPS) data structures to efficiently retrieve the top $O(\sqrt{n})$ candidates based on dot product between parameters and features.
- Estimates the partition function and expected sufficient statistics using a combination of top-$k$ MIPS results and uniform sampling from the tail.
- Treats the MIPS data structure as a black box, enabling compatibility with any efficient MIPS implementation.
- Employs fresh, independent Gumbel samples per query to avoid bias and correlation issues present in prior frozen-noise methods.
Experimental results
Research questions
- RQ1Can inference and learning in large discrete log-linear models be accelerated beyond linear-time complexity?
- RQ2Can sublinear amortized inference be achieved while preserving accuracy and providing theoretical guarantees?
- RQ3How can the tail of the distribution be effectively incorporated in approximate inference without incurring linear cost?
- RQ4Can the use of Gumbel perturbations and MIPS be combined to yield provably accurate and efficient inference?
Key findings
- The method achieves $9.6\times$ speedup in gradient computation on ImageNet compared to exact inference, with nearly identical log-likelihood.
- On ImageNet, the method achieves a log-likelihood of $-3.175$, close to the exact method ($-3.170$), while outperforming the top-$k$ method ($-4.062$).
- The method provides $5\text{--}10\times$ per-query speedup in sampling, inference, and learning on ImageNet and word embedding tasks.
- The use of $O(\sqrt{n})$ top candidates plus uniform sampling from the tail yields provably accurate estimates of the partition function and expectations.
- The method avoids the bias and correlation issues of prior frozen-Gumbel approaches by using fresh Gumbel samples per query.
- The approach is flexible and compatible with any efficient MIPS implementation, with performance improvements inheriting advances in MIPS technology.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.