Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Fast Exact Nearest-Neighbor Learning for High-Frequency Financial Time Series

About

AI efficiency at scale is becoming critical in finance as market data volumes surge across equities, ETFs, FX, options, and high-frequency trading streams. This growth creates a core challenge for mature financial AI systems: models must learn from larger historical corpora while still meeting real-time latency constraints in trading, risk management, and derivative pricing. We use exact nearest-neighbor learning for high-frequency financial time series as a concrete case study to show that Mojo-based financial AI can address this challenge. We introduce a Mojo SIMD k-d tree with variance-based splitting, contiguous flat-buffer storage, and compile-time vectorized distance computation. We also provide a runtime result showing that, under standard pruning and implementation-cost assumptions, the Mojo SIMD k-d tree asymptotically dominates Mojo SIMD brute force and scikit-learn's k-d tree in the fixed-stock, large-$n$, moderate-dimensional regime. Empirically, across eight financial datasets on x86 and ARM64 with up to 277K training samples, the method achieves 17.5--21.6$\times$ speedup over scikit-learn's k-d tree on x86 and 28.1--43.5$\times$ over scikit-learn brute force on ARM64 equity/ETF datasets, while preserving exact outputs. Beyond nearest-neighbor inference, Mojo's compiled execution enables an Extra Trees-based implied-volatility pricing model to train on $10\times$ more options data, reducing put-IV RMSE by 8.0\%. These results position Mojo as a scalable, production-ready stack for financial AI and a promising foundation for efficient AI in other data-intensive fields. \keywords{Financial AI \and AI Efficiency \and Mojo \and SIMD \and K-D Trees \and KNN \and High-Frequency Trading \and Financial Time Series \and Scaling}

Henry Han, Diane Li• 2026

Related benchmarks

TaskDatasetResultRank
k-Nearest NeighborsCPRI x86 d=16 1.5.0 (test)
Inference Time (s)0.829
4
k-Nearest NeighborsJPM x86, d=16 1.5.0 (test)
Inference Time (s)1.197
4
k-Nearest NeighborsWMT x86 d=16 1.5.0 (test)
Inference Time (s)1.449
4
k-Nearest NeighborsAAPL x86 d=16 1.5.0 (test)
Inference Time (s)3.037
4
k-Nearest NeighborsBAC ARM64 d=24 1.5.0 (test)
Inference Time (s)0.079
4
k-Nearest NeighborsSPY ARM64 d=24 1.5.0 (test)
Inference Time (s)0.036
4
k-Nearest NeighborsQQQ ARM64 d=24 1.5.0 (test)
Inference Time (s)0.021
4
k-Nearest NeighborsEURUSD ARM64 d=24 1.5.0 (test)
Inference Time (s)0.209
4
Implied Volatility PredictionAAPL Implied Volatility d=8 (Mixed)
RMSE0.483
2
Implied Volatility PredictionAAPL Implied Volatility d=7 (Puts only)
RMSE0.333
2
Showing 10 of 11 rows

Other info

Follow for update