Skip to content
AI.info

Research

Target-Guided Bayesian Flow Networks for Quantitatively Constrained CAD Generation

Overview Research area: Generative modeling for computer-aided design (CAD), specifically conditional generation of parametric CAD command sequences under numerical (quantitative) constraints. Technic

Target-Guided Bayesian Flow Networks for Quantitatively Constrained CAD Generation
arXiv
2510.25163
Published
2025-10-29
Authors
Wenhao Zheng, Chenwei Sun, Wenbo Zhang, Jiancheng Lv, Xianggen Liu

AI summary

Overview

Research area: Generative modeling for computer-aided design (CAD), specifically conditional generation of parametric CAD command sequences under numerical (quantitative) constraints.

Technical level: Advanced. The paper builds directly on Bayesian Flow Networks and requires comfort with variational objectives, KL divergence, categorical belief states, and probability-simplex updates.

Scope: The paper introduces Target-Guided Bayesian Flow Network (TGBFN), a framework that generates parametric CAD sequences satisfying target surface-area and volume values, and evaluates it against five adapted baselines on a newly constructed quantitatively labeled CAD dataset.

What This Paper Is About

Parametric CAD models are sequences of discrete commands (line, arc, circle) plus continuous numeric parameters, and existing generative models handle this mixed "modality duality" awkwardly — diffusion models assume continuous noise, while autoregressive transformers accumulate errors and are sensitive to tiny parameter deviations. The paper's goal is a generator that takes target numerical properties (e.g., a required surface area and volume) as input and outputs a valid CAD token sequence that actually matches those numbers, rather than merely producing plausible shapes.

Key Contributions

  1. A unified Bayesian formulation for multimodal CAD sequences. TGBFN handles discrete commands and continuous parameters in a single continuous, differentiable parameter space instead of the discrete data space.
  2. A guided Bayesian flow. The authors penetrate the conventional parameter-update kernel and factorize the conditional Bayesian update into a standard update term and a condition-guidance term (Theorem 4.1), claiming a theoretical guarantee that this is an accurate approximation of the parameter update process under given quantitative conditions.
  3. Unbiased Bayesian inference (UBI) and calibrated distribution estimation (CDE). UBI uses multiple parallel sampling paths to counteract exposure bias from single-sample belief updates; CDE averages repeated categorical draws and projects to the nearest category to reduce quantization bias.
  4. A new quantitatively constrained CAD dataset and benchmark. Built from DeepCAD's 178,238 parametric models, annotated with surface area and volume computed via boundary representation (B-Rep) analysis using PythonOCC.

Main Findings

  • Single-condition performance: Under surface-area constraints, TGBFN reached MSE 0.3503, MAE 0.3067, PCC 0.9587, versus BFN at MSE 5.1052, MAE 0.7854, PCC 0.7865 and autoregressive Transformer at MSE 1.3033, MAE 0.7678, PCC 0.8410. Under volume constraints, TGBFN reached MSE 0.0158, MAE 0.0529, PCC 0.9342, versus BFN at MSE 0.2188, MAE 0.1030, PCC 0.7748.
  • Reported relative gains (single-condition): The authors state the method reduces MSE by over 60% and improves Pearson correlation by 7–20% compared with BFN and the autoregressive Transformer.
  • Multi-condition performance: With surface area and volume jointly constrained, TGBFN reached MSE 0.4235, MAE 0.3128, PCC 0.9512 on area, and MSE 0.0078, MAE 0.0326, PCC 0.9652 on volume. The best baseline (BFN) reached MSE 1.1745 / 0.0340 with PCC 0.8956 / 0.8986. The paper reports over 2× MSE improvement over the best baseline and correlation increases of more than 5%.
  • Baseline failure patterns: D3PM shows high absolute errors (e.g., MSE 45.194 on single-condition area), non-autoregressive Transformer is worst on area (MSE 30.807), and DeepCAD and LSTM generalize poorly. The authors attribute this to an imbalance between structural trend and fine-grained numerical accuracy.
  • Parallel samples are cheap: Increasing the number of parallel samples m from 1 to 4 reduced MSE by 75.6% (0.8469 to 0.2063) with only a 5.7% memory increase (1351 MB to 1428 MB) and a slight runtime decrease (12.06 s to 11.85 s). Going to m = 16 raised memory 46.3% while MSE gain fell to 15.1% (0.7191), showing diminishing returns.
  • Calibration granularity helps up to a point: Increasing sampling granularity H in CDE improves all metrics, with diminishing returns beyond moderate values.
  • Dataset statistics: Surface area and volume distributions are both right-skewed; volume has a wider interquartile range; the two properties correlate strongly (Pearson's r = 0.82), which the authors present as evidence of label reliability.
  • Data filtering: The final dataset contains 68,219 training, 6,327 validation, and 5,652 testing instances, retaining only models with no more than 64 parametric CAD tokens.

Methodology in Plain English

TGBFN does not add noise to a CAD sequence and then denoise it step by step. Instead, it maintains a "belief state" for every token position — a probability distribution over which command that position should be — and iteratively refines that belief. Because these beliefs are continuous and differentiable, both the discrete commands and the continuous numeric parameters can be manipulated in one shared space.

Three pieces make the constraint control work. First, unbiased Bayesian inference replaces the standard single-random-draw belief update with an average over m independent draws, so the sampling error that normally accumulates over many steps gets averaged out. Second, the guided Bayesian flow splits the belief update into an ordinary update and a multiplicative guidance term, implemented as a neural network that predicts the mean and variance of the target property given the current belief state; this lets the model steer generation toward a requested surface area or volume without retraining the main network. Third, calibrated distribution estimation draws H categorical samples, averages them, snaps the average to the nearest category, and uses that as the sender signal, which corrects the coarse-quantization bias of naive discrete sampling.

Training is modular: the skeleton Bayesian flow network is trained unconditionally to learn valid CAD structure, and the conditional guidance network is trained separately by minimizing KL divergence between its predicted Gaussian and an empirical Gaussian estimated from mini-batch statistics.

Why This Matters

Research impact: This is an early demonstration that Bayesian flow networks — rather than diffusion or autoregressive models — can handle mixed discrete/continuous sequence data under hard numerical constraints, and it establishes quantitative (rather than qualitative) conditioning as a benchmarkable CAD task with a released dataset and metrics.

Real-world applications:

  • Manufacturing and tolerance-driven design, where a part must hit a specified volume or surface area to meet material and cost targets.
  • Design-space exploration, where engineers specify desired physical properties and let the model propose CAD programs.
  • Editing and repairing existing models by generating variants that meet new quantitative specifications.
  • Geometry-constrained engineering simulation pipelines, where consistent mass or surface properties are prerequisites for downstream analysis.

Industry relevance: CAD vendors and industrial design teams work in exactly these constraints; a model that hits target numbers while producing valid command sequences could be integrated into parametric sketching tools. The paper reports that extra parallel sampling buys accuracy at near-zero runtime cost, which matters for interactive settings.

Future Directions

  • Extending quantitative conditioning beyond surface area and volume to other manufacturable properties, which the paper does not attempt.
  • Testing whether the guided-flow formulation scales beyond the 64-token sequence limit and beyond the rectangle/sketch-style models in the DeepCAD-derived dataset.
  • Determining the right defaults for m and H; the paper reports saturation and even accuracy loss at high values but does not give a principled selection rule.
  • Comparing against stronger proprietary or larger-scale CAD generators; the current baselines are LSTM, two Transformer variants, DeepCAD, D3PM, and BFN, all adapted by the authors.
  • Reporting full generative-quality evaluation (the paper's metrics are MSE, MAE, and PCC only, and the provided content does not report shape-validity or perceptual metrics).

Target Audience

Researchers and graduate students in generative modeling, especially those working on diffusion, flow-based, or Bayesian methods for structured and multimodal data. It is also relevant to CAD and geometry-processing researchers interested in constraint-aware design synthesis, and to practitioners who need generative models that satisfy explicit numerical specifications rather than only producing plausible shapes. Readers without a probabilistic-modeling background will find the method and theorems demanding.

Authors’ abstract

Deep generative models, such as diffusion models, have shown promising progress in image generation and audio generation via simplified continuity assumptions. However, the development of generative modeling techniques for generating multi-modal data, such as parametric CAD sequences, still lags behind due to the challenges in addressing long-range constraints and parameter sensitivity. In this work, we propose a novel framework for quantitatively constrained CAD generation, termed Target-Guided Bayesian Flow Network (TGBFN). For the first time, TGBFN handles the multi-modality of CAD sequences (i.e., discrete commands and continuous parameters) in a unified continuous and differentiable parameter space rather than in the discrete data space. In addition, TGBFN penetrates the parameter update kernel and introduces a guided Bayesian flow to control the CAD properties. To evaluate TGBFN, we construct a new dataset for quantitatively constrained CAD generation. Extensive comparisons across single-condition and multi-condition constrained generation tasks demonstrate that TGBFN achieves state-of-the-art performance in generating high-fidelity, condition-aware CAD sequences. The code is available at https://github.com/scu-zwh/TGBFN.

Read the original paper