Evidence of Meaning in Language Models Trained on Programs
- URL: http://arxiv.org/abs/2305.11169v2
- Date: Wed, 24 May 2023 11:52:13 GMT
- Title: Evidence of Meaning in Language Models Trained on Programs
- Authors: Charles Jin, Martin Rinard
- Abstract summary: We present evidence that language models can learn meaning despite being trained only to perform next token prediction on text.
We first train a Transformer model on the corpus of programs, then probe the trained model's hidden states as it completes a program given a specification.
There is a strong, statistically significant correlation between the accuracy of the probe and the model's ability to generate a program that implements the specification.
- Score: 5.892876463573452
- License: http://creativecommons.org/licenses/by/4.0/
- Abstract: We present evidence that language models can learn meaning despite being
trained only to perform next token prediction on text, specifically a corpus of
programs. Each program is preceded by a specification in the form of (textual)
input-output examples. Working with programs enables us to precisely define
concepts relevant to meaning in language (e.g., correctness and semantics),
making program synthesis well-suited as an intermediate testbed for
characterizing the presence (or absence) of meaning in language models.
We first train a Transformer model on the corpus of programs, then probe the
trained model's hidden states as it completes a program given a specification.
Despite providing no inductive bias toward learning the semantics of the
language, we find that a linear probe is able to extract abstractions of both
current and future program states from the model states. Moreover, there is a
strong, statistically significant correlation between the accuracy of the probe
and the model's ability to generate a program that implements the
specification. To evaluate whether the semantics are represented in the model
states rather than learned by the probe, we design a novel experimental
procedure that intervenes on the semantics of the language while preserving the
lexicon and syntax. We also demonstrate that the model learns to generate
correct programs that are, on average, shorter than those in the training set,
which is evidence that language model outputs may differ from the training
distribution in semantically meaningful ways. In summary, this paper does not
propose any new techniques for training language models, but develops an
experimental framework for and provides insights into the acquisition and
representation of (formal) meaning in language models.
Related papers
- Tracr-Injection: Distilling Algorithms into Pre-trained Language Models [2.532202013576547]
We propose tracr-injection, a method that allows us to distill algorithms written in RASP directly into a pre-trained language model.<n>We show how our method creates an interpretable subspace within the model's residual stream, which can be decoded into the variables present in the RASP algorithm.
arXiv Detail & Related papers (2025-05-15T21:43:51Z) - Training Neural Networks as Recognizers of Formal Languages [87.06906286950438]
Formal language theory pertains specifically to recognizers.
It is common to instead use proxy tasks that are similar in only an informal sense.
We correct this mismatch by training and evaluating neural networks directly as binary classifiers of strings.
arXiv Detail & Related papers (2024-11-11T16:33:25Z) - Training of Scaffolded Language Models with Language Supervision: A Survey [62.59629932720519]
This survey organizes the literature on the design and optimization of emerging structures around post-trained LMs.<n>We refer to this overarching structure as scaffolded LMs and focus on LMs that are integrated into multi-step processes with tools.
arXiv Detail & Related papers (2024-10-21T18:06:25Z) - 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) - Code Representation Pre-training with Complements from Program
Executions [29.148208436656216]
We propose FuzzPretrain to explore the dynamic information of programs revealed by their test cases and embed it into the feature representations of code as complements.
FuzzyPretrain yielded more than 6%/9% mAP improvements on code search over its counterparts trained with only source code or AST.
arXiv Detail & Related papers (2023-09-04T01:57:22Z) - An Overview on Language Models: Recent Developments and Outlook [32.528770408502396]
Conventional language models (CLMs) aim to predict the probability of linguistic sequences in a causal manner.
Pre-trained language models (PLMs) cover broader concepts and can be used in both causal sequential modeling and fine-tuning for downstream applications.
arXiv Detail & Related papers (2023-03-10T07:55:00Z) - 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) - Summarize and Generate to Back-translate: Unsupervised Translation of
Programming Languages [86.08359401867577]
Back-translation is widely known for its effectiveness for neural machine translation when little to no parallel data is available.
We propose performing back-translation via code summarization and generation.
We show that our proposed approach performs competitively with state-of-the-art methods.
arXiv Detail & Related papers (2022-05-23T08:20:41Z) - Pre-Trained Language Models for Interactive Decision-Making [72.77825666035203]
We describe a framework for imitation learning in which goals and observations are represented as a sequence of embeddings.
We demonstrate that this framework enables effective generalization across different environments.
For test tasks involving novel goals or novel scenes, initializing policies with language models improves task completion rates by 43.6%.
arXiv Detail & Related papers (2022-02-03T18:55:52Z) - How could Neural Networks understand Programs? [67.4217527949013]
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.
arXiv Detail & Related papers (2021-05-10T12:21:42Z) - Sequence Model Design for Code Completion in the Modern IDE [3.4824234779710452]
We propose a novel design for predicting top-k next tokens that combines static analysis' ability to enumerate all valid keywords and in-scope identifiers with the ability of a language model to place a probability distribution over them.
Our model mixes character-level input representation with token output to represent out-of-vocabulary (OOV) tokens meaningfully and minimize prediction latency.
arXiv Detail & Related papers (2020-04-10T22:40:49Z)
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.