Pre-trained Large Language Models Learn Hidden Markov Models In-context
Hidden Markov 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)x2013their ability to infer patterns from
examples within a prompt. On a diverse set of synthetic HMMs, LLMs achieve
predictive accuracy approaching the theoretical optimum. We uncover novel
scaling trends influenced by HMM properties, and offer theoretical conjectures
for these empirical observations. We also provide practical guidelines for
scientists on using ICL as a diagnostic tool for complex data. On real-world
animal decision-making tasks, ICL achieves competitive performance with models
designed by human experts. To our knowledge, this is the first demonstration
that ICL can learn and predict HMM-generated sequencesx2013an
advance that deepens our understanding of in-context learning in LLMs and
establishes its potential as a powerful tool for uncovering hidden structure in
complex scientific data.
684795e83ec10bdd8ab4de6a
Yijia Dai
claimed_verified
2025-06-10T08:43:53.562Z
62de9e6fdcdc9043efa8b756
/avatars/c26974c740633d143f7382f0858ea99a.svg
Yijia Dai
user
DaiYijia
684795e83ec10bdd8ab4de6b
Zhaolin Gao
claimed_verified
2025-06-11T08:36:03.340Z
652eec0aabc673c4204c459e
https://cdn-avatars.huggingface.co/v1/production/uploads/652eec0aabc673c4204c459e/9otSQFP8G3S8zarR1Y5rE.jpeg
Zhaolin Gao
user
GitBag
684795e83ec10bdd8ab4de6c
Yahya Satter
extracted_pending
2025-06-10T17:17:58.491Z
6848686d2f229c24e592ced1
/avatars/df99a455c00423892dd6411bffa7c090.svg
Yahya Sattar
user
ysattar
684795e83ec10bdd8ab4de6d
Sarah Dean
extracted_confirmed
2025-06-10T10:25:24.393Z
664f92095a60ca2484b90d7a
/avatars/3232bb702ed479ac821b7a5dfb457d0b.svg
Sarah Dean
user
sarahdean
684795e83ec10bdd8ab4de6e
Jennifer J. Sun
Pre-trained Large Language Models Learn Hidden Markov Models In-context
Hidden Markov 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)x2013their ability to infer patterns from
examples within a prompt. On a diverse set of synthetic HMMs, LLMs achieve
predictive accuracy approaching the theoretical optimum. We uncover novel
scaling trends influenced by HMM properties, and offer theoretical conjectures
for these empirical observations. We also provide practical guidelines for
scientists on using ICL as a diagnostic tool for complex data. On real-world
animal decision-making tasks, ICL achieves competitive performance with models
designed by human experts. To our knowledge, this is the first demonstration
that ICL can learn and predict HMM-generated sequencesx2013an
advance that deepens our understanding of in-context learning in LLMs and
establishes its potential as a powerful tool for uncovering hidden structure in
complex scientific data.
In-context learning in large language models can effectively model sequences generated by hidden Markov models, achieving predictive accuracy and uncovering scaling trends, thus demonstrating its potential as a diagnostic tool for complex scientific data.
hidden Markov models HMMs large language models LLMs in-context learning IC predictive accuracy theoretical optimum synthetic HMMs scaling trends empirical observations animal decision-making tasks human experts