  Code summarization (CS) is becoming a promising area in recent natural
language understanding, which aims to generate sensible annotations
automatically for source code and is known as programmer oriented. Previous
works attempt to apply structure-based traversal (SBT) or non-sequential models
like Tree-LSTM and GNN to learn structural program semantics. They both meet
the following drawbacks: 1) it is shown ineffective to incorporate SBT into
Transformer; 2) it is limited to capture global information through GNN; 3) it
is underestimated to capture structural semantics only using Transformer. In
this paper, we propose a novel model based on structure-induced self-attention,
which encodes sequential inputs with highly-effective structure modeling.
Extensive experiments show that our newly-proposed model achieves new
state-of-the-art results on popular benchmarks. To our best knowledge, it is
the first work on code summarization that uses Transformer to model structural
information with high efficiency and no extra parameters. We also provide a
tutorial on how we pre-process.
