mlsanityData to 14 Oct 2026

Code Compliance Assessment as a Learning Problem

arXiv 2209.04602 ↗First posted 10 Sep 2022cs.SE cs.AI cs.IRcited by 0

Not on the map. Why?

Abstract (arXiv)

Manual code reviews and static code analyzers are the traditional mechanisms to verify if source code complies with coding policies. However, these mechanisms are hard to scale. We formulate code compliance assessment as a machine learning (ML) problem, to take as input a natural language policy and code, and generate a prediction on the code's compliance, non-compliance, or irrelevance. This can help scale compliance classification and search for policies not covered by traditional mechanisms. We explore key research questions on ML model formulation, training data, and evaluation setup. The core idea is to obtain a joint code-text embedding space which preserves compliance relationships via the vector distance of code and policy embeddings. As there is no task-specific data, we re-interpret and filter commonly available software datasets with additional pre-training and pre-finetuning tasks that reduce the semantic gap. We benchmarked our approach on two listings of coding policies (CWE and CBP). This is a zero-shot evaluation as none of the policies occur in the training set. On CWE and CBP respectively, our tool Policy2Code achieves classification accuracies of (59%, 71%) and search MRR of (0.05, 0.21) compared to CodeBERT with classification accuracies of (37%, 54%) and MRR of (0.02, 0.02). In a user study, 24% Policy2Code detections were accepted compared to 7% for CodeBERT.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 28 of its 50 references that are in the map. First posted on arXiv 10 Sep 2022.

Builds on

28 of 50 references.

References · 28

  1. 2017Attention Is All You Needcited by 60,361
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  3. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  4. 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,918
  5. 2015FaceNet: A Unified Embedding for Face Recognition and Clusteringcited by 2,849
  6. 2017Billion-scale similarity search with GPUscited by 2,497
  7. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  8. 2017In Defense of the Triplet Loss for Person Re-Identificationcited by 786
  9. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
  10. 2017Sampling Matters in Deep Embedding Learningcited by 285
  11. 2017Learning to Represent Programs with Graphscited by 220
  12. 2020Sparse, Dense, and Attentional Representations for Text Retrievalcited by 214
16 more
  1. 2021Muppet: Massive Multi-task Representations with Pre-Finetuningcited by 192
  2. 2018Delete, Retrieve, Generate: A Simple Approach to Sentiment and Style Transfercited by 191
  3. 2017Beyond triplet loss: a deep quadruplet network for person re-identificationcited by 172
  4. 2018DeepBugs: A Learning Approach to Name-based Bug Detectioncited by 65
  5. 2020Deep Learning for Source Code Modeling and Generation: Models, Applications and Challengescited by 55
  6. 2016Unsupervised Pretraining for Sequence to Sequence Learningcited by 47
  7. 2019When Deep Learning Met Code Searchcited by 46
  8. 2019Multi-Modal Attention Network Learning for Semantic Source Code Retrievalcited by 41
  9. 2019CoaCor: Code Annotation for Code Retrieval with Reinforcement Learningcited by 22
  10. 2020Deep Graph Matching and Searching for Semantic Code Retrievalcited by 20
  11. 2019CORE: Automating Review Recommendation for Code Changescited by 14
  12. 2015SWIM: Synthesizing What I Meancited by 10
  13. 2021Leveraging Unsupervised Learning to Summarize APIs Discussed in Stack Overflowcited by 9
  14. 2019Neural Bug Finding: A Study of Opportunities and Challengescited by 6
  15. 2020CoNCRA: A Convolutional Neural Network Code Retrieval Approachcited by 3
  16. 2021What Do Developers Discuss about Code Comments?cited by 3

Built on by

Not cited yet.