From Text to Trajectories: GPT-2 as an ODE Solver via In-Context

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Ma, Ziyang, Zhou, Baojian, Yang, Deqing, Xiao, Yanghua
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866913975105486848
author Ma, Ziyang
Zhou, Baojian
Yang, Deqing
Xiao, Yanghua
author_facet Ma, Ziyang
Zhou, Baojian
Yang, Deqing
Xiao, Yanghua
contents In-Context Learning (ICL) has emerged as a new paradigm in large language models (LLMs), enabling them to perform novel tasks by conditioning on a few examples embedded in the prompt. Yet, the highly nonlinear behavior of ICL for NLP tasks remains poorly understood. To shed light on its underlying mechanisms, this paper investigates whether LLMs can solve ordinary differential equations (ODEs) under the ICL setting. We formulate standard ODE problems and their solutions as sequential prompts and evaluate GPT-2 models on these tasks. Experiments on two types of ODEs show that GPT-2 can effectively learn a meta-ODE algorithm, with convergence behavior comparable to, or better than, the Euler method, and achieve exponential accuracy gains with increasing numbers of demonstrations. Moreover, the model generalizes to out-of-distribution (OOD) problems, demonstrating robust extrapolation capabilities. These empirical findings provide new insights into the mechanisms of ICL in NLP and its potential for solving nonlinear numerical problems.
format Preprint
id arxiv_https___arxiv_org_abs_2508_03031
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle From Text to Trajectories: GPT-2 as an ODE Solver via In-Context
Ma, Ziyang
Zhou, Baojian
Yang, Deqing
Xiao, Yanghua
Artificial Intelligence
In-Context Learning (ICL) has emerged as a new paradigm in large language models (LLMs), enabling them to perform novel tasks by conditioning on a few examples embedded in the prompt. Yet, the highly nonlinear behavior of ICL for NLP tasks remains poorly understood. To shed light on its underlying mechanisms, this paper investigates whether LLMs can solve ordinary differential equations (ODEs) under the ICL setting. We formulate standard ODE problems and their solutions as sequential prompts and evaluate GPT-2 models on these tasks. Experiments on two types of ODEs show that GPT-2 can effectively learn a meta-ODE algorithm, with convergence behavior comparable to, or better than, the Euler method, and achieve exponential accuracy gains with increasing numbers of demonstrations. Moreover, the model generalizes to out-of-distribution (OOD) problems, demonstrating robust extrapolation capabilities. These empirical findings provide new insights into the mechanisms of ICL in NLP and its potential for solving nonlinear numerical problems.
title From Text to Trajectories: GPT-2 as an ODE Solver via In-Context
topic Artificial Intelligence
url https://arxiv.org/abs/2508.03031