Skip to main content
QUICK REVIEW

[Paper Review] Extreme Classification in Log Memory using Count-Min Sketch: A Case Study of Amazon Search with 50M Products

Tharun Medini, Qixuan Huang|arXiv (Cornell University)|Jan 1, 2019
Advanced Image and Video Retrieval TechniquesComputer Science23 citations
TL;DR

This paper introduces MACH, a novel extreme classification framework that uses Count-Min Sketch with universal hashing to reduce memory scaling from O(K) to O(log K) for large-scale classification. Trained on a 49.46M-product Amazon search dataset, MACH achieves state-of-the-art precision and recall with 6.4B parameters, training in under 35 hours on a single p3.16x instance—7–10x faster and 2–4x more memory-efficient than prior methods.

ABSTRACT

In the last decade, it has been shown that many hard AI tasks, especially in NLP, can be naturally modeled as extreme classification problems leading to improved precision. However, such models are prohibitively expensive to train due to the memory bottleneck in the last layer. For example, a reasonable softmax layer for the dataset of interest in this paper can easily reach well beyond 100 billion parameters (> 400 GB memory). To alleviate this problem, we present Merged-Average Classifiers via Hashing (MACH), a generic $K$-classification algorithm where memory provably scales at $O(\log K)$ without any assumption on the relation between classes. MACH is subtly a count-min sketch structure in disguise, which uses universal hashing to reduce classification with a large number of classes to few embarrassingly parallel and independent classification tasks with a small (constant) number of classes. MACH naturally provides a technique for zero communication model parallelism. We experiment with 6 datasets; some multiclass and some multilabel, and show consistent improvement in precision and recall metrics compared to respective baselines. In particular, we train an end-to -end deep classifier on a private product search dataset sampled from Amazon Search Engine with 70 million queries and 49.46 million documents. MACH outperforms, by a significant margin, the state-of-the-art extreme classification models deployed on commercial search engines: Parabel and dense embedding models. Our largest model has 6.4 billion parameters and trains in less than 35 hrs on a single p3.16x machine. Our training times are 7-10x faster, and our memory footprints are 2-4x smaller than the best baselines. This training time is also significantly lower than the one reported by Google’s mixture of experts (MoE) language model on a comparable model size and hardware.

Motivation & Objective

  • Address the memory bottleneck in extreme classification, where softmax layers for millions of classes require hundreds of gigabytes of memory.
  • Develop a scalable, memory-efficient classification framework that maintains high precision and recall without assumptions on class relationships.
  • Enable zero-communication model parallelism for distributed training by reducing large-scale classification into independent, small-class tasks.
  • Demonstrate superior performance and efficiency on real-world industrial-scale datasets, particularly in product search with 50M+ classes.

Proposed method

  • MACH employs a Count-Min Sketch structure to map high-dimensional classification tasks into a set of smaller, independent classification problems using universal hashing.
  • Each hash function maps the original K-class problem into a constant-sized sub-problem, enabling embarrassingly parallel training and inference.
  • The final prediction is computed via a merged-average of predictions from all hash-based sub-classifiers, preserving model expressiveness while reducing memory footprint.
  • The method provably scales memory at O(log K) by leveraging the concentration properties of universal hashing and sketching techniques.
  • MACH supports end-to-end training of deep neural networks with extreme output layers, integrating seamlessly with standard deep learning frameworks.
  • The architecture enables zero-communication model parallelism, as each sub-classifier can be trained independently without parameter synchronization.

Experimental results

Research questions

  • RQ1Can extreme classification be performed with memory complexity sub-linear in the number of classes, specifically O(log K), without sacrificing model accuracy?
  • RQ2How does MACH compare to state-of-the-art models like Parabel and dense embedding methods in terms of precision, recall, and training efficiency on large-scale product search data?
  • RQ3To what extent can MACH scale to datasets with over 49 million classes while maintaining low memory usage and fast training times?
  • RQ4Does the use of Count-Min Sketch with universal hashing enable effective zero-communication model parallelism in extreme classification?
  • RQ5Can MACH achieve faster training and lower memory usage than Google’s mixture-of-experts model on comparable hardware and model size?

Key findings

  • MACH achieved state-of-the-art precision and recall on a private Amazon product search dataset with 70 million queries and 49.46 million documents.
  • The largest MACH model, with 6.4 billion parameters, trained in under 35 hours on a single p3.16x instance, significantly outperforming baseline models in speed and efficiency.
  • MACH reduced memory footprint by 2–4x and training time by 7–10x compared to the best existing baselines, including Parabel and dense embedding models.
  • Training time for MACH was substantially lower than that reported for Google’s mixture-of-experts language model on a comparable model size and hardware configuration.
  • The method demonstrated consistent improvements across six diverse datasets, including both multiclass and multilabel settings, validating its generality and robustness.
  • The theoretical memory scaling of O(log K) was empirically validated, confirming the method’s scalability to extreme class counts without assumptions on class structure.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.