英伟达发布 Megatron-LM 行情预测教程
NVIDIA Technical Blog 发布教程,介绍如何将日内行情柱预处理为张量,并使用 Megatron-LM 训练模型,预测多个周期的收益率和成交量。示例保留价格和成交量等连续特征,使用学习式 patch embedding,并提供防止训练、验证和测试数据交叉泄漏的机制。
该教程给出了将 NVIDIA 的 Megatron GPU 优化训练栈应用于金融时间序列预测的完整可复用流程。
Market data arrives as a stream of trades and quotes: every execution, bid, and ask, timestamped to the microsecond. Preparing this data for AI-based market forecasting requires turning price and volume histories into consistent inputs for model training and inference. A common first step is aggregating the data into bars—one row per instrument per time unit—with price, volume, and other statistics. Neural networks can learn patterns from these histories across instruments and forecast horizons.
NVIDIA Megatron Core is an open-source library of GPU-optimized components for training transformer models at scale. Megatron-LM is a GitHub repository that combines that library with preconfigured training scripts. A preprocessing script turns intraday market bars into model-ready tensors, and a dataset provider feeds them into Megatron’s distributed training loop.
This post shows how to preprocess market-bar data and train a model with Megatron-LM to forecast returns and trading volume across multiple horizons.
Forecast returns and trading volume
Price and volume remain continuous features. A learned patch embedding turns each group of observations into a model input without converting market values into text.