[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-81829-en":3,"doc-seo-81829-105":29,"detail-sidebar-cat-0-en-105":90},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":4,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":13,"seo_description":14,"update_tm":27,"read_time":28},81829,4398048950312,"Violet","https://ap-avatar.wpscdn.com/avatar/400002538284de19e3c?_k=1778320343897328908",6,"Technology","Hawk Harnessing Hardware-Aware Knowledge for High-Performance NPU Kernel Generation","High-performance NPU kernel generation remains a key industry bottleneck because developers must manually handle implicit hardware constraints and strict memory hierarchies. Large language models offer automation, yet they fail on NPUs due to missing hardware-specific priors: code reuse may compile but often causes runtime crashes and degraded performance. Hawk is a training-free framework that synthesizes runtime error knowledge, retrieves bottleneck-aware hardware-aligned knowledge, and distills effect-driven guidance from execution feedback. Experiments on real NPU workloads improve accuracy from 49.4% to 80.0% and yield up to 2.2× faster execution than state-of-the-art baselines.","Hawk: Harnessing Hardware-Aware Knowledge for High-Performance NPU Kernel Generation  \narXiv :2607 .0 1590v2 [ cs .AI] 3 Jul 2026  \nJunyi Wen∗ , Ruiyan Zhuang†, Yongjia Xu∗ , Pengtu Li∗ , Rui Zou∗ , Hongyi Chen∗ , Chingman Wan∗ , Puxu Yang∗ , Wuhui Chen∗‡, and Yanlin Wang∗  \n∗ Sun Yat-sen University, Zhuhai, China  \nEmail: {wenjy23, xuyj73, lipt5, zour5, chenhy567, wancm5, [yangpx26](yangpx26}@mail2.sysu.edu.cn)[}](yangpx26}@mail2.sysu.edu.cn)[@mail2.sysu.edu.cn](yangpx26}@mail2.sysu.edu.cn),{chenwuh, [wangylin36](wangylin36}@mail.sysu.edu.cn)[}](wangylin36}@mail.sysu.edu.cn)[@mail.sysu.edu.cn](wangylin36}@mail.sysu.edu.cn)  \n† Greater Bay Area National Technology Innovation Center, Guangzhou, China  \nEmail: [zhuangruiyan@ncti-gba.cn](zhuangruiyan@ncti-gba.cn)  \n‡Peng Cheng Laboratory, Shenzhen, China  \nAbstract—Developing high-performance kernels for Neural Processing Units (NPUs) is a critical industry bottleneck, requiring developers to manually navigate implicit hardware constraints and strict memory hierarchies. While large language models offer immense automation potential, they fail catastrophically on NPUs due to a fundamental lack of hardware-specific priors. Na¨ıvely transplanting code snippets from similar NPU kernels may pass the compiler, but it consistently triggers runtime crashes and performance degradation by blindly violating underlying hardware constraints. To overcome this, we introduce Hawk, a training-free framework that harnesses hardwareaware knowledge through three core modules: (1) RunTime Knowledge Synthesis Module, which employs a Triple-Part Executable Knowledge Representation to inherently couple the error context with executable semantics;  \n(2) Bottleneck-Aware Knowledge Retrieval Module, which implements a 2D-Retrieval paradigm to project queries into orthogonal syntactic and hardware-aligned semantic spaces; and (3) Effect-Driven Knowledge Distillation Module, which leverages LLM-driven semantic arbitration to continuously distill the knowledge by pruning errors and consolidating redundancies based on the empirical execution feedback. Extensive evaluations on real-world NPU workloads demonstrate that Hawk elevates generation accuracy from 49.4% to 80.0%, while achieving up to a 2.2× execution speedup over state-of-the-art baselines.  \nIndex Terms—NPU, Kernel Generation, Harness Engineering, Automatic Programming.  \nI. INTRODUCTION  \nDomain-specific accelerators like Neural Processing Units (NPUs) are critical for modern AI workloads, yet automating NPU kernel generation via Large Language Models (LLMs) [1]–[4] remains notoriously difficult. Our empirical study (§III) shows state-of-the-art LLMs achieve merely 13.3% Comp@1 (compilation success rate) and 13.3% Pass@1 (functional correctness rate) on NPUs, starkly contrasting with GPU generation (100% Comp@1, 80% Pass@1) . We find that over 75% of these failures stem from low-level, hardware-specific misuses (e.g., invalid API invocations and memory lay-  \nout mismatches) . Moreover, even functionally correct NPU kernels execute nearly 20× slower than their GPU equivalents under identical theoretical compute capacity.  \nRecent efforts to improve NPU kernel generation generally fall into two paradigms: model training (e.g., domain-adaptive fine-tuning [5] and RL guidance [6]) and intermediate representation (IR) assistance (e.g., lightweight DSLs [7] and polyhedral compilers [8]) . However, both suffer from severe scalability bottlenecks. In model-centric approaches, API updates [9], [10] induce distribution shifts that invalidate existing datasets, necessitating thousands of new expert-labeled samples and resource-intensive retraining [11]–[13] . Conversely, in IR-centric methods, even modest code library extensions demand months of manual engineering from specialists to rewrite grammar rules [14]–[17] .  \nTo bypass these scalability bottlenecks, we explore a highly scalable alternative: exploiting functional similarity among existing NPU kernels","cbCaijWsR6uDgZLK","https://ap.wps.com/l/cbCaijWsR6uDgZLK","pdf",1068742,1,12,"English","en",105,"# Introduction\n## Challenges in NPU Kernel Generation","[{\"question\":\"Why do large language models struggle with NPU kernel generation compared with GPUs?\",\"answer\":\"NPU kernels require hardware-specific constraints and memory hierarchy handling. Without hardware-specific priors, LLM-generated code may compile but commonly leads to runtime crashes and performance degradation, unlike the more forgiving GPU environment.\"},{\"question\":\"What is Hawk’s overall approach to improving NPU kernel generation?\",\"answer\":\"Hawk is a training-free framework that harnesses hardware-aware knowledge via three modules: runtime knowledge synthesis, bottleneck-aware knowledge retrieval, and effect-driven knowledge distillation from execution feedback.\"},{\"question\":\"How does Hawk achieve accuracy and speed improvements on real NPU workloads?\",\"answer\":\"It improves generation accuracy from 49.4% to 80.0% by coupling error context with executable semantics, retrieving knowledge aligned with both syntax and hardware semantics, and continuously distilling guidance by pruning errors and consolidating redundancies based on empirical execution feedback.\"}]",1784176432,30,{"code":4,"msg":30,"data":31},"ok",{"site_id":24,"language":23,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":85,"head_meta":87,"extra_data":89,"updated_unix":27},"hawk-harnessing-hardware-aware-knowledge-for-high-performance-npu-kernel-generation","",{"@graph":35,"@context":84},[36,53,67],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,50],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":49},"https://docshare.wps.com/document/technology/",3,{"item":51,"name":13,"@type":42,"position":52},"https://docshare.wps.com/document/hawk-harnessing-hardware-aware-knowledge-for-high-performance-npu-kernel-generation/81829/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":23,"description":14,"dateModified":61,"datePublished":61,"encodingFormat":60,"isAccessibleForFree":62,"interactionStatistic":63},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":40,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-16",true,{"@type":64,"interactionType":65,"userInteractionCount":4},"InteractionCounter",{"@type":66},"ViewAction",{"@type":68,"mainEntity":69},"FAQPage",[70,76,80],{"name":71,"@type":72,"acceptedAnswer":73},"Why do large language models struggle with NPU kernel generation compared with GPUs?","Question",{"text":74,"@type":75},"NPU kernels require hardware-specific constraints and memory hierarchy handling. Without hardware-specific priors, LLM-generated code may compile but commonly leads to runtime crashes and performance degradation, unlike the more forgiving GPU environment.","Answer",{"name":77,"@type":72,"acceptedAnswer":78},"What is Hawk’s overall approach to improving NPU kernel generation?",{"text":79,"@type":75},"Hawk is a training-free framework that harnesses hardware-aware knowledge via three modules: runtime knowledge synthesis, bottleneck-aware knowledge retrieval, and effect-driven knowledge distillation from execution feedback.",{"name":81,"@type":72,"acceptedAnswer":82},"How does Hawk achieve accuracy and speed improvements on real NPU workloads?",{"text":83,"@type":75},"It improves generation accuracy from 49.4% to 80.0% by coupling error context with executable semantics, retrieving knowledge aligned with both syntax and hardware semantics, and continuously distilling guidance by pruning errors and consolidating redundancies based on empirical execution feedback.","https://schema.org",{"og:url":51,"og:type":86,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":88,"canonical":51},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":91},[92,96,100,104,109,112,117,121,126,129,133],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":93,"show_sort_weight":94,"slug":95},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":97,"show_sort_weight":98,"slug":99},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":45,"category_name":101,"show_sort_weight":102,"slug":103},"Exam",70,"exam",{"id":105,"doc_module":4,"doc_module_name":45,"category_name":106,"show_sort_weight":107,"slug":108},5,"Comic",60,"comic",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":110,"slug":111},50,"technology",{"id":113,"doc_module":4,"doc_module_name":45,"category_name":114,"show_sort_weight":115,"slug":116},7,"Healthcare",40,"healthcare",{"id":118,"doc_module":4,"doc_module_name":45,"category_name":119,"show_sort_weight":28,"slug":120},8,"Research & Report","research-report",{"id":122,"doc_module":4,"doc_module_name":45,"category_name":123,"show_sort_weight":124,"slug":125},9,"Religion & Spirituality",20,"religion-spirituality",{"id":124,"doc_module":4,"doc_module_name":45,"category_name":127,"show_sort_weight":124,"slug":128},"World Cup","world-cup",{"id":130,"doc_module":4,"doc_module_name":45,"category_name":131,"show_sort_weight":130,"slug":132},10,"Lifestyle","lifestyle",{"id":134,"doc_module":4,"doc_module_name":45,"category_name":135,"show_sort_weight":105,"slug":136},19,"General","general"]