ACL 2025finding0 citations

Explicit Bayesian Inference to Uncover the Latent Themes of Large Language Models

Raymond Li, Chuyuan Li, Gabriel Murray, Giuseppe Carenini

Abstract

Large language models (LLMs) have demonstrated impressive generative capabilities, yet their inner mechanisms remain largely opaque. In this work, we introduce a novel approach to interpret LLMs generation process through the lens of an explicit Bayesian framework by inferring latent topic variables via variational inference. Specifically, we leverage a variational autoencoder-based neural topic model to dynamically approximate the posterior distribution over the high-level latent topic variables at each generation step. By reconstructing the LLM’s next-token predictions through these latent topics and maintaining a regularized latent space, our method yields interpretable and diverse topic representations but also has the ability to effectively captures semantic shifts throughout the text. We validate our approach on multiple datasets, showing that our latent topics outperform state-of-the-art topic models on intrinsic measures of coherence and diversity. Furthermore, we demonstrate the utility of our approach in downstream applications by using the inferred topic distributions to retrieve relevant demonstration examples for in-context learning, resulting in significant gains on classification and summarization tasks.

BibTeX
@inproceedings{li-etal-2025-explicit,
    title = "Explicit {B}ayesian Inference to Uncover the Latent Themes of Large Language Models",
    author = "Li, Raymond  and
      Li, Chuyuan  and
      Murray, Gabriel  and
      Carenini, Giuseppe",
    editor = "Che, Wanxiang  and
      Nabende, Joyce  and
      Shutova, Ekaterina  and
      Pilehvar, Mohammad Taher",
    booktitle = "Findings of the Association for Computational Linguistics: ACL 2025",
    month = jul,
    year = "2025",
    address = "Vienna, Austria",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2025.findings-acl.1123/",
    doi = "10.18653/v1/2025.findings-acl.1123",
    pages = "21819--21833",
    ISBN = "979-8-89176-256-5"
}
Explicit Bayesian Inference to Uncover the Latent Themes of Large Language Models · ACL 2025