Intermediate N-Gramming: Deterministic and Fast N-Grams for Large N and Large Datasets
Ryan R. Curtin, Fred Lu, Edward Raff, Priyanka Ranade
摘要
The number of n-gram features grows exponentially in n, making it computationally demanding to compute the most frequent n-grams even for n as small as 3. Motivated by our production machine learning system built on n-gram features, we ask: is it possible to accurately, deterministically, and quickly recover the top-k most frequent n-grams? We devise a multi-pass algorithm called Intergrams that constructs candidate n-grams from the preceding (n -1)-grams. By designing this algorithm with hardware in mind, our approach yields more than an order of magnitude speedup (up to 33×!) over the next known fastest algorithm, even when similar optimization are applied to the other algorithm. Using the empirical power-law distribution over n-grams, we also provide theory to inform the efficacy of our multi-pass approach. Our code is available at https://github.com/rcurtin/Intergrams .
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了每一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
它引用的顶会 Paper1
相关 Paper
- Superposed Decoding: Multiple Generations from a Single Autoregressive Inference PassEthan Shen, Alan Fan, Sarah M. Pratt, Jae Sung Park 等NeurIPS 2024 · 被引用 6 次
- Scaling Embedding Layers in Language ModelsDa Yu, Edith Cohen, Badih Ghazi, Yangsibo Huang 等NeurIPS 2025 · 被引用 21 次
- FR-Spec: Accelerating Large-Vocabulary Language Models via Frequency-Ranked Speculative SamplingWeilin Zhao, Tengyu Pan, Xu Han, Yudi Zhang 等ACL 2025 · 被引用 14 次
- An Efficient Streaming Algorithm for Approximating Graphlet DistributionsMarco Bressan, T.-H. Hubert Chan, Qipeng Kuang, Mauro SozioSIGMOD 2026
- External Merge Sort for Top-K Queries: Eager input filtering guided by histogramsYannis Chronis, Thanh Do, Goetz Graefe, Keith PetersSIGMOD 2020 · 被引用 4 次
