NeuralForecast: Scalable Neural Time Series Forecasting for Python

Jul 9, 2025

Introduction

Predicting future trends in complex time series data often requires a balance between the statistical rigor of traditional models and the predictive power of deep learning. NeuralForecast is a high-performance Python library that bridges this gap, providing a scalable and user-friendly framework for implementing state-of-the-art neural forecasting models. With over 4,200 GitHub stars, it enables developers and data scientists to deploy global models that can learn across thousands of unique time series simultaneously, significantly improving accuracy and efficiency over local statistical methods.

What Is NeuralForecast?

NeuralForecast is an open-source neural forecasting library developed by Nixtla that provides fast, scalable implementations of over 30 state-of-the-art neural forecasting models. It is written in Python and licensed under the Apache License 2.0, allowing for broad commercial and academic use. The library is designed to replace the cumbersome process of building custom PyTorch models for every forecasting task by offering a unified, scikit-learn-like interface for a vast collection of architectures.

The core philosophy of NeuralForecast is to make neural networks’ potential for time series forecasting actually usable. While many research papers publish complex architectures, NeuralForecast provides the production-ready implementations of these models, focusing on usability, robustness, and computational efficiency.

Why NeuralForecast Matters

For years, the time series community has relied on local models like ARIMA or ETS, which treat each time series as an independent entity. This approach is computationally expensive to maintain at scale and fails to capture cross-series patterns. NeuralForecast introduces global models—single neural networks trained on multiple time series—which allow the model to learn shared representations and improve forecasts for series with limited historical data.

The library addresses the “black box” nature of deep learning by integrating interpretability methods. By allowing users to plot trend, seasonality, and exogenous components for models like N-BEATS and NHITS, it transforms neural forecasting from a blind prediction into an explainable business insight. This makes it a critical tool for industries like retail, finance, and energy where understanding the why behind a forecast is as important as the accuracy itself.

Furthermore, the integration with the wider Nixtla ecosystem (including StatsForecast and MLForecast) ensures that users can benchmark neural models against statistical and machine learning baselines within the same pipeline, ensuring that the most effective model is always chosen for the specific dataset.

Key Features

  • Extensive Model Collection: Provides out-of-the-box implementations of over 30 models, including classic RNNs, LSTMs, GRUs, and cutting-edge transformers like PatchTST, iTransformer, and TimeLLM.
  • Global Model Training: Capable of training a single model across thousands of unique time series, leveraging shared patterns to improve overall predictive performance.
  • Exogenous Variable Support: Full support for static covariates (e.g., store location) and historical or future exogenous variables (e.g., weather forecasts, holidays) to enhance forecast accuracy.
  • Probabilistic Forecasting: Includes adapters for quantile losses and parametric distributions, allowing users to generate prediction intervals rather than just point forecasts.
  • Forecast Interpretability: Built-in tools to decompose and plot trend and seasonality for specific architectures like N-BEATS, NHITS, and TFT, making the results explainable.
  • Automatic Model Selection: Features parallelized automatic hyperparameter tuning to efficiently search for the best validation configuration for any given dataset.
  • Unified Interface: Uses a familiar .fit() and .predict() syntax, ensuring compatibility with the scikit-learn ecosystem and other Nixtla libraries.
  • Scalable Architecture: Built on top of PyTorch Lightning, leveraging GPU acceleration to handle massive datasets that would be computationally prohibitive for traditional statistical models.

How NeuralForecast Compares

Feature NeuralForecast Darts GluonTS
Primary Focus Scalable Neural Models General Purpose Wrapper Probabilistic Deep Learning
Model Variety 30+ SOTA Neural Models Mixed (Stat, ML, Neural) Deep Learning Specialized
Interface SKLearn-like (Fit/Predict) Custom Darts-specific MXNet/PyTorch based
Scalability High (PyTorch Lightning) Moderate High
Interpretability Built-in Decomposition Limited Limited

NeuralForecast differentiates itself by focusing exclusively on the neural aspect of forecasting. While Darts acts as a comprehensive wrapper for many different libraries, NeuralForecast provides highly optimized, native implementations of the latest research papers. This means that for users who have already decided to use deep learning for their time series, NeuralForecast is often the most efficient and fastest path to implementation.

Compared to GluonTS, NeuralForecast offers a more intuitive interface and a wider array of recent transformer-based models. While GluonTS is excellent for probabilistic forecasting, NeuralForecast matches this capability while reducing the boilerplate code required to get a model running. The primary tradeoff is that NeuralForecast is more specialized; if you need a simple ARIMA model, you would use Nixtla’s StatsForecast instead of this library.

Getting Started: Installation

NeuralForecast can be installed via the most common Python package managers. It is highly recommended to use a virtual environment to avoid dependency conflicts.

PyPI Installation

The simplest way to install the released version is via pip:

pip install neuralforecast

Conda Installation

For users preferring the conda-forge channel:

conda install -c conda-forge neuralforecast

Development Mode

If you wish to contribute to the project or modify the source code, install it in editable mode:

git clone https://github.com/Nixtla/neuralforecast.git
cd neuralforecast
pip install -e .

How to Use NeuralForecast

The workflow in NeuralForecast is designed to be linear and intuitive. It follows the standard data science pipeline: define models, fit to data, and predict the future.

To begin, your data must be in a pandas DataFrame with three essential columns: unique_id (to identify different time series), ds (the datestamp), and y (the target value). This format is the Nixtla standard for time series data.

Once the data is prepared, you instantiate the NeuralForecast class, passing a list of models you wish to evaluate. This allows you to train multiple architectures (e.g., N-BEATS and NHITS) on the same dataset simultaneously to see which performs best.

Code Examples

Below is a minimal example demonstrating how to use the N-BEATS model for a simple forecasting task. This example uses the built-in AirPassengersDF dataset.

from neuralforecast import NeuralForecast
from neuralforecast.models import NBEATS
from neuralforecast.utils import AirPassengersDF

# Initialize the NeuralForecast object with a specific model
nf = NeuralForecast(
    models=[NBEATS(input_size=24, h=12, max_steps=100)],
    freq='ME'
)

# Fit the model to the data
nf.fit(df=AirPassengersDF)

# Generate forecasts for the next 12 months
forecasts = nf.predict()
print(forecasts)

For more complex scenarios, you can implement multivariate forecasting by adding exogenous variables. For example, if you are forecasting sales and have future knowledge of promotions, you can pass these as futr_exog variables in the model definition.

from neuralforecast.models import NHITS

# Example of NHITS with future exogenous variables
model = NHITS(
    input_size=24,
    h=12,
    futr_exog_list=["promotion_active", "holiday_flag"],
    scaler_type="robust",
    max_steps=100
)

# Pass the exogenous data in the fit and predict methods
# (Assuming df contains the columns listed in futr_exog_list)
nf = NeuralForecast(models=[model], freq='ME')
nf.fit(df=df)
forecasts = nf.predict()

Real-World Use Cases

NeuralForecast is particularly effective in scenarios where the volume of time series is high and the patterns are shared across different entities.

  • Retail Demand Forecasting: A retailer with thousands of SKUs across hundreds of stores can use a single global model to learn the general demand patterns of a product category, improving forecasts for new products with little historical data (the “cold start” problem).
  • Energy Load Prediction: Utility companies can forecast electricity demand across thousands of grid nodes. By using exogenous variables like temperature and humidity, the model can capture the complex non-linear relationship between weather and energy consumption.
  • Financial Market Analysis: Quantitative traders can use transformer-based models like PatchTST or iTransformer to capture long-term dependencies in stock prices or cryptocurrency values, leveraging the library’s ability to handle high-frequency data.
  • Supply Chain Optimization: Logistics companies can predict lead times and shipment volumes to optimize warehouse space and and reduce overstocking by training models on historical shipment data across multiple routes.

Contributing to NeuralForecast

The Nixtla team encourages community contributions to keep the library updated with the latest research. Most contribution-ready issues are tagged with good first issue or help wanted on GitHub.

The project follows a standard fork-and-pull workflow: fork the repository, create a feature branch, implement changes, and ensure all CI tests are green before submitting a pull request. Contributors are also encouraged to improve the documentation or report bugs via GitHub Issues. New model implementations are particularly welcome, as the library aims to be the most comprehensive collection of SOTA neural forecasting models.

Community and Support

NeuralForecast is part of the larger Nixtla ecosystem. Support is primarily handled through GitHub Discussions and the official documentation site. The community is active, and developers can find a variety of tutorials on Medium and Kaggle to see how the library is used in real-world competitions.

The documentation is comprehensive, covering everything from the core NeuralForecast class to the detailed API reference for every supported model. Because the library is built on PyTorch Lightning, users with a PyTorch background can easily dive into the source code to customize the model architectures.

Conclusion

NeuralForecast provides a professional-grade implementation of the most advanced neural forecasting techniques available today. By shifting the focus from local statistical models to scalable global neural networks, it allows organizations to handle massive datasets with unprecedented accuracy and efficiency.

While the library is an excellent choice for high-volume, complex time series data, it is important to remember that for very small datasets or extremely simple trends, traditional statistical models (available via StatsForecast) may still be more robust. The right choice depends on the balance between your data volume and the model complexity.

Star the repo, try the quickstart, and join the Nixtla community to start transforming your time series data into actionable forecasts.

What is NeuralForecast and what problem does it solve?

NeuralForecast is a Python library that provides scalable implementations of state-of-the-art neural forecasting models. It solves the problem of the high computational cost and limited predictive power of traditional local statistical models by allowing the use of global neural networks that learn across multiple time series simultaneously.

How do I install NeuralForecast?

You can install NeuralForecast using pip with the command pip install neuralforecast or via conda using conda install -c conda-forge neuralforecast. It is recommended to use a virtual environment for installation.

How does NeuralForecast compare to Darts?

While Darts is a general-purpose wrapper for many different forecasting libraries, NeuralForecast focuses exclusively on high-performance, native implementations of neural forecasting models. This makes it NeuralForecast generally faster and more specialized for deep learning-based time series analysis.

Can I use NeuralForecast for multivariate forecasting?

Yes, NeuralForecast can handle multivariate forecasting by incorporating exogenous variables. You can provide static covariates and historical or future exogenous variables to improve the model’s accuracy by adding them to the model’s futr_exog_list.

Does NeuralForecast support probabilistic forecasting?

Yes, it includes adapters for quantile losses and parametric distributions, allowing you to generate prediction intervals rather than just point forecasts.

What is the difference between a local model and a global model in NeuralForecast?

A local model is trained on a single time series, while a global model is a single neural network trained on multiple time series. NeuralForecast specializes in global models, which allow the model to learn shared patterns across different series to improve overall accuracy.

Is NeuralForecast open source?

NeuralForecast is open source and licensed under the Apache License 2.0, which allows for free use, modification, and distribution of the software.