AstBERT: Enabling Language Model for Financial Code Understanding with Abstract Syntax Trees
Rong Liang, Tiehua Zhang, Yujie Lu, Yuze Liu, Zhen Huang, Xin Chen
Abstract
Using the pre-trained language models to understand source codes has attracted increasing attention from financial institutions owing to the great potential to uncover financial risks. However, there are several challenges in applying these language models to solve programming language related problems directly. For instance, the shift of domain knowledge between natural language (NL) and programming language (PL) requires understanding the semantic and syntactic information from the data from different perspectives. To this end, we propose the AstBERT model, a pre-trained PL model aiming to better understand the financial codes using the abstract syntax tree (AST). Specifically, we collect a sheer number of source codes (both Java and Python) from the Alipay code repository and incorporate both syntactic and semantic code knowledge into our model through the help of code parsers, in which AST information of the source codes can be interpreted and integrated. We evaluate the performance of the proposed model on three tasks, including code question answering, code clone detection and code refinement. Experiment results show that our AstBERT achieves promising performance on three different downstream tasks.- Anthology ID:
- 2022.finnlp-1.2
- Volume:
- Proceedings of the Fourth Workshop on Financial Technology and Natural Language Processing (FinNLP)
- Month:
- December
- Year:
- 2022
- Address:
- Abu Dhabi, United Arab Emirates (Hybrid)
- Editors:
- Chung-Chi Chen, Hen-Hsen Huang, Hiroya Takamura, Hsin-Hsi Chen
- Venue:
- FinNLP
- SIG:
- Publisher:
- Association for Computational Linguistics
- Note:
- Pages:
- 10–17
- Language:
- URL:
- https://aclanthology.org/2022.finnlp-1.2
- DOI:
- 10.18653/v1/2022.finnlp-1.2
- Cite (ACL):
- Rong Liang, Tiehua Zhang, Yujie Lu, Yuze Liu, Zhen Huang, and Xin Chen. 2022. AstBERT: Enabling Language Model for Financial Code Understanding with Abstract Syntax Trees. In Proceedings of the Fourth Workshop on Financial Technology and Natural Language Processing (FinNLP), pages 10–17, Abu Dhabi, United Arab Emirates (Hybrid). Association for Computational Linguistics.
- Cite (Informal):
- AstBERT: Enabling Language Model for Financial Code Understanding with Abstract Syntax Trees (Liang et al., FinNLP 2022)
- PDF:
- https://preview.aclanthology.org/nschneid-patch-4/2022.finnlp-1.2.pdf