Phase 0 · pilot · Colab Tesla T4 · done 2026-10-04
Scanning every window of a market time series on a GPU
In the same minute the GPU ran 53× more trials, so its interval was 6.7× narrower: precision is bought with re-runs, which reframed the project around evaluation under a time budget.
Numba CPU baselineCUDA kernels via CuPyBTCUSDT 2024Write-up (opens in a new tab)Notebook and code (opens in a new tab)Raw results (opens in a new tab)
01How a window is scored
Every (start, length) window of BTCUSDT bars — a 2024 quarter at 1 minute, one week at 1 second — is scored for how unusual its price range and volume are for its length. The GPU runs one thread per window; the fair CPU baseline is an optimized O(N·K) scan.
Fig. 1 · From a window to a reported episode
- 1
Take every window
Each (start, length) pair, 15 lengths from 2 to 256 bars.
- 2
Measure two features
Price range (max − min) / min and traded volume.
- 3
Rank within its length
Only against windows of the same length; keep the less extreme rank.
- 4
Score its rarity
S = −log10(rank / count). S = 3 means top 0.1% on both features.
- 5
Report the top 20
Local peaks with S ≥ 2, merged into episodes when close.
02Correct first: a gate that catches broken kernels
- GPU features (two thread layouts) and both CPU scans matchpass
- GPU rarity ranks and candidate flags, exactpass
- Top 20 identical on the CPU and all three GPU pathspass
- Broken kernel: boundary off by onecaught
- Broken kernel: wrong window lengthcaught
A gate that passes everything proves little. Catching two deliberately broken kernels shows it can tell a correct kernel from a subtly wrong one, and it ran before every timing.
03Does the map find anything real?
The fake SEC post draws one cone at 1-minute resolution and three at 1-second. Against news events fixed in advance (every CPI and FOMC release) the hits are 1 of 5 (p = 0.086): the map finds large moves, not their cause.
Fig. 2 · 1-minute bars, 2024 Q1
Fig. 3 · 1-second bars, one week
Fig. 4 · Injected pump-and-dump events that reach the top 20
04Where the time goes: not the kernel
The kernel is 59× faster than the optimized CPU, but end to end only 5.4×: sending features for nine million windows back costs more than computing them. Keeping ranking and selection on the GPU removes that cost.
Fig. 5 · One full scan of 604,800 bars × 15 lengths (median, log scale)
Fig. 6 · End-to-end time per pipeline (log scale)
05Seven hypotheses, written before the run
Every one was fixed with a numerical criterion before measuring, and all held.
| Hypothesis | Criterion → result | Verdict | |
|---|---|---|---|
| H1 | A cost model predicts the GPU/CPU crossover | 4.00 criterion, result 2.85 | supported |
| H2 | Download dominates when all features return | 82% of GPU time | supported |
| H3 | Candidates-only output beats features output | ≥ 2× criterion, result 66× | supported |
| H4 | Mixed window lengths in a warp slow the kernel | 4.4× criterion, result 3.6× | supported |
| H5 | The map reads an event's length | ⅓–1 × L criterion, result 0.34–0.58 | supported |
| H6 | A minimum detectable strength exists | 50% at 8–32× | supported |
| H7 | Same budget: more trials, interval narrows as 1/√n | 7.3× criterion, result 6.7× | supported |
06What this changed
- After moving to the GPU, sorting and data movement dominate, not the kernel.Optimise the whole pipeline and what is sent back.
- The optimized CPU is 3.6× the direct scan, and still ranks single-threaded.Phase 1 rebuilds the CPU baseline in C++ with parallel sorting.
- Two broken kernels were caught.The correctness gate runs before every timing.
- Precision is bounded by re-runs per unit time.The project's question: evaluation under a time budget.
Corrections (2026-10-07)
- The 3,480 ms CPU-only pipeline uses the direct scan; an end-to-end comparison with the optimized CPU was not measured.
- 53× is a ratio for this setup: two cores and a full re-run per trial, which Phase 1 shows is not the CPU's floor.
One Colab session; synthetic events without market reaction; nothing judges whether any trading was manipulative. Details: docs/phase0.md (opens in a new tab).