L1 Meta Ensembling
Relevant source files
The following files were used as context for generating this wiki page:
L1 Meta Ensembling represents the second layer of the ZINC-Fusion V15 hierarchical ensemble architecture. Its primary objective is to act as a "meta-learner" that determines the optimal weighting and trust levels for various base models across different time horizons. By combining the probabilistic outputs of the L0 Core models with the domain-specific intelligence of L0 Specialists, the L1 layer produces a unified, high-conviction forecast that serves as the foundation for downstream calibration and risk analysis.
The system utilizes a stacked ensembling approach, where four distinct meta-learners are trained—one for each target horizon (5d, 21d, 63d, and 126d). This ensures that the ensembling logic is specifically tuned to the unique market dynamics and signal decay associated with different forecasting windows.
Sources: README.md:16-24, README.md:120-121
Architecture and Components
The L1 Meta layer sits between the base signal generation (L0) and the conformal calibration (L2). It is designed to mitigate individual model biases and leverage the strengths of specialized predictors in varying market regimes.
Hierarchical Position
In the v3 architecture, the pipeline follows a strict dependency order:
- L0 Core: Generates base probabilistic multi-step forecasts.
- L0 Specialists: Generate horizon-agnostic domain signals (e.g., Crush, China, FX).
- L1 Meta: Stacks Core Out-of-Fold (OOF) predictions and Specialist signals.
Sources: README.md:120-140, README.md:204-215
Data Flow Overview
The L1 Meta learner consumes data from multiple schemas within the Prisma Postgres database to form its training and inference matrices.
This diagram illustrates the convergence of L0 outputs into the L1 training matrix.
Sources: README.md:144-149, README.md:204-215
Input Requirements and Integrity
The L1 Meta learner relies on three primary categories of input data to make informed weighting decisions.
Input Matrix Composition
The training.meta_inputs_1d table is the authoritative source for L1 training. It includes:
- Core OOF Predictions: Out-of-fold predictions (p30, p50, p70) from the L0 Core models to prevent data leakage during stacking.
- Specialist Signals: Signal values and confidence scores from the "Big-11" specialist buckets.
- Regime/Calendar Features: Temporal context such as seasonality and market volatility regimes.
Sources: README.md:146-150, README.md:205-207
Stacking Discipline (Hard Rules)
To ensure the statistical validity of the ensemble, the following rules are enforced:
| Rule | Description |
|---|---|
| OOF Integrity | Meta must train ONLY on out-of-fold Core predictions to avoid overfitting/leakage. |
| Monotonicity | Quantile uncertainty ranges must widen as horizons increase; narrowing ranges indicate model failure. |
| Regime-Block CV | Validation folds use regime blocks (e.g., macro eras) with embargo windows around boundaries. |
Sources: README.md:152-153, README.md:225-231, cubic.yaml:148-155
Technical Implementation
The L1 Meta layer is implemented as a series of Python-based stacked ensembles managed by the root ML pipeline.
Model Catalog and Storage
L1 Meta models are trained per horizon and stored as artifacts. The resulting predictions are persisted into production tables for dashboard consumption.
- Training Script:
src/fusion/core_training/train_models.py(referenced for the zoo of models). - Output Tables:
forecasts.production_{H}d_1d(where H ∈ {5, 21, 63, 126}). - Registry: Models are registered in
model.model_registrywith metrics and versioning.
Sources: README.md:210-213, README.md:267-270, AGENTS.md:68-71
Quantile Policy
The L1 Meta layer operates on a specific quantile contract to support probabilistic forecasting:
- Stacking Quantiles: [0.30, 0.50, 0.70].
- Constraint: L1 must enforce a "quantile crossing guardrail" where $p30 \leq p50 \leq p70$.
Sources: README.md:126-128, README.md:162-164
Downstream Consumption
The outputs of the L1 Meta learner (from the model.meta_ensemble table) are consumed by the L5-C Synthesis Engine to generate natural language market posture summaries.
# Example of loading L1 Meta outputs for synthesis
# Source: scripts/generate_synthesis.py:82-95
def load_forecast_data(conn, horizon: int) -> Dict:
"""Load latest meta-ensemble forecast for horizon."""
with conn.cursor() as cur:
cur.execute(
"""
SELECT as_of_date, p10, p50, p90
FROM "model"."meta_ensemble"
WHERE horizon = %s
ORDER BY as_of_date DESC
LIMIT 1
""",
(horizon,),
)
row = cur.fetchone()
# ... logic to return p10, p50, p90
Sources: scripts/generate_synthesis.py:82-105
Specialist Integration
The meta-learner's power comes from its ability to integrate the 11 specialists. The L1 layer learns to adjust weights based on the confidence scores provided by these specialists.
| Specialist Bucket | Input to L1 |
|---|---|
| Crush / China | Demand outlook and competition z-scores. |
| Tariff / Trump Effect | Event intensity and policy risk scores. |
| Biofuel / Energy | Policy pressure and energy spillover momentum. |
| Volatility / FX | Regime conditioning and currency pressure indices. |
Sources: AGENTS.md:88-100, README.md:58-62
Summary
L1 Meta Ensembling is the intelligence-layer of the ZINC-Fusion pipeline that synthesizes base predictions and domain-specific signals. By enforcing strict OOF discipline and quantile monotonicity, it ensures that the resulting forecasts are not only statistically robust but also contextually aware of market regimes. The outputs of this layer directly inform the calibration and risk engines, ultimately providing the data-driven basis for institutional procurement decisions.