[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-497900-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-497900-en":131},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":74,"head_meta":76,"extra_data":78,"updated_unix":80},105,"en","compilerdream-learning-a-compiler-world-model-for-general-code-optimization","CompilerDream - Learning a Compiler World Model for General Code Optimization","","Effective code optimization in compilers is crucial for software and computer engineering. Success largely depends on selecting and ordering optimization passes, yet existing approaches either search too slowly or struggle to generalize to unseen programs. CompilerDream introduces a compiler world model with reward smoothing to simulate optimization accurately. Value-prediction and end-to-end agents are trained on large datasets and act as versatile optimizers, achieving strong autotuning results on CompilerGym and strong zero-shot generalization across diverse datasets, outperforming built-in LLVM optimizations and recent methods.",{"@graph":14,"@context":73},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/research-report/","Research & Report",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/compilerdream-learning-a-compiler-world-model-for-general-code-optimization/497900/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/compilerdream-learning-a-compiler-world-model-for-general-code-optimization/497900.png","ImageObject",300,407,{"name":42,"@type":43},"nayy☆","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-16","2026-10-02",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",14,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"What problem does CompilerDream aim to solve in compiler optimization?","Question",{"text":63,"@type":64},"It targets the difficulty of finding effective optimization-pass sequences for specific programs, especially when existing search methods are too slow and learning approaches generalize poorly to unseen code.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"How does CompilerDream model and simulate compiler optimizations?",{"text":68,"@type":64},"It uses a compiler world model with reward smoothing to accurately simulate the optimization process, enabling reliable evaluation and planning for code optimization agents.",{"name":70,"@type":61,"acceptedAnswer":71},"What are the two agent construction approaches proposed by CompilerDream?",{"text":72,"@type":64},"Agents can be built either via value prediction or by directly generating optimization sequences end-to-end.","https://schema.org",{"og:url":32,"og:type":75,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":77,"canonical":32},"index,follow",{"doc_id":79,"site_id":7},497900,1791290080,{"code":4,"msg":82,"data":83},"success",[84,88,92,96,101,106,111,115,120,123,127],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":85,"show_sort_weight":86,"slug":87},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":93,"show_sort_weight":94,"slug":95},"Exam",70,"exam",{"id":97,"doc_module":4,"doc_module_name":25,"category_name":98,"show_sort_weight":99,"slug":100},5,"Comic",60,"comic",{"id":102,"doc_module":4,"doc_module_name":25,"category_name":103,"show_sort_weight":104,"slug":105},6,"Technology",50,"technology",{"id":107,"doc_module":4,"doc_module_name":25,"category_name":108,"show_sort_weight":109,"slug":110},7,"Healthcare",40,"healthcare",{"id":112,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":113,"slug":114},8,30,"research-report",{"id":116,"doc_module":4,"doc_module_name":25,"category_name":117,"show_sort_weight":118,"slug":119},9,"Religion & Spirituality",20,"religion-spirituality",{"id":118,"doc_module":4,"doc_module_name":25,"category_name":121,"show_sort_weight":118,"slug":122},"World Cup","world-cup",{"id":124,"doc_module":4,"doc_module_name":25,"category_name":125,"show_sort_weight":124,"slug":126},10,"Lifestyle","lifestyle",{"id":128,"doc_module":4,"doc_module_name":25,"category_name":129,"show_sort_weight":97,"slug":130},19,"General","general",{"code":4,"msg":82,"data":132},{"doc_id":79,"user_id":133,"nickname":42,"user_avatar":134,"doc_module":4,"category_id":112,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":135,"file_id":136,"file_url":137,"file_type":138,"file_size":139,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":140,"language":141,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":142,"faqs":143,"seo_title":144,"seo_description":12,"update_tm":145,"read_time":146,"preview_page_count":33,"preview_urls":147},962090893153,"https://ap-avatar.wpscdn.com/davatar_9964176cb1d06d4a9deccf72a44ae3dc","CompilerDream: Learning a Compiler World Model for General  \nCode Optimization  \narXiv :2404 . 16077v4 [ cs .PL] 28 May 2026  \nChaoyi Deng∗ School of Software, BNRist Tsinghua University Beijing, China  \n[dengcy23@mails.tsinghua.edu.cn](dengcy23@mails.tsinghua.edu.cn)  \nJialong Wu∗ School of Software, BNRist Tsinghua University Beijing, China [wujialong0229@gmail.com](wujialong0229@gmail.com)  \nNingya Feng  \nSchool of Software, BNRist Tsinghua University Beijing, China  \n[fny21@mails.tsinghua.edu.cn](fny21@mails.tsinghua.edu.cn)  \nJianmin Wang  \nSchool of Software, BNRist Tsinghua University Beijing, China [jimwang@tsinghua.edu.cn](jimwang@tsinghua.edu.cn)  \nMingsheng Long† School of Software, BNRist Tsinghua University Beijing, China  \n[mingsheng@tsinghua.edu.cn](mingsheng@tsinghua.edu.cn)  \nAbstract  \nEffective code optimization in compilers is crucial for computer and software engineering. The success of these optimizations primarily depends on the selection and ordering of the optimization passes applied to the code. While most compilers rely on fixed pass sequences, current methods to find the optimal sequence for specific programs either employ impractically slow search algorithms or learning methods that struggle to generalize to code unseen during training. To address these challenges, we introduce CompilerDream, the first world-model-based approach for general code optimization. CompilerDream features a compiler world model with a reward smoothing technique, enabling accurate simulation of optimization processes. Built on this model, code optimization agents can then be constructed via value prediction or direct optimization sequence generation. Trained on a large-scale program dataset, these agents serve as versatile code optimizers across diverse application scenarios and source-code languages. Our extensive experiments highlight CompilerDream’s strong optimization capabilities for autotuning, where it leads the CompilerGym leaderboard. More importantly, the zero-shot generalization ability of large-scale trained compiler world model and agent, excels across diverse datasets, surpassing LLVM’s built-in optimizations and state-of-the-art methods in both settings of value prediction and end-to-end code optimization.1  \nCCS Concepts  \n• Computing methodologies → Machine learning; Model development and analysis; • Software and its engineering → Compilers.  \n∗ Both authors contributed equally to this research.  \n†Corresponding author.  \n1 Code and data available at [https://github.com/thuml/CompilerDream](https://github.com/thuml/CompilerDream).  \nThis work is licensed under a Creative Commons Attribution 4 .0 International License. KDD’25, August 3–7, 2025, Toronto, ON, Canada  \n© 2025 Copyright held by the owner/author(s) .  \nACM ISBN 979-8-4007-1454-2/2025/08  \n[https://doi.org/10.1145/3711896.3736887](https://doi.org/10.1145/3711896.3736887)  \nKeywords  \nWorld Models, Compiler Optimization, Code Data Mining  \nACM Reference Format:  \nChaoyi Deng, Jialong Wu, Ningya Feng, Jianmin Wang, and Mingsheng Long. 2025. CompilerDream: Learning a Compiler World Model for General Code Optimization. In Proceedings of the 31st ACM SIGKDD Conference on Knowledge Discovery and Data Mining V.2 (KDD’25), August 3–7, 2025, Toronto, ON, Canada. ACM, New York, NY, USA, 17 pages. [https://doi.org/](https://doi.org/)[ ](https://doi.org/)10.1145/3711896.3736887  \nKDD Availability Link:  \nThe source code of this paper has been made publicly available at [https:](https:)//[doi.org/10.5281/zenodo.15552746. The data of](doi.org/10.5281/zenodo.15552746. The data of) this paper has been made publicly available at [https://doi.org/10.5281/zenodo.15549673](https://doi.org/10.5281/zenodo.15549673) .  \nFigure 1: CompilerDream performs code optimization by interacting with the compiler using an agent powered by a world model. With strong generalization capabilities, it efficiently optimizes programs from diverse origins.  \n1 Introduction  \nCode optimiz","cbCaivJxGA8lkBDS","https://ap.wps.com/l/cbCaivJxGA8lkBDS","pdf",1560159,17,"English","# Abstract\n# CCS Concepts\n# Keywords\n# 1 Introduction\n## Code optimization background\n## Optimization pass sequences\n## Limitations of existing search and learning methods","[{\"question\":\"What problem does CompilerDream aim to solve in compiler optimization?\",\"answer\":\"It targets the difficulty of finding effective optimization-pass sequences for specific programs, especially when existing search methods are too slow and learning approaches generalize poorly to unseen code.\"},{\"question\":\"How does CompilerDream model and simulate compiler optimizations?\",\"answer\":\"It uses a compiler world model with reward smoothing to accurately simulate the optimization process, enabling reliable evaluation and planning for code optimization agents.\"},{\"question\":\"What are the two agent construction approaches proposed by CompilerDream?\",\"answer\":\"Agents can be built either via value prediction or by directly generating optimization sequences end-to-end.\"}]","CompilerDream - Learning a Compiler World Model for General Code Optimization | PDF",1790970982,43,[148,152,156,160],{"page_no":22,"url":149,"width":150,"height":151},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/71c34078ab59eb7a5fe8cf7631c95eb9.webp",983,1272,{"page_no":26,"url":153,"width":154,"height":155},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/6d008f14f29aad8dd45c77a623d64aa0.webp",982,1270,{"page_no":30,"url":157,"width":158,"height":159},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/08c5598bb24bcc49a213d2ae9c4fcfa3.webp",981,1269,{"page_no":33,"url":161,"width":162,"height":163},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/4b4e9a599274f82e99b77e0dc849b4ca.webp",980,1268]