Learning the Relation between Code Features and Code Transforms with
Structured Prediction
- URL: http://arxiv.org/abs/1907.09282v2
- Date: Fri, 2 Jun 2023 23:19:18 GMT
- Title: Learning the Relation between Code Features and Code Transforms with
Structured Prediction
- Authors: Zhongxing Yu, Matias Martinez, Zimin Chen, Tegawend\'e F. Bissyand\'e,
Martin Monperrus
- Abstract summary: We present the first approach for structurally predicting code transforms at the level of AST nodes using conditional random fields (CRFs)
Our approach first learns offline a probabilistic model that captures how certain code transforms are applied to certain AST nodes, and then uses the learned model to predict transforms for arbitrary new, unseen code snippets.
- Score: 13.62633524166298
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- Abstract: To effectively guide the exploration of the code transform space for
automated code evolution techniques, we present in this paper the first
approach for structurally predicting code transforms at the level of AST nodes
using conditional random fields (CRFs). Our approach first learns offline a
probabilistic model that captures how certain code transforms are applied to
certain AST nodes, and then uses the learned model to predict transforms for
arbitrary new, unseen code snippets. {Our approach involves a novel
representation of both programs and code transforms. Specifically, we introduce
the formal framework for defining the so-called AST-level code transforms and
we demonstrate how the CRF model can be accordingly designed, learned, and used
for prediction}. We instantiate our approach in the context of repair transform
prediction for Java programs. Our instantiation contains a set of carefully
designed code features, deals with the training data imbalance issue, and
comprises transform constraints that are specific to code. We conduct a
large-scale experimental evaluation based on a dataset of bug fixing commits
from real-world Java projects. The results show that when the popular
evaluation metric \emph{top-3} is used, our approach predicts the code
transforms with an accuracy varying from 41\% to 53\% depending on the
transforms. Our model outperforms two baselines based on history probability
and neural machine translation (NMT), suggesting the importance of considering
code structure in achieving good prediction accuracy. In addition, a
proof-of-concept synthesizer is implemented to concretize some repair
transforms to get the final patches. The evaluation of the synthesizer on the
Defects4j benchmark confirms the usefulness of the predicted AST-level repair
transforms in producing high-quality patches.
Related papers
- Making the Most of your Model: Methods for Finetuning and Applying Pretrained Transformers [0.21756081703276003]
This thesis provides methods and analysis of models which make progress on this goal.
We introduce two new finetuning methods which add new capabilities to the models they are used on.
We provide theoretical and empirical insights on the divergence of model-likelihood and output quality.
arXiv Detail & Related papers (2024-08-29T03:50:24Z) - Learning on Transformers is Provable Low-Rank and Sparse: A One-layer Analysis [63.66763657191476]
We show that efficient numerical training and inference algorithms as low-rank computation have impressive performance for learning Transformer-based adaption.
We analyze how magnitude-based models affect generalization while improving adaption.
We conclude that proper magnitude-based has a slight on the testing performance.
arXiv Detail & Related papers (2024-06-24T23:00:58Z) - Scalable Learning of Latent Language Structure With Logical Offline
Cycle Consistency [71.42261918225773]
Conceptually, LOCCO can be viewed as a form of self-learning where the semantic being trained is used to generate annotations for unlabeled text.
As an added bonus, the annotations produced by LOCCO can be trivially repurposed to train a neural text generation model.
arXiv Detail & Related papers (2023-05-31T16:47:20Z) - Stochastic Code Generation [1.7205106391379026]
Large language models pre-trained for code generation can generate high-quality short code but often struggle with generating coherent long code.
This issue is also observed in language modeling for long text generation.
In this study, we investigate whether this technique can be applied to code generation to improve coherence.
arXiv Detail & Related papers (2023-04-14T00:01:05Z) - Transformer-based approaches to Sentiment Detection [55.41644538483948]
We examined the performance of four different types of state-of-the-art transformer models for text classification.
The RoBERTa transformer model performs best on the test dataset with a score of 82.6% and is highly recommended for quality predictions.
arXiv Detail & Related papers (2023-03-13T17:12:03Z) - Inducing Transformer's Compositional Generalization Ability via
Auxiliary Sequence Prediction Tasks [86.10875837475783]
Systematic compositionality is an essential mechanism in human language, allowing the recombination of known parts to create novel expressions.
Existing neural models have been shown to lack this basic ability in learning symbolic structures.
We propose two auxiliary sequence prediction tasks that track the progress of function and argument semantics.
arXiv Detail & Related papers (2021-09-30T16:41:19Z) - SIT3: Code Summarization with Structure-Induced Transformer [48.000063280183376]
We propose a novel model based on structure-induced self-attention, which encodes sequential inputs with highly-effective structure modeling.
Our newly-proposed model achieves new state-of-the-art results on popular benchmarks.
arXiv Detail & Related papers (2020-12-29T11:37:43Z) - Autoencoding Variational Autoencoder [56.05008520271406]
We study the implications of this behaviour on the learned representations and also the consequences of fixing it by introducing a notion of self consistency.
We show that encoders trained with our self-consistency approach lead to representations that are robust (insensitive) to perturbations in the input introduced by adversarial attacks.
arXiv Detail & Related papers (2020-12-07T14:16:14Z) - Evaluating Prediction-Time Batch Normalization for Robustness under
Covariate Shift [81.74795324629712]
We call prediction-time batch normalization, which significantly improves model accuracy and calibration under covariate shift.
We show that prediction-time batch normalization provides complementary benefits to existing state-of-the-art approaches for improving robustness.
The method has mixed results when used alongside pre-training, and does not seem to perform as well under more natural types of dataset shift.
arXiv Detail & Related papers (2020-06-19T05:08:43Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.