--- license: mit library_name: transformers pipeline_tag: text-generation tags: - cad - text-to-cad - world-model - qwen2 --- # CAD-WAM — stepwise text-to-CAD with a geometric world model **Anonymous artifact for a paper currently under double-blind review.** CAD-WAM generates a parametric CAD construction sequence from a natural-language description. At every step it predicts both the next construction action **and** the geometric state that action will produce, and it is re-conditioned on the solid its own actions have actually built: each predicted action is executed by a CAD kernel, the resulting solid is sampled and encoded, and that encoding is fed back as the state for the next step. - Backbone: Qwen2.5-1.5B-Instruct, extended with a **geometric state embedding** (1024-d latent → 16 input tokens) and a **state prediction head**. - Loss: action cross-entropy + `state_loss_weight` × next-state regression (this checkpoint: `0.03`). - Training data: the official DeepCAD split, converted to a step-wise action/state dataset. ## Files | file | what it is | |---|---| | `model.safetensors` | the CAD-WAM weights (BF16, 378 tensors) | | `config.json`, `generation_config.json` | architecture and decoding configuration | | `modeling_cadwam.py`, `geometric_state_embedding.py`, `state_prediction_head.py` | the model definition, loaded through `trust_remote_code=True` | | tokenizer files | unchanged from the backbone, plus the geometric placeholder token | | `setvae_encoder/setvae_encoder.pt` | the SetVAE point-cloud encoder that produces the 1024-d geometric state (6.4 M parameters) | ## Loading ```python from transformers import AutoModelForCausalLM, AutoTokenizer tok = AutoTokenizer.from_pretrained("") model = AutoModelForCausalLM.from_pretrained( "", trust_remote_code=True, dtype="bfloat16" ).eval() ``` Requires `transformers >= 4.51` (the model definition imports the Qwen3 classes at module scope); verified with 4.57.6, the version the checkpoint was trained under. The model is **not** a plain text-to-text model. A forward pass expects a `geo_latent` tensor of shape `(batch, 1024)` alongside `input_ids`, and the prompt must contain the geometric placeholder token at the 16 positions reserved for the state. Encoding a solid into that latent requires the SetVAE encoder in `setvae_encoder/`; its architecture, the point-cloud sampling, the CAD kernel executor and the closed-loop rollout are in the anonymous code repository linked from the review discussion. For the first step of a construction the state is the empty model, whose latent is the encoder's representation of an empty point set. A forward pass returns `logits`, `pred_next_state` (the predicted next geometric state, `(batch, 1024)`), `last_hidden_state`, `geo_hidden_states` and `state_repr`. ## Intended use and limitations Research artifact for reproducing the paper's results. The action vocabulary covers sketch-and-extrude modelling (lines, arcs and circles in a sketch plane, extrusion with boolean union, cut and new-body operations); fillet, chamfer, revolve and sketches on created faces are **not** part of this checkpoint's representation. Generations are only as valid as the kernel confirms: an action that fails to produce a solid is rejected during rollout rather than silently accepted. The checkpoint was trained and evaluated on one corpus of mechanical parts and should not be expected to transfer to organic shapes, assemblies or drawings. ## License MIT for the released weights and code in this repository. The backbone is Qwen2.5-1.5B-Instruct (Apache-2.0); the training data derives from a public CAD corpus under its own terms.