F2HF: Feed-Forward Network as a Noisy Head Filter in Vision Transformer Explanations
ICCIT 2025
Khulna University of Engineering & Technology
Abstract
Key Contribution
When the object is small or hard to distinguish from the background, F2HF generates cleaner saliency maps than existing methods.
Problem
When a neural network mades a decision, it is difficult to understand why that decision has been made. For example, if there is an images of a tiger and a cat (which both have highly similar facial structure and texture) and a vision model has decided the image to be cat, how would we know the model only focused on the features (i.e., structure and texture) of the cat and not on the features of the tiger? Interpretabiliy methods such as GradCAM, Integrated Gradients can be a tool to explore this question. However, in our experiments, these method seemed to not do good in cases where the object itself had very minimal presence in the overall image (e.g., the total image of 224 by 224 pixels but the object itself was present in 50 by 50 pixels) or when the object itself was difficult to distinguish from the background. Visual example of these 2 problems were added below.
In the above mentioned cases, existing methods are likely to attribute many background pixels comparetively highly. A possible reason is gradient shattering as most of these methods are gradient-based.
Besides, while recent research has shown the MLP to be the knowledge-base of the model, we found these methods to totally ignore MLP's contribution in modifying Attention's output. This is specially true where attention output is passed directly into LayerNorm which also takes MLP output of the last layer. The structure is shown in Figure-2.
In the ViT architecture, LayerNorm takes concatenated vector of attention output and previous layer's MLP output and then normalize the whole concatenated vector where mean and standard deviation were calculted from the whole concatenated vector itself. Therefore, during BackProp, attention output itself are being modified by the MLP output i.e. MLP of layer l-1 learns to filter attention output of layer l. This was ignored on all previous methods.
Solution
We use MLP output of layer l-1 to filter the attention output of layer l. This helps in 2 ways: (i) Replication of MLP's Attention filtering capability in the heatmap generation i.e., making heatmap generation process more closer to the ViT architecture itself, (ii) Eliminating the gradient shattering effect specially in the deeper layers.
Results
We rigorously tested F2HF against state-of-the-art baselines. The results were incredibly promising.
Attribution map of previously shown images in Figure-1
We ran a subjective blind test where three human subjects reviewed 500 images and heatmap and chose the least noisy, most accurate heatmap. In 84% of the cases, humans preferred F2HF over existing methods.
Quantitatively, the addition of Feed-Forward filtering provides massive improvements. We saw up to a 16.4% improvement in Intersection over Union (IoU), along with consistent leaps in Precision and F1 scores.
Segmentation Test Comparison (Higher is better)
| Architecture | Method | Pix. Acc (%) | mIoU | mAP | mF1 |
|---|---|---|---|---|---|
| Proposed (F2HF) | 81.36 | 0.65 | 0.88 | 0.45 | |
| Beyond Int.-T | 77.47 | 0.60 | 0.87 | 0.44 | |
| Beyond Int.-H | 78.04 | 0.61 | 0.86 | 0.44 | |
| Rollout | 70.33 | 0.52 | 0.82 | 0.42 | |
| Raw Attention | 65.91 | 0.41 | 0.72 | 0.19 | |
| Int. Gradient | 67.31 | 0.49 | 0.78 | 0.38 | |
| GradCAM | 65.91 | 0.41 | 0.72 | 0.19 | |
| Proposed (F2HF) | 77.35 | 0.61 | 0.85 | 0.42 | |
| Beyond Int.-T | 71.46 | 0.52 | 0.82 | 0.39 | |
| Beyond Int.-H | 77.14 | 0.59 | 0.85 | 0.43 | |
| Rollout | 66.00 | 0.47 | 0.79 | 0.39 | |
| Raw Attention | 67.41 | 0.40 | 0.70 | 0.11 | |
| Int. Gradient | 65.89 | 0.43 | 0.72 | 0.30 | |
| GradCAM | 63.49 | 0.40 | 0.70 | 0.10 |
Positive Perturbation Test Results (Lower is better)
| Perturbation | Top-K | Proposed (F2HF) | B. Int. (T) | B. Int. (H) | Rollout | IG |
|---|---|---|---|---|---|---|
| 10% | Top-1 | 62.14% | 65.37% | 63.60% | 63.55% | 72.10% |
| Top-3 | 77.26% | 80.33% | 78.88% | 78.60% | 85.68% | |
| Top-5 | 81.94% | 84.56% | 83.43% | 82.95% | 89.10% | |
| 20% | Top-1 | 48.37% | 53.51% | 63.59% | 50.76% | 65.94% |
| Top-3 | 63.80% | 69.03% | 78.87% | 66.27% | 80.39% | |
| Top-5 | 69.82% | 74.58% | 83.43% | 71.84% | 84.49% | |
| 30% | Top-1 | 37.50% | 43.59% | 41.08% | 40.96% | 59.25% |
| Top-3 | 52.58% | 58.74% | 56.15% | 55.82% | 74.31% | |
| Top-5 | 59.10% | 64.70% | 62.23% | 61.76% | 79.26% |
Key takeaway from our reserach
By integrating Feed-Forward filtering into the attention mechanism, F2HF provides a significantly more faithful and noise-free interpretability method for Vision Transformers.
Note: Please visit this link if you need the paper PDF as the published version is locked behind paywall.
Citation
@INPROCEEDINGS{11491078,
author={Hossen, Imran and Alam, Kazi Saeed},
booktitle={2025 28th International Conference on Computer and Information Technology (ICCIT)},
title={F2HF: Feed-Forward Network as a Noisy Head Filter in Vision Transformer Explanations},
year={2025},
volume={},
number={},
pages={2675-2680},
keywords={Satellite images;Earth Observing System;Feeds;Antennas;Radio broadcasting;Frequency modulation;Filtering;Filters;Circuits and systems;HTTP;interpretability;attention;feed-forward network},
doi={10.1109/ICCIT68739.2025.11491078}}