paper-with-me

홈 › Papers

Do Language Models Learn Semantics of Code? A Case Study in Vulnerability Detection

2023-11-07 · Benjamin Steenhoek, Md Mahbubur Rahman, Shaila Sharmin, Wei Le

Recently, pretrained language models have shown state-of-the-art performance on the vulnerability detection task. These models are pretrained on a large corpus of source code, then fine-tuned on a smaller supervised vulnerability dataset. Due to the different training objectives and the performance of the models, it is interesting to consider whether the models have learned the semantics of code relevant to vulnerability detection, namely bug semantics, and if so, how the alignment to bug semantics relates to model performance. In this paper, we analyze the models using three distinct methods: interpretability tools, attention analysis, and interaction matrix analysis. We compare the models' influential feature sets with the bug semantic features which define the causes of bugs, including buggy paths and Potentially Vulnerable Statements (PVS). We find that (1) better-performing models also aligned better with PVS, (2) the models failed to align strongly to PVS, and (3) the models failed to align at all to buggy paths. Based on our analysis, we developed two annotation methods which highlight the bug semantics inside the model's inputs. We evaluated our approach on four distinct transformer models and four vulnerability datasets and found that our annotations improved the models' performance in the majority of settings - 11 out of 16, with up to 9.57 points improvement in F1 score compared to conventional fine-tuning. We further found that with our annotations, the models aligned up to 232% better to potentially vulnerable statements. Our findings indicate that it is helpful to provide the model with information of the bug semantics, that the model can attend to it, and motivate future work in learning more complex path-based bug semantics. Our code and data are available at https://figshare.com/s/4a16a528d6874aad51a0.

📄 PDF Abstract BibTeX arXiv:2311.04109

Code (0)

등록된 구현이 없습니다.

Tasks

Vulnerability Detection

Methods 이 논문이 사용한 방법론

ALIGN In the ALIGN method, visual and language representations are jointly trained from noisy image alt-text data. The image and text encoders are learned via contrastive loss…

Similar Papers 제목 키워드 기반

SemCoder: Training Code Language Models with Comprehensive Semantics Reasoning

2024-06-03 · Yangruibo Ding, Jinjun Peng, Marcus J. Min, Gail Kaiser 외

Code Large Language Models (Code LLMs) have excelled at tasks like code completion but often miss deeper semantics such as execution effects and dynamic states. This paper aims to bridge the gap between Code LLMs' relian…

Code CompletionCode GenerationHumanEvalProgram Repair

Are LLMs Models of Distributional Semantics? A Case Study on Quantifiers

2024-10-17 · Zhang Enyan, Zewei Wang, Michael A. Lepori, Ellie Pavlick 외

Distributional semantics is the linguistic theory that a word's meaning can be derived from its distribution in natural language (i.e., its use). Language models are commonly viewed as an implementation of distributional…

Semantics-Enhanced Task-Oriented Dialogue Translation: A Case Study on Hotel Booking

2017-11-01 · IJCNLP 2017 11 · Long-Yue Wang, Jinhua Du, Liangyou Li, Zhaopeng Tu 외

We showcase TODAY, a semantics-enhanced task-oriented dialogue translation system, whose novelties are: (i) task-oriented named entity (NE) definition and a hybrid strategy for NE recognition and translation; and (ii) a …

Dialogue UnderstandingMachine TranslationManagementNamed Entity Recognition (NER)+1

Smart Choices and the Selection Monad

2020-07-17 · Martin Abadi, Gordon Plotkin

Describing systems in terms of choices and their resulting costs and rewards offers the promise of freeing algorithm designers and programmers from specifying how those choices should be made; in implementations, the cho…

Decision Making

Can Language Model Understand Word Semantics as A Chatbot? An Empirical Study of Language Model Internal External Mismatch

2024-09-21 · Jinman Zhao, Xueyan Zhang, Xingyu Yue, Weizhe Chen 외

Current common interactions with language models is through full inference. This approach may not necessarily align with the model's internal knowledge. Studies show discrepancies between prompts and internal representat…

ChatbotDecoderLanguage ModelingLanguage Modelling+2