NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

LLC: Accurate, Multi-purpose Learnt Low-dimensional Binary Codes

Aditya Kusupati, Matthew Wallingford, Vivek Ramanujan, Raghav Somani, Jae Sung Park, Krishna Pillutla, Prateek Jain, Sham M. Kakade, Ali Farhadi

TL;DR

The LLC (Learning Low-dimensional binary Codes) framework jointly learns extremely compact binary representations for both image instances and their classes. By using just 20 bits—barely more than the information-theoretic minimum for 1,000 classes—LLC achieves near-state-of-the-art classification on ImageNet while enabling "out-of-the-box" efficiency for image retrieval and out-of-distribution (OOD) detection.

The Heavy Cost of High-Dimensional Vision

In modern computer vision, images are typically represented as high-dimensional vectors of real numbers (e.g., 2048-dimensional floats in ResNet architectures). While highly accurate, these representations are computationally "heavy." They require significant storage and make searching through millions of images computationally expensive.

Binary codes (strings of 0s and 1s) represent the holy grail of efficiency, allowing for incredibly fast comparisons using hardware-accelerated XOR operations. However, compressing complex visual data into very short binary strings usually results in a massive drop in accuracy. Furthermore, most existing methods require "side-information"—like human-annotated attributes (e.g., "has wings," "is furry")—to create meaningful codes for classes. LLC aims to bridge this gap, learning accurate, low-dimensional binary codes for both images and classes using only standard label data.

The LLC Framework

The authors propose a two-phase pipeline called LLC:

  1. Codebook Learning: Instead of assigning random binary strings to classes, the model learns a "codebook" where each class gets a unique $k$-bit code. This is achieved via a surrogate classification task. Because the sign function used to create binary bits is non-differentiable, the authors employ the Straight-Through Estimator (STE), allowing gradients to bypass the non-smooth binarization step during training.
  2. Instance Code Learning: Once the class codes are fixed, the model learns to map specific images to these codes. By utilizing the Error-Correcting Output Codes (ECOC) framework, the model treats the $k$-bit target as $k$ independent binary classification problems. This process distills semantic similarity: if two classes are visually similar, their learnt binary codes naturally end up with a small Hamming distance (few differing bits).

Key Insights and Discoveries

Joint Learning is Essential: Learning class codes and instance codes together is significantly more effective than using fixed random codes or codes derived from traditional dimensionality reduction techniques like SVD or CCA.

Codebook Comparison

Emergent Taxonomy: Even though the model is not provided with any hierarchical or taxonomic information, the 20-bit codes it learns for ImageNet-1K naturally cluster into an intuitive taxonomy. For example, different species of birds, reptiles, or marine life end up with highly similar binary strings.

Emergent Taxonomy

The "Unassigned Code" Trick for OOD Detection: A 20-bit space allows for $2^{20}$ (over 1 million) possible codes. Since ImageNet-1K only has 1,000 classes, the vast majority of binary strings remain "unassigned." LLC can detect Out-of-Distribution (OOD) samples simply by checking if an image maps to one of these unassigned codes. This works "out-of-the-box" without needing thousands of examples to tune a detection threshold.

Hamming vs. Linear Separability: The researchers noted that "Hamming separability" (distinguishing classes by bit differences) inherently enables linear separability, but the reverse is not necessarily true, highlighting the unique geometric constraints of binary spaces.

Performance and Efficiency

Evaluated across standard benchmarks (ImageNet-1K, ImageNet-100, ImageNet-750, and MIT Places), LLC demonstrates remarkable efficiency without sacrificing much accuracy:

  • Classification: On ImageNet-1K with a ResNet50 backbone, LLC achieved 74.5% accuracy using only 20 bits (Minimum Hamming Decoding). For context, the uncompressed 2048-d baseline is 77%. This represents a massive compression ratio with minimal accuracy loss.
  • Retrieval: In image retrieval tasks on ImageNet-100, LLC's 10-bit codes outperformed 16-bit codes from HashNet, a popular specialized hashing method.
  • O(1) Inference: Using "Exact Decoding" (where an image must match a class code perfectly), the model achieves 68.8% accuracy on ImageNet. This allows for $O(1)$ inference time via a simple hash-table lookup, making it incredibly fast for massive datasets.

Limitations and Future Directions

While highly efficient, LLC has a few limitations. Unlike attribute-based methods, the individual bits in an LLC code lack direct interpretability (they don't map to human-understandable features like "wheels"). Additionally, there remains a performance gap between "Exact Decoding" and "Minimum Hamming Decoding." Closing this gap would unlock even faster, more accurate inference. Finally, the authors suggest that LLC could be extended to encode multiple modalities (audio, text, video) into the same shared binary space, paving the way for ultra-efficient cross-modal search.

Summary updated

BibTeX
@inproceedings{kusupati2021llc,
  author = {Aditya Kusupati and Matthew Wallingford and Vivek Ramanujan and Raghav Somani and Jae Sung Park and Krishna Pillutla and Prateek Jain and Sham M. Kakade and Ali Farhadi},
  title = {{LLC: Accurate, Multi-purpose Learnt Low-dimensional Binary Codes}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=BuYz5Nl4L_},
}
Figure