Discrete Factorization Machines for Fast Feature-based Recommendation

Han Liu, Xiangnan He, Fuli Feng, Liqiang Nie, Rui Liu, Hanwang Zhang

Abstract

Modern recommendation systems often rely on Factorization Machines (FM) to model complex feature interactions. However, deploying FMs on mobile devices is challenging due to high memory and computational costs. This paper introduces Discrete Factorization Machines (DFM), which binarize model parameters to enable efficient on-device recommendation. By optimizing binary codes directly through an end-to-end strategy, DFM achieves a 16x speedup over traditional FMs while maintaining competitive accuracy.

Introduction

Recommendation systems increasingly utilize "side information"—such as user demographics and item attributes—to improve prediction quality. Factorization Machines (FM) are widely used for this purpose as they effectively model pairwise feature interactions. Despite their success, FMs face significant deployment hurdles on mobile platforms. In large-scale systems, feature dimensions can exceed $10^7$, leading to massive embedding matrices that consume gigabytes of memory. Furthermore, calculating scores requires millions of floating-point multiplications, draining battery life.

Previous attempts to binarize FMs typically followed a two-stage "train then round" approach, which often resulted in substantial quantization loss. DFM addresses this by rethinking the optimization process to learn binary representations directly.

Methodology

DFM optimizes binary codes $B \in \{\pm 1\}^{k \times n}$ in an end-to-end fashion rather than relying on post-hoc quantization. The core of the approach involves several key technical innovations:

  • Discrete Optimization Strategy: To overcome the NP-hard nature of binary optimization, DFM uses an alternating optimization framework. It decomposes the objective into manageable sub-problems for binary codes, continuous "delegate" variables, and model biases.
  • Balanced and De-correlated Constraints: The model enforces constraints to ensure that binary bits are balanced (equal distribution of +1 and -1) and de-correlated. This maximizes the information entropy of the binary representations.
  • Softened Learning Objective: A continuous delegate variable $D$ acts as a bridge during training, making the discrete optimization computationally tractable while guiding weights toward binary values.
  • Discrete Coordinate Descent (DCD): This algorithm allows for bit-by-bit updates, ensuring the model converges efficiently to a local optimum.

Experimental Evaluation

The authors evaluated DFM on two large-scale, sparse datasets:

  1. Yelp: Over 2.6 million ratings with a feature dimensionality of 34,601 after encoding textual reviews and IDs.
  2. Amazon (Books): A massive dataset with 12.8 million ratings and 76,346 feature dimensions.

Performance and Efficiency

DFM was compared against the full-precision libFM and several state-of-the-art binarized models, including DCMF, DCF, and BCCF.

Performance comparison of DFM against baselines on Yelp and Amazon datasets across various bit lengths (8, 16, 32, 64).

Key findings include:

  • Efficiency: DFM delivers an approximate 16x speedup compared to the C++ implementation of libFM by replacing floating-point operations with bitwise XOR and bit-counting.
  • Accuracy: The performance gap between DFM and the full-precision libFM is remarkably small, typically ranging from 2.4% to 3.2%. This gap further narrows as the code length increases.
  • Robustness: DFM consistently outperformed other discrete models across all tested bit lengths (8, 16, 32, and 64 bits), demonstrating the effectiveness of its end-to-end optimization.

Discussion and Insights

A surprising finding was that binarization can serve as a form of regularization. In high-dimensional, noisy settings, the "coarseness" of DFM's binary weights helped prevent overfitting, a problem sometimes encountered by full-precision models. Furthermore, the inclusion of side information makes DFM's binary representations more expressive than models relying solely on user/item IDs, particularly in cold-start scenarios.

Conclusion and Future Work

Discrete Factorization Machines provide a viable path for deploying sophisticated recommendation models on resource-constrained devices. Future research directions include adapting the DFM framework for ranking-based tasks and exploring the binarization of more complex architectures, such as Neural Factorization Machines. Additionally, investigating online learning capabilities for DFM would be beneficial for real-time recommendation scenarios.

Summary updated

BibTeX
@inproceedings{liu2018discrete,
  author = {Han Liu and Xiangnan He and Fuli Feng and Liqiang Nie and Rui Liu and Hanwang Zhang},
  title = {{Discrete Factorization Machines for Fast Feature-based Recommendation}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2018},
  doi = {10.24963/ijcai.2018/479},
}
Figure