Skip to main content
QUICK REVIEW

[Paper Review] From Words to Numbers: Your Large Language Model Is Secretly A Capable Regressor When Given In-Context Examples

Robert Vacareanu, Vlad-Andrei Negru|arXiv (Cornell University)|Apr 11, 2024
Topic ModelingComputer Science3 citations
TL;DR

This paper demonstrates that pre-trained large language models (LLMs) like GPT-4 and Claude 3 can perform linear and non-linear regression with performance rivaling or exceeding traditional supervised methods—such as Random Forest and Gradient Boosting—when given in-context exemplars, without any fine-tuning or gradient updates. The models achieve sub-linear regret, indicating strong generalization as context size increases.

ABSTRACT

We analyze how well pre-trained large language models (e.g., Llama2, GPT-4, Claude 3, etc) can do linear and non-linear regression when given in-context examples, without any additional training or gradient updates. Our findings reveal that several large language models (e.g., GPT-4, Claude 3) are able to perform regression tasks with a performance rivaling (or even outperforming) that of traditional supervised methods such as Random Forest, Bagging, or Gradient Boosting. For example, on the challenging Friedman #2 regression dataset, Claude 3 outperforms many supervised methods such as AdaBoost, SVM, Random Forest, KNN, or Gradient Boosting. We then investigate how well the performance of large language models scales with the number of in-context exemplars. We borrow from the notion of regret from online learning and empirically show that LLMs are capable of obtaining a sub-linear regret.

Motivation & Objective

  • To investigate whether pre-trained LLMs can perform regression tasks using only in-context examples, without any fine-tuning or gradient updates.
  • To compare the regression performance of LLMs against traditional supervised models (e.g., Random Forest, Gradient Boosting) on synthetic datasets.
  • To analyze how LLM performance scales with increasing numbers of in-context exemplars.
  • To evaluate the robustness of LLMs on non-numerical input regression tasks and assess their generalization capability.
  • To explore whether non-transformer LLMs (e.g., RWKV, StripedHyena) can also exhibit strong in-context regression capabilities.

Proposed method

  • The study uses synthetic regression datasets, including linear functions, Friedman #1, #2, #3, and custom non-linear functions, to ensure deterministic, controllable, and non-overlapping data from training distributions.
  • For each regression task, the model is prompted with $ n $ input-output pairs as context, followed by a query input $ x_{n+1} $, and the model generates a predicted output $ \hat{y}_{n+1} $.
  • Performance is evaluated using Mean Absolute Error (MAE), with results averaged over 20 random seeds per dataset size and model.
  • The authors introduce a regret-based analysis inspired by online learning to measure how well LLMs improve with more in-context examples, showing sub-linear regret growth.
  • Experiments are conducted on multiple LLMs, including GPT-4, Claude 3, Llama2, DBRX, RWKV 14B, and StripedHyena 7B, across diverse regression tasks and context lengths.
  • To assess robustness, non-numerical input regression tasks are also evaluated, and model outputs are validated for correctness and consistency.
Figure 1: Mean Absolute Error ( $\downarrow$ ) comparison between three large language models (LLMs) and four traditional supervised methods for learning a linear regression function with one informative variable out of two. Given only in-context examples and without any additional training or gradi
Figure 1: Mean Absolute Error ( $\downarrow$ ) comparison between three large language models (LLMs) and four traditional supervised methods for learning a linear regression function with one informative variable out of two. Given only in-context examples and without any additional training or gradi

Experimental results

Research questions

  • RQ1Can pre-trained LLMs perform regression tasks effectively using only in-context examples, without any fine-tuning or gradient updates?
  • RQ2How does the performance of LLMs compare to traditional supervised models (e.g., Random Forest, Gradient Boosting) on linear and non-linear regression tasks?
  • RQ3How does the performance of LLMs scale with increasing numbers of in-context exemplars, and does it exhibit sub-linear regret?
  • RQ4Do non-transformer-based LLMs (e.g., RWKV, StripedHyena) also demonstrate strong in-context regression capabilities?
  • RQ5How do LLMs perform on regression tasks with non-numerical inputs, and what is the impact of dataset awareness on performance?

Key findings

  • Claude 3 outperforms multiple traditional supervised methods—including AdaBoost, SVM, Random Forest, KNN, and Gradient Boosting—on the challenging Friedman #2 regression dataset.
  • GPT-4 outperforms Random Forest in 92% of cases, Gradient Boosting in 51%, and Linear Regression with Polynomial Features in 40% of cases across five datasets and varying context sizes.
  • As the number of in-context examples increases from 20 to 500, GPT-4’s performance improves steadily, narrowing the gap with Linear Regression + Polynomial Features.
  • LLMs exhibit sub-linear regret growth as context size increases, indicating strong generalization and learning efficiency from in-context examples.
  • RWKV 14B performs worse than transformer-based LLMs but still surpasses unsupervised baselines on most tasks, while StripedHyena 7B struggles with validity, especially on complex datasets like Friedman #2.
  • On the Original #1 dataset, KNN-based methods perform well, suggesting that certain data structures may favor specific in-context learning behaviors in LLMs.
(a) Informative Variables: 1; Total Variables: 3
(a) Informative Variables: 1; Total Variables: 3

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.