Papers
Topics
Authors
Recent
Search
2000 character limit reached

Differentiable Black-box & Gray-box Modeling

Updated 20 January 2026
  • Differentiable black-box and gray-box modeling are frameworks that leverage gradient-based learning to capture system dynamics, with gray-box models integrating known physical laws.
  • Black-box models offer maximal flexibility at the risk of poor extrapolation, while gray-box models embed domain constraints to enhance data efficiency and interpretability.
  • Both paradigms utilize end-to-end differentiability, enabling joint optimization through components like neural networks, differential equation solvers, and signal processing modules.

A differentiable black-box model is a parametrized mapping—typically a deep neural network—that learns an unknown system or operator purely from data, with no imposed structural or physical constraints beyond those implicit in the class of functions chosen and the differentiability of all network operations. In contrast, a differentiable gray-box model embeds domain or mechanistic knowledge into its structure, constraining or augmenting part of the mapping by known relationships, while using trainable differentiable components for unknown or intractable terms. Both paradigms exploit end-to-end differentiability to enable efficient gradient-based learning, inference, and (in some settings) backpropagation through dynamical simulators, PDE solvers, or control loops, but differ fundamentally in the degree of inductive bias imposed by prior knowledge.

1. Formal Definitions and Distinction of Black-Box and Gray-Box Modeling

A differentiable black-box model learns a function or operator FθF_\theta from input xx (possibly with controls or parameters cc), producing output y^=Fθ(x,c)\hat{y} = F_\theta(x, c), where FθF_\theta is parameterized by a composition of differentiable functions—usually layers of DNNs, GPs, or residual operators. No domain structure, physics, or constraints are imposed on FθF_\theta itself. This approach underlies neural ODEs, end-to-end sequence models, differentiable audio effect chains, PDE right-hand side learners, and differentiable surrogates for black-box simulators (Lee et al., 2022, Florio et al., 2023, Shirobokov et al., 2020, Comunità et al., 20 Feb 2025, Comunità et al., 17 Feb 2025).

A differentiable gray-box model explicitly decomposes the mapping, enforcing part of the structure by known domain components (e.g., physical law, analytic modules, explicit state-space block, or closure), and learns only the unknown terms. Canonically, a gray-box PDE model writes

bt=Dbxx+CHML(b,bx,s,sx,)\frac{\partial b}{\partial t} = D\, b_{xx} + CH_{\rm ML}(b, b_x, s, s_x, \ldots)

with fixed coefficient DD representing known diffusion and a learned ML component CHMLCH_{\rm ML} for the unresolved chemotactic flux (Lee et al., 2022). In audio, a gray-box effect model composes a chain of known DSP blocks (biquad filters, static nonlinearities), only learning parametric controllers or missing components (Comunità et al., 17 Feb 2025, Comunità et al., 20 Feb 2025). In robotics, gray-box approaches embed the full Lagrangian or Newton–Euler rigid-body structure and learn only unmodeled forces or kinematics (Lutter et al., 2020, Gupta et al., 2019).

The general principle is:

  • Black-box: No mechanistic prior, maximal flexibility, potential for poor extrapolation or lack of interpretability.
  • Gray-box: Hardwire known mechanisms; only learn what is not analytically tractable, resulting in better inductive bias, data efficiency, interpretation, and often improved out-of-distribution reliability.

2. Model Construction and End-to-End Differentiability

Both black-box and gray-box models are constructed using differentiable primitives, ensuring all outputs are smooth with respect to their parameters and (in the case of dynamic models) current states or controls. This enables backpropagation through all pipeline components—including finite-difference derivatives, neural network blocks, GP regressors, time integrators (RK4, Dormand–Prince), and even Newton solvers for system-scale simulations.

General Black-box Pipeline

  • Define the input-output mapping (sequence→sequence, PDE RHS, ODE evolution, audio effect, etc).
  • Parametrize a universal function approximator FθF_\theta or operator BMLB_{\rm ML}.
  • Compute loss w.r.t. ground truth or system observations (typically mean-squared, L1, or spectral losses).
  • Backpropagate using AD frameworks; update θ\theta with optimizers (e.g., Adam, L-BFGS).
  • For dynamic systems, differentiate through unrolled integrators or collocation-based constrainers (Lee et al., 2022, Florio et al., 2023, Comunità et al., 20 Feb 2025).

General Gray-box Pipeline

  • Partition the system: Ffull=Fknown+FunknownF_{\rm full} = F_{\rm known} + F_{\rm unknown}, or more generally F=Fhardwired(x,θwb)+FML(x,θ)F = F_{\rm hardwired}(x, \theta_{\rm wb}) + F_{\rm ML}(x, \theta).
  • For the known part, either code explicit operators (e.g., Newton–Euler dynamics, PDE terms, filters, ODEs) or supply analytic Jacobians/gradients as needed.
  • For the learned part, use differentiable ML models (NN, GP, etc).
  • Compose both known and unknown parts inside a differentiable graph; propagate all derivatives for joint optimization of analytic and learned parameters.
  • Losses, regularization, and physics-informed constraints can be enforced end-to-end in the computational graph (Lutter et al., 2020, Lee et al., 2022, Gupta et al., 2019, Agarwal et al., 2024, Mercère et al., 2014).

For example, the differentiable gray-box chemotactic PDE learning framework computes finite-difference spatial stencils via TensorFlow ops, applies a neural or GP closure, and time-steps the evolved solution with differentiable Runge–Kutta or Dormand–Prince, so that final losses (e.g., trajectory mismatch) propagate through all components for gradient optimization (Lee et al., 2022). Audio frameworks such as NablAFx construct a chain of DSP and neural modules under full end-to-end differentiability, enabling joint training with gradient signal through every block (Comunità et al., 17 Feb 2025).

3. Applications Across Scientific and Engineering Domains

Differentiable black-box and gray-box modeling has been demonstrated and benchmarked in diverse scientific, engineering, and control domains:

Domain Example Task/Model Key Reference
Chemotaxis/Bio-PDE Learning Keller–Segel PDEs and closures (Lee et al., 2022)
Chaotic ODEs Data-driven discovery of Lorenz/hyperchaos/Sprott flows (Florio et al., 2023)
Mechanical Systems Structured Lagrangian and Newton–Euler robot learning (Gupta et al., 2019, Lutter et al., 2020)
Power/Energy Systems Implicit gray-box simulation with DNN-coupled Newton (Agarwal et al., 2024)
Audio Effects Nonlinear device, compression, fuzz, parametric chains (Comunità et al., 20 Feb 2025, Comunità et al., 17 Feb 2025)
System Identification Transforming LTI state-space from black-box to structured (Mercère et al., 2014)
Sequence Modeling Hybrid neural networks with black-box function calls (Jacovi et al., 2019)
Biotech/Optogenetics Conservation-law/closure modeling with incomplete observation (Lovelett et al., 2019)

Specifics include gray-box ODE learning with delayed embeddings and neural closure for bioreactors (Lovelett et al., 2019), gray-box block-oriented audio effect chains with interpretable parametric control (Comunità et al., 20 Feb 2025), and hybrid simulation engines for power networks incorporating DNN macromodels directly into the Newton–Raphson solver, with Jacobian backpropagation through both physics and neural blocks (Agarwal et al., 2024).

4. Learning Procedures, Feature Selection, and Loss Functions

Training in both paradigms is based on gradient-based optimization over differentiable loss functions, typically chosen to capture statistical or dynamical fidelity to ground-truth trajectories, states, or system outputs. Core aspects include:

Black-box models optimize all parameters unconstrained by domain structure. Gray-box models require parameterization of both analytic and learned variables, often with a subset Mθ(q)M_{\theta}(q), Vθ(q)V_{\theta}(q), Fθ(q,q˙,u)F_{\theta}(q, \dot{q}, u) as neural networks and the remainder fixed or partially hardwired (Gupta et al., 2019). Training is typically performed via Adam or quasi-Newton techniques, frequently with backpropagation through differential equation solvers.

5. Quantitative Performance and Practical Trade-Offs

Performance of black-box vs. gray-box models is typically reported using metric errors over train and test sets, generalization to out-of-distribution (OOD) conditions, data efficiency, and stability under long-term integration. Notable findings include:

  • In chemotactic PDE learning, gray-box and functional-correction models achieve superior generalization to unseen chemoattractant profiles; e.g., on out-of-sample s(x)s(x), black-box FNN reaches maxEr12%\max E_r\approx12\%, functional correction FNN reduces this to 4%\approx4\% (Lee et al., 2022).
  • For double pendulum model-based RL, gray-box Lagrangian architectures reach control goals in 4–7 episodes; black-box MLPs do not succeed in 20 (Gupta et al., 2019).
  • In audio effects modeling, large S4-TFiLM black-box models attain the lowest loss and highest perceptual quality, but gray-box pipelines are orders of magnitude smaller and offer interpretability; for fuzz effects, gray-box rational nonlinearities with dynamic control approach black-box fidelity with two orders lower parameter count (Comunità et al., 20 Feb 2025, Comunità et al., 17 Feb 2025).
  • End-to-end differentiability enables gradient-based optimization through black- or gray-box simulators using surrogate models (e.g., local generative surrogates) to deliver low-variance, unbiased gradients, which are empirically competitive with numerical or Bayesian optimization for non-differentiable simulators (Shirobokov et al., 2020).

In dynamics and control contexts, gray-box architectures combining white-box rigidity for mass-inertia, energy, and kinematics with energy-dissipative ML actuators avoid catastrophic divergence (energy blowup) observed in unconstrained black-box MLP variants (Lutter et al., 2020).

6. Symbolic Discovery, System Identification, and Model Structure Recovery

Differentiable black-box and gray-box frameworks can be explicitly augmented with symbolic regression back-ends to recover interpretable closed-form models from learned operators. For example, in the AI-Lorenz framework, a neural collocation approach (X-TFC) first fits black- or gray-box functional approximations to ODEs, then passes the derivatives to symbolic regression (PySR) to recover exact analytic expressions (e.g., the canonical Lorenz system x˙=10(yx)\dot{x}=10(y-x), etc.) (Florio et al., 2023). This two-stage setup is robust to noise and sparse data, and uniquely enables interpretable model extraction from highly nonlinear or chaotic flows—an advantage over vanilla neural ODE learning.

In control and system identification, full differentiability enables conversion of arbitrary black-box discrete LTI models into structured (gray-box) state-space parameterizations by minimizing gradients of compatibility equations with respect to analytic parameter templates, using BFGS or other gradient-based solvers, and optionally incorporating subgradients for regularization of matrix conditioning (Mercère et al., 2014).

7. Limitations, Theoretical Guarantees, and Extensions

Key limitations cited in the literature include:

  • Black-box models may generalize poorly or exhibit instability out-of-distribution if not regularized by physical constraints or analytic terms (Lutter et al., 2020, Kemeth et al., 2022).
  • Gray-box efficacy depends critically on correct encoding of domain knowledge; mis-specified analytic components (e.g., in closure relations or mass-balance forms) can force learned residues into compensatory regimes (Lovelett et al., 2019).
  • Selection of embedding dimension and delay in partial observation/closure models requires careful tuning to ensure latent state reconstructions are both expressive and parsimonious (Lovelett et al., 2019).
  • Fully differentiable simulation of implicit gray-box models (where DNNs and physical equations share state) relies on the ability of auto-diff frameworks to compute joint Jacobians accurately and efficiently in large-scale problems (Agarwal et al., 2024).
  • Theoretical error bounds are available in some contexts, e.g., local generative surrogates for black-box optimization guarantee arbitrarily small gradient bias in small-enough neighborhoods, with empirical low variance (Shirobokov et al., 2020).

A plausible implication is that hybrid or gray-box approaches—where interpretable analytic modules are combined with low-parameter DNN closures, sometimes with supplementary symbolic regression—will increasingly be favored in domains where both physical consistency and data-driven flexibility are paramount.


References:

  • (Lee et al., 2022): Learning black- and gray-box chemotactic PDEs/closures from agent based Monte Carlo simulation data
  • (Shirobokov et al., 2020): Black-Box Optimization with Local Generative Surrogates
  • (Lutter et al., 2020): A Differentiable Newton Euler Algorithm for Multi-body Model Learning
  • (Florio et al., 2023): AI-Lorenz: A physics-data-driven framework for black-box and gray-box identification of chaotic systems with symbolic regression
  • (Comunità et al., 17 Feb 2025): NablAFx: A Framework for Differentiable Black-box and Gray-box Modeling of Audio Effects
  • (Comunità et al., 20 Feb 2025): Differentiable Black-box and Gray-box Modeling of Nonlinear Audio Effects
  • (Agarwal et al., 2024): A Hybrid Simulation of DNN-based Gray Box Models
  • (Kemeth et al., 2022): Black and Gray Box Learning of Amplitude Equations: Application to Phase Field Systems
  • (Mercère et al., 2014): Identification of parameterized gray-box state-space systems: from a black-box linear time-invariant representation to a structured one: detailed derivation of the gradients involved in the cost functions
  • (Gupta et al., 2019): A General Framework for Structured Learning of Mechanical Systems
  • (Jacovi et al., 2019): Neural network gradient-based learning of black-box function interfaces
  • (Lovelett et al., 2019): Partial observations and conservation laws: Grey-box modeling in biotechnology and optogenetics

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Differentiable Black-box and Gray-box Modeling.