Modular Bayesian Foundation Models: Bayesian time series encoders for OOD detection, routing and forecasting
Organizations: Department of Mathematics and Statistics McGill University · Hydro-Quebec
Abstract
Industrial systems continuously generate time series that vary in sampling frequency, scale, dynamics, and operating regime. Consequently a single time-series foundation model may not be able to represent all regimes effectively and retraining a large model for every new dataset or regime shift is computationally expensive. Modular foundation models address this issue by reusing specialised encoders trained on diverse datasets and by allowing the expansion of capabilities through the addition of new experts. This approach requires compact experts to minimize storage cost and a proper selection mechanism of experts for unseen data. We propose a modular foundation model framework that combines end-to-end Bayesian encoder training with uncertainty based routing. Using Singular Bayesian Neural Networks (SBNNs), we build a collection of compact Bayesian encoders whose epistemic uncertainty guides label-free selection. At the selected ranks, our Bayesian collection uses 63.8% less storage than its deterministic counterpart. We evaluate this framework on time-series data through distribution shift, encoder selection, and probabilistic forecasting. Across seven incoming datasets, uncertainty-based routing is competitive with distance-based routing in terms of forecast MSE, while reducing average ECE from 0.086 to 0.072 and average NLL from 0.907 to 0.836. It also increases PICP90 from 82.28% to 89.03%. In a separate model-family comparison, we evaluate the SBNN pipeline against full-rank Bayes by Backprop, deep ensembles, and MC Dropout. The SBNN pipeline achieves an average MSE of 0.390, comparable with 0.396 for deep ensembles, 0.389 for MC dropout, and 0.443 for the full-rank Bayesian model. It uses 63.9% fewer parameters than MC dropout, 81.9% fewer than the full-rank model, and 92.8% fewer than the deep ensemble.
Figures & tables
| Policy | Selection rule | Weights |
|---|---|---|
| Top- uncertainty | lowest source-normalized uncertainty ratios | Inverse-ratio |
| Top- distance | lowest source-distance scores | Inverse-distance |
| Source-diverse top- | Lowest-ratio encoder per source, then lowest ratios | Inverse-ratio |
| Random- , full pool | Sample encoders without replacement | Inverse-ratio |
| Random- , shortlist | Sample encoders without replacement | Uniform |
| Bottom- , shortlist | highest uncertainty ratios within the shortlist | Uniform |
| Family | MSE | ECE | NLL | PICP90 (%) | MPIW90 | Params (M) |
|---|---|---|---|---|---|---|
| SBNN | 1.759 | |||||
| Deterministic | 4.868 | |||||
| MC Dropout | 4.868 | |||||
| Full-rank BBB | 9.731 | |||||
| Deep ensemble (5) | 24.342 |
Appendix figures & tables25 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | Measured signal | Origin |
| Source datasets | ||
| Acoustic | Generator acoustic signal | Industrial partner |
| HAR | Human-activity signals | Public ( Reyes-Ortiz et al., 2013 ) |
| Torque45 | Shaft torque signal at 45% of maximum unit power | Industrial partner |
| ETT (ETTh1) | Transformer oil temperature | Public ( Zhou et al., 2021 ) |
| Incoming datasets | ||
| SBNN configuration | KL coefficient SBNN | KL coefficient Full-rank BBB | |
|---|---|---|---|
| Acoustic balanced | 0.1 | ||
| Acoustic lean | 0.1 | ||
| Acoustic counterpart | 0.1 | ||
| Acoustic strong variants (3 encoders) | 0.1 | ||
| Acoustic CNN | 0 | ||
| HAR variants (3 encoders) | 0.5 |
| Encoder configuration | Configured masking |
|---|---|
| Acoustic Transformer | Point fraction 0.05; span fraction 0.25 |
| HAR | Mask ratio 0.50 |
| ETT | Mask ratio 0.25 |
| Torque45 | Mask ratio 0 |
| Acoustic CNN | Mask ratio 0 |
| Family | Encoders | Head | Total |
|---|---|---|---|
| SBNN | 1,743,722 | 14,784 | 1,758,506 |
| Deterministic | 4,818,737 | 49,600 | 4,868,337 |
| MC Dropout | 4,818,737 | 49,600 | 4,868,337 |
| Full-rank BBB | 9,632,608 | 98,752 | 9,731,360 |
| Deep ensemble (5) | 24,093,685 | 248,000 | 24,341,685 |
| Method | Stored components |
|---|---|
| SBNN ( Toure and Stephens, 2026 ) | Means and scales of the low-rank weight factors; no retained dense weight matrix for the factorized layer. |
| Rank-1 BNNs ( Dusenberry et al., 2020 ) | Shared dense weight matrix and posterior parameters for multiplicative vectors. |
| SWAG ( Maddox et al., 2019 ) | Dense weight mean, diagonal variance statistics and retained low-rank covariance deviation vectors. |
| Low-rank Gaussian VI ( Tomczak et al., 2020 ) | Dense weight mean and low-rank covariance factors, with a fixed diagonal constant or a learned diagonal variance vector. |
| BLoB ( Wang et al., 2024 ) | Frozen dense backbone, one deterministic adapter factor, and the mean and scale of the other adapter factor. |
| Acoustic | ||||
|---|---|---|---|---|
| Model | MSE | ECE | PICP90 (%) | MPIW90 |
| Deterministic | 0.07613 | — | — | — |
| MC Dropout | 0.07613 | 0.3620 | 29.48 | 0.2880 |
| Deep ensemble (5) | 0.05515 | 0.3391 | 30.86 | 0.2865 |
| Full-rank BBB | 0.07492 | 0.1251 | 71.09 | 0.8453 |
| SBNN | 0.10601 | 0.0453 | 80.72 | 1.3125 |
| Model | MSE | ECE | PICP90 (%) | MPIW90 |
|---|---|---|---|---|
| Acoustic | ||||
| Deterministic | 0.07613 | — | — | — |
| MC Dropout | 0.07613 | 0.3620 | 29.48 | 0.2880 |
| Deep ensemble (5) | 0.05515 | 0.3391 | 30.86 | 0.2865 |
| Full-rank BBB | 0.07492 | 0.1251 | 71.09 | 0.8453 |
| SBNN (reconstruction) | 0.09097 | 0.0898 | 74.79 | 1.0428 |
| Torque45 encoder | Acoustic encoder | ETT encoder | ||||
|---|---|---|---|---|---|---|
| Dataset | ||||||
| Torque45 | 0.000 | 1.000 | 1.055 | 0.751 | 1.739 | 1.538 |
| Acoustic | 1.055 | 3.177 | 0.000 | 1.000 | 1.939 | 2.000 |
| HAR | 1.059 | 0.962 | 1.874 | 0.780 | 1.863 | 1.437 |
| ETT | 1.739 | 7.759 | 1.939 | 1.982 | 0.000 | 1.000 |
| WTH | 1.130 | 3.913 | 1.063 | 1.289 | 1.547 | 1.627 |
| Family | MSE | ECE | PICP90 (%) | MPIW90 |
|---|---|---|---|---|
| SBNN | 0.456 | 0.088 | 80.60 | 1.874 |
| Deterministic | 0.407 | — | — | — |
| MC Dropout | 0.392 | 0.341 | 32.77 | 0.363 |
| Deep ensemble (5) | 0.394 | 0.385 | 24.61 | 0.283 |
| Metric | Top-3 distance | Top-3 uncertainty |
|---|---|---|
| MSE | ||
| ECE | ||
| NLL | ||
| PICP90 (%) | ||
| MPIW90 |
| Policy | MSE | ECE | NLL | PICP90 (%) | MPIW90 |
|---|---|---|---|---|---|
| Torque10 | |||||
| Top-3 distance | |||||
| Top-3 uncertainty | |||||
| Torque90 | |||||
| Top-3 distance | |||||
| Top-3 uncertainty | |||||
| Reconstruction MSE | |||||||
| Policy | Torque10 | Torque90 | WTH | ETTh2 | ECL | Vibration | EMG |
| Top-3 uncertainty | 0.0015 | 0.0268 | 0.0134 | 0.0104 | 0.0184 | 0.0090 | |
| Top-4 uncertainty | 0.2069 | 0.1260 | 0.0832 | 0.1899 | 0.2602 | 0.0193 | 0.0098 |
| Source-diverse top-3 | 0.5247 | 0.3461 | 0.2405 | 0.5437 | 0.7143 | 0.0478 | 0.1360 |
| Source-diverse top-4 | 0.4926 | 0.3424 | 0.2060 | 0.4592 | 0.7136 | 0.1686 | 0.1226 |
| Random-4 of top-8 | 0.5989 | 0.4088 | 0.2092 | 0.6303 | 0.8713 | 0.0219 | 0.0079 |
| Reconstruction ECE | |||||||
| Policy | Torque10 | Torque90 | WTH | ETTh2 | ECL | Vibration | EMG |
| Top-3 uncertainty | 0.3752 | 0.2316 | 0.1669 | 0.1936 | 0.3404 | 0.2912 | 0.3451 |
| Top-4 uncertainty | 0.4044 | 0.2933 | 0.2173 | 0.2596 | 0.3752 | 0.2931 | 0.3432 |
| Source-diverse top-3 | 0.4660 | 0.4250 | 0.3649 | 0.4045 | 0.4531 | 0.3129 | 0.2775 |
| Source-diverse top-4 | 0.4568 | 0.4237 | 0.3001 | 0.3459 | 0.4529 | 0.3129 | 0.2566 |
| Random-4 of top-8 | 0.4688 | 0.4179 | 0.3065 | 0.4082 | 0.4506 | 0.2996 | 0.2759 |
| Forecasting ECE | |||||||
|---|---|---|---|---|---|---|---|
| Policy | Torque10 | Torque90 | WTH | ETTh2 | ECL | Vibration | EMG |
| Top-3 uncertainty | 0.0419 | 0.0195 | 0.0055 | 0.0874 | 0.0067 | 0.1378 | 0.2061 |
| Top-4 uncertainty | 0.0166 | 0.0327 | 0.0101 | 0.0643 | 0.0068 | 0.1345 | 0.2158 |
| Source-diverse top-3 | 0.0095 | 0.0326 | 0.0161 | 0.0485 | 0.0135 | 0.1273 | 0.2296 |
| Source-diverse top-4 | 0.0129 | 0.0401 | 0.0108 | 0.0514 | 0.0098 | 0.1240 | 0.2285 |
| Random-4 of top-8 | 0.0118 | 0.0345 | 0.0052 | 0.0593 | 0.0186 | 0.1171 | 0.2263 |
| Policy | MSE | ECE | PICP90 (%) | NLL | MPIW90 |
|---|---|---|---|---|---|
| Top- | |||||
| Top- | |||||
| Cutoff |
| Incoming dataset | Selected encoders |
|---|---|
| Torque10 | 3 |
| Torque90 | 3 |
| WTH | 6 |
| ETTh2 | 3 |
| ECL | 3 |
| Vibration | 10 |
Time-Series Foundation Models
Time-series foundation models are pretrained sequence models designed to transfer across forecasting, classification, anomaly detection, and other temporal tasks.
See all 303 papers