Label Smoothing Improves Neural Source Code Summarization

Authors: Sakib Haque, Aakash Bansal, Collin McMillan

Submitted to arXiv on 28 Mar. 2023
Abstract

Label smoothing is a regularization technique for neural networks. Normally neural models are trained to an output distribution that is a vector with a single 1 for the correct prediction, and 0 for all other elements. Label smoothing converts the correct prediction location to something slightly less than 1, then distributes the remainder to the other elements such that they are slightly greater than 0. A conceptual explanation behind label smoothing is that it helps prevent a neural model from becoming "overconfident" by forcing it to consider alternatives, even if only slightly. Label smoothing has been shown to help several areas of language generation, yet typically requires considerable tuning and testing to achieve the optimal results. This tuning and testing has not been reported for neural source code summarization - a growing research area in software engineering that seeks to generate natural language descriptions of source code behavior. In this paper, we demonstrate the effect of label smoothing on several baselines in neural code summarization, and conduct an experiment to find good parameters for label smoothing and make recommendations for its use.

The papers around it, by date and closeness

Higher is closer to this paper; left is older. Lines join papers close to each other: groups of lines are sub-topics. Select a point to see why it is there. Back to the summary of this paper

How to read this map? Illustrated guide

Closest papers Prior work it builds on Papers that cite it

Papers around this one

Ranked by how close their title and abstract are to this paper’s. Select some to read them together.

Closest papers

  1. Very close
    When Does Label Smoothing Help?
    Rafael Müller, Simon Kornblith, Geoffrey Hinton · 2019 · Machine Learning · cited 2,595 times · AI summary available
    Abstract

    The generalization and learning speed of a multi-class neural network can often be significantly improved by using soft targets that are a weighted average of the hard targets and the uniform distribution over labels. Smoothing the labels in this way prevents the network from becoming over-confident and label smoothing has been used in many state-of-the-art models, including image classification, language translation and speech recognition. Despite its widespread use, label smoothing is still poorly understood. Here we show empirically that in addition to improving generalization, label smoothing improves model calibration which can significantly improve beam-search. However, we also observe…

  2. Very close Cited by this paper Used in depth by this paper
    Does label smoothing mitigate label noise?
    Michal Lukasik, Srinadh Bhojanapalli, A. Menon et al. · 2020 · International Conference on Machine Learning · cited 437 times · Not summarized yet
    Abstract

    Label smoothing is commonly used in training deep learning models, wherein one-hot training labels are mixed with uniform label vectors. Empirically, smoothing has been shown to improve both predictive performance and model calibration. In this paper, we study whether label smoothing is also effective as a means of coping with label noise. While label smoothing apparently amplifies this problem --- being equivalent to injecting symmetric noise to the labels --- we show how it relates to a general family of loss-correction techniques from the label noise literature. Building on this connection, we show that label smoothing is competitive with loss-correction under label noise. Further, we sho…

  3. Very close Cited by this paper
    Delving Deep Into Label Smoothing
    Chang-Bin Zhang, Peng-Tao Jiang, Qibin Hou et al. · 2020 · IEEE Transactions on Image Processing · cited 294 times · Not summarized yet
    Abstract

    Label smoothing is an effective regularization tool for deep neural networks (DNNs), which generates soft labels by applying a weighted average between the uniform distribution and the hard label. It is often used to reduce the overfitting problem of training DNNs and further improve classification performance. In this paper, we aim to investigate how to generate more reliable soft labels. We present an Online Label Smoothing (OLS) strategy, which generates soft labels based on the statistics of the model prediction for the target category. The proposed OLS constructs a more reasonable probability distribution between the target categories and non-target categories to supervise DNNs. Experim…

  4. Close Cites this paper
    Revisiting the Role of Label Smoothing in Enhanced Text Sentiment Classification
    Shijing Si, Yi-Jie Gao, Haixia Sun et al. · 2023 · Electronics · Not summarized yet
    Abstract

    Label smoothing is a widely used technique in various domains, such as text classification, image classification and speech recognition, known for effectively combating model overfitting. However, there is little fine-grained analysis on how label smoothing enhances text sentiment classification. To fill in the gap, this article performs a set of in-depth analyses on eight datasets for text sentiment classification and three deep learning architectures: TextCNN, BERT, and RoBERTa, under two learning schemes: training from scratch and fine-tuning. By tuning the smoothing parameters, we can achieve improved performance on almost all datasets for each model architecture. Specifically, our exper…

  5. Close Cited by this paper
    From Label Smoothing to Label Relaxation
    Julian Lienen, Eyke Hüllermeier · 2021 · AAAI Conference on Artificial Intelligence · cited 68 times · Not summarized yet
    Abstract

    Regularization of (deep) learning models can be realized at the model, loss, or data level. As a technique somewhere in-between loss and data, label smoothing turns deterministic class labels into probability distributions, for example by uniformly distributing a certain part of the probability mass over all classes. A predictive model is then trained on these distributions as targets, using cross-entropy as loss function. While this method has shown improved performance compared to non-smoothed cross-entropy, we argue that the use of a smoothed though still precise probability distribution as a target can be questioned from a theoretical perspective. As an alternative, we propose a generali…

  6. Close
    Meta Learning for Code Summarization
    Moiz Rauf, Sebastian Padó, Michael Pradel · 2022 · arXiv.org · preprint, not peer reviewed · cited 1 time · Not summarized yet
    Abstract

    Source code summarization is the task of generating a high-level natural language description for a segment of programming language code. Current neural models for the task differ in their architecture and the aspects of code they consider. In this paper, we show that three SOTA models for code summarization work well on largely disjoint subsets of a large code-base. This complementarity motivates model combination: We propose three meta-models that select the best candidate summary for a given code segment. The two neural models improve significantly over the performance of the best individual model, obtaining an improvement of 2.1 BLEU points on a dataset of code segments where at least on…

  7. Close
    On the Evaluation of Neural Code Summarization
    En-Sheng Shi, Yan-Lin Wang, Lun Du et al. · 2021 · International Conference on Software Engineering · cited 137 times · Not summarized yet
    Abstract

    Source code summaries are important for program comprehension and maintenance. However, there are plenty of programs with missing, outdated, or mismatched summaries. Recently, deep learning techniques have been exploited to automatically generate summaries for given code snippets. To achieve a profound understanding of how far we are from solving this problem and provide suggestions to future research, in this paper, we conduct a systematic and in-depth analysis of 5 state-of-the-art neural code summarization models on 6 widely used BLEU variants, 4 pre-processing operations and their combinations, and 3 widely used datasets. The evaluation results show that some important factors have a gre…

  8. Close
    Exploring the Utilization of Program Semantics in Extreme Code Summarization: An Experimental Study Based on Acceptability Evaluation
    Jiuli Li, Yan Liu · 2023 · International Journal of Advanced Computer Science and Applications · Not summarized yet
    Abstract

    —With the rise of deep learning methods, neural network architecture adopted from neural machine translation has been widely studied in code summarization by learning the sequential content of code. Given the inherent nature of programming languages, learning the representation of source code from the parsed structural information is also a typical way for constructing code summarization models. Recent studies show that the overall performance of the neural models for code summarization can be improved by utilizing sequential and structural information in a hybrid manner. However, both of these two kinds of information fed to the neural models for code summarization fail to embrace the seman…

Prior work it builds on

  1. Close Used in depth by this paper A method it uses
    Action Word Prediction for Neural Source Code Summarization
    Sakib Haque, Aakash Bansal, Ling-Fei Wu et al. · 2021 · IEEE International Conference on Software Analysis, Evolution, and Reengineering · cited 21 times · Not summarized yet
    Abstract

    Source code summarization is the task of creating short, natural language descriptions of source code. Code summarization is the backbone of much software documentation such as JavaDocs, in which very brief comments such as "adds the customer object" help programmers quickly understand a snippet of code. In recent years, automatic code summarization has become a high value target of research, with approaches based on neural networks making rapid progress. However, as we will show in this paper, the production of good summaries relies on the production of the action word in those summaries: the meaning of the example above would be completely changed if "removes" were substituted for "adds." …

  2. Close* A method it uses
    Improving automated source code summarization via an eye-tracking study of programmers
    Paige Rodeghero, Collin McMillan, P. Mcburney et al. · 2014 · International Conference on Software Engineering · cited 236 times · Not summarized yet
  3. Close A method it uses
    Summarizing Source Code using a Neural Attention Model
    Srini Iyer, Ioannis Konstas, Alvin Cheung et al. · 2016 · Annual Meeting of the Association for Computational Linguistics · cited 793 times · Not summarized yet
    Abstract

    High quality source code is often paired with high level summaries of the computation it performs, for example in code documentation or in descriptions posted in online forums. Such summaries are extremely useful for applications such as code search but are expensive to manually author, hence only done for a small fraction of all code that is produced. In this paper, we present the first completely datadriven approach for generating high level summaries of source code. Our model, CODE-NN , uses Long Short Term Memory (LSTM) networks with attention to produce sentences that describe C# code snippets and SQL queries. CODE-NN is trained on a new corpus that is automatically collected from Stack…

  4. Close A method it uses
    A Transformer-based Approach for Source Code Summarization
    Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray et al. · 2020 · Annual Meeting of the Association for Computational Linguistics · cited 474 times · Not summarized yet
    Abstract

    Generating a readable summary that describes the functionality of a program is known as source code summarization. In this task, learning code representation by modeling the pairwise relationship between code tokens to capture their long-range dependencies is crucial. To learn code representation for summarization, we explore the Transformer model that uses a self-attention mechanism and has shown to be effective in capturing long-range dependencies. In this work, we show that despite the approach is simple, it outperforms the state-of-the-art techniques by a significant margin. We perform extensive analysis and ablation studies that reveal several important findings, e.g., the absolute enco…

  5. Close
    Ensemble Models for Neural Source Code Summarization of Subroutines
    Alexander LeClair, Aakash Bansal, Collin McMillan · 2021 · IEEE International Conference on Software Maintenance and Evolution · cited 35 times · Not summarized yet
    Abstract

    A source code summary of a subroutine is a brief description of that subroutine. Summaries underpin a majority of documentation consumed by programmers, such as the method summaries in JavaDocs. Source code summarization is the task of writing these summaries. At present, most state-of-the-art approaches for code summarization are neural network-based solutions akin to seq2seq, graph2seq, and other encoder-decoder architectures. The input to the encoder is source code, while the decoder helps predict the natural language summary. While these models tend to be similar in structure, evidence is emerging that different models make different contributions to prediction quality - differences in m…

Papers that cite it

  1. Close
    Reduce Redundancy Then Rerank: Enhancing Code Summarization with a Novel Pipeline Framework
    Xiao-Yu Hu, Xu Zhang, Ze-Xu Lin et al. · 2024 · International Conference on Language Resources and Evaluation · cited 3 times · Not summarized yet
    Abstract

    Code summarization is the task of automatically generating natural language descriptions from source code. Recently, pre-trained language models have gained significant popularity in code summarization due to their capacity to capture richer semantic representations of both code and natural language. Nonetheless, contemporary code summarization models grapple with two fundamental limitations. (1) Some tokens in the code are irrelevant to the natural language description and damage the alignment of the representation spaces for code and language. (2) Most approaches are based on the encoder-decoder framework, which is often plagued by the exposure bias problem, hampering the effectiveness of …

  2. Related
    Automatic Extraction of Argumentative Relations from Scientific Communication Texts
    Yu.A. Zagorulko, E. Sidorova, I. Akhmadeeva · 2025 · Russian Digital Libraries Journal · Not summarized yet
    Abstract

    The complexity of the problem of extracting argumentative structures is associated with such problems as selecting argumentative segments, predicting long-range connections between non-contact segments, and training on data labeled with a low degree of inter-annotator consistency. In this paper, we consider an approach to extracting argumentative relations from fairly large texts related to scientific communication. A comparative analysis was performed of fine-tuning methods using a pre-trained Longformer-type language model that takes into account long contexts and two methods that take into account annotator discrepancies in argument labeling by using the so-called soft labels obtained by …

How are these papers found?

We compare the title and abstract of this paper with those of every paper summarized on this site, and with the papers Semantic Scholar recommends, those it cites and those citing it (for a much-cited paper, its most recent citations and, from OpenAlex, the most cited ones). Among the prior work and the follow-ups, the papers that use each other in depth, a method it uses and the much-cited follow-ups come a little higher. The levels (very close, close, related) come from the similarity of the texts, not from a judgment of quality; * marks a paper without an abstract, compared by its title. The sentence under a paper is written by an AI from the two abstracts: check it in the papers. A paper marked not relevant by three readers leaves the list.

Updated on 6 November 2026.

The illustrated guide to the papers around a paper