---
title: 'CliqueFlowmer: Neural MBO for Materials Discovery'
url: https://www.emergentmind.com/topics/cliqueflowmer
type: topic
---

# CliqueFlowmer: Neural MBO for Materials Discovery

CliqueFlowmer is a neural model architecture and offline model-based optimization (MBO) framework for computational materials discovery (CMD), designed to produce crystal structures maximizing or minimizing specific materials properties, such as formation energy or band gap. Unlike purely generative approaches that operate via maximum likelihood training, CliqueFlowmer fuses property optimization with discrete atom generation and continuous geometry decoding by incorporating a clique-based surrogate, transformer encoders/decoders, and conditional flow-based geometry modeling. Empirical results show CliqueFlowmer achieves substantially superior property values and high rates of stability, uniqueness, and novelty relative to previous state-of-the-art generative models [2603.06082].

## 1. Architectural Overview

CliqueFlowmer is conceptualized as an auto-encoder plus surrogate model comprising three principal phases: encoding, clique decomposition and surrogate prediction, and decoding.

- **Encoding:** The model receives as inputs the lattice lengths $(a,b,c)$, lattice angles $(\alpha,\beta,\gamma)$, fractional atomic positions $p\in[0,1)^{N_{\mathrm{atom}}\times 3}$, and atom types $t\in\mathcal{A}^{N_{\mathrm{atom}}}$. Each is embedded using distinct MLPs and an atom-type embedding layer. The outputs are concatenated to a sequence that is processed by a transformer encoder with AdaLN (adaptive layer normalization), producing a contextualized representation $H^{\mathrm{out}}\in\mathbb{R}^{(N_{\mathrm{atom}}+2)\times d_{\mathrm{model}}}$. Attention pooling with a learned query yields a pooled vector $h^{\mathrm{pool}}$, which is mapped to mean and log-variance for a latent Gaussian $z\sim\mathcal{N}(\mu, \mathrm{diag}(\sigma^2))$.

- **Clique Decomposition & Surrogate:** The latent $z\in\mathbb{R}^d$ is reshaped into $N_{\text{clique}}$ overlapping cliques $z_c\in\mathbb{R}^{d_{\rm clique}}$ (with overlap $d_{\rm knot}$). The property predictor is a sum of small MLPs over cliques:
  $$f_\theta(z) = \sum_{c=1}^{N_{\rm clique}} f^{(c)}_\theta(z_c; c).$$

- **Decoding:** The decoder bifurcates into (i) an atom-type autoregressive transformer, and (ii) a conditional normalizing flow for geometry. The atom-type decoder maps $z$ to $z^{\rm mod}$ and employs a causal transformer, conditioned by AdaLN. The geometry decoder uses a denoising velocity network $V_\theta$ trained using a flow-matching loss over interpolations between prior and ground truth geometry.

## 2. Clique-Based Model-Based Optimization

Offline MBO is enabled by the surrogate’s additive clique structure. The optimization problem is to find $z$ minimizing the predicted property:
$$
\min_{z\in\mathbb{R}^d} f_\theta(z), \quad \text{where} \quad f_\theta(z) = \sum_{c=1}^{N_{\rm clique}} f^{(c)}_\theta(z_c).
$$
Latents are regularized towards the prior $\mathcal{N}(0, I)$ via AdamW weight decay, which maintains proximity to the training manifold. In-distribution clique fragments can be "stitched" to synthesize new candidate materials.

Evolution strategies (ES), specifically rank-based ES with antithetic perturbations and standardized rank differences, are used to optimize latents:
$$
\hat\nabla^{\rm ES} f_\theta(z) = \frac{1}{2\sigma N_{\rm pert}} \sum_{i=1}^{N_{\rm pert}} [R^i_+ - R^i_-]\;\epsilon^i,
$$
where $R^i_\pm$ are ranks of $f_\theta(z \pm \sigma\epsilon^i)$ and $\epsilon^i$ are perturbations.

## 3. Training Objectives and Procedures

Training utilizes four objectives:

- Atom-type log-likelihood: $\mathcal{L}_{\rm atom}$ from the autoregressive transformer decoder.
- Flow matching loss: $\mathcal{L}_{\rm flow}$ for geometry, with loss
  $$
  \mathbb{E}_{t, x_0, x_1} \left\| V_\theta(x_t, t \mid z) - (x_1 - x_0) \right\|^2,
  $$
  with $x_t = (1-t)x_0 + t x_1$ interpolating between prior and data.
- Prediction loss: $\mathcal{L}_{\rm pred} = (f_\theta(z) - f(M))^2$.
- Clique-wise latent KL: $\mathcal{L}_{\rm lat}$, averaged over cliques.

The total loss is
$$
\mathcal{L}(\theta) =
\mathbb{E}_{M\sim\mathcal{D},\, z\sim p_\theta(\cdot\,|\,M)}
\left[\mathcal{L}_{\rm atom} + \mathcal{L}_{\rm flow} + \tau_{\rm pred}\,\mathcal{L}_{\rm pred} + \beta\,\mathcal{L}_{\rm lat}\right],
$$
with $\tau_{\rm pred}$ and $\beta$ as warm-up weights.

Key training parameters: MP-20 dataset (45k crystals), batch size 1024, 700k steps, learning rate $1.4\times 10^{-4}$, dropout 0.1, latent dimension $d=128$, $N_{\rm clique}=8$, $d_{\rm clique}=16$, $d_{\rm knot}=1$.

Inference proceeds by encoding empirical lattices, optimizing $z$ via ES for 2,000 steps, decoding atom types by beam search, and decoding geometry using flow-matching under classifier-free guidance (CFG, $\omega=2$).

## 4. Algorithmic Implementation

Pseudocode implementations are provided for key subroutines:

- **Clique chaining (PyTorch):**
  ```python
  def chain_cliques(z, N_clique, d_clique, d_knot):
      z_unfold = z.unfold(dim=1, size=d_clique, step=d_clique-d_knot)
      return z_unfold  # [batch, N_clique, d_clique]
  ```

- **Rank-ES gradient estimator (NumPy):**
  ```python
  def rank_es_grad(f, z, sigma, n_pert):
      eps = np.random.randn(n_pert, z.size)
      eps = np.concatenate([ eps, -eps ], axis=0)
      vals = np.array([f(z+sigma*e) for e in eps])
      ranks = scipy.stats.rankdata(vals)
      R = (ranks - ranks.mean())/ranks.std()
      Rplus, Rminus = R[:n_pert], R[n_pert:]
      grad = ((Rplus - Rminus)[:,None] * eps[:n_pert]).mean(axis=0)/(2*sigma)
      return grad
  ```

- **Flow-matching training loop:**
  ```python
  for each batch:
      x0 = sample_prior(z_batch)
      x1 = ground_truth_geom
      t = sample_lifted_logit_normal()
      x_t = (1-t)*x0 + t*x1
      v_pred = Vθ(x_t, t | z_batch)
      v_true = x1 - x0
      L_flow = MSE(v_pred, v_true)
  ```

- **Inference pipeline (pseudo):**
  ```python
  Z = Encθ(M_dataset)
  for each z in Z:
      z* = optimize_ES(z, fθ)
      t* = BeamSearch(T^{dec}_θ, z*)
      M* = flow_decode(Vθ, z*, t*, ω=2)
  ```

## 5. Quantitative Evaluation and Comparative Performance

Performance is evaluated on the MP-20 dataset using metrics formalized as follows:

- **Formation energy per atom:** $E_{\rm form}(\mathsf{M}) = \frac{1}{N_{\rm atom}} E_{\rm form}^{\rm oracle}(\mathsf{M})$.
- **Band gap:** $\Delta_{\rm band}(\mathsf{M})$.
- **Stability:** Design is “strictly stable” if DFT energy above hull $E_{\rm hull}\le 0$.
- **Uniqueness:** Fraction of non-duplicate designs.
- **Novelty:** Not present in training set.
- **S.U.N. rate:** Designs that are stable, unique, and novel.
- **Top-$k\%$ property:** Mean of best $k\%$ designs post-MBO.

Empirical results (Table: selected metrics):

| Metric              | CrystalFormer | DiffCSP | DiffCSP++ | MatterGen | CliqueFlowmer | Top-10% |
|---------------------|:------------:|:-------:|:---------:|:---------:|:-------------:|:-------:|
| E_form (↓)          |    0.71      |  0.59   |   0.65    |   0.60    |     –0.81     |  –0.99  |
| Band Gap (↓)        |    0.52      |  0.63   |   0.48    |   0.57    |     0.03      |  0.07   |
| S.U.N. rate (↑)     |   12.8 %     | 18.6 %  |  18.5 %   |  17.6 %   |    61.3 %     | 69.4 %  |

CliqueFlowmer achieves average formation energies of –0.81 eV/atom (–0.99 eV/atom for Top 10%). For band gap, output is driven to 0.03 eV (0.07 eV for Top 10%). In the S.U.N. metric for band-gap-optimized designs, CliqueFlowmer achieves $>60\%$, whereas generative baselines attain around $18\%$.

## 6. Comparative Analysis

Generative baselines such as CrystalFormer, DiffCSP, MatterGen, and FlowMM sample from a maximum likelihood-trained model and subsequently select candidates with the best predicted properties, restricting exploration to the data manifold and failing to systematically push into regions of optimal property values. CliqueFlowmer, in contrast, couples property gradients (via rank-based ES in latent space) with generative decoding, traversing aggressively toward property optima. The clique-based structure further supports combinatorial recombination of in-distribution latents, balancing exploration with distributional realism.

Empirically, CliqueFlowmer consistently discovers materials with superior formation energy and band gap metrics, while maintaining or exceeding generative baselines in stability, uniqueness, and novelty of candidate materials [2603.06082].

## 7. Significance and Applications

CliqueFlowmer demonstrates a new paradigm for computational materials optimization by integrating latent-space property surrogates that are both decomposable and amenable to ES-based gradient estimation, transformer-based sequence modeling for discrete atom prediction, and flow-based geometry generation. The architecture is fully differentiable and amenable to large-batch offline training while leveraging in-distribution regularization of latent states.

All code for CliqueFlowmer is open-sourced to facilitate replication and further research in materials optimization (https://github.com/znowu/CliqueFlowmer). This facilitates its adoption and adaptation for specialized materials optimization objectives, supporting ongoing interdisciplinary developments in offline CMD [2603.06082].

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