RWTH Aachen's DISCOMAX Beats Chemical AI Baselines by 13x Without Synthetic Data
A new differentiable solver called DISCOMAX lets neural networks learn phase equilibria end-to-end while guaranteeing thermodynamic consistency at every step.
ProTakeaways
- DISCOMAX makes phase-equilibrium calculation differentiable via discrete enumeration and masked softmax over feasible states
- Uses a straight-through estimator so forward pass returns the exact argmin while gradients flow through a soft surrogate
- On single-system fits it beats the surrogate baseline by roughly 6.8 times on MAE, up to 26 times without auxiliary losses
- Ten-fold cross-validation on 8,597 binary liquid-liquid systems shows a 15 percent MAE reduction versus the surrogate approach
- No synthetic pretraining data or trainable solver parameters, eliminating the UNIFAC data leakage problem
- Full code, dataset, and HANNA 2 predictions available on the RWTH GitLab repo
Predicting when two liquids will mix or split into distinct phases is one of the oldest problems in chemical engineering, and it is also one of the messiest to hand to a neural network. The target you want to predict is not a direct output of a model, it is the solution of a constrained optimization problem sitting on top of a Gibbs free energy surface. A team from RWTH Aachen has now proposed a clean way to make that lower-level optimization fully differentiable, and it beats the current neural-network baseline while dropping the need for synthetic training data.
Their method, called DISCOMAX, is described in a new paper that treats phase-equilibrium calculation as a discrete argmin problem with a softmax relaxation for gradients. The code and dataset are released under an open-source license on the group's GitLab repository.
Why phase equilibria break end-to-end training
Classical thermodynamic models like Wilson, NRTL, and UNIQUAC have modeled activity coefficients and phase behavior for decades, and group-contribution approaches like UNIFAC extended their reach, but these methods remain limited by applicability, accuracy, or computational cost. Modern ML models predict activity coefficients accurately but often violate basic thermodynamic laws, which is why hybrid physics-informed architectures have become popular.
The trouble is that some equilibrium properties are not just functions you can differentiate. Liquid-liquid equilibrium is defined by the global minimum of the Gibbs energy of mixing under mass balance, so learning from that data becomes a bilevel optimization problem: an outer loss depending on the solution of an inner constrained minimization. You cannot just backprop through a global optimizer, especially when the inner Gibbs energy surface has multiple local minima.
The workaround proposed in recent work by Hoffmann et al. was to train a neural network as a surrogate for the equilibrium solver on UNIFAC-generated data, then freeze it and use it during training of the actual Gibbs-energy model. This surrogate approach has two structural problems: it is thermodynamically inconsistent, meaning it does not guarantee global optimality, stability, or mass balance even in the limit of fine discretization, and its training data leak information from the test domain because UNIFAC parameters were fitted using many of the molecules that appear in the test set.
The DISCOMAX trick
DISCOMAX side-steps the whole surrogate business by discretizing the composition space and enumerating every feasible phase split, then using two different computation paths for the forward and backward passes. In the forward pass it picks the hard argmin, so the reported equilibrium is exact up to discretization. In the backward pass it uses a Boltzmann-weighted softmax over all candidate pairs and glues the two together with a straight-through estimator.
Concretely, the algorithm does the following:
- Build a composition grid on the interval (0, 1), augmented with the feed composition z
- Evaluate the neural Gibbs-energy-of-mixing model at every grid point
- Enumerate all feasible phase pairs (i, j) that satisfy the mass balance for feed z, and compute the total Gibbs energy for each pair
- Take the hard argmin over pairs for the forward prediction
- Compute a softmax distribution over the same pairs with temperature parameter tau, then take a weighted average of grid compositions for the differentiable soft estimate
- Replace gradients via
tensor.detach(), so the forward value stays hard and gradients flow through the soft surrogate
The authors point out an elegant interpretation: the softmax over Gibbs energies has the same mathematical structure as a Boltzmann distribution over discrete energy states, and introducing a temperature-like parameter recovers the classical equilibrium solution in the limit as it goes to zero, while yielding a smooth, differentiable mapping for finite values. In other words, the relaxation is not just a numerical hack, it corresponds to a statistical-thermodynamics ensemble with composition fluctuations.
The model on top
The Gibbs-energy model itself is a graph neural network. Each molecule in a binary pair is encoded with a Chemprop D-MPNN, the two embeddings are concatenated into a mixture representation, and a feedforward network with smooth ELU activations predicts the excess Gibbs energy at composition x. The output is multiplied by x(1-x) so that the mixing energy vanishes at the pure-component boundaries, giving thermodynamic consistency at the endpoints for free.
Training uses a mean-squared error on the predicted phase compositions plus two optional auxiliary losses: a masked Gibbs loss (borrowed from the surrogate baseline) that encourages a concave region somewhere on the Gibbs-energy curve, and a novel Hessian loss that specifically enforces convexity at the target phase compositions and concavity at the feed composition. The Hessian loss makes the biggest difference in practice.
Benchmarks and results
The authors built a new benchmark by forming all possible binary mixtures of 526 unique solvents, yielding 138,601 candidate systems, and extracted the 8,597 that exhibit a liquid-liquid equilibrium at 298.15 K. Ground-truth compositions were generated with the HANNA 2 model, which is MIT-licensed and therefore reproducible, unlike the proprietary Dortmund Database and NIST TDE.
Two experiments matter. First, fitting a single system in isolation with a composition-only model. Second, full ten-fold cross-validation on the entire dataset with a GNN encoder that has to generalize to unseen mixtures.
On single-system fitting, the gap is striking:
| Configuration | MAE | R squared |
|---|---|---|
| DISCOMAX + Hessian + Gibbs | 0.016 | 0.998 |
| DISCOMAX + Hessian | 0.017 | 0.998 |
| DISCOMAX (no aux loss) | 0.019 | 0.996 |
| Surrogate + Hessian | 0.109 | 0.952 |
| Surrogate + Gibbs (literature baseline) | 0.253 | 0.740 |
| Surrogate (no aux loss) | 0.413 | 0.390 |
Even bare DISCOMAX with no auxiliary loss beats the strongest surrogate configuration by roughly 5.7 times on MAE, and the previously proposed Surrogate+Gibbs setup by 13 times. The surrogate solver often converges smoothly but to entirely wrong solutions, indicating that although its gradients are stable, they are biased and do not reliably point towards the true target equilibrium state.
On full ten-fold cross-validation with molecular structure, the DISCOMAX with Hessian loss achieves a test MAE of 0.068, compared to 0.080 for the Surrogate G baseline, a reduction of roughly 15 percent. The advantage concentrates on narrow miscibility gaps, which are the hardest systems to fit because small mis-predictions flip the model between one-phase and two-phase behavior.
What this actually enables
The main practical shift is that you can now train a neural excess-Gibbs-energy model directly on equilibrium composition data without needing synthetic pre-training data, an auxiliary neural solver, or any second-order optimization tricks. The DISCOMAX module contains zero trainable parameters, so any bias in your final model comes only from your model architecture and your real training data, not from a leaked UNIFAC solver.
Useful places to reach for this:
- Building activity-coefficient or Gibbs-energy models from measured liquid-liquid tie-line data
- Extending existing ML models to vapor-liquid, solid-liquid, or vapor-pressure calculations, since the same framework applies to any equilibrium defined by an extremum principle
- Cases where you want end-to-end differentiability through the equilibrium step, for example in learned process design or property prediction pipelines
- Situations where thermodynamic guarantees matter for downstream engineering, since the forward pass returns the exact global minimum over the discretized grid
Where it does not fit yet: the enumeration is essentially brute force over composition pairs, so it scales poorly beyond binary mixtures because the number of candidate groups grows combinatorially with the number of components. For deployment on multi-component flash calculations, you would still use a standard solver. The paper also notes the framework is currently trained only on systems that actually exhibit a phase split, meaning it has no supervision for miscible systems and cannot yet decide whether a phase split occurs at all. Very narrow miscibility gaps remain the hardest regime, which is a known problem for traditional Gibbs-energy models too.
The bigger idea
The real contribution beyond the LLE numbers is showing that a large class of physics-consistent ML problems can be handled with discrete enumeration plus softmax relaxation plus a straight-through estimator, rather than through implicit differentiation, unrolled optimization, or surrogate networks. The connection to statistical thermodynamics is not incidental, it is the reason the relaxation gives sensible gradients: you are literally computing an ensemble average that becomes the deterministic equilibrium in the low-temperature limit.
The framework generalizes naturally to any equilibrium that arises from minimizing a thermodynamic potential, so pure-component vapor pressure and three-phase liquid-liquid-liquid systems are already demonstrated in the supporting material. For anyone building physics-informed models where the target quantity is itself the solution of an optimization problem, DISCOMAX is a useful template to steal from.