按年被提到
20222023 · 8 次2026
大模型与语言模型›大模型推理与思维链·arXiv:2210.07128 · cs.CL

Language Models of Code are Few-Shot Commonsense Learners

代码语言模型是少样本常识学习者
Aman Madaan, Shuyan Zhou, Uri Alon, Yiming Yang, Graham Neubig · 2022

把结构化常识推理改写成代码生成,Codex表现更好

开始阅读 ↗PDFalphaXiv 讨论
被提及 · 5 人首次 2023-05-09 · 最近 2023-09-01
5不同的人
3活跃月份
8讨论串
131被引(OpenAlex)

论文把“生成事件图、推理图”这类结构化常识推理任务改写为代码生成任务,让用代码预训练的语言模型来完成。即使任务本身与代码无关,少样本设定下的 Codex 也优于在目标任务上微调的 T5 等自然语言模型,以及 GPT-3 等强基线。

HN 为什么提它

HN 上的人常引它来支持“用代码训练的模型推理更强,即使基准与代码无关”这一说法,也有人认为这一点此前已知,并不意外。

方法难度 3 / 5约 30 分钟经得起时间
读之前最好知道
1大语言模型的 few-shot 提示
2Codex 等代码预训练模型
3结构化常识推理任务
4图的基本表示

学习路径

读这篇之前,按顺序读书架上的 3 篇 · 参考文献来自 OpenAlex,顺序和要点由 Claude Code 排出

这条路径帮我建立预训练语言模型、文本到文本范式以及用语言模型生成形式化代码的背景,再看把结构化常识生成改写成代码生成的做法。

  1. 1
    Attention Is All You Need注意力就是你所需要的一切 · 2017

    现代语言模型,包括代码模型,都建立在 Transformer 之上。

    读抓自注意力和编码器-解码器结构。

  2. 2
    Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer探索迁移学习的极限:统一的文本到文本 Transformer · 2019

    文本到文本的统一框架,微调的 T5 一类序列化输出的做法正是目标论文所对照的。

    读抓把任务都转成文本输入输出的格式,理解把图序列化成文本的做法。

  3. 3

    同样利用大模型在代码或形式语言上的能力,把自然语言转成形式化表达。

    读抓用少样本提示让模型生成形式语言的做法。

  4. 4
    Language Models of Code are Few-Shot Commonsense Learners代码语言模型是少样本常识学习者 · 2022 · 就是这篇

    把结构化常识推理的输出图改写成代码,让代码语言模型少样本完成。

    读抓图到代码的转换方式、提示的设计,以及与序列化为扁平文本的对比实验。

HN 书评

推荐在前,同类按时间 · 每篇最多保留 20 条,统计用全部提及
批评wcoenen · 2023-09

“It was already known that training on code improves performance on all reasoning tasks[1], so this is not really surprising.”

Can Programming Languages Boost Each Other via Instruction Tuning? Yes原评论 ↗
引用cosmojg · 2023-05

“Alternatively, as Madaan et al. show in their 2022 paper[2],”

引它说明代码预训练是结构化推理提升的来源
LLMs are not greater than the sum of their parts: Stanford researchers原评论 ↗
引用og_kalu · 2023-05

“LLMs trained on code reason better. Perform better on reasoning benchmarks even if the benchmarks have nothing to do with code.”

引它说明用代码训练的 LLM 推理更强,即使基准与代码无关
Chatbots Don’t Know What Stuff Isn’t原评论 ↗
引用og_kalu · 2023-05

“Language models trained on Code reason better, even on benchmarks that have nothing to do with code.”

引它说明用代码训练的语言模型推理更强,即使基准与代码无关
Ask HN: Why can GPT4 en/decode base64?原评论 ↗
引用og_kalu · 2023-07

“Language models of code reason better even if the benchmarks have nothing to do with code.”

引它说明代码语言模型推理更强,即使基准与代码无关
AI Safety and the Age of Dislightenment原评论 ↗
被提交为 story · 3 次