使用 IBM Granite 时间序列模型进行集成预测
原题Ensemble forecasting with IBM Granite time-series models
读前速览
Granite Timeseries Ensemble 将 4 种互补的预测架构结合起来,无需选择模型或重新训练,即可提供稳健且高精度的预测。
模型多样性
集成模型包含 4 种不同架构(Patch Transformer、状态空间模型和 MLP 混合器),能够捕捉广泛的时间动态,并降低特定模型误差带来的风险。
聚合方法
该方法采用两种主要的聚合策略:概率集成(均匀加权)和 IQR 集成(根据预测分布范围自适应加权),因此能够灵活适应不同的数据特征。
基准测试表现
在 GIFT-Eval 基准测试中,该集成模型的表现显著优于单个成员模型,MASE 和 CRPS 值更低,表明其预测准确性和校准效果更佳。
完整摘要
Granite Timeseries Ensemble 通过汇总 4 个不同模型的预测结果,简化了时间序列预测:PatchTST-FM-r1、PatchTST-FM-r2、FlowState-r1.1 和 TTM-r3。该方法利用各架构的优势提升整体准确性与可靠性,并通过统一接口提供点预测和分位数预测。
目录 · 11 节
四款开放的 Granite 模型、一个可扩展的预测接口,让你不必再猜该用哪款模型。Four open Granite models, one extensible forecasting interface, and less guesswork about which model to use.
预训练时间序列模型无需使用你的数据集进行训练即可进行预测,但你仍然需要选择一个模型。擅长处理平滑工业信号的模型,可能难以应对噪声较大的零售需求或较长的季节性预测跨度;最佳选择取决于时间序列本身和具体任务。Pre-trained time-series models can forecast without training on your dataset, but you still have to choose one. A model that handles smooth industrial signals well may struggle with noisy retail demand or a long seasonal horizon, and the best choice depends on the series and the task.
Granite Timeseries Ensemble 将这一选择简化为一个合理的默认方案。一个配方结合四种互补的 Granite 架构,并返回中位数和分位数预测,无需重新训练,也无需拟合集成权重。首先使用概率集成(均匀概率池化),再与自适应四分位距(IQR)集成进行比较,并通过兼容的预测器扩展同一接口。该集成配方及其默认 Granite 成员均采用宽松许可证授权。Granite Timeseries Ensemble reduces that choice to a sensible default. One recipe combines four complementary Granite architectures and returns median and quantile forecasts, with no retraining and no fitted ensemble weights. Start with the Probabilistic Ensemble (uniform probability pooling), compare the adaptive Inter Quartile Range (IQR) Ensemble, and extend the same interface with compatible forecasters. The ensemble recipe and its default Granite members are permissively licensed.
这个概念在天气预报中并不陌生。集合预报会探索各种可能的结果,北美多模式集合等系统则会结合不同模型进行季节预测。时间序列预测也能以类似方式受益:互补的模型从不同角度展望未来,而集成则将这些观点融合成一份预测。The idea will be familiar from weather forecasting. Ensemble forecasts explore a range of possible outcomes, and systems such as the North American Multi-Model Ensemble combine different models for seasonal prediction. Time-series forecasting benefits in a similar way: complementary models offer different views of what comes next, and an ensemble merges those views into one forecast.
试用 Granite 时间序列集成模型 Try Granite Timeseries Ensemble
安装 Granite TSFM,并直接从 Hugging Face 加载推荐的四模型方案:Install Granite TSFM and load the recommended four-model recipe directly from Hugging Face:
pip install "granite-tsfm>=0.3.11"
import pandas as pd
from tsfm_public.models.ensemble.modeling_ensemble import QuantileEnsembleForecaster
df = pd.read_csv(
"https://raw.githubusercontent.com/zhouhaoyi/ETDataset/main/ETT-small/ETTh1.csv",
parse_dates=["date"],
)
ensemble = QuantileEnsembleForecaster.from_pretrained(
"ibm-granite/granite-timeseries-ensemble-r1",
)
result = ensemble(
df.tail(1024),
timestamp_column="date",
target_columns=["OT"],
context_length=1024,
prediction_length=24,
)
print(result.prediction_outputs) # point forecast
print(result.quantile_outputs) # quantiles
该配方保存的是集成配置,而不是合并后的模型权重。它会在运行时下载四个成员检查点,因此首次运行时请预留更多时间。完整配置、成员检查点、评估详情和限制请参阅模型卡。The recipe stores the ensemble configuration rather than merged model weights. It downloads the four member checkpoints at runtime, so allow extra time for the first run. For the full configuration, member checkpoints, evaluation details, and limitations, see the model card.
result.prediction_outputs 包含点预测,而 result.quantile_outputs 包含分位数预测,默认范围为 0.1 到 0.9。应用可以将点值用作中心预测,并使用选定的分位数表示预测范围。例如,0.1 和 0.9 分位数定义了一个名义覆盖率为 80% 的中心预测区间。result.prediction_outputs contains the point forecast, while result.quantile_outputs contains the quantile predictions which by default range from 0.1 to 0.9. Applications can use the point value as a central prediction and selected quantiles to express forecast ranges. For example, the 0.1 and 0.9 quantiles define a central forecast interval with nominal 80% coverage.
集成成员 The ensemble members
默认配置将四个采用不同架构的预训练 Granite 模型组合在一起:The default recipe combines four pre-trained Granite models with different architectures:
| Model | Architecture |
|---|---|
| Granite PatchTST-FM-r1 | Patched Transformer |
| Granite PatchTST-FM-r2 | Patched Conformer |
| Granite FlowState-r1.1 | State-space model |
| Granite TTM-r3 | Tiny Time Mixers (MLP mixer) |
有关背景信息,请参阅 PatchTST-FM-r1 论文、PatchTST-FM-r2 架构概述、FlowState 论文和 Tiny Time Mixers 论文。For background, see the PatchTST-FM-r1 paper, PatchTST-FM-r2 architecture overview, FlowState paper, and Tiny Time Mixers paper.
这些架构以不同方式捕捉趋势、季节性和局部变化,因此它们的误差未必会一致。一篇回顾了预测组合发展历程 50 年的综述指出,组合预测可以降低选错单一模型的风险,同时强调各模型的质量和多样性仍然重要。These architectures capture trends, seasonality, and local variation in different ways, so their errors need not coincide. A 50-year review of forecast combinations describes how combining forecasts can reduce the risk of picking the wrong single model, while stressing that member quality and diversity still matter.
合并预测的两种方法 Two ways to combine the forecasts
每个成员都会输出分位数预测。两种主要方案采用不同规则,将这些预测转换为一个预测分布及其中位数。Each member returns quantile forecasts. The two main recipes use different rules to turn those forecasts into one predictive distribution and its median.
概率集成:推荐的默认选项 Probabilistic Ensemble: the recommended default
概率集成(均匀概率池化)让每个成员具有同等影响力,在概率空间中合并它们的分位数预测,并从合并后的数值中提取所需的分位数。由于权重固定,对新序列无需进行拟合,也无需调优加权超参数。The Probabilistic Ensemble (uniform probability pooling) gives each member equal influence, pools their quantile forecasts in probability space, and extracts the requested quantiles from the combined values. Because the weights are fixed, there is no fitting step and no weighting hyperparameters to tune for a new series.
预测组合难题提供了一个很好的动机:在点预测中,简单的等权组合往往表现不逊于采用估计权重的方法。这一做法将同样的等影响力理念应用于概率预测。它是上文示例中默认加载的方案。The forecast combination puzzle offers useful motivation: in point forecasting, simple equal-weight combinations have often held up well against methods with estimated weights. This recipe applies the same equal-influence idea to probabilistic forecasts. It is the default loaded in the example above.
IQR 集成:一种自适应替代方案 IQR Ensemble: an adaptive alternative
IQR 集成根据各成员的预测区间宽度赋予权重,区间越窄,影响力越大。它利用最接近第 25 和第 75 百分位数的可用分位数,近似计算各成员的四分位距。权重会随样本、目标变量和预测步长而变化;与概率集成一样,不会根据历史预测误差拟合任何内容。等渗回归可防止合并后的分位数发生交叉。The IQR Ensemble weights members according to their forecast spread, giving narrower intervals greater influence. It approximates each member’s interquartile range from the closest available quantiles around the 25th and 75th percentiles. Weights vary by sample, target, and horizon step, and like the Probabilistic Ensemble, nothing is fitted from historical forecast errors. Isotonic regression keeps the combined quantiles from crossing.
区间更窄并不一定意味着预测更准确或校准得更好,按 IQR 加权也可能偏向过度自信的成员。如果你想尝试,该方案提供了温度设置(值越高,权重越趋于均匀)以及单个成员权重的可选上限。A narrower interval does not necessarily mean a more accurate or better-calibrated forecast, and IQR weighting can favor an overconfident member. If you want to experiment, the recipe exposes a temperature setting (higher values move the weights toward uniform) and an optional cap on any single member's weight.
只需更改子文件夹即可加载已评估的 IQR 配方:Load the evaluated IQR recipe by changing only the subfolder:
ensemble = QuantileEnsembleForecaster.from_pretrained(
"ibm-granite/granite-timeseries-ensemble-r1",
subfolder="recipes/granite-iqr",
)
我应该使用哪种方法? Which method should I use?
| Your goal | Start with | Why |
|---|---|---|
| A simple default | Probabilistic Ensemble | Equal influence, no fitted weights |
| Adaptive weighting based on forecast spread | IQR Ensemble | Influence varies with each member's predicted spread |
从概率集成开始。如果预测离散程度对你的应用有参考价值,可以用有代表性的数据将 IQR 集成与其进行比较,因为准确性和校准效果取决于时间序列和预测时域。Start with the Probabilistic Ensemble. If forecast spread looks informative for your application, compare the IQR Ensemble against it on representative data, since accuracy and calibration depend on the series and the horizon.
集成模型的表现是否优于其组成成员? Does the ensemble improve on its members?
我们在 97 种 GIFT-Eval 数据集配置上评估了这两种方案。模型在未经微调的情况下进行预测,且未使用测试目标来选择或拟合聚合方法。此处我们将官方集成提交结果与四个组成模型进行比较,采用的是截至 2026 年 10 月 20 日记录的已发布排行榜得分和排名。We evaluated both recipes on 97 GIFT-Eval dataset configurations. The models forecast without fine-tuning, and test targets were not used to select or fit the aggregation method. Here we compare the official ensemble submission results with the four constituent models, using published leaderboard scores and ranks captured on 20 October 2026.
GIFT-Eval 对点预测报告 MASE,对概率预测报告 CRPS/MWQL(基准的 mean_weighted_sum_quantile_loss 指标)。分数以季节性朴素法(Seasonal Naive)为基准进行归一化,并在各配置间取几何平均。分数越低越好。GIFT-Eval reports MASE for point forecasts and CRPS/MWQL (the benchmark's mean_weighted_sum_quantile_loss metric) for probabilistic forecasts. Scores are normalized to Seasonal Naive and geometrically averaged across configurations. Lower is better.
| Forecast | MASE ↓ | MASE Rank ↓ | CRPS / MWQL ↓ | CRPS Rank ↓ |
|---|---|---|---|---|
| Granite Ensemble R1 — Prob | 0.683★ | 47.175★ | 0.471 | 50.948 |
| Granite Ensemble R1 — IQR | 0.684 | 48.773 | 0.471 | 47.619★ |
| Granite PatchTST-FM-r2 | 0.685 | 51.371 | 0.467★ | 48.918 |
| Granite FlowState-r1.1 | 0.701 | 66.474 | 0.490 | 69.485 |
| Granite PatchTST-FM-r1 | 0.717 | 74.794 | 0.488 | 68.134 |
| Granite TTM-r3 | 0.724 | 83.062 | 0.520 | 88.959 |
★ 在所示预测中性价比最高。数值越低越好。★ Best value among the forecasts shown. Lower is better.
Rank 列表示每种配置相对于完整 GIFT-Eval 参考排行榜的平均排名,而不仅仅是这六项预测的排名,因此随着新条目加入排行榜,排名数值可能会发生变化。Rank columns average per-configuration ranks against the full GIFT-Eval reference leaderboard, not just these six forecasts, so rank values can shift as entries are added to the leaderboard.
两个集成模型在汇总 MASE 和平均 MASE 排名上均优于四个单独成员。概率集成在这六种预测方案中的 MASE 最低:为 0.683,而 PatchTST-FM-r2 为 0.685。平均 MASE 排名越低,表明在 GIFT-Eval 的多样化数据集配置中,相对点预测性能越强。综合来看,这些结果表明,集成模型是一个实用的起点,无需开发者预先选定表现最强的单一架构。它相较于最佳单一成员的 MASE 优势虽小,但主要收益在于稳健性:即使事先不知道哪种架构适合自己的数据,也能获得相当或更高的汇总准确率。Both ensembles outperform all four individual members on aggregate MASE and average MASE Rank. The Probabilistic Ensemble achieves the lowest MASE among these six forecasts: 0.683 compared with 0.685 for PatchTST-FM-r2. Lower average MASE Rank indicates stronger relative point-forecast performance across GIFT-Eval’s diverse dataset configurations. Together, these results support the ensemble as a practical starting point, without requiring developers to select the strongest individual architecture in advance. The MASE margin over the best single member is small, so the main benefit is robustness: you get comparable or better aggregate accuracy without knowing in advance which architecture will suit your data.
PatchTST-FM-r2 的综合 CRPS/MWQL 得分仍然最低。在这六种预测中,IQR Ensemble 的平均 CRPS 排名最低,而 Probabilistic Ensemble 在该指标上的排名落后于 PatchTST-FM-r2。因此,综合误差和平均排名指向了不同的选择。PatchTST-FM-r2 retains the lowest aggregate CRPS/MWQL score. The IQR Ensemble achieves the lowest average CRPS Rank among these six forecasts, while the Probabilistic Ensemble ranks behind PatchTST-FM-r2 on that measure. Aggregate error and average rank therefore favor different choices.
在 2026 年 10 月 20 日的对比中,集成方案在符合资格的系统中,MASE Rank 和 CRPS Rank 均排名第 3。下图按各项指标展示了两种配方以及排名前十的符合资格参考系统。部分系统(包括因经过微调或许可协议不够宽松而被排除的条目)得分高于任一种配方,因此集成方案的价值不在于登顶排行榜,而在于无需挑选成员模型,只需使用一个默认方案,就能在众多时间序列上获得出色且稳定的结果。In the 20 October 2026 comparison, the ensemble approach ranks 3rd among eligible systems on MASE Rank and CRPS Rank. The figure below shows both recipes alongside the ten best eligible reference systems per metric. Some systems, including entries excluded as fine-tuned or non-permissively licensed, score better than either recipe, so the value of the ensemble is not that it tops the leaderboard. It is that a single default delivers strong, consistent results across many series without requiring you to choose a member.
图:截至 2026 年 10 月 20 日的 GIFT-Eval 平均排名,展示了两个 Granite 集成模型,以及每项指标中排名前十的合格参考系统。合格系统须提供复现代码,且未声明存在测试数据泄漏;微调条目以及已知采用非宽松许可证或存在成员依赖的系统均不纳入。排名数值直接取自已发布的总榜快照;筛选只会改变展示哪些系统,不会改变其排名数值。Figure: GIFT-Eval average-rank standings on 20 October 2026, showing both Granite ensembles alongside the ten best eligible reference systems per metric. Eligible systems have replication code and no declared test-data leakage; fine-tuned entries and systems with known non-permissive licenses or member dependencies are excluded. Rank values are taken directly from the published overall leaderboard snapshot; filtering changes which systems are displayed, not their rank values.
将此方案扩展到其他预测器 Extend the recipe to other forecasters
默认配置使用四个 Granite 模型,但通用的 Forecaster 接口也接受兼容的外部模型。你可以调整成员组合或聚合方法,同时保持下游预测格式不变,无需合并或重新训练成员检查点。这样更容易将集成模型融入现有的预测系统,并随着需求变化,添加适合你所在领域的预测器。The default recipe uses four Granite models, but the common Forecaster interface also accepts compatible external models. You can change the member mix or the aggregation method and keep the same downstream forecast format, with no merging or retraining of member checkpoints. That makes it easier to fit the ensemble into an existing forecasting stack, and to add forecasters suited to your domain as your needs evolve.
该代码库还包含扩展配方,其中新增了 IBM Research 的检查点。这些检查点受单独的许可条款约束,包括非商业用途和研究用途限制,因此使用前请查看每个模型的模型卡。The repository also includes expanded recipes that add IBM Research checkpoints. These carry separate license terms, including non-commercial and research-use restrictions, so review each member's model card before using them.
对于任何新的组合,都要检查预测兼容性、准确性、校准度、延迟和许可情况。For any new combination, check forecast compatibility, accuracy, calibration, latency, and licensing.
评估适合您应用程序的配方 Evaluate the recipe for your application
GIFT-Eval 是一个覆盖面广的基准测试,但总体性能提升并不意味着每个时间序列都能受益,平均排名也无法证明模型校准良好。要了解这些方案在你的应用中表现如何,最好的方法是在具有代表性的数据上对它们进行回测:GIFT-Eval is a broad benchmark, but aggregate gains don’t mean every series benefits, and average ranks don’t establish calibration. The way to find out how the recipes behave for your application is to backtest them on representative data:
- 使其与你的使用场景相匹配。使用历史预测窗口,确保其反映每个预测起点时可用的数据、你所需的预测期限,以及你预计要服务的时间序列。Match your use case. Use historical forecast windows that reflect the data available at each forecast origin, the horizon you need, and the series you expect to serve.
- 确保比较对象一致。在相同窗口上运行 Probabilistic Ensemble、IQR Ensemble 和一个表现强劲的单模型成员(如 PatchTST-FM-r2)。Compare like with like. Run the Probabilistic Ensemble, the IQR Ensemble, and a strong individual member (such as PatchTST-FM-r2) on the same windows.
- 不要只看点误差。除 MASE 外,还要评估分位数损失,并检查 0.1 至 0.9 区间的经验覆盖率是否达到其名义上的 80%。Look beyond point error. Assess quantile loss alongside MASE, and check the empirical coverage of the 0.1 to 0.9 interval against its nominal 80%.
- 衡量成本。记录运行时间和内存使用情况,以判断对于你的工作负载而言,组合四个模型带来的收益是否值得付出相应代价。Measure the cost. Record runtime and memory use to judge whether the benefit of combining four models justifies it for your workload.
请牢记两个局限。当前方案独立预测多变量通道,不利用通道间信息;同时会加载四个成员模型的检查点,相较于单个成员,会增加推理时间和内存占用。各成员的上下文长度限制、预测时域、预处理方式和缺失值处理也各不相同;此外,任何一种聚合方法都无法保证预测结果经过校准,或能在分布偏移时保持稳健,因此部署后仍需持续监控预测结果。Keep two limitations in mind. The current recipe forecasts multivariate channels independently, without using cross-channel information, and it loads four member checkpoints, which increases inference time and memory relative to a single member. Member context limits, horizons, preprocessing, and missing-value handling also differ, and neither aggregation method guarantees calibration or robustness under distribution shift, so keep monitoring forecasts after deployment.
在你的数据上试试 Try it on your data
建议的起点是默认的四模型方案:The recommended starting point is the default four-model recipe:
- Hugging Face 上的 Granite 时间序列集成模型
- 入门指南笔记本
- Granite TSFM 仓库
- GIFT-Eval 基准测试
加载默认配方,即可通过一次调用获取所有四种 Granite 架构的中位数和分位数预测,并根据需求变化调整配方。Load the default recipe to get median and quantile forecasts from all four Granite architectures in one call, and adapt the recipe as your needs evolve.
参考文献 References
- ECMWF:集合天气预报
- NOAA:北美多模式集合预报模型
- FlowState:采样率等变的时间序列预测
- 微型时间混合器(TTM):用于增强多变量时间序列零样本/少样本预测的快速预训练模型
- 重新审视通用 Transformer:解构时间序列基础模型的强基线
- 预测组合:五十余年的回顾
- 史密斯和沃利斯(2009):《对预测组合之谜的简单解释》
