用本地小模型分析代码,安全提取优化原则再调用云端大模型,兼顾性能与知识产权保护。
Principle-Guided Verilog Optimization: IP-Safe Knowledge Transfer via Local-Cloud Collaboration
- 本地小模型对比设计代码,提炼通用优化原则,避免直接暴露原始代码。
- 联合使用Qwen-2.5-Coder-7B与Deepseek-V3,功耗优化成功率高达66.67%。
- 适合需保护硬件设计机密的芯片开发团队,尤其适用于敏感场景下的自动化优化。
近年来,大语言模型(LLM)在寄存器传输级(RTL)代码优化中受到广泛关注。尽管云上强大的LLM具备优越优化能力,但在处理专有硬件设计时存在不可接受的知识产权(IP)泄露风险。本文提出一种新范式:在不泄露敏感IP的前提下优化Verilog代码的特定属性。我们首次构建了基于边缘-云协同的IP保护框架,融合两种模式优势。方法采用本地小型LLM(如Qwen-2.5-Coder-7B)对高质量目标设计与新手草稿代码进行安全比对分析,生成概括性设计原则;这些原则随后用于查询更强的云上LLM(如Deepseek-V3),实现针对性代码改进,确保仅抽象化且无敏感信息的指导被传至外部服务。实验表明,该框架显著提升优化成功率。例如,结合Qwen-2.5-Coder-7B与Deepseek-V3,在功耗利用优化上达到66.67%的成功率,优于单独使用Deepseek-V3(49.81%)及商业模型GPT-4o(55.81%)。进一步研究显示,不同模型组合在特定优化目标下表现各异,且比较代码对数量的变化引发有趣趋势。本工作确立了一种兼顾性能提升与IP保护的新范式。
原文摘要 · Abstract (English)
Recent years have witnessed growing interest in adopting large language models (LLMs) for Register Transfer Level (RTL) code optimization. While powerful cloud-based LLMs offer superior optimization capabilities, they pose unacceptable intellectual property (IP) leakage risks when processing proprietary hardware designs. In this paper, we propose a new scenario where Verilog code must be optimized for specific attributes without leaking sensitive IP information. We introduce the first IP-preserving edge-cloud collaborative framework that leverages the benefits of both paradigms. Our approach employs local small LLMs (e.g., Qwen-2.5-Coder-7B) to perform secure comparative analysis between paired high-quality target designs and novice draft codes, yielding general design principles that summarize key insights for improvements. These principles are then used to query stronger cloud LLMs (e.g., Deepseek-V3) for targeted code improvement, ensuring that only abstracted and IP-safe guidance reaches external services. Our experimental results demonstrate that the framework achieves significantly higher optimization success rates compared to baseline methods. For example, combining Qwen-2.5-Coder-7B and Deepseek-V3 achieves a 66.67\% optimization success rate for power utilization, outperforming Deepseek-V3 alone (49.81\%) and even commercial models like GPT-4o (55.81\%). Further investigation of local and cloud LLM combinations reveals that different model pairings exhibit varying strengths for specific optimization objectives, with interesting trends emerging when varying the number of comparative code pairs. Our work establishes a new paradigm for secure hardware design optimization that balances performance gains with IP protection.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。