mlsanityData to 14 Oct 2026

Extracting Algorithms in Pre-trained LLMs: A Case on Hidden Markov Models

arXiv 2607.22646 ↗First posted 24 Jun 2026cs.AI cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

Large language models (LLMs) display a striking ability to predict next observations from Hidden Markov Models (HMMs) via in-context learning (ICL), but the algorithm underlying this capability remains undetermined: prior work has proposed several candidates without consensus, and none has been grounded in the model's internal activations. We close this gap with a three-stage pipeline. First, we empirically compare LLM behavior against a suite of candidate algorithms and narrow the space to three classes -- though no single class explains LLM behavior across all HMM settings and sequence lengths. Second, we derive theoretical connections between the three classes and show how each can be implemented in-context by a Transformer, validating the construction in a small trained Transformer. Third, returning to pre-trained LLMs, we introduce the Principal Activations Probe (PAP), a layer-wise probing and intervention method that isolates algorithmic signals in model activations. PAP reveals low-dimensional linear representations that causally drive model predictions and track empirical ICL performance. PAP further reveals how these representations shift with properties of the underlying HMM regime; distinct computational stages are localized to different layers. Together, our results connect the in-context behavior of pre-trained LLMs to the underlying internal mechanisms and advance our understanding of how LLMs perform ICL on HMMs.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 9 of its 42 references that are in the map. First posted on arXiv 24 Jun 2026.

Builds on

9 of 42 references.

References · 9

  1. 2023Towards Best Practices of Activation Patching in Language Models: Metrics and Methodscited by 359
  2. 2025Interpreting the Repeated Token Phenomenon in Large Language Modelscited by 16
  3. 2025Learning In-context n-grams with Transformers: Sub-n-grams Are Near-stationary Pointscited by 16
  4. 2024On Limitation of Transformer for Learning HMMscited by 10
  5. 2026From Kepler to Newton: Inductive Biases Guide Learned World Models in Transformerscited by 7
  6. 2025Finite Sample Identification of Partially Observed Bilinear Dynamical Systemscited by 5
  7. 2025What One Cannot, Two Can: Two-Layer Transformers Provably Represent Induction Heads on Any-Order Markov Chainscited by 5
  8. 2023Bridging the Usability Gap: Theoretical and Methodological Advances for Spectral Learning of Hidden Markov Modelscited by 2
  9. 2025Transformers as Multi-task Learners: Decoupling Features in Hidden Markov Modelscited by 1

Built on by

Not cited yet.