Can a Large Language Model Learn Matrix Functions In Context?
This work addresses the problem of efficient high-dimensional numerical computation for researchers and practitioners, offering a potential alternative to classical methods, though it is incremental in exploring LLM capabilities for specific matrix operations.
The paper investigates whether large language models (LLMs) can learn matrix functions, such as those from Singular Value Decomposition, through in-context learning, finding that LLMs outperform traditional methods like SGD-based linear regression and neural networks on complex tasks like top-k singular values, with high accuracy and scalability as matrix size increases.
Large Language Models (LLMs) have demonstrated the ability to solve complex tasks through In-Context Learning (ICL), where models learn from a few input-output pairs without explicit fine-tuning. In this paper, we explore the capacity of LLMs to solve non-linear numerical computations, with specific emphasis on functions of the Singular Value Decomposition. Our experiments show that while LLMs perform comparably to traditional models such as Stochastic Gradient Descent (SGD) based Linear Regression and Neural Networks (NN) for simpler tasks, they outperform these models on more complex tasks, particularly in the case of top-k Singular Values. Furthermore, LLMs demonstrate strong scalability, maintaining high accuracy even as the matrix size increases. Additionally, we found that LLMs can achieve high accuracy with minimal prior examples, converging quickly and avoiding the overfitting seen in classical models. These results suggest that LLMs could provide an efficient alternative to classical methods for solving high-dimensional problems. Future work will focus on extending these findings to larger matrices and more complex matrix operations while exploring the effect of using different numerical representations in ICL.