AST-Probe: Recovering abstract syntax trees from hidden representations
of pre-trained language models
- URL: http://arxiv.org/abs/2206.11719v1
- Date: Thu, 23 Jun 2022 14:09:05 GMT
- Title: AST-Probe: Recovering abstract syntax trees from hidden representations
of pre-trained language models
- Abstract summary: We prove the existence of a textitsyntactic subspace, lying in the hidden representations of pre-trained language models.
We show that this subspace exists in five state-of-the-art pre-trained language models.
This suggests that pre-trained language models use a small part of their representation spaces to encode syntactic information of the programming languages.
- Score: 0.6719751155411076
- License: http://creativecommons.org/licenses/by/4.0/
- Abstract: The objective of pre-trained language models is to learn contextual
representations of textual data. Pre-trained language models have become
mainstream in natural language processing and code modeling. Using probes, a
technique to study the linguistic properties of hidden vector spaces, previous
works have shown that these pre-trained language models encode simple
linguistic properties in their hidden representations. However, none of the
previous work assessed whether these models encode the whole grammatical
structure of a programming language. In this paper, we prove the existence of a
\textit{syntactic subspace}, lying in the hidden representations of pre-trained
language models, which contain the syntactic information of the programming
language. We show that this subspace can be extracted from the models'
representations and define a novel probing method, the AST-Probe, that enables
recovering the whole abstract syntax tree (AST) of an input code snippet. In
our experimentations, we show that this syntactic subspace exists in five
state-of-the-art pre-trained language models. In addition, we highlight that
the middle layers of the models are the ones that encode most of the AST
information. Finally, we estimate the optimal size of this syntactic subspace
and show that its dimension is substantially lower than those of the models'
representation spaces. This suggests that pre-trained language models use a
small part of their representation spaces to encode syntactic information of
the programming languages.
Related papers
- TypeProbe: Recovering Type Representations from Hidden States of Pre-trained Code Models [0.0]
State-of-the-art code models achieve impressive performance, yet the extent to which they internally encode type information remains poorly understood.<n>We probe the residual streams of pretrained code models for internal type representations using a parallel dataset of Java and Python code examples.<n>Our results show that cross-lingual type representations emerge even from untyped code.
arXiv Detail & Related papers (2026-07-09T10:29:15Z) - Pre-trained Language Models Do Not Help Auto-regressive Text-to-Image Generation [82.5217996570387]
We adapt a pre-trained language model for auto-regressive text-to-image generation.
We find that pre-trained language models offer limited help.
arXiv Detail & Related papers (2023-11-27T07:19:26Z) - Wave to Syntax: Probing spoken language models for syntax [16.643072915927313]
We focus on the encoding of syntax in several self-supervised and visually grounded models of spoken language.
We show that syntax is captured most prominently in the middle layers of the networks, and more explicitly within models with more parameters.
arXiv Detail & Related papers (2023-05-30T11:43:18Z) - Benchmarking Language Models for Code Syntax Understanding [79.11525961219591]
Pre-trained language models have demonstrated impressive performance in both natural language processing and program understanding.
In this work, we perform the first thorough benchmarking of the state-of-the-art pre-trained models for identifying the syntactic structures of programs.
Our findings point out key limitations of existing pre-training methods for programming languages, and suggest the importance of modeling code syntactic structures.
arXiv Detail & Related papers (2022-10-26T04:47:18Z) - Language Model Pre-Training with Sparse Latent Typing [66.75786739499604]
We propose a new pre-training objective, Sparse Latent Typing, which enables the model to sparsely extract sentence-level keywords with diverse latent types.
Experimental results show that our model is able to learn interpretable latent type categories in a self-supervised manner without using any external knowledge.
arXiv Detail & Related papers (2022-10-23T00:37:08Z) - Probing Linguistic Information For Logical Inference In Pre-trained
Language Models [2.4366811507669124]
We propose a methodology for probing linguistic information for logical inference in pre-trained language model representations.
We find that (i) pre-trained language models do encode several types of linguistic information for inference, but there are also some types of information that are weakly encoded.
We have demonstrated language models' potential as semantic and background knowledge bases for supporting symbolic inference methods.
arXiv Detail & Related papers (2021-12-03T07:19:42Z) - Towards Zero-shot Language Modeling [90.80124496312274]
We construct a neural model that is inductively biased towards learning human languages.
We infer this distribution from a sample of typologically diverse training languages.
We harness additional language-specific side information as distant supervision for held-out languages.
arXiv Detail & Related papers (2021-08-06T23:49:18Z) - Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods
in Natural Language Processing [78.8500633981247]
This paper surveys and organizes research works in a new paradigm in natural language processing, which we dub "prompt-based learning"
Unlike traditional supervised learning, which trains a model to take in an input x and predict an output y as P(y|x), prompt-based learning is based on language models that model the probability of text directly.
arXiv Detail & Related papers (2021-07-28T18:09:46Z) - Constrained Language Models Yield Few-Shot Semantic Parsers [73.50960967598654]
We explore the use of large pretrained language models as few-shot semantics.
The goal in semantic parsing is to generate a structured meaning representation given a natural language input.
We use language models to paraphrase inputs into a controlled sublanguage resembling English that can be automatically mapped to a target meaning representation.
arXiv Detail & Related papers (2021-04-18T08:13:06Z) - SLM: Learning a Discourse Language Representation with Sentence
Unshuffling [53.42814722621715]
We introduce Sentence-level Language Modeling, a new pre-training objective for learning a discourse language representation.
We show that this feature of our model improves the performance of the original BERT by large margins.
arXiv Detail & Related papers (2020-10-30T13:33:41Z)
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.