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

Robert Vacareanu, Vlad-Andrei Negru, Vasile Suciu, Mihai Surdeanu
4/11/2024
cs.CLcs.AI

No official code found. Best implementation: robertvacareanu/llm4regression (161 stars, last commit 2025-10-12).

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.

View on arXivView PDF

Code Implementations(1)

Examining how large language models (LLMs) perform across various synthetic regression tasks when given (input, output) examples in their context, without any parameter update

16121Python, Jupyter NotebookJan 16, 20241 years ago
large-language-modelslinear-regressionllmllm-benchmarkingllm-inference+4 more

Similar Papers

Cite this paper

@article{vacareanu2024from,
  title  = {From Words to Numbers: Your Large Language Model Is Secretly A Capable Regressor When Given In-Context Examples},
  author = {Robert Vacareanu and Vlad-Andrei Negru and Vasile Suciu and Mihai Surdeanu},
  year   = {2024},
  eprint = {2404.07544},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.07544v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2404.07544.svg)](https://codeofpaper.com/paper/2404.07544)

Discussion