
Prepare Market Data for Forecasting with NVIDIA Megatron Core
NVIDIA’s Megatron-LM example uses the open-source Megatron Core library to train a shared model across instruments and forecast returns and trading volume at multiple horizons. The preprocessor takes intraday Parquet bars, sorts each
Read moreShow less about Prepare Market Data for Forecasting with NVIDIA Megatron Core
NVIDIA’s Megatron-LM example uses the open-source Megatron Core library to train a shared model across instruments and forecast returns and trading volume at multiple horizons.
The preprocessor takes intraday Parquet bars, sorts each instrument’s daily observations, derives log returns and volumes, and groups them into overlapping windows. Eight bars per patch and 32 patches yield 256 observations. Gaps remain intact.
Each context position gets point or cumulative targets measured in observations or patches. Cumulative targets can span overnight moves, while intraday settings mask horizons that cross the close.
Preprocessing saves reusable PyTorch splits and metadata offline. The loader memory-maps tensors, then one worker per tensor-parallel group reads and broadcasts each microbatch. Researchers can swap compatible models.
Date-based splits keep each window and its targets together. An embargo before validation, overlap checks and training-only target statistics guard against leakage. The example trainer leaves targets unscaled.







