Beyond the Black Box: Theory and Mechanism of Large Language Models
Zeyu Gan, Ruifeng Ren, Wei Yao, Xiaolin Hu, Gengze Xu, Chen Qian, Huayi Tang, Zixuan Gong, Xinhao Yao, Pengwei Tang, Zhenxing Dou, Yong Liu
TL;DR
This paper addresses the lack of theoretical grounding for Large Language Models (LLMs) by introducing a lifecycle-based taxonomy that partitions theory into Data Preparation, Model Preparation, Training, Alignment, Inference, and Evaluation. It provides a systematic review of foundational theories and mechanisms across these stages, including data-mixture theory, representability of Transformers, pre-training scaling laws, RLHF dynamics, prompt engineering, and inference-time reasoning. The work highlights frontier challenges such as synthetic-data self-improvement limits, formal safety guarantees, and the mechanistic origins of emergent intelligence, offering a roadmap to shift LLM development from engineering heuristics to principled science. By connecting empirical observations with rigorous theory, it aims to unify disparate strands of LLM research and guide future investigations toward safe, trustworthy, and scalable AI systems.
Abstract
The rapid emergence of Large Language Models (LLMs) has precipitated a profound paradigm shift in Artificial Intelligence, delivering monumental engineering successes that increasingly impact modern society. However, a critical paradox persists within the current field: despite the empirical efficacy, our theoretical understanding of LLMs remains disproportionately nascent, forcing these systems to be treated largely as ``black boxes''. To address this theoretical fragmentation, this survey proposes a unified lifecycle-based taxonomy that organizes the research landscape into six distinct stages: Data Preparation, Model Preparation, Training, Alignment, Inference, and Evaluation. Within this framework, we provide a systematic review of the foundational theories and internal mechanisms driving LLM performance. Specifically, we analyze core theoretical issues such as the mathematical justification for data mixtures, the representational limits of various architectures, and the optimization dynamics of alignment algorithms. Moving beyond current best practices, we identify critical frontier challenges, including the theoretical limits of synthetic data self-improvement, the mathematical bounds of safety guarantees, and the mechanistic origins of emergent intelligence. By connecting empirical observations with rigorous scientific inquiry, this work provides a structured roadmap for transitioning LLM development from engineering heuristics toward a principled scientific discipline.
