代码世界建模(code world modeling)
Search documents
LeCun团队开源首个代码世界模型:能生成代码还能自测自修,传统编程模型一夜成古典
3 6 Ke· 2025-09-25 09:28
Core Insights - Meta FAIR has launched the Code World Model (CWM), a language model designed specifically for code generation and reasoning, featuring 32 billion parameters and a context size of 131k tokens, marking the first systematic introduction of world modeling into code generation [1][20]. Group 1: Model Capabilities - CWM distinguishes itself by not only generating code but also understanding its execution, simulating variable state changes and environmental feedback, thus enhancing overall code comprehension and debugging capabilities [2][6]. - The model has demonstrated impressive performance in various coding and reasoning tasks, achieving a score of 65.8% on the SWE-bench Verified benchmark, which is close to GPT-4 levels [2][25]. - CWM introduces code world modeling during training, allowing the model to learn how program states evolve during code execution, transitioning from static text prediction to dynamic execution understanding [8][9]. Group 2: Enhanced Features - CWM can simulate code execution line by line, predicting how each line affects variable states and identifying potential errors during execution [11][14]. - The model is capable of self-testing and self-correcting, automatically generating test cases and attempting multiple modification paths to fix errors, mimicking the human programming cycle of writing, testing, and revising [15][17]. - CWM exhibits reasoning and planning abilities, enabling it to analyze problem descriptions, plan function structures, and generate and validate code through iterative logical reasoning [18][19]. Group 3: Model Architecture and Training - The architecture of CWM consists of a 64-layer decoder-only Transformer with 32 billion parameters, supporting long context inputs of 131k tokens, enhancing its ability to handle complex projects and multi-file code [20][21]. - CWM underwent a three-phase training process, starting with pre-training on 8 trillion tokens, followed by mid-training with 5 trillion tokens focused on world modeling, and concluding with supervised fine-tuning and multi-task reinforcement learning [30][33]. - The training utilized advanced infrastructure, including FlashAttention-3 and low-precision acceleration, while adhering to safety frameworks to mitigate risks in sensitive domains [35]. Group 4: Future Directions and Limitations - Currently, CWM's world modeling data is limited to Python, with plans for future expansion to other programming languages like C++ and Java [36]. - The model is intended for research purposes only and is not suitable for dialogue tasks or chatbot applications, emphasizing its focus on code understanding and complex reasoning research [36][37].