Language Models of Code are Few-Shot Commonsense Learners

10/13/2022
by   Aman Madaan, et al.
0

We address the general task of structured commonsense reasoning: given a natural language input, the goal is to generate a graph such as an event – or a reasoning-graph. To employ large language models (LMs) for this task, existing approaches “serialize” the output graph as a flat list of nodes and edges. Although feasible, these serialized graphs strongly deviate from the natural language corpora that LMs were pre-trained on, hindering LMs from generating them correctly. In this paper, we show that when we instead frame structured commonsense reasoning tasks as code generation tasks, pre-trained LMs of code are better structured commonsense reasoners than LMs of natural language, even when the downstream task does not involve source code at all. We demonstrate our approach across three diverse structured commonsense reasoning tasks. In all these natural language tasks, we show that using our approach, a code generation LM (CODEX) outperforms natural-LMs that are fine-tuned on the target task (e.g., T5) and other strong LMs such as GPT-3 in the few-shot setting.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
01/28/2022

Commonsense Knowledge Reasoning and Generation with Pre-trained Language Models: A Survey

While commonsense knowledge acquisition and reasoning has traditionally ...
research
06/12/2022

CoSe-Co: Text Conditioned Generative CommonSense Contextualizer

Pre-trained Language Models (PTLMs) have been shown to perform well on n...
research
02/21/2021

Automatic Code Generation using Pre-Trained Language Models

Recent advancements in natural language processing <cit.> <cit.> have le...
research
11/28/2022

GPT-Neo for commonsense reasoning-a theoretical and practical lens

Recent work has demonstrated substantial gains in pre-training large-sca...
research
06/02/2022

Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Code

Few-shot learning with large-scale, pre-trained language models is a pow...
research
02/10/2023

Translating Natural Language to Planning Goals with Large-Language Models

Recent large language models (LLMs) have demonstrated remarkable perform...
research
05/23/2023

Large Language Models as Commonsense Knowledge for Large-Scale Task Planning

Natural language provides a natural interface for human communication, y...

Please sign up or login with your details

Forgot password? Click here to reset