Static program analysis plays an essential role in program optimization, bug detection, and debugging. However, reliance on compilation and limited customization hinder its adoption in the real world. This paper presents a compositional neuro-symbolic approach named NESA that facilitates compilation-free and customizable static program analysis using large language models (LLMs) with mitigated hallucinations. Specifically, we propose an analysis policy language, a restricted form of Datalog, to support users decomposing a static program analysis problem into several sub-problems that target simpler syntactic or semantic properties upon smaller code snippets. The problem decomposition enables the LLMs to target more manageable semantic-related sub-problems with reduced hallucinations, while the syntactic ones are resolved by parsing-based analysis without hallucinations. An analysis policy then is evaluated with lazy and incremental prompting, which significantly mitigates the hallucinations and improves the performance. We evaluate NESA for program slicing and bug detection upon benchmark and real-world programs. Evaluation results show that while NESA supports compilation-free and customizable analysis, it can still achieve comparable and even better performance than existing techniques. In a customized taint vulnerability detection upon TaintBench, for example, NESA achieves a precision of 66.27%, a recall of 78.57%, and an F1 score of 0.72, surpassing an industrial approach by 0.20 in F1 score. NESA also detects 13 real-world memory leak bugs, which have been fixed by developers.


翻译:静态程序分析在程序优化、缺陷检测和调试中起着至关重要的作用。然而,对编译的依赖和有限的可定制性阻碍了其在实际场景中的广泛应用。本文提出一种名为NESA的组合式神经符号方法,利用大型语言模型(LLMs)实现无需编译且可定制的静态程序分析,并有效缓解幻觉问题。具体而言,我们提出一种分析策略语言(即受限形式的Datalog),支持用户将静态程序分析问题分解为若干子问题,这些子问题针对较小代码片段上的简单语法或语义属性。问题分解使LLMs能够专注于更易处理的语义相关子问题,从而减少幻觉,而语法相关子问题则通过基于解析的分析无幻觉地解决。分析策略随后通过惰性渐进式提示进行评估,显著缓解幻觉并提升性能。我们在基准程序和真实程序上评估了NESA在程序切片和缺陷检测中的表现。评估结果表明,尽管NESA支持无需编译和可定制的分析,其性能仍可与现有技术相媲美甚至更优。例如,在TaintBench上的定制化污点漏洞检测中,NESA实现了66.27%的精确率、78.57%的召回率和0.72的F1分数,在F1分数上比工业方法高出0.20。此外,NESA还检测出13个已被开发者修复的真实内存泄漏缺陷。

0
下载
关闭预览

相关内容

TransMLA:多头潜在注意力(MLA)即为所需
专知会员服务
23+阅读 · 2025年2月13日
【AAAI2024】大型语言模型是神经符号推理器
专知会员服务
38+阅读 · 2024年1月18日
【NeurIPS2023】大型语言模型是零样本的时间序列预测者
专知会员服务
47+阅读 · 2023年10月13日
神经网络常微分方程 (Neural ODEs) 解析
AI科技评论
42+阅读 · 2019年8月9日
大讲堂 | 神经关系抽取模型
AI研习社
24+阅读 · 2018年9月11日
深度学习文本分类方法综述(代码)
中国人工智能学会
28+阅读 · 2018年6月16日
神经网络结构在命名实体识别(NER)中的应用
全球人工智能
11+阅读 · 2018年4月5日
特定目标情感分析——神经网络这是要逆天么
计算机研究与发展
14+阅读 · 2017年9月5日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 3月24日
VIP会员
相关主题
最新内容
重新思考无人机时代的生存能力
专知会员服务
2+阅读 · 今天7:44
装甲突击旅:现代战争思考、战斗与组织
专知会员服务
2+阅读 · 今天7:28
在人工智能加速决策环境中拓展OODA循环
专知会员服务
3+阅读 · 今天7:18
军事欺骗:供作战战术指挥官使用的工具
专知会员服务
3+阅读 · 今天7:03
综述 | 世界动作模型:少做梦,多行动
专知会员服务
5+阅读 · 6月23日
美以伊冲突:无人机与人工智能的运用
专知会员服务
10+阅读 · 6月23日
《特种部队在透明战场中的生存力》最新报告
专知会员服务
5+阅读 · 6月23日
相关资讯
神经网络常微分方程 (Neural ODEs) 解析
AI科技评论
42+阅读 · 2019年8月9日
大讲堂 | 神经关系抽取模型
AI研习社
24+阅读 · 2018年9月11日
深度学习文本分类方法综述(代码)
中国人工智能学会
28+阅读 · 2018年6月16日
神经网络结构在命名实体识别(NER)中的应用
全球人工智能
11+阅读 · 2018年4月5日
特定目标情感分析——神经网络这是要逆天么
计算机研究与发展
14+阅读 · 2017年9月5日
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员