TL;DR
This paper introduces CadVLM, a novel multimodal vision-language model that bridges the gap between natural language and visual representations for generating parametric CAD sketches. By leveraging pre-trained foundation models, CadVLM significantly improves CAD autocompletion and autoconstraint tasks, paving the way for more efficient and intelligent mechanical design.
What Problem Does This Paper Address?
Parametric Computer-Aided Design (CAD) is fundamental to modern mechanical engineering, enabling precise modeling of complex objects. However, creating and manipulating these designs, particularly 2D sketches which form the basis of 3D models, can be challenging and time-consuming. Current CAD generation methods often struggle with precise parametric sketch modeling and lack robust evaluation metrics. While deep learning has shown promise in automating parts of this process, existing models often rely solely on textual representations of sketches or rendered images, failing to capture the full richness of the design information. This paper addresses the need for a more comprehensive approach that integrates both visual and textual data to improve the accuracy and efficiency of CAD sketch generation.
Methods
The core innovation is CadVLM, an end-to-end vision-language model that treats CAD sketches as a combination of language (primitive sequences) and images. It employs a multimodal encoder-decoder architecture:
- Dual-Stream Encoder: A text encoder processes the sequence of sketch primitives (lines, arcs, circles, and their parameters), while a vision encoder processes the rendered image of the sketch. Both encoders are adapted from pre-trained foundation models.
- Image-Text Contrastive Loss (ITC): This loss function aligns the feature spaces of the visual and textual encoders, ensuring that corresponding image-text pairs are similar and dissimilar pairs are contrasted.
- Image-Grounded Text Decoder: This component generates the output sketch primitives (textual representation) by conditioning on the fused image and text embeddings. It's trained using a language modeling loss.
- Text-Grounded Image Decoder: This component generates the visual representation of the autocompleted sketch, conditioned on the fused embeddings. It's trained using an image decoding loss (MSE).
For the CAD autoconstraint task, the image decoder is not used. The model is trained to optimize a combined loss function including ITC, language modeling (LM), and image decoding (IDL).
Datasets
The primary dataset used is SketchGraphs, a large-scale dataset containing 15 million parametric CAD sketches with detailed geometric constraint graphs. The authors use a filtered and deduplicated version of this dataset, consisting of sketches with arcs, circles, and lines.
Key Insights and Ideas
- Multimodality is Key: Combining visual (sketch images) and textual (primitive sequences) information significantly boosts performance in CAD generation tasks, outperforming text-only models.
- Foundation Models Transfer Well: Pre-trained vision and language models (like ViT-MAE and CodeT5+) can be effectively adapted for the domain of CAD, demonstrating strong cross-domain knowledge transfer.
- Image Modality Adds Richness: While text describes the geometry, images provide a holistic view and can capture subtle visual cues that are difficult to encode purely textually, especially for complex shapes.
- Alignment is Crucial: The Image-Text Contrastive (ITC) loss plays a vital role in aligning the visual and textual representations, leading to better overall performance.
Key Results
- CAD Autocompletion: CadVLM significantly outperforms baselines like Vitruvion, Deepcad, and fine-tuned ChatGPT models. For instance, CadVLM achieved 23.8% Sketch Accuracy and 68.3% Entity Accuracy, a substantial improvement over Vitruvion (3.0% and 40.7% respectively).
- CAD Autoconstraint: CadVLM also shows strong performance, with CadVLM-w/o-ITC achieving the best results in this task.
- Qualitative Improvements: Visual examples show CadVLM generating more complete, accurate, and symmetrical sketches compared to baselines, which often produce invalid or incomplete results.
- Ablation Studies: Removing the image modality (CadVLM-Text) led to a performance drop, highlighting the importance of visual input. CadVLM-w/o-IDL (without image decoding loss) performed best among CadVLM variants, suggesting that aligning embeddings is more critical than pixel-level image reconstruction for some tasks.
Limitations and Future Work
- ChatGPT Fine-tuning: Fine-tuning large language models like ChatGPT on CAD data for a limited number of epochs showed improvements but didn't reach CadVLM's performance, possibly due to insufficient training time for adaptation.
- Computational Cost: Training multimodal models is computationally intensive, as noted by the 30-40 hour training time on 8 NVIDIA A100 GPUs.
- Inductive Bias: Adding an explicit inductive bias for entity-level modeling in CadVLM increased computational demands with only marginal performance gains, suggesting that the current architecture is already effective.
- Future Work: The paper suggests exploring different pre-trained language models and further investigating the impact of model size and architecture for optimal performance. The authors also highlight the potential for CadVLM to be used in real-world settings due to its robustness across different input entity ratios.
Summary updated