Introduction
Recent advancements in Large Language Models (LLMs) have demonstrated remarkable capabilities in In-Context Learning (ICL), where models solve complex tasks based solely on examples provided in a prompt. However, a fundamental question remains: are these models merely performing sophisticated pattern matching, or are they developing internal "world models" that reflect the underlying rules of the physical environment?
Physics serves as an ideal domain to investigate this question due to its reliance on rigid, universal laws such as the conservation of energy. This research investigates whether an LLM (specifically Qwen3) spontaneously discovers these physical principles when tasked with forecasting the trajectories of mechanical systems.
Methodology
The study employs a combination of dynamics forecasting and mechanistic interpretability techniques to probe the model's internal state.
- Dynamics Forecasting: The model is prompted with numerical trajectories (positions and velocities) of physical systems. Using a specialized "single-digit" tokenization method, numerical data is treated as sequences that the model processes without explicit physical instructions.
- Sparse Autoencoders (SAEs): To analyze the model's internal communication, SAEs are used to deconstruct the "residual stream" of the Transformer. This process disentangles "polysemantic" neurons—which may respond to multiple unrelated stimuli—into "monosemantic" features that represent distinct physical concepts.
- Correlation and Causal Intervention: The researchers calculated the Pearson correlation between SAE-extracted features and ground-truth physical variables (e.g., Kinetic and Potential Energy). To establish causality, they performed interventions by "ablating" (suppressing) energy-related features to observe the impact on prediction accuracy.
Experimental Framework
The investigation utilized synthetic data from two classical mechanics setups:
- Coupled Mass-Spring System (1D): A stable system of three masses producing periodic motion.
- Coupled Pendulum System (3D): A complex, chaotic system representing a significantly higher forecasting challenge.
Models were evaluated across various context lengths ($L_{hist}$), ranging from 64 to 1024 steps, to determine how historical data influences the formation of internal representations.
Emergent Representations and Functional Analysis
The analysis revealed several key insights into how LLMs process physical data:
- Energy as an Emergent Feature: The model spontaneously develops internal features that correlate strongly with total energy. This suggests the model is not merely tracking positions but is internally representing the system's underlying dynamics.
- The "Middle Layer" Sweet Spot: These representations are most distinct in the middle layers of the transformer architecture, indicating that the model "assembles" its world model in these intermediate stages before generating final outputs.
- Context-Driven Understanding: As context length increases, energy features become more refined. In chaotic systems like the pendulum, longer histories are required to successfully disentangle kinetic and potential energy components.
Quantitative Results
The study demonstrates that these internal representations are functionally necessary for accurate forecasting.
- Scaling Performance: As shown in Figure 6, prediction error consistently decreases as context length ($L_{hist}$) increases, particularly for the more complex pendulum system.
- High Feature Correlation: SAE features reached high Pearson correlation coefficients with total energy, significantly outperforming random baselines.
- Impact of Causal Intervention: Suppressing the top 1% of energy-correlated activations led to a significant spike in prediction error. This effect was most pronounced in the chaotic pendulum system at higher context lengths, proving that the model actively utilizes its internal concept of energy to perform calculations.
Conclusion and Future Directions
This research provides evidence that LLMs can spontaneously learn fundamental physical principles through in-context learning. These "physics neurons" are not merely accidental correlations but are functional components of the model's predictive mechanism.
Future work may explore the impact of "Chain-of-Thought" prompting on these representations and whether similar emergent structures appear for more abstract domains like electromagnetism or quantum mechanics. Ultimately, these findings pave the way for more reliable, "physics-informed" AI agents capable of reasoning in grounded, real-world environments.
Summary updated