News ·
Prepare Market Data for Forecasting with NVIDIA Megatron Core
NVIDIA's Megatron-LM now includes a preprocessing pipeline that turns intraday market-bar Parquet files into model-ready tensors for forecasting returns and trading volume across multiple horizons.

NVIDIA published a workflow for preparing market data for AI-based forecasting using Megatron Core, its open-source library of GPU-optimized components for training transformer models at scale, combined with the preconfigured training scripts in the Megatron-LM repository. The pipeline starts from Parquet files of intraday market bars (one row per instrument per time unit) with columns like Symbol, Date, Timestamp, Close, and Volume, and produces tensors for forecasting returns and trading volume at several horizons.
The preprocessing script groups consecutive bars into patches that serve as the model's tokens, slides fixed-length context windows over them, and computes forecast targets. For example, eight bars per patch across 32 patches gives 256 observations in 32 model positions. It writes train, validation, test, and metadata tensor splits, so Parquet parsing stays outside the training loop, and a memory-mapped data loader shares batches within tensor-parallel groups. Temporal safeguards split data by date with embargo periods to prevent leakage, and per-horizon target statistics come only from the training split to avoid forward-looking bias. Metadata records patch size, context length, and horizons.
For builders, the framework separates the data interface from the model: any MegatronModule accepting patches, instrument IDs, and patch positions and returning return and volume tensors can replace the example model while keeping the data layer, loader, and target masking unchanged. The same pipeline also accommodates data from different vendors or sampling schemes, and NVIDIA suggests using the small example model to verify preprocessing and training wiring before swapping in a custom architecture.

References
- NVIDIA · developer.nvidia.com
Read the full story at NVIDIA ↗Like, save or discuss on Buzz


