mlsanityData to 14 Oct 2026

The EarlyBIRD Catches the Bug: On Exploiting Early Layers of Encoder Models for More Efficient Code Classification

arXiv 2305.04940 ↗First posted 8 May 2023cs.SE cs.AI cs.CLcited by 5

Not on the map. Why?

Abstract (arXiv)

The use of modern Natural Language Processing (NLP) techniques has shown to be beneficial for software engineering tasks, such as vulnerability detection and type inference. However, training deep NLP models requires significant computational resources. This paper explores techniques that aim at achieving the best usage of resources and available information in these models. We propose a generic approach, EarlyBIRD, to build composite representations of code from the early layers of a pre-trained transformer model. We empirically investigate the viability of this approach on the CodeBERT model by comparing the performance of 12 strategies for creating composite representations with the standard practice of only using the last encoder layer. Our evaluation on four datasets shows that several early layer combinations yield better performance on defect detection, and some combinations improve multi-class classification. More specifically, we obtain a +2 average improvement of detection accuracy on Devign with only 3 out of 12 layers of CodeBERT and a 3.3x speed-up of fine-tuning. These findings show that early layers can be used to obtain better results using the same resources, as well as to reduce resource usage during fine-tuning and inference.

Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 37 of its 57 references that are in the map. First posted on arXiv 8 May 2023.

Builds on

37 of 57 references.

References · 37

  1. 2017Attention Is All You Needcited by 60,361
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  3. 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
  4. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  5. 2019XLNet: Generalized Autoregressive Pretraining for Language Understandingcited by 2,811
  6. 2019ALBERT: A Lite BERT for Self-supervised Learning of Language Representationscited by 2,790
  7. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  8. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
  9. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
  10. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
  11. 2019Reducing Transformer Depth on Demand with Structured Dropoutcited by 439
  12. 2019How to Fine-Tune BERT for Text Classification?cited by 411
25 more
  1. 2019Linguistic Knowledge and Transferability of Contextual Representationscited by 383
  2. 2021Unified Pre-training for Program Understanding and Generationcited by 366
  3. 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 272
  4. 2020Revisiting Few-sample BERT Fine-tuningcited by 238
  5. 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 221
  6. 2019To Tune or Not to Tune? Adapting Pretrained Representations to Diverse Taskscited by 167
  7. 2018Dissecting Contextual Word Embeddings: Architecture and Representationcited by 146
  8. 2018SequenceR: Sequence-to-Sequence Learning for End-to-End Program Repaircited by 145
  9. 2020Deep Learning based Vulnerability Detection: Are We There Yet?cited by 144
  10. 2020On the Effect of Dropping Layers of Pre-trained Transformer Modelscited by 118
  11. 2018Automated Vulnerability Detection in Source Code Using Deep Representation Learningcited by 114
  12. 2021CVEfixes: Automated Collection of Vulnerabilities and Their Fixes from Open-Source Softwarecited by 91
  13. 2020PyMT5: multi-mode translation of natural language and Python code with transformerscited by 80
  14. 2021Break-It-Fix-It: Unsupervised Learning for Program Repaircited by 71
  15. 2021CoTexT: Multi-task Learning with Code-Text Transformercited by 61
  16. 2021Neural Program Repair with Execution-based Backpropagationcited by 50
  17. 2021Multilingual training for Software Engineeringcited by 43
  18. 2021What do pre-trained code models know about code?cited by 36
  19. 2018Deep RNNs Encode Soft Hierarchical Syntaxcited by 34
  20. 2021A Survey on Machine Learning Techniques for Source Code Analysiscited by 24
  21. 2022Deep Learning Meets Software Engineering: A Survey on Pre-Trained Models of Source Codecited by 21
  22. 2022AST-Probe: Recovering abstract syntax trees from hidden representations of pre-trained language modelscited by 16
  23. 2023ContraBERT: Enhancing Code Pre-trained Models via Contrastive Learningcited by 16
  24. 2022An Exploratory Study on Code Attention in BERTcited by 12
  25. 2021Greedy-layer Pruning: Speeding up Transformer Models for Natural Language Processingcited by 11

Built on by

Cited by year

Citing papers per year: 2024: 2; 2025: 3.

5 papers.