Deployment-constrained key estimation with a DSP-guided transformer reranker

Pardis NoorzadarXiv 2026 · arXiv

TL;DR

The authors present key lime, a hybrid musical key estimation system that combines traditional Digital Signal Processing (DSP) with a tiny 21.5k-parameter transformer reranker. By using the transformer to "correct" the output of a lightweight DSP analyzer, they achieve near-state-of-the-art accuracy with a deployment footprint significantly smaller than heavy deep-learning alternatives.

What Problem Does This Paper Address?

In the world of "local-first" music software—applications that run entirely on a user's laptop rather than in the cloud—efficiency is king. When a user imports thousands of tracks, the software needs to estimate the musical key of each file quickly and without hogging disk space.

Historically, developers faced a trade-off:

  1. Compact DSP Methods: These are tiny and fast but struggle with accuracy, often failing to capture complex harmonic relationships.
  2. Deep Learning (DL) Methods: These are highly accurate but come with a massive "installed footprint." A typical DL model might require hundreds of megabytes for the model weights and the necessary runtime environments (like Python or heavy C++ libraries).

The authors aim to bridge this gap, creating a system that is accurate enough for professional use but small enough to ship inside a standard desktop application.

Methods

The core innovation is a DSP-guided transformer reranker called KL-FMAK. Instead of trying to learn key estimation from scratch, the model acts as a "second opinion" for an existing Rust-based DSP analyzer called trail mix.

The Architecture

The system follows a specific pipeline:

  • Base Scorer (KL-DSP): A deterministic analyzer calculates 24 initial key scores (12 major, 12 minor) using chroma-template matching.
  • The Reranker: A single-layer transformer encoder processes the raw audio features (chroma frames).
  • Circular Pitch Convolution: To keep the model tiny, the authors used a circular 1-D convolution for the input stage. This encodes transposition equivariance—the musical logic that if you shift a song by one semitone, the key should also shift by one semitone. This allowed them to use just 12 parameters for the input stage instead of the usual 468.
  • Residual Fusion: The transformer's output is added to the original DSP scores. The model is initialized to the "identity," meaning that before training, it simply outputs the DSP's original guess. Training then teaches the model to provide a "residual correction" to fix the DSP's mistakes.
Figure 1: KL-FMAK architecture and trainable parameter split. The circular convolution is part of the selected KL-FMAK model. The six blocks sum to 21,528 parameters in a 115 KB fp32 ONNX file.

Datasets

The authors utilized several datasets to train and rigorously test the model:

  • FMAK: 4,040 tracks for training and 449 for validation.
  • FMAKv2: A disjoint 1,000-track holdout set used for final evaluation.
  • SC06 (Schubert Winterreise): A small 24-track dataset of classical music used for a "cross-corpus" check to see if the model generalizes to genres outside of popular/electronic music.

Key Insights and Ideas

  • The "Installed Footprint" Matters: The authors argue that researchers often ignore the size of the runtime. While their model file is only 115 KB, the ONNX Runtime needed to run it takes up 74.58 MB. Even so, this is much smaller than competitors like madmom or S-KEY, which can exceed 400 MB.
  • Domain Knowledge Saves Parameters: By building musical symmetry (circular convolution) directly into the neural network architecture, they achieved the same accuracy as a much larger linear layer while using 39x fewer parameters.
  • Reranking is Easier than Predicting: By starting with the DSP scores, the tiny transformer doesn't have to learn what a "C Major" is from scratch; it only has to learn when the DSP analyzer is likely to be wrong.

Key Results

The hybrid approach yielded impressive gains over the baseline DSP method:

  • Accuracy Boost: On the FMAKv2 holdout, the system improved the MIREX score (a standard metric for key estimation) from 61.08 to 73.55.
  • Competitive Performance: It approached the performance of the much larger madmom KeyCNN (74.16 MIREX) while being significantly more deployment-friendly.
  • Efficiency: The reranking step adds only 0.32 ms of processing time per track.
Figure 2: FMAKv2 MIREX against installed footprint (Table 3). Filled points use local measurements on the sealed holdout; libKeyFinder covers 996 scored tracks. The hollow S-KEY point combines a locally measured installed footprint with a published full-protocol score. Essentia is omitted from the scatter because it falls below the plotted y-range.

As shown in the figure above, KL-FMAK occupies a "sweet spot" on the Pareto front between the ultra-lightweight (but less accurate) DSP tools and the heavy (but accurate) deep learning models.

Limitations and Future Work

  • Small Cross-Corpus Sample: While the model performed well on the Schubert classical dataset, the sample size (24 tracks) is too small to definitively prove it generalizes perfectly across all genres.
  • Global vs. Local: The current model only estimates a single "global" key for the entire track. It does not account for songs that change keys (modulations) internally.
  • Future Directions: The authors suggest that this reranking approach could be applied to other DSP scorers and that future work should include more diverse "same-manifest" benchmarks to compare against other emerging learned baselines.

Summary updated

Abstract

Local music applications estimate key during library import and benefit from an analyzer that is small, fast, and runs in-process. We start from a compact chroma-template key analyzer that fits this budget but lags behind learned references. Learned systems reach higher accuracy, but their installed model and runtime dependencies can occupy tens to hundreds of megabytes. We present key lime, a 21.5k-parameter DSP-guided transformer reranker with a 115 KB model artifact and a 76.7 MB installed footprint, including the extracted ONNX Runtime. It adds 0.32 ms per track to deterministic DSP scoring. Trained from labels on 4,040 FMAK tracks, with 449 tracks for validation and 1,000 disjoint FMAKv2 tracks held out for evaluation, it improves MIREX from 61.08 to 73.55 +/- 0.46 and exact accuracy from 52.30 to 67.07 +/- 0.65 over three seeds (mean +/- population SD). It approaches a same-manifest local madmom KeyCNN reference at 74.16 MIREX. A 12-parameter circular input stage matches the accuracy range of a 468-parameter linear input projection.
BibTeX
@misc{noorzad2026deployment,
  author = {Pardis Noorzad},
  title = {{Deployment-constrained key estimation with a DSP-guided transformer reranker}},
  year = {2026},
  eprint = {2611.02408},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.02408},
}
Figure