{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/flexcad-unified-and-versatile-controllable","title":"FlexCAD: Unified and Versatile Controllable CAD Generation with Fine-tuned Large Language Models","arxiv_id":"2411.05823","date":"2024-11-05","proceeding":null,"authors":["Zhanwei Zhang","Shizhao Sun","Wenxiao Wang","Deng Cai","Jiang Bian"],"abstract":"Recently, there is a growing interest in creating computer-aided design (CAD) models based on user intent, known as controllable CAD generation. Existing work offers limited controllability and needs separate models for different types of control, reducing efficiency and practicality. To achieve controllable generation across all CAD construction hierarchies, such as sketch-extrusion, extrusion, sketch, face, loop and curve, we propose FlexCAD, a unified model by fine-tuning large language models (LLMs). First, to enhance comprehension by LLMs, we represent a CAD model as a structured text by abstracting each hierarchy as a sequence of text tokens. Second, to address various controllable generation tasks in a unified model, we introduce a hierarchy-aware masking strategy. Specifically, during training, we mask a hierarchy-aware field in the CAD text with a mask token. This field, composed of a sequence of tokens, can be set flexibly to represent various hierarchies. Subsequently, we ask LLMs to predict this masked field. During inference, the user intent is converted into a CAD text with a mask token replacing the part the user wants to modify, which is then fed into FlexCAD to generate new CAD models. Comprehensive experiments on public dataset demonstrate the effectiveness of FlexCAD in both generation quality and controllability. Code will be available at https://github.com/microsoft/FlexCAD.","url_abs":"https://arxiv.org/abs/2411.05823v2","url_pdf":"https://arxiv.org/pdf/2411.05823v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"flexcad-unified-and-versatile-controllable","repo_url":"https://github.com/microsoft/flexcad","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[{"method_slug":"set","method_name":"SET"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2411.05823","atlas_url":"https://app.syntology.ai/?focus=2411.05823","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2411.05823"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/microsoft/FlexCAD","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/microsoft/flexcad","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":3,"ran_honours":1,"unverified":8},"by_repo_kind":{"official":{"samples":12,"ran":4,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"a3fdffdcd374aabc","entry":"count_curve","repo":"microsoft/FlexCAD","repo_kind":"official","path":"finetune.py","file_url":"https://github.com/microsoft/FlexCAD/blob/HEAD/finetune.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a3fdffdcd374aabc"}},{"code_sha256_prefix":"75c80ac7bdc5c8ad","entry":"find_all_curve_end_positions","repo":"microsoft/FlexCAD","repo_kind":"official","path":"finetune.py","file_url":"https://github.com/microsoft/FlexCAD/blob/HEAD/finetune.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"75c80ac7bdc5c8ad"}},{"code_sha256_prefix":"680bb1e97d16d80c","entry":"find_files","repo":"microsoft/flexcad","repo_kind":"official","path":"utils/eval_cad.py","file_url":"https://github.com/microsoft/flexcad/blob/HEAD/utils/eval_cad.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"680bb1e97d16d80c"}},{"code_sha256_prefix":"5f1a10736eedb807","entry":"interleave_lists_with_zeros","repo":"microsoft/FlexCAD","repo_kind":"official","path":"finetune.py","file_url":"https://github.com/microsoft/FlexCAD/blob/HEAD/finetune.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5f1a10736eedb807"}},{"code_sha256_prefix":"7e74ac9f39f00581","entry":"angle_from_vector_to_x","repo":"microsoft/flexcad","repo_kind":"official","path":"utils/parser.py","file_url":"https://github.com/microsoft/flexcad/blob/HEAD/utils/parser.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7e74ac9f39f00581"}},{"code_sha256_prefix":"0952c03cfe81d964","entry":"create_curve_str","repo":"microsoft/flexcad","repo_kind":"official","path":"utils/convert.py","file_url":"https://github.com/microsoft/flexcad/blob/HEAD/utils/convert.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0952c03cfe81d964"}},{"code_sha256_prefix":"3281e0329f756e35","entry":"create_extrude_str","repo":"microsoft/flexcad","repo_kind":"official","path":"utils/convert.py","file_url":"https://github.com/microsoft/flexcad/blob/HEAD/utils/convert.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3281e0329f756e35"}},{"code_sha256_prefix":"49b122ae146ce330","entry":"create_sketch_str","repo":"microsoft/flexcad","repo_kind":"official","path":"utils/convert.py","file_url":"https://github.com/microsoft/flexcad/blob/HEAD/utils/convert.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"49b122ae146ce330"}},{"code_sha256_prefix":"24afc5c7ff764ff4","entry":"dequantize_verts","repo":"microsoft/flexcad","repo_kind":"official","path":"utils/parser.py","file_url":"https://github.com/microsoft/flexcad/blob/HEAD/utils/parser.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"24afc5c7ff764ff4"}},{"code_sha256_prefix":"9a578f2a671a37e4","entry":"distChamfer","repo":"microsoft/flexcad","repo_kind":"official","path":"utils/eval_cad.py","file_url":"https://github.com/microsoft/flexcad/blob/HEAD/utils/eval_cad.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9a578f2a671a37e4"}},{"code_sha256_prefix":"e49ee2dfad59267a","entry":"find_arc_geometry","repo":"microsoft/flexcad","repo_kind":"official","path":"utils/parser.py","file_url":"https://github.com/microsoft/flexcad/blob/HEAD/utils/parser.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e49ee2dfad59267a"}},{"code_sha256_prefix":"7ea8042cb1e765a6","entry":"read_ply","repo":"microsoft/flexcad","repo_kind":"official","path":"utils/eval_cad.py","file_url":"https://github.com/microsoft/flexcad/blob/HEAD/utils/eval_cad.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7ea8042cb1e765a6"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}