IDEAS home Printed from https://ideas.repec.org/a/hin/complx/5027198.html
   My bibliography  Save this article

A Deep Learning Approach for a Source Code Detection Model Using Self-Attention

Author

Listed:
  • Yao Meng
  • Long Liu

Abstract

With the development of deep learning, many approaches based on neural networks are proposed for code clone. In this paper, we propose a novel source code detection model At-biLSTM based on a bidirectional LSTM network with a self-attention layer. At-biLSTM is composed of a representation model and a discriminative model. The representation model firstly transforms the source code into an abstract syntactic tree and splits it into a sequence of statement trees; then, it encodes each of the statement trees with a deep-first traversal algorithm. Finally, the representation model encodes the sequence of statement vectors via a bidirectional LSTM network, which is a classical deep learning framework, with a self-attention layer and outputs a vector representing the given source code. The discriminative model identifies the code clone depending on the vectors generated by the presentation model. Our proposed model retains both the syntactics and semantics of the source code in the process of encoding, and the self-attention algorithm makes the classifier concentrate on the effect of key statements and improves the classification performance. The contrast experiments on the benchmarks OJClone and BigCloneBench indicate that At-LSTM is effective and outperforms the state-of-art approaches in source code clone detection.

Suggested Citation

  • Yao Meng & Long Liu, 2020. "A Deep Learning Approach for a Source Code Detection Model Using Self-Attention," Complexity, Hindawi, vol. 2020, pages 1-15, September.
  • Handle: RePEc:hin:complx:5027198
    DOI: 10.1155/2020/5027198
    as

    Download full text from publisher

    File URL: http://downloads.hindawi.com/journals/8503/2020/5027198.pdf
    Download Restriction: no

    File URL: http://downloads.hindawi.com/journals/8503/2020/5027198.xml
    Download Restriction: no

    File URL: https://libkey.io/10.1155/2020/5027198?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Jiaman Ding & Weikang Fu & Lianyin Jia, 2023. "Deep Forest and Pruned Syntax Tree-Based Classification Method for Java Code Vulnerability," Mathematics, MDPI, vol. 11(2), pages 1-18, January.

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:hin:complx:5027198. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Mohamed Abdelhakeem (email available below). General contact details of provider: https://www.hindawi.com .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.