How could Neural Networks understand Programs?
- URL: http://arxiv.org/abs/2105.04297v1
- Date: Mon, 10 May 2021 12:21:42 GMT
- Title: How could Neural Networks understand Programs?
- Authors: Dinglan Peng, Shuxin Zheng, Yatao Li, Guolin Ke, Di He, Tie-Yan Liu
- Abstract summary: It is difficult to build a model to better understand programs, by either directly applying off-the-shelf NLP pre-training techniques to the source code, or adding features to the model by theshelf.
We propose a novel program semantics learning paradigm, that the model should learn from information composed of (1) the representations which align well with the fundamental operations in operational semantics, and (2) the information of environment transition.
- Score: 67.4217527949013
- License: http://creativecommons.org/licenses/by-sa/4.0/
- Abstract: Semantic understanding of programs is a fundamental problem for programming
language processing (PLP). Recent works that learn representations of code
based on pre-training techniques in NLP have pushed the frontiers in this
direction. However, the semantics of PL and NL have essential differences.
These being ignored, we believe it is difficult to build a model to better
understand programs, by either directly applying off-the-shelf NLP pre-training
techniques to the source code, or adding features to the model by the
heuristic. In fact, the semantics of a program can be rigorously defined by
formal semantics in PL theory. For example, the operational semantics,
describes the meaning of a valid program as updating the environment (i.e., the
memory address-value function) through fundamental operations, such as memory
I/O and conditional branching. Inspired by this, we propose a novel program
semantics learning paradigm, that the model should learn from information
composed of (1) the representations which align well with the fundamental
operations in operational semantics, and (2) the information of environment
transition, which is indispensable for program understanding. To validate our
proposal, we present a hierarchical Transformer-based pre-training model called
OSCAR to better facilitate the understanding of programs. OSCAR learns from
intermediate representation (IR) and an encoded representation derived from
static analysis, which are used for representing the fundamental operations and
approximating the environment transitions respectively. OSCAR empirically shows
the outstanding capability of program semantics understanding on many practical
software engineering tasks.
Related papers
- Large Language Models are Interpretable Learners [53.56735770834617]
In this paper, we show a combination of Large Language Models (LLMs) and symbolic programs can bridge the gap between expressiveness and interpretability.
The pretrained LLM with natural language prompts provides a massive set of interpretable modules that can transform raw input into natural language concepts.
As the knowledge learned by LSP is a combination of natural language descriptions and symbolic rules, it is easily transferable to humans (interpretable) and other LLMs.
arXiv Detail & Related papers (2024-06-25T02:18:15Z) - Understanding Programs by Exploiting (Fuzzing) Test Cases [26.8259045248779]
We propose to incorporate the relationship between inputs and possible outputs/behaviors into learning, for achieving a deeper semantic understanding of programs.
To obtain inputs that are representative enough to trigger the execution of most part of the code, we resort to fuzz testing and propose fuzz tuning.
The effectiveness of the proposed method is verified on two program understanding tasks including code clone detection and code classification, and it outperforms current state-of-the-arts by large margins.
arXiv Detail & Related papers (2023-05-23T01:51:46Z) - Emergent Representations of Program Semantics in Language Models Trained on Programs [3.376269351435396]
We present evidence that language models (LMs) of code can learn to represent the formal semantics of programs.
We train a Transformer model on a synthetic corpus of programs written in a domain-specific language for navigating 2D grid world environments.
arXiv Detail & Related papers (2023-05-18T17:58:08Z) - Guiding the PLMs with Semantic Anchors as Intermediate Supervision:
Towards Interpretable Semantic Parsing [57.11806632758607]
We propose to incorporate the current pretrained language models with a hierarchical decoder network.
By taking the first-principle structures as the semantic anchors, we propose two novel intermediate supervision tasks.
We conduct intensive experiments on several semantic parsing benchmarks and demonstrate that our approach can consistently outperform the baselines.
arXiv Detail & Related papers (2022-10-04T07:27:29Z) - Supporting Vision-Language Model Inference with Confounder-pruning Knowledge Prompt [71.77504700496004]
Vision-language models are pre-trained by aligning image-text pairs in a common space to deal with open-set visual concepts.
To boost the transferability of the pre-trained models, recent works adopt fixed or learnable prompts.
However, how and what prompts can improve inference performance remains unclear.
arXiv Detail & Related papers (2022-05-23T07:51:15Z) - Learning to Synthesize Programs as Interpretable and Generalizable
Policies [25.258598215642067]
We present a framework that learns to synthesize a program, which details the procedure to solve a task in a flexible and expressive manner.
Experimental results demonstrate that the proposed framework not only learns to reliably synthesize task-solving programs but also outperforms DRL and program synthesis baselines.
arXiv Detail & Related papers (2021-08-31T07:03:06Z) - Semantics-Aware Inferential Network for Natural Language Understanding [79.70497178043368]
We propose a Semantics-Aware Inferential Network (SAIN) to meet such a motivation.
Taking explicit contextualized semantics as a complementary input, the inferential module of SAIN enables a series of reasoning steps over semantic clues.
Our model achieves significant improvement on 11 tasks including machine reading comprehension and natural language inference.
arXiv Detail & Related papers (2020-04-28T07:24:43Z) - Can We Learn Heuristics For Graphical Model Inference Using
Reinforcement Learning? [114.24881214319048]
We show that we can learn programs, i.e., policies, for solving inference in higher order Conditional Random Fields (CRFs) using reinforcement learning.
Our method solves inference tasks efficiently without imposing any constraints on the form of the potentials.
arXiv Detail & Related papers (2020-04-27T19:24:04Z)
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.