about
Language Models of Code Are Few-Shot Commonsense Learners (arxiv.org)
2 points by tim_sw on May 15, 2023 | hide | past | pdf | discuss on HN

In plain words: Instead of writing the answer graph as a flat list of nodes and edges, they write it as code that builds the graph, so a model trained on code can produce it. Across three commonsense reasoning tasks, this code-trained model beat language models fine-tuned on each task and GPT-3 given a few examples.

Abstract · Language Models of Code are Few-Shot Commonsense Learners

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.

Aman Madaan, Shuyan Zhou, Uri Alon, Yiming Yang, Graham Neubig
arXiv:2210.07128 · cs.CL, cs.LG · submitted Oct 13, 2022 · updated Dec 6, 2022
abstract · pdf · html · EMNLP 2022

add comment on HN
Also discussed: May 2023 (1 point, 0 comments) · May 2023 (3 points, 0 comments)