How Do Transformers Model Physics? Investigating the Simple Harmonic Oscillator
How do transformers model physics? Do transformers model systems with interpretable analytical solutions or do they create an “alien physics” that is difficult for humans to decipher? We have taken a step towards demystifying this larger puzzle by investigating the simple harmonic oscillator (SHO),...
Saved in:
| Main Authors: | , , |
|---|---|
| Format: | Article |
| Language: | English |
| Published: |
MDPI AG
2024-11-01
|
| Series: | Entropy |
| Subjects: | |
| Online Access: | https://www.mdpi.com/1099-4300/26/11/997 |
| Tags: |
Add Tag
No Tags, Be the first to tag this record!
|
| _version_ | 1846153622090416128 |
|---|---|
| author | Subhash Kantamneni Ziming Liu Max Tegmark |
| author_facet | Subhash Kantamneni Ziming Liu Max Tegmark |
| author_sort | Subhash Kantamneni |
| collection | DOAJ |
| description | How do transformers model physics? Do transformers model systems with interpretable analytical solutions or do they create an “alien physics” that is difficult for humans to decipher? We have taken a step towards demystifying this larger puzzle by investigating the simple harmonic oscillator (SHO), <inline-formula><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><semantics><mrow><mover accent="true"><mi>x</mi><mo>¨</mo></mover><mo>+</mo><mn>2</mn><mi>γ</mi><mover accent="true"><mi>x</mi><mo>˙</mo></mover><mo>+</mo><msubsup><mi>ω</mi><mn>0</mn><mn>2</mn></msubsup><mi>x</mi><mo>=</mo><mn>0</mn></mrow></semantics></math></inline-formula>, one of the most fundamental systems in physics. Our goal was to identify the methods transformers use to model the SHO, and to do so we hypothesized and evaluated possible methods by analyzing the encoding of these methods’ intermediates. We developed four criteria for the use of a method within the simple test bed of linear regression, where our method was <inline-formula><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><semantics><mrow><mi>y</mi><mo>=</mo><mi>w</mi><mi>x</mi></mrow></semantics></math></inline-formula> and our intermediate was <i>w</i>: (1) Can the intermediate be predicted from hidden states? (2) Is the intermediate’s encoding quality correlated with the model performance? (3) Can the majority of variance in hidden states be explained by the intermediate? (4) Can we intervene on hidden states to produce predictable outcomes? Armed with these two correlational (1,2), weak causal (3), and strong causal (4) criteria, we determined that transformers use known numerical methods to model the trajectories of the simple harmonic oscillator, specifically, the matrix exponential method. Our analysis framework can conveniently extend to high-dimensional linear systems and nonlinear systems, which we hope will help reveal the “world model” hidden in transformers. |
| format | Article |
| id | doaj-art-de124c4a41a44e98ab0f236da00b2563 |
| institution | Kabale University |
| issn | 1099-4300 |
| language | English |
| publishDate | 2024-11-01 |
| publisher | MDPI AG |
| record_format | Article |
| series | Entropy |
| spelling | doaj-art-de124c4a41a44e98ab0f236da00b25632024-11-26T18:03:22ZengMDPI AGEntropy1099-43002024-11-01261199710.3390/e26110997How Do Transformers Model Physics? Investigating the Simple Harmonic OscillatorSubhash Kantamneni0Ziming Liu1Max Tegmark2Institute for Artificial Intelligence and Fundamental Interactions, Massachusetts Institute of Technology, Cambridge, MA 02139, USAInstitute for Artificial Intelligence and Fundamental Interactions, Massachusetts Institute of Technology, Cambridge, MA 02139, USAInstitute for Artificial Intelligence and Fundamental Interactions, Massachusetts Institute of Technology, Cambridge, MA 02139, USAHow do transformers model physics? Do transformers model systems with interpretable analytical solutions or do they create an “alien physics” that is difficult for humans to decipher? We have taken a step towards demystifying this larger puzzle by investigating the simple harmonic oscillator (SHO), <inline-formula><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><semantics><mrow><mover accent="true"><mi>x</mi><mo>¨</mo></mover><mo>+</mo><mn>2</mn><mi>γ</mi><mover accent="true"><mi>x</mi><mo>˙</mo></mover><mo>+</mo><msubsup><mi>ω</mi><mn>0</mn><mn>2</mn></msubsup><mi>x</mi><mo>=</mo><mn>0</mn></mrow></semantics></math></inline-formula>, one of the most fundamental systems in physics. Our goal was to identify the methods transformers use to model the SHO, and to do so we hypothesized and evaluated possible methods by analyzing the encoding of these methods’ intermediates. We developed four criteria for the use of a method within the simple test bed of linear regression, where our method was <inline-formula><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><semantics><mrow><mi>y</mi><mo>=</mo><mi>w</mi><mi>x</mi></mrow></semantics></math></inline-formula> and our intermediate was <i>w</i>: (1) Can the intermediate be predicted from hidden states? (2) Is the intermediate’s encoding quality correlated with the model performance? (3) Can the majority of variance in hidden states be explained by the intermediate? (4) Can we intervene on hidden states to produce predictable outcomes? Armed with these two correlational (1,2), weak causal (3), and strong causal (4) criteria, we determined that transformers use known numerical methods to model the trajectories of the simple harmonic oscillator, specifically, the matrix exponential method. Our analysis framework can conveniently extend to high-dimensional linear systems and nonlinear systems, which we hope will help reveal the “world model” hidden in transformers.https://www.mdpi.com/1099-4300/26/11/997mechanistic intepretabilityAI for sciencephysics |
| spellingShingle | Subhash Kantamneni Ziming Liu Max Tegmark How Do Transformers Model Physics? Investigating the Simple Harmonic Oscillator Entropy mechanistic intepretability AI for science physics |
| title | How Do Transformers Model Physics? Investigating the Simple Harmonic Oscillator |
| title_full | How Do Transformers Model Physics? Investigating the Simple Harmonic Oscillator |
| title_fullStr | How Do Transformers Model Physics? Investigating the Simple Harmonic Oscillator |
| title_full_unstemmed | How Do Transformers Model Physics? Investigating the Simple Harmonic Oscillator |
| title_short | How Do Transformers Model Physics? Investigating the Simple Harmonic Oscillator |
| title_sort | how do transformers model physics investigating the simple harmonic oscillator |
| topic | mechanistic intepretability AI for science physics |
| url | https://www.mdpi.com/1099-4300/26/11/997 |
| work_keys_str_mv | AT subhashkantamneni howdotransformersmodelphysicsinvestigatingthesimpleharmonicoscillator AT zimingliu howdotransformersmodelphysicsinvestigatingthesimpleharmonicoscillator AT maxtegmark howdotransformersmodelphysicsinvestigatingthesimpleharmonicoscillator |