Number of paths, steps, and speed
After finishing this section, you will know where the time for one prediction goes, and you will be able to tune --paths, --steps, and --precision to suitable values based on your own GPU and needs.
Where the time goes: number of paths × steps
As the previous lesson said: each path starts from a blob of noise, and the model takes a step, takes a look, then takes another step. So the number of times the model has to compute is roughly:
Number of paths K × steps
The defaults are K=16 and steps=32, which is 512 times. Increase K to 64, and the time becomes roughly 4 times as long.
Measured: RTX 4080 SUPER 16GB
Official 2.84-hundred-million-parameter model (284 million parameters), a single example, --chunk 48 (the automatic value for a 16GB GPU). Other programs were also running on the same card, so only look at the relative sizes of the numbers:
| Granularity | Precision | K | steps | Time | Peak VRAM |
|---|---|---|---|---|---|
| 1h | bf16 | 16 | 8 | 1.0 sec | 2.1 GB |
| 1h | bf16 | 16 | 32 | 3.7 sec | 2.1 GB |
| 1h | bf16 | 64 | 32 | 16.9 sec | 3.0 GB |
| 1h | bf16 | 256 | 32 | 70.0 sec | 3.1 GB |
| 1h | fp32 | 16 | 32 | 5.4 sec | 1.6 GB |
| 1m | bf16 | 16 | 32 | 15.2 sec | 3.1 GB |
| 1m | bf16 | 64 | 32 | 60.8 sec | 5.9 GB |
| 1m | fp32 | 64 | 32 | 89.7 sec | 5.6 GB |
Three patterns:
- Time is proportional to K × steps. 16→64 paths, 3.7→16.9 sec.
- 1-minute bars are the most expensive. It has to look at 1200 bars and draw 120 bars at a time, so the sequence is more than three times as long as the 1-hour bars.
- bf16 is about 30% faster than fp32. When a GPU is present, the script defaults to bf16.
How to choose each parameter
Look it upI want to...
Click one to see.
Try it: same example, different number of paths
python eval/infer_for_pred.py --case 300733.SZ,1h,"2026-02-09 15:00" --paths 64 --out results/k64You should see the time go from just over 3 seconds to a dozen or so seconds (we measured 16.9 seconds). The median of the endpoints will differ from the 16-path run, which is normal: with more paths, the computed median and interval are more stable, and the interval is what matters.
There is one more parameter, --solver heun: it computes an extra correction step at each step (Heun's method), roughly doubling the number of model computations. The default euler is what the paper used.
Quiz timeTo compress a 1-hour-candle prediction from about 4 seconds to about 1 second, the most direct approach is?
Check yourself
- I know the runtime is roughly proportional to "number of paths × steps"
- I ran it once with
--paths 64and looked at how the interval changed - When VRAM runs out, I know to adjust
--chunkfirst
Next section: Evaluation and backtesting.