CPFlow: Full-Atom Cyclic Peptide Design via Masked Autoregressive Flow Matching with Test-Time Scaling

Yunpeng Wang, Zhonghui Gu, Runze Ma, Jie Yang, Zhanpeng Shi, Xiaoliang Shi, Zhijian Wei, Jun Li, Shuangjia ZhengNeurIPS 2026

TL;DR

Designing cyclic peptides—tiny, ring-shaped proteins that act like molecular Velcro against disease targets—requires simultaneously locking into a target pocket and closing a strict chemical loop without clashing atoms. Instead of trying to hallucinate the entire ring at once, CPFlow builds cyclic peptides one amino acid at a time, using flow matching and multi-trajectory test-time search to steer toward chemically valid, tightly binding rings. The result is controllable, state-of-the-art drug scaffold design across multiple ring-closing chemistries.

What Problem Does This Paper Address?

In drug discovery, peptides sit in a "Goldilocks" zone: smaller and more adaptable than bulky antibodies, yet far more specific than traditional small molecules. Cyclic peptides go a step further by tying the chain into a covalent loop, locking the molecule into a rigid shape that binds tighter and resists breaking down in the body.

Recently, generative 3D AI models (using diffusion and flow matching) have gotten good at designing linear peptides—essentially microscopic pieces of cooked spaghetti—to fit into protein pockets. However, they stumble when asked to make loops. Generating an entire 3D ring in "one shot" often leads to geometric clashes, sequences that wouldn't actually fold into the predicted shape, or broken rings that fail to close. Furthermore, there isn't just one way to close a loop: head-to-tail (backbone-to-backbone), disulfide (sulfur-to-sulfur), and isopeptide (side-chain-to-side-chain) bonds all demand vastly different 3D geometries. Existing models lack a unified way to control and enforce these specific topologies.

Methods

CPFlow keeps a standard multi-modal flow-matching backbone (adopted from an earlier model, PepFlow, which jointly models amino acid types, 3D coordinates, backbone orientations, and side-chain angles), and completely overhauls how it trains and generates:

Figure 2: Overview of CPFlow. (A) CPFlow is trained by receptor-conditioned masked residue recovery. Given observed peptide residues, the model predicts the masked residues and computes the loss only on the recovered masked positions. (B) CPFlow generates cyclic peptides autoregressively. At each step, it predicts all remaining masked residues and scores them. It selects the best one and then moves it to the observed set, and repeats until completion. (C) CPFlow scales at test time. It explores parallel autoregressive trajectories, scores them by accumulated confidence, and resamples particles to keep high-scoring paths while pruning low-scoring ones. (D) CPFlow enables stable and controllable cyclic peptide generation. Given a cyclization type, the model generates cyclic peptides with terminal constraints, including head-tail, isopeptide, and disulfide cyclization.
  • Masked Flow Matching & Adaptive Autoregressive Decoding: During training, random subsets of peptide residues (amino acids) are masked out, and the model learns to reconstruct them given the target protein and any visible peptide pieces. At inference time, CPFlow starts completely blank. In each step, it predicts clean 3D states for all remaining blank spots, scores them using a custom sequence-geometry score (which checks sequence confidence alongside physical sanity like atomic clashes and target contacts), and permanently commits only the single best residue. Unlike text models that write strictly left-to-right, CPFlow builds the ring in whatever adaptive order makes the most physical sense—for instance, anchoring key binding spots first and bridging the loop later.
Figure 1: At inference time, generating a cyclic peptide of length N is decomposed into N steps. Previously committed residues serve as visible context. At each step, ungenerated residue positions are initialized with independent Gaussian noise for flow-matching generation, and only one newly generated residue is selected for commitment. The newly committed residue is then fixed and serves as visible context in all subsequent steps. Note that a step denotes an autoregressive residue- commitment step, not a single neural function evaluation (NFE).
  • Multi-Particle Test-Time Scaling: Committing one residue at a time is greedy; an early mistake can paint the molecule into a geometric corner. Borrowing a page from Sequential Monte Carlo and LLM reasoning, CPFlow runs $N$ parallel generation trajectories ("particles"). When trajectory scores diverge too much, low-scoring paths are pruned and high-scoring paths are duplicated, searching a wider space without any extra training.
  • Cyclization-Aware Conditioning: To control how the ring closes, the authors inject data-derived distance priors (based on characteristic $C_\beta$ atom spacing for head-to-tail, disulfide, or isopeptide bonds) into the model's relative positional encodings, while hard-coding required terminal amino acids (like Cysteines for disulfide bridges) from the start.

Datasets

The authors train and evaluate on CPSea, a recently introduced benchmark of 2.71 million cyclic peptide-receptor complexes mined from the AlphaFold Database covering head-to-tail, disulfide, and isopeptide rings. Specifically, they train on CPCore (a high-quality curated subset of 71,867 complexes clustered via FoldSeek to prevent data leakage) and evaluate on 56 targets from the non-redundant LNR test set.

Key Insights and Ideas

  • Order matters—a lot: When the authors replaced their sequence-geometry scoring with a random unmasking order, binding success plummeted from 87.2% to 51.6%. Letting the model lock in high-confidence, clash-free anchors early prevents downstream geometric trainwrecks.
  • Interaction beats brute force: Is test-time scaling just a fancy way of taking more guesses? No. Under a strictly matched compute budget of 400 total trajectories, running 100 groups of 4 interacting particles ($N=4$) beat generating 400 independent single-particle samples ($N=1$) across every binding and structural metric. Pruning bad partial rings early genuinely guides better assembly.
  • Decoupling topology from generic 3D equivariance: Simply respecting 3D rotations and translations ($\text{SE}(3)$ equivariance) isn't enough for macrocycles; giving the network explicit, bond-specific distance priors at the ring's seam allows a single unified model to switch cleanly between different chemical crosslinks on command.

Key Results

Evaluated against strong 3D generative baselines (DiffPepBuilder, PepFlow, and PepGLAD), CPFlow ($N=4$) achieves across-the-board improvements:

Table 1: Evaluation on sequence-structure co-design. N is the number of parallel particles. For each metric, the best result is shown in bold, and the second-best result is underlined. ↑indicates that higher values are better, and ↓indicates that lower values are better.
  • Binding Energy: Achieves a mean Rosetta binding affinity ($\Delta G$) of -26.3 kcal/mol (improving by 3.0 kcal/mol over the best baseline) and a 93.4% binding success rate (vs. 65.0%–74.8% for baselines).
  • Structural Fidelity: Improves designability (how well a redesigned sequence folds back into the generated shape, measured via scRMSD—lower is better) by 0.30 Å (down to 1.89 Å head-to-tail / 1.92 Å disulfide) and self-consistency by 0.15 Å, while boosting structural diversity to 0.623.
  • Controllable Cyclization: Successfully hits target ring-closing distance geometries 74.2%, 71.7%, and 63.4% of the time for head-to-tail, disulfide, and isopeptide modes, respectively. Molecular dynamics (100 ns) simulations on three challenging isopeptide designs confirmed the peptides stayed folded inside their target pockets.

Limitations and Future Work

The authors candidly note that their cyclization-aware encoding relies on a coarse $C_\beta$–$C_\beta$ distance proxy. While it provides a strong structural nudge, falling into the right distance bin does not strictly guarantee valid covalent bond angles or chemical ring closure at the atomic level. Additionally, current structure-prediction networks struggle to refold side-chain isopeptide crosslinks, limiting automated self-consistency checks for that class. Moving forward, the authors highlight the need for finer local-geometry analyses, actual wet-lab validation, and more sophisticated test-time search algorithms and reward functions to push trajectory exploration even further.

Summary updated

BibTeX
@inproceedings{wang2026cpflow,
  author = {Yunpeng Wang and Zhonghui Gu and Runze Ma and Jie Yang and Zhanpeng Shi and Xiaoliang Shi and Zhijian Wei and Jun Li and Shuangjia Zheng},
  title = {{CPFlow: Full-Atom Cyclic Peptide Design via Masked Autoregressive Flow Matching with Test-Time Scaling}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=SVOoK5w27h},
}
Figure