Skip to main content
QUICK REVIEW

[Paper Review] Fastfood: Approximate Kernel Expansions in Loglinear Time

Quoc V. Le, Tamás Sarlós|arXiv (Cornell University)|Aug 13, 2014
Face and Expression RecognitionComputer Science13 citations
TL;DR

Fastfood proposes a log-linear time approximation for kernel expansions using Hadamard matrices and diagonal Gaussian matrices to replace dense random matrices in Random Kitchen Sinks. It achieves O(n log d) computation and O(n) storage, reducing runtime by 100x and memory usage by 1000x compared to standard methods, while maintaining accuracy on RBF and polynomial kernels.

ABSTRACT

Despite their successes, what makes kernel methods difficult to use in many large scale problems is the fact that storing and computing the decision function is typically expensive, especially at prediction time. In this paper, we overcome this difficulty by proposing Fastfood, an approximation that accelerates such computation significantly. Key to Fastfood is the observation that Hadamard matrices, when combined with diagonal Gaussian matrices, exhibit properties similar to dense Gaussian random matrices. Yet unlike the latter, Hadamard and diagonal matrices are inexpensive to multiply and store. These two matrices can be used in lieu of Gaussian matrices in Random Kitchen Sinks proposed by Rahimi and Recht (2009) and thereby speeding up the computation for a large range of kernel functions. Specifically, Fastfood requires O(n log d) time and O(n) storage to compute n non-linear basis functions in d dimensions, a significant improvement from O(nd) computation and storage, without sacrificing accuracy. Our method applies to any translation invariant and any dot-product kernel, such as the popular RBF kernels and polynomial kernels. We prove that the approximation is unbiased and has low variance. Experiments show that we achieve similar accuracy to full kernel expansions and Random Kitchen Sinks while being 100x faster and using 1000x less memory. These improvements, especially in terms of memory usage, make kernel methods more practical for applications that have large training sets and/or require real-time prediction.

Motivation & Objective

  • Address the high computational and memory cost of kernel methods in large-scale learning, especially at prediction time.
  • Overcome the O(nd) complexity of storing and computing kernel expansions in standard approaches.
  • Develop a scalable approximation method that maintains accuracy while drastically reducing time and space requirements.
  • Enable real-time prediction and deployment on resource-constrained devices like mobile phones.
  • Provide a general-purpose solution applicable to translation-invariant and dot-product kernels, such as RBF and polynomial kernels.

Proposed method

  • Leverage the mathematical property that products of random Hadamard matrices and diagonal Gaussian matrices approximate dense Gaussian random matrices.
  • Use this matrix product in place of full Gaussian matrices in the Random Kitchen Sinks framework to avoid expensive matrix storage and multiplication.
  • Apply fast Hadamard transforms (e.g., FFT-based) to compute the feature map in O(n log d) time instead of O(nd).
  • Construct n nonlinear basis functions via randomized feature maps that preserve kernel approximation quality.
  • Ensure the approximation is unbiased and has low variance through theoretical analysis of the matrix product distribution.
  • Integrate the method into existing kernel learning pipelines with minimal modification, supporting both RBF and polynomial kernels.

Experimental results

Research questions

  • RQ1Can we approximate kernel expansions in O(n log d) time and O(n) storage without sacrificing accuracy?
  • RQ2Do Hadamard and diagonal matrix products effectively mimic the statistical properties of dense Gaussian matrices in kernel approximation?
  • RQ3How does the proposed method compare to Random Kitchen Sinks and Nystrom in terms of speed, memory, and predictive performance?
  • RQ4Can the method scale to large datasets and real-time applications, including mobile deployment?
  • RQ5Does the approximation remain accurate across diverse kernel types, including RBF and polynomial kernels?

Key findings

  • Fastfood achieves O(n log d) computation and O(n) storage, representing a 100x speedup and 1000x memory reduction compared to Random Kitchen Sinks.
  • On the CIFAR-10 dataset, Fastfood achieved 63.1% test accuracy with n=16,384 basis functions, outperforming Random Kitchen Sinks (62.4%) and matching state-of-the-art results with permutation-invariant features.
  • Prediction speed on a single input vector was 24x faster than Random Kitchen Sinks (0.003s vs. 0.07s) for d=1,024 and n=16,384.
  • The method maintained high accuracy on regression tasks, with test RMSE improving as the number of basis functions increased.
  • Experiments on diverse datasets (e.g., CPU, KEGG, Year, Forest) showed consistent performance across tasks, with Fastfood matching or exceeding baseline methods in accuracy.
  • The method enables deployment of kernel methods on mobile devices due to its low memory and high-speed computation, making real-time prediction feasible.

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.