AI RESEARCH

Pre-trained Large Language Models Learn Hidden Markov Models In-context

arXiv CS.AI

ArXi:2506.07298v3 Announce Type: replace-cross Hidden Marko Models (HMMs) are foundational tools for modeling sequential data with latent Markovian structure, yet fitting them to real-world data remains computationally challenging. In this work, we show that pre-trained large language models (LLMs) can effectively model data generated by HMMs via in-context learning (ICL)$\unicode{x2013}$their ability to infer patterns from examples within a prompt. On a diverse set of synthetic HMMs, LLMs achieve predictive accuracy approaching the theoretical optimum.