Skip to content

System Overview ​

This page explains how the repository is organized at a subsystem level.

Two layers ​

The repository contains two related but distinct layers:

  • foreblocks: the main forecasting library
  • foretools: auxiliary tools for generation, decomposition, and analysis

Core runtime path ​

The main foreblocks training flow is:

  1. prepare data as windows
  2. build a ForecastingModel
  3. train with Trainer
  4. evaluate with ModelEvaluator

Main subsystems ​

PathRole
foreblocks/kernelscompute tier — Triton/CUDA kernels, no nn.Module API surface
foreblocks/opstensor ops and execution dispatch on top of kernels/
foreblocks/nnreusable nn.Module primitives: attention config/variants/cache, transformer stack, blocks, heads, MoE, routing, sequence backbones, norms, embeddings, graph
foreblocks/modelsassembled models: forecasting.py (ForecastingModel), graph.py, baselines/ (NBEATS, Informer, …), kan/, anomaly/ (applications layer)
foreblocks/trainingTrainer, config, sampling, conformal prediction, optimization (LLRD, NAS)
foreblocks/evaluationModelEvaluator, benchmarking, metrics
foreblocks/studioStudio node/spec auto-discovery backend for apps/webui
foreblocks/processingpreprocessing, normalization, filtering, imputation, window creation
dartsneural architecture search and finalization workflow
foretoolssynthetic data generation, feature engineering, decomposition, BOHB search
mltrackerexperiment tracking support

Public API boundary ​

The stable starting point is the top-level import surface:

python
from foreblocks import ForecastingModel, Trainer, ModelEvaluator

That boundary is safer than importing deep internal modules unless you are extending the library itself.

Dependency graph ​

text
foreblocks (main)
├── foreblocks/kernels           — Triton/CUDA compute: attention/, mamba/, linear/, normalization/, activations/, graph/
├── foreblocks/ops                — tensor ops + dispatch on top of kernels/: attention/, mamba/
├── foreblocks/integrations       — optional external backends: fla/ (flash-linear-attention), softpick
├── foreblocks/nn                 — attention/, transformer/, blocks/, heads/, moe/, routing/, sequence/, normalization/, embeddings/, graph/
├── foreblocks/models
│   ├── forecasting.py            — ForecastingModel
│   ├── graph.py                  — GraphForecastingModel
│   ├── baselines/                — NBEATS, Informer, Autoformer, TimesNet, …
│   ├── kan/                      — Kolmogorov-Arnold Network
│   └── anomaly/                  — anomaly-detection applications layer
├── foreblocks/training           — Trainer, config, sampling, conformal, optimization (LLRD, NAS)
├── foreblocks/evaluation         — ModelEvaluator, benchmarking, metrics
├── foreblocks/quantization       — FakeQuantize, DynamicQuantizedLinear
├── foreblocks/studio             — Studio node/spec auto-discovery backend
├── foreblocks/processing         — TimeSeriesHandler, preprocessing, filtering
├── mltracker                     — Experiment tracking
└── darts (standalone)            — Neural architecture search

foretools (companion)
├── foretools/tsgen           — Synthetic time-series generation
├── foretools/bohb            — Bayesian hyperparameter search
├── foretools/decomposition   — emd/ (VMD, EMD-family), ewt/ (Empirical Wavelet Transform)
├── foretools/tsaug           — AutoDA augmentation
├── foretools/fengineer       — Feature engineering pipeline
├── foretools/foreminer       — Changepoint detection & mining
├── foretools/stats           — mutual information, distance correlation, HSIC, Bayesian Blocks binning
├── foretools/arima           — ARIMA model utilities
└── foretools/benchmarking    — benchmarking frameworks

Choosing where to start ​

Your goalStart here
Train a forecasting model from scratchGetting Started
Use raw [T, D] time-series dataPreprocessor Guide
Try different model architecturesTransformer Guide or DARTS Guide
Add uncertainty estimatesUncertainty Quantification
Search for a better architectureRun A DARTS Search
Generate synthetic test dataGenerate Synthetic Series

Design intent ​

The codebase is organized around modular composition:

  • model composition in ForecastingModel
  • backbone specialization in recurrent and transformer blocks
  • optional preprocessing before training
  • optional architecture search through DARTS
  • optional synthetic data generation in foretools

MIT License