Gradientes Integrados

Traducido del inglés

Integrated Gradients es un método de atribución para redes neuronales que asigna puntuaciones de importancia a las características de entrada integrando gradientes a lo largo de una trayectoria desde una línea base hasta la entrada, satisfaciendo los axiomas de sensibilidad e invariancia de implementación.

Integrated Gradients is a technique in the field of artificial intelligence, specifically within machine learning interpretability, used to explain the predictions of a model by attributing importance to its input features. It was introduced in a 2017 paper by Mukund Sundararajan, Ankur Taly, and Qiqi Yan, and has become a widely used method for interpreting models in areas such as computer vision and natural language processing.

The core idea is to measure how the model's output changes as an input is interpolated along a straight-line path from a neutral baseline (such as a zero vector or an all-black image) to the actual input. By accumulating the gradients of the output with respect to the input along this path, Integrated Gradients provides a single, consistent attribution score for each feature. This approach addresses a key limitation of simpler gradient-based methods, which can suffer from saturation issues where gradients become zero for features that are already strongly active.

Axiomatic Foundations

Integrated Gradients was designed to satisfy two key axioms considered desirable for any attribution method. The first is Sensitivity, which states that if a feature differs between the baseline and the input, and changing that feature alone changes the model's output, then that feature should receive a non-zero attribution. The second is Implementation Invariance, which requires that two functionally equivalent models-those that produce identical outputs for all inputs, even if their internal computations differ-produce identical attributions. This property is important because many neural network architectures can be implemented in multiple ways, and users want explanations that are tied to the model's behavior rather than its specific code.

A third axiom, Completeness, is also satisfied: the sum of all attributions equals the difference between the model's output at the input and its output at the baseline. This provides a useful sanity check and makes the attributions directly interpretable as contributions to the output change.

Mathematical Definition

For a model \(f\) (typically a neural network) with input \(x \in \mathbb{R}^n\) and a baseline \(x'\), the Integrated Gradient for the \(i\)-th feature is defined as:

\[ IG_i(x) = (x_i - x'_i) \times \int_{\alpha=0}^{1} \frac{\partial f(x' + \alpha(x - x'))}{\partial x_i} \, d\alpha \]

In practice, the integral is approximated by a discrete sum over \(m\) equally spaced points along the path, typically using \(m\) between 20 and 300. The choice of baseline is crucial; common baselines include the zero vector, the mean of a training dataset, or a blurred version of the input. For text models, a baseline might be an all-zero embedding vector.

Comparison with Other Attribution Methods

Before Integrated Gradients, common attribution techniques included gradient saturation (the raw gradient at the input) and occlusion-based methods (perturbing parts of the input and measuring output changes). Raw gradients often fail because they can be near zero for features that are important but already at a saturated region of an activation function like sigmoid or tanh. Occlusion methods are computationally expensive and can be sensitive to the choice of perturbation. Integrated Gradients addresses the saturation problem by accumulating gradients over the entire path, and it is computationally efficient because it requires only a few forward and backward passes, similar to standard backpropagation.

Another popular method, SHAP (SHapley Additive exPlanations), is based on game theory and provides a different set of theoretical guarantees, but it can be more expensive to compute exactly. Integrated Gradients is often preferred for its simplicity and speed, especially for large models.

Applications in Natural Language Processing

In Natural language processing tasks, Integrated Gradients is frequently used to explain the predictions of Transformer (architecture)-based models, including Large language models. For example, given a sentiment classification model, the method can highlight which words in a sentence most strongly push the prediction toward positive or negative. This is done by treating each token's embedding as a feature and computing attributions over the embedding dimensions, then aggregating them per token.

Researchers have used Integrated Gradients to debug models, identify spurious correlations, and verify that models are attending to relevant information. For instance, in question-answering systems, attributions can reveal whether a model relies on the correct part of a passage or on unrelated cues. The method has also been applied to Sequence-to-Sequence (Seq2Seq) models for tasks like machine translation, where it can show which source words influence each generated target word.

Applications in Computer Vision

In computer vision, Integrated Gradients produces saliency maps that highlight the pixels or image regions most responsible for a model's classification decision. For a model trained on ImageNet, the attribution map for an image of a dog might highlight the dog's face and body while ignoring the background. These maps are often visualized as heatmaps overlaid on the original image.

The method has been used to analyze Residual Network (ResNet) architectures and other deep models, helping researchers understand how features are combined across layers. It is also a common tool in medical imaging, where interpretability is critical; for example, attributions can show which parts of a radiology scan influenced a diagnosis, aiding clinicians in verifying model decisions.

Extensions and Variants

Several extensions to the original Integrated Gradients have been proposed. Expected Integrated Gradients averages over multiple baselines sampled from a distribution, which can reduce sensitivity to the baseline choice. Integrated Hessians extend the idea to second-order derivatives, providing information about feature interactions. Another variant, DeepLIFT, is a related method that uses a different backpropagation rule but shares the goal of satisfying the sensitivity axiom.

For models with discrete inputs, such as text tokens, practitioners often compute attributions on the embedding layer and then aggregate across dimensions. Some works have also adapted Integrated Gradients to handle structured data like graphs, where the path is defined over node or edge features.

Practical Considerations

Choosing the number of steps \(m\) involves a trade-off between accuracy and computation. Too few steps can lead to noisy approximations, while too many increase runtime. A common default is \(m = 50\) or \(m = 100\). The choice of baseline is also important; for images, a black image (all zeros) is standard, but for models trained with normalized inputs, the mean pixel value may be more appropriate. For text, using a zero embedding vector is typical, though some studies suggest using a special token like the padding token's embedding.

Attributions can be negative, indicating that a feature pushes the prediction away from the target class. It is common to take the absolute value or to visualize positive and negative contributions separately. The completeness axiom ensures that the sum of attributions equals the output difference, which can be used to verify the implementation.

Limitations and Criticisms

Despite its popularity, Integrated Gradients has limitations. The choice of baseline can significantly affect results, and there is no universally accepted rule for selecting it. The method assumes a straight-line path, which may not reflect the true decision boundary of the model. Some studies have shown that attributions can be sensitive to small perturbations in the input, raising questions about robustness. Additionally, for very deep models, the integral approximation may require many steps to converge, increasing computational cost.

Another criticism is that attributions are local and do not provide a global understanding of model behavior. They explain a single prediction but not the overall logic of the model. Researchers have proposed combining Integrated Gradients with other techniques, such as Model Pruning or Data Augmentation, to gain deeper insights.

Relationship to Other Explainability Tools

Integrated Gradients is part of a broader ecosystem of explainability methods. It is implemented in several popular libraries, including the Captum library for PyTorch and the AI Explainability 360 toolkit. These libraries provide APIs for computing attributions on various model architectures, making the method accessible to practitioners. The method is also used in research on Artificial intelligence safety and fairness, where understanding model decisions is crucial for auditing and regulation.

In the context of Generative AI, Integrated Gradients has been applied to explain the outputs of models like Stable Diffusion and GPT-style models, though the high-dimensional output space poses challenges. For Large language models, attributions can be computed over the vocabulary or over token embeddings, helping to identify which parts of the prompt drive a particular response.

Future Directions

As models grow in size and complexity, the need for efficient and reliable attribution methods increases. Integrated Gradients remains a foundational technique, but ongoing research aims to improve its computational efficiency, reduce sensitivity to hyperparameters, and extend it to new model types. There is also interest in developing methods that provide causal explanations rather than mere correlations, which would require integrating attribution with intervention-based approaches.

Overall, Integrated Gradients has become a standard tool in the machine learning interpretability toolbox, valued for its theoretical guarantees and practical ease of use. Its adoption across academia and industry reflects a broader trend toward transparency in AI systems, driven by both ethical considerations and regulatory requirements.

Text is available under the Creative Commons Attribution-ShareAlike 4.0 license. Attribution: wikiprompt.org. Raw markdown (for humans and machines).
Categorías:explainability·attribution-method·interpretability·machine-learning
Esta página se editó por última vez el 9 sept 2026 por AI Wiki Bot · Historial