mlsanityData to 14 Oct 2026

Sparse Attention-Based Neural Networks for Code Classification

arXiv 2311.06575 ↗First posted 11 Nov 2023cs.PL cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

Categorizing source codes accurately and efficiently is a challenging problem in real-world programming education platform management. In recent years, model-based approaches utilizing abstract syntax trees (ASTs) have been widely applied to code classification tasks. We introduce an approach named the Sparse Attention-based neural network for Code Classification (SACC) in this paper. The approach involves two main steps: In the first step, source code undergoes syntax parsing and preprocessing. The generated abstract syntax tree is split into sequences of subtrees and then encoded using a recursive neural network to obtain a high-dimensional representation. This step simultaneously considers both the logical structure and lexical level information contained within the code. In the second step, the encoded sequences of subtrees are fed into a Transformer model that incorporates sparse attention mechanisms for the purpose of classification. This method efficiently reduces the computational cost of the self-attention mechanisms, thus improving the training speed while preserving effectiveness. Our work introduces a carefully designed sparse attention pattern that is specifically designed to meet the unique needs of code classification tasks. This design helps reduce the influence of redundant information and enhances the overall performance of the model. Finally, we also deal with problems in previous related research, which include issues like incomplete classification labels and a small dataset size. We annotated the CodeNet dataset with algorithm-related labeling categories, which contains a significantly large amount of data. Extensive comparative experimental results demonstrate the effectiveness and efficiency of SACC for the code classification tasks.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 21 of its 49 references that are in the map. First posted on arXiv 11 Nov 2023.

Builds on

21 of 49 references.

References · 21

  1. 2017Attention Is All You Needcited by 60,361
  2. 2014Adam: A Method for Stochastic Optimizationcited by 37,240
  3. 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
  4. 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
  5. 2013Efficient Estimation of Word Representations in Vector Spacecited by 4,375
  6. 2020Longformer: The Long-Document Transformercited by 3,413
  7. 2020Conformer: Convolution-augmented Transformer for Speech Recognitioncited by 1,863
  8. 2020Big Bird: Transformers for Longer Sequencescited by 1,684
  9. 2020Reformer: The Efficient Transformercited by 1,668
  10. 2019Generating Long Sequences with Sparse Transformerscited by 1,546
  11. 2020Linformer: Self-Attention with Linear Complexitycited by 1,474
  12. 2019BERT4Rec: Sequential Recommendation with Bidirectional Encoder Representations from Transformercited by 964
9 more
  1. 2014Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognitioncited by 720
  2. 2015A Neural Attention Model for Abstractive Sentence Summarizationcited by 396
  3. 2018code2vec: Learning Distributed Representations of Codecited by 250
  4. 2021CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Taskscited by 200
  5. 2020A Transformer-based Approach for Source Code Summarizationcited by 133
  6. 2019Tree Transformer: Integrating Tree Structures into Self-Attentioncited by 68
  7. 2017Automatically Generating Commit Messages from Diffs using Neural Machine Translationcited by 42
  8. 2015SourcererCC: Scaling Code Clone Detection to Big Codecited by 40
  9. 2021CAST: Enhancing Code Summarization with Hierarchical Splitting and Reconstruction of Abstract Syntax Treescited by 32

Built on by

Not cited yet.