fastkqr: A Fast Algorithm for Kernel Quantile Regression

Qian Tang, Yuwen Gu, Boxiang Wang

This paper introduces fastkqr, a high-performance algorithm designed to make Kernel Quantile Regression (KQR) both exact and exceptionally fast. By combining a "finite smoothing" approach with a clever spectral technique for matrix operations, the authors achieve speedups of up to an order of magnitude over current state-of-the-art tools while solving the notorious problem of "crossing" quantile curves.

TL;DR

The fastkqr algorithm provides a breakthrough in Kernel Quantile Regression by delivering exact solutions—not just approximations—at speeds up to 10x faster than existing packages. It leverages a finite smoothing strategy and a spectral matrix-reuse technique to handle large datasets and non-crossing constraints with unprecedented efficiency.

What Problem Does This Paper Address?

Quantile regression is a favorite tool for statisticians because it’s robust to outliers and provides a full picture of a distribution (e.g., predicting the 90th percentile of home prices rather than just the average). However, it has two major "pain points":

  1. Computational Complexity: The "check loss" function used in quantile regression is non-smooth (it has a sharp "V" shape at zero). This makes optimization difficult. When you move to Kernel Quantile Regression (KQR) to model non-linear relationships, the math becomes even heavier, often requiring expensive matrix inversions ($O(n^3)$ complexity) that must be repeated many times.
  2. Quantile Crossing: If you estimate the 10th, 50th, and 90th percentiles separately, the curves often cross each other due to noise in small samples. This is logically impossible (the 10th percentile cannot be higher than the 90th) and makes the model hard to interpret.

Methods

The authors introduce three key innovations to solve these issues:

  • Finite Smoothing Algorithm: Instead of simply smoothing the "pointy" loss function and accepting an approximate answer, the authors use a sequence of smoothed surrogates. They prove that this process recovers the exact solution to the original non-smooth problem in just a few iterations.
  • Fast Spectral Technique: The computational bottleneck in these algorithms is usually inverting a large kernel matrix. The authors perform a single eigen-decomposition of the kernel matrix at the start. They then use the Woodbury matrix identity to "reuse" this computation. This drops the complexity of each subsequent update from $O(n^3)$ to $O(n^2)$.
  • Non-Crossing Kernel Quantile Regression (NCKQR): They extend the algorithm to estimate multiple quantile levels simultaneously. They add a "soft" non-crossing penalty (using a smoothed ReLU function) and a specialized Majorization-Minimization (MM) algorithm to ensure the curves stay in the correct order without blowing up the computation time.

Datasets

The researchers evaluated their algorithm using:

  • Simulated Data: Benchmarks from Yuan (2006) and Friedman (2010) to test speed and accuracy across different sample sizes ($n=200$ to $1000$) and dimensions.
  • Real-World Benchmarks:
    • GAGurine: Urinary GAG concentration in children (a classic example of crossing quantiles).
  • crabs: Morphometric measurements of Leptograpsus crabs.
  • mcycle: Accelerometer data from motorcycle crash simulations.
  • BostonHousing: Median home values in Boston.

Key Insights and Ideas

  • Exactness via Smoothing: The most surprising "aha" moment is that you don't have to trade off accuracy for speed. By carefully managing the smoothing parameter ($\gamma$), you can use smooth optimization tools (like Accelerated Proximal Gradient Descent) to find the exact "pointy" solution.
  • Decoupling the Kernel: By performing the eigen-decomposition once, the algorithm separates the data's structure from the tuning parameters. This makes "warm-starting" (using the solution from one parameter to start the next) incredibly effective.
  • Soft Constraints are Faster: Instead of using "hard" inequality constraints to prevent crossing (which are computationally brutal), the authors show that a "soft" penalty is flexible, easier to compute, and just as effective for practitioners.

Key Results

  • Speed: On a dataset of $n=1000$, fastkqr completed its task in 30 seconds, while the popular kernlab package took 400 seconds.
  • Non-Crossing Efficiency: When fitting non-crossing curves for $n=1000$, fastkqr took only 57 seconds. In comparison, the general-purpose solver cvxr took about an hour, and standard optimizers like nlm failed to finish within 24 hours.
  • Accuracy: Despite the speed, fastkqr consistently matched or achieved lower objective values (better fit) than all competing solvers.

Limitations and Future Work

  • The $O(n^3)$ Start: While the updates are fast ($O(n^2)$), the very first step—the eigen-decomposition—is still $O(n^3)$. This means the algorithm might struggle with truly "big data" (e.g., $n > 50,000$) on standard hardware.
  • Future Scaling: The authors suggest integrating kernel approximation techniques like Nyström subsampling or random features into their framework to push the algorithm into the realm of massive-scale data analysis.

The algorithm is available as an R package, fastkqr, on CRAN.

Summary updated

BibTeX
@article{tang2025fastkqr,
  author = {Qian Tang and Yuwen Gu and Boxiang Wang},
  title = {{fastkqr: A Fast Algorithm for Kernel Quantile Regression}},
  journal = {Journal of Computational and Graphical Statistics},
  year = {2025},
  doi = {10.1080/10618600.2025.2541004},
}
Figure