---
title: 'PREIG: Physics-Informed GRU for Forecasting'
url: https://www.emergentmind.com/topics/preig
type: topic
---

# PREIG: Physics-Informed GRU for Forecasting

PREIG (Physics-informed and Reinforcement-driven Interpretable GRU) is a deep learning framework developed for commodity demand forecasting that integrates domain-specific economic constraints into a Gated Recurrent Unit (GRU) network via physics-informed principles and a hybrid, population-based optimization strategy. The central innovation is the enforcement of the negative price-demand elasticity—an economic law stating that demand should not increase with price—directly into the learning objective, ensuring interpretable and economically consistent predictions. PREIG is designed to handle high-dimensional, nonlinear, and non-stationary time series, and demonstrates improved predictive accuracy and interpretability relative to both traditional econometric models and standard deep learning baselines [2507.21710].

## 1. Core Motivation and Design Principles

PREIG addresses the challenge of accurate demand forecasting in commodity markets characterized by volatile dynamics and intricate nonlinear dependencies. Standard neural models may violate domain knowledge, such as the law of demand, leading to predictions that are plausible statistically but not economically interpretable. PREIG overcomes this by embedding a physics constraint—specifically, enforcing that the learned demand must not increase as price rises, mathematically encoded as $\partial\,\mathrm{demand}/\partial\,\mathrm{price}\leq 0$.

Two main architectural choices underpin PREIG:
- The use of a GRU recurrent network as its sequence modeling backbone, which enables the extraction of temporal features from high-dimensional inputs.
- The addition of a physics-informed custom loss, which penalizes any violation of negative price elasticity throughout training.

Furthermore, optimization is driven by a hybrid procedure: Population-Based Training (POP) orchestrates the joint evolution of model weights, learning rate, and physics loss weight, while each candidate is refined by both first-order (NAdam) and quasi-Newton (L-BFGS) methods.

## 2. Model Architecture and Physics-Informed Loss

### GRU Backbone

Let $x_t\in\mathbb{R}^d$ denote the input vector at time $t$ (including features such as price and macro/mesoeconomic indicators), and $h_{t-1}\in\mathbb{R}^H$ the previous hidden state. The GRU cell update equations are
\[
\begin{aligned}
z_t &= \sigma(W_z x_t + U_z h_{t-1} + b_z) \\
r_t &= \sigma(W_r x_t + U_r h_{t-1} + b_r) \\
\tilde{h}_t &= \tanh(W_h x_t + U_h (r_t \odot h_{t-1}) + b_h) \\
h_t &= (1 - z_t) \odot h_{t-1} + z_t \odot \tilde{h}_t
\end{aligned}
\]
where $W_*$, $U_*$, $b_*$ are learned parameters, $\sigma(\cdot)$ is the sigmoid, and $\odot$ is element-wise multiplication.

### Physics-Informed Neural Network (PINN) Principle

The output $f(x_{1:t};\theta)$ at time $t$ represents predicted demand; $p_t$ is the price component of $x_t$. The model computes $J_t = \partial f(x_{1:t};\theta)/\partial p_t$ through automatic differentiation. The economic constraint is $J_t \leq 0$ for all $t$.

### Composite Loss Function

The composite objective integrates two components:
1. **Data loss (MSE):**
   \[
   L_\mathrm{data}(\theta) = \frac{1}{N} \sum_{t=1}^N [f(x_{1:t};\theta) - y_t]^2
   \]
2. **Physics loss (elasticity constraint):**
   \[
   L_\mathrm{phys}(\theta) = \frac{1}{N} \sum_{t=1}^N \max(0, J_t)
   \]
3. **Total loss:**
   \[
   L_\mathrm{total}(\theta) = \lambda_1 L_\mathrm{data}(\theta) + \lambda_2 L_\mathrm{phys}(\theta)
   \]
$\lambda_1$ and $\lambda_2$ weight data fidelity vs. physics adherence.

## 3. Hybrid Optimization via Population-Based Training

PREIG employs a three-level optimization strategy:

### 3.1 Population-Based Training (POP)
A population of $M$ candidate models, each parameterized by $(\theta^k, \eta^k, \lambda_2^k)$ ($k=1\ldots M$), is simultaneously optimized. Each round involves:
- **Evaluation:** Inner-loop optimization using NAdam and L-BFGS for a fixed budget; compute validation losses.
- **Selection:** Retain the top $M/2$ models by validation performance.
- **Perturbation:** Clone and randomly perturb hyperparameters (model weights, learning rate $\eta$, physics weight $\lambda_2$) of top candidates to replace the bottom $M/2$.

### 3.2 NAdam First-Order Stage

Within each candidate, NAdam performs $L_1$ steps:
\[
\begin{aligned}
m_t &= \beta_1 m_{t-1} + (1-\beta_1)g_t \\
v_t &= \beta_2 v_{t-1} + (1-\beta_2)g_t^2 \\
\hat{m}_t &= m_t / (1-\beta_1^t),\quad \hat{v}_t = v_t / (1-\beta_2^t) \\
\theta_t &= \theta_{t-1} - \eta \frac{\beta_1\hat{m}_t + (1-\beta_1)g_t/(1-\beta_1^t)}{\sqrt{\hat{v}_t} + \epsilon}
\end{aligned}
\]
$g_t = \nabla_\theta L_\mathrm{total}$.

### 3.3 L-BFGS Quasi-Newton Refinement

After NAdam, each candidate is refined with $L_2$ L-BFGS steps, updating parameters using an approximate inverse Hessian constructed from recent gradients and steps:
\[
\theta_{t+1} = \theta_t - H_t \nabla_\theta L_\mathrm{total}(\theta_t)
\]
$H_t$ is built from histories $\{s_i, y_i\}$ where $s_i = \theta_i - \theta_{i-1}$ and $y_i = \nabla L(\theta_i) - \nabla L(\theta_{i-1})$.

## 4. Training Configuration and Datasets

The PREIG framework was benchmarked on monthly export volumes for Coal, Soybean, Crude Oil, and Iron Ore from December 2014 to December 2024 (121 months). The first 114 months were used for training; the final 6 for testing. Features included macroeconomic (exchange rate, commodity indices, GDP, etc.), mesoeconomic (energy/substitute prices, futures, shipping, inventories), and historical export lags (up to 64 months).

Key hyperparameters:
- GRU hidden size $H=64$
- Input window $T=64$
- Batch size 32; dropout 0.2
- Initial learning rate $\eta \in [10^{-3},\,5\times10^{-4}]$; evolved by POP
- NAdam parameters: $\beta_1=0.9$, $\beta_2=0.999$, $\epsilon=10^{-8}$
- Physics loss weight $\lambda_2 \in [0.1, 1.0]$ (POP-evolved)
- Inner optimization: $L_1=2000$ NAdam steps, $L_2=100$ L-BFGS steps
- POP population $M=8$, $T_\mathrm{pop}=10$ rounds

Convergence typically occurs in approximately 2200 steps, with total training on a single NVIDIA RTX 2080 Ti taking 25–30 minutes per POP sweep.

## 5. Empirical Performance and Interpretability

### 5.1 Quantitative Results

Test-set performance for the four commodities (lower is better):

| Model | Soybean (RMSE) | Coal (RMSE) | Crude Oil (RMSE) | Iron Ore (RMSE) |
|-------|---------------|-------------|------------------|-----------------|
| ARIMA | 300.20        | 3.34        | 774.86           | 8336.04         |
| GARCH | 366.80        | 1.87        | 478.50           | 5453.20         |
| BPNN  | 276.74        | 1.46        | 240.79           | 2701.40         |
| RNN   | 197.37        | 0.51        | 164.82           | 922.49          |
| GRU   | 143.82        | 0.24        | 89.53            | 627.95          |
| PREIG | 154.55        | 0.22        | 104.94           | 685.23          |

PREIG reduces coal RMSE to 0.22 (vs. 0.24 for GRU), and coal MAPE to 0.52% (vs. 0.55% for GRU), achieving top-tier accuracy across all series.

### 5.2 Physics Consistency

For every test time step $t$, the condition $J_t = \partial f/\partial p_t \leq 0$ holds, guaranteeing negative elasticity. In coal, $J_t$ averaged $-0.012$ (std 0.003) across test months, resulting in a zero physics-loss penalty—demonstrating that outputs are by construction aligned with the economic constraint.

## 6. Scalability, Limitations, and Future Extensions

### Scalability

The additional backward pass to compute the PINN gradient $\partial f/\partial p$ scales linearly with GRU hidden size $H$ and sequence length $T$. POP candidates are independent and suitable for parallelization on multiple GPUs. The architecture accommodates inputs with $d>200$ features and look-back windows of $T>200$ with modest cost increases.

### Limitations

Currently, PREIG enforces only univariate price elasticity; cross-price and income elasticities are not modeled. POP introduces computational overhead due to multiple concurrent candidates, potentially impeding real-time adaptation. Storing gradient histories for L-BFGS elevates memory requirements.

### Potential Extensions

- Imposition of multivariate PDE-style constraints, e.g., cross-elasticity matrices $\partial^2 f /\partial p_i \partial p_j$
- Replacement of L-BFGS with stochastic quasi-Newton methods (e.g., oLBFGS) for lower algorithmic overhead
- Integration of attention mechanisms to dynamically weight features (macro, meso, historical)
- Extension to multivariate outputs for joint forecasting of multiple commodities with shared physics constraints

By embedding a hard economic rule within a recurrent neural forecasting architecture and leveraging a hybridized optimization scheme, PREIG delivers both interpretability and state-of-the-art predictive performance for high-dimensional commodity demand forecasting [2507.21710].

Source: https://www.emergentmind.com/topics/preig