Quiet-STaR: I Modelli Linguistici Possono Imparare a Pensare Prima di Parlare
Quiet-STaR: Language Models Can Teach Themselves to Think Before Speaking
March 14, 2024
Autori: Eric Zelikman, Georges Harik, Yijia Shao, Varuna Jayasiri, Nick Haber, Noah D. Goodman
cs.AI
Abstract
Quando scrivono e parlano, le persone talvolta si fermano a riflettere. Sebbene i lavori focalizzati sul ragionamento lo abbiano spesso inquadrato come un metodo per rispondere a domande o completare compiti agentici, il ragionamento è implicito in quasi tutti i testi scritti. Ad esempio, questo si applica ai passaggi non dichiarati tra le righe di una dimostrazione o alla teoria della mente sottostante a una conversazione. Nel Self-Taught Reasoner (STaR, Zelikman et al. 2022), il pensiero utile viene appreso inferendo giustificazioni da esempi few-shot nel contesto di domande e risposte e imparando da quelli che portano a una risposta corretta. Questo è un contesto altamente vincolato: idealmente, un modello linguistico potrebbe invece imparare a inferire giustificazioni non dichiarate in testi arbitrari. Presentiamo Quiet-STaR, una generalizzazione di STaR in cui i modelli linguistici imparano a generare giustificazioni a ogni token per spiegare il testo futuro, migliorando le loro previsioni. Affrontiamo sfide chiave, tra cui 1) il costo computazionale della generazione di continuazioni, 2) il fatto che il modello linguistico inizialmente non sappia come generare o utilizzare pensieri interni, e 3) la necessità di prevedere oltre i singoli token successivi. Per risolverle, proponiamo un algoritmo di campionamento parallelo token per token, utilizzando token apprendibili che indicano l'inizio e la fine di un pensiero, e una tecnica estesa di teacher forcing. In modo incoraggiante, le giustificazioni generate aiutano in modo sproporzionato a modellare token difficili da prevedere e migliorano la capacità del modello linguistico di rispondere direttamente a domande difficili. In particolare, dopo un ulteriore pre-addestramento di un modello linguistico su un corpus di testo internet con Quiet-STaR, osserviamo miglioramenti zero-shot su GSM8K (5,9% → 10,9%) e CommonsenseQA (36,3% → 47,2%) e un miglioramento della perplessità per i token difficili nel testo naturale. Crucialmente, questi miglioramenti non richiedono alcun fine-tuning su questi compiti. Quiet-STaR rappresenta un passo verso modelli linguistici che possono imparare a ragionare in modo più generale e scalabile.
English
When writing and talking, people sometimes pause to think. Although
reasoning-focused works have often framed reasoning as a method of answering
questions or completing agentic tasks, reasoning is implicit in almost all
written text. For example, this applies to the steps not stated between the
lines of a proof or to the theory of mind underlying a conversation. In the
Self-Taught Reasoner (STaR, Zelikman et al. 2022), useful thinking is learned
by inferring rationales from few-shot examples in question-answering and
learning from those that lead to a correct answer. This is a highly constrained
setting -- ideally, a language model could instead learn to infer unstated
rationales in arbitrary text. We present Quiet-STaR, a generalization of STaR
in which LMs learn to generate rationales at each token to explain future text,
improving their predictions. We address key challenges, including 1) the
computational cost of generating continuations, 2) the fact that the LM does
not initially know how to generate or use internal thoughts, and 3) the need to
predict beyond individual next tokens. To resolve these, we propose a tokenwise
parallel sampling algorithm, using learnable tokens indicating a thought's
start and end, and an extended teacher-forcing technique. Encouragingly,
generated rationales disproportionately help model difficult-to-predict tokens
and improve the LM's ability to directly answer difficult questions. In
particular, after continued pretraining of an LM on a corpus of internet text
with Quiet-STaR, we find zero-shot improvements on GSM8K
(5.9%rightarrow10.9%) and CommonsenseQA (36.3%rightarrow47.2%) and
observe a perplexity improvement of difficult tokens in natural text.
Crucially, these improvements require no fine-tuning on these tasks. Quiet-STaR
marks a step towards LMs that can learn to reason in a more general and
scalable way.