Learn to explain transformer via interpretation path by reinforcement learning
Related Experiment Video
Updated: May 12, 2025

Closed-loop Neuro-robotic Experiments to Test Computational Properties of Neuronal Networks
Published on: March 2, 2015
Runliang Niu1, Qi Wang1, He Kong1
1School of Artificial Intelligence, Jilin University, ChangChun 130012, China; Engineering Research Center of Knowledge-Driven Human-Machine Intelligence, Ministry of Education, China.
Abstract:
In recent years, the Transformer model has become a key part of many AI systems, making it important to understand how it works. The large parameter size and complex structure of the Transformer make interpretation more difficult and less efficient. Fortunately, there are many internal variables in Transformers that can aid in the explanation process, including attention matrices, gradients, hidden states, and activations between layers. Effectively utilizing these internal factors can help us better understand the decision-making process of Transformers. Also, most existing works focus on one type of these features and fail to investigate the interpretability of different variables in a unified model. To address these issues, this paper introduces a Reinforcement Learning environment in which the agent makes step-by-step modifications to input sequences to construct perturbed samples and gradually reduces the model's confidence in classification labels. The environment guides the agent to choose the token modification strategy along a more targeted interpretation path instead of random sampling, which can significantly improve the interpretation effectiveness. The flexibly designed agent can utilize multiple internal variables or even combinations of variables as observation, allowing for comparisons of their contributions to the model's interpretability. Extensive experiments conducted on three real-world datasets demonstrate the superior performance of our proposed model in both model interpretation and model adversarial attack tasks. We obtain a set of interesting findings, which can inspire further research on Transformer and Transformer-based model interpretation works. The code of this paper is available at https://github.com/niuzaisheng/Learn-to-Explain.
Related Concept Videos
Transformers in Distribution System
Distribution substation transformers come in various ratings and typically use mineral oil for insulation and cooling. To prevent moisture and air from entering the oil, some transformers use an inert gas like nitrogen to fill the...
Types Of Transformers
If the ratio of the number of turns in the secondary winding to that of the primary winding is greater than one, then the transformer is said to be a step-up transformer. In a step-up transformer, the voltage at the secondary winding is greater than the voltage applied at the primary winding.
However, if this ratio is less than one, the transformer is said to be a step-down...
Transformers
The iron core has a substantial relative permeability. Therefore, the magnetic field lines generated due to the current in one winding are almost entirely confined within the core, such that the same magnetic flux permeates each turn of both...
Three-Winding Transformers
In the per-unit equivalent circuit of a grounded Y-Y three-phase...
Transformers with Off-Nominal Turns Ratios
Reducing Line Loss
With a step-up transformer at the source, the voltage is increased, thereby reducing the current in the transmission lines since power loss...

