跨架构知识蒸馏:视觉可解释性转移,DMS透明度新方向

论文信息

  • 标题: Transferring Visual Explanations: How Cross-Architecture Knowledge Distillation Affects Model Interpretability
  • arXiv: 2609.23561 (2026年9月19日)
  • 领域: 知识蒸馏, 模型可解释性
  • 应用场景: 自动驾驶, 医学

核心研究问题

当大型教师模型蒸馏到紧凑学生模型时,视觉解释(空间特征归因)是否保留? 这对DMS的可信度至关重要——如果蒸馏后模型变成了”黑箱”,就无法通过医疗/安全审计。

关键发现

1
2
3
4
5
6
7
8
9
10
11
# 跨架构蒸馏对可解释性的影响
distillation_findings = {
"教师→学生空间归因转移": "部分保留,取决于架构相似性",
"架构差异影响": "架构差异越大,归因转移越差",
"安全启示": "蒸馏DMS模型需验证可解释性保留程度",
"DMS应用": "疲劳/分心判定需可解释→安全审计→法规合规"
}

print("=== 蒸馏可解释性发现 ===")
for k, v in distillation_findings.items():
print(f" {k}: {v}")

模型实现

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"""
论文:Transferring Visual Explanations
arXiv: 2609.23561

核心方法:评估跨架构蒸馏中空间特征归因的转移
"""

import torch
import torch.nn as nn
import torch.nn.functional as F

class ExplainableDistillation(nn.Module):
"""可解释蒸馏:保留教师的空间归因"""

def __init__(self, teacher: nn.Module, student: nn.Module):
super().__init__()
self.teacher = teacher
self.student = student
for p in self.teacher.parameters():
p.requires_grad = False

def compute_attribution_consistency(self, x):
"""
计算教师和学生的空间归因一致性

使用Grad-CAM或注意力图对比
"""
# 教师归因
with torch.no_grad():
teacher_out = self.teacher(x)
teacher_grad = torch.autograd.grad(
teacher_out.max(), x, create_graph=False
)[0]
teacher_attribution = teacher_grad.abs().mean(dim=1) # (B, H, W)

# 学生归因
student_out = self.student(x)
student_grad = torch.autograd.grad(
student_out.max(), x, create_graph=True
)[0]
student_attribution = student_grad.abs().mean(dim=1)

# 一致性 (SSIM或相关性)
consistency = F.cosine_similarity(
teacher_attribution.flatten(1),
student_attribution.flatten(1)
).mean()

return consistency

def distill_loss(self, x, y):
# 标准蒸馏
with torch.no_grad():
teacher_logits = self.teacher(x)
student_logits = self.student(x)

# KL散度 (软标签)
loss_kd = F.kl_div(
F.log_softmax(student_logits / 3.0, dim=1),
F.softmax(teacher_logits / 3.0, dim=1),
reduction='batchmean'
) * 9.0 # T^2

# 硬标签
loss_ce = F.cross_entropy(student_logits, y)

# 归因一致性
loss_attribution = 1.0 - self.compute_attribution_consistency(x)

return loss_kd + loss_ce + 0.1 * loss_attribution

IMS开发启示

DMS模型可解释性要求

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# DMS蒸馏可解释性检查清单
dms_explainability_checklist = {
"法规合规": {
"Euro NCAP": "需证明疲劳判定依据",
"GB 47955": "需提供检测日志+判定依据",
"GDPR": "用户有权了解AI决策依据"
},
"安全审计": {
"误报分析": "为何误报疲劳? → 空间归因",
"漏报分析": "为何漏报分心? → 特征缺失",
"边界案例": "戴眼镜/口罩/不同种族"
},
"蒸馏检查": {
"教师归因": "大模型关注哪些面部区域",
"学生归因": "蒸馏后是否保留",
"一致性": "两者归因相似度>阈值?"
}
}

print("=== DMS蒸馏可解释性检查 ===")
for category, items in dms_explainability_checklist.items():
print(f"\n{category}:")
for k, v in items.items():
print(f" {k}: {v}")

参考


发布时间: 2026-09-25 00:00
分类: 知识蒸馏 | 可解释性 | DMS | 安全审计 | 论文解读