Nature:可解释深度学习让人类理解自动驾驶决策,CW-Net概念包装器

论文信息


核心创新

“CW-Net grounds the reasoning of a black-box ML planner in human-interpretable concepts, such as ‘Approaching stopped vehicle’ or ‘Close to cyclist’.”

Concept-Wrapper Network (CW-Net)

特性 描述
概念包装 替换ML planner最终层为概念分类器
因果忠实 概念直接决定AV行为,非事后解释
即插即用 可应用于任意预训练DNN
无损性能 不降低原始模型精度
无需重训 只训练概念层+新奖励层

技术架构

核心公式

原始planner选择最大奖励轨迹:
$$\hat{\tau} = \arg\max_{\tau \in {\tau_1…\tau_k}} R(E(\mathbf{h}, \tau))$$

CW-Net替换为概念驱动决策:
$$\hat{\tau}’ = \arg\max_{\tau \in {\tau_1…\tau_k}} R’(\mathbf{c}_i)$$

其中 $\mathbf{c}_i = C(z_i)$ 是概念分类输出。


人类可理解概念

概念 描述 对应行为
ASV Approaching Stopped Vehicle 减速准备
CLOSE Close to another vehicle 保持距离
BIKE Close to cyclist 减速避让
LANE Lane change available 变道准备
TURN Approaching intersection 减速观察
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
"""
CW-Net: Concept-Wrapper Network
论文: Nature, 2026

核心思想:
1. 保留预训练黑盒模型的特征提取层
2. 替换最终决策层为概念分类器+新奖励层
3. 概念分类器输出人类可理解标签
4. 新奖励层基于概念做决策

适用: 任意预训练DNN的即插即用改造
"""

import torch
import torch.nn as nn
from typing import List

class ConceptClassifier(nn.Module):
"""
概念分类器

将黑盒模型的嵌入zi映射到人类可理解概念
如: 靠近停止车辆/接近自行车/跟车过近
"""
def __init__(self, embed_dim: int = 256,
concepts: List[str] = None):
super().__init__()

if concepts is None:
concepts = [
'ASV', # Approaching Stopped Vehicle
'CLOSE', # Close to another vehicle
'BIKE', # Close to cyclist
'LANE_CHG', # Lane change available
'TURN', # Approaching intersection
'PED', # Pedestrian nearby
'SPEED', # Speed mismatch
'CROWD', # Dense traffic
]

self.num_concepts = len(concepts)
self.concept_names = concepts

# 概念分类头(多标签)
self.classifier = nn.Sequential(
nn.Linear(embed_dim, 128),
nn.ReLU(),
nn.Dropout(0.2),
nn.Linear(128, self.num_concepts)
)

def forward(self, z: torch.Tensor) -> torch.Tensor:
"""
Args:
z: 场景-轨迹嵌入 (B, embed_dim)
Returns:
concept_logits: 概念logits (B, num_concepts)
"""
return self.classifier(z)

def explain(self, z: torch.Tensor) -> dict:
"""生成人类可读解释"""
logits = self.forward(z)
probs = torch.sigmoid(logits)

active_concepts = []
for i, p in enumerate(probs[0]):
if p > 0.5:
active_concepts.append({
'concept': self.concept_names[i],
'probability': p.item()
})

return {
'active_concepts': active_concepts,
'explanation': self._generate_text(active_concepts)
}

def _generate_text(self, concepts: list) -> str:
"""概念→自然语言解释"""
if not concepts:
return "Normal driving condition"

parts = []
for c in concepts:
name = c['concept']
if name == 'ASV':
parts.append("approaching a stopped vehicle")
elif name == 'CLOSE':
parts.append("close to another vehicle")
elif name == 'BIKE':
parts.append("a cyclist is nearby")
elif name == 'LANE_CHG':
parts.append("lane change is available")
elif name == 'TURN':
parts.append("approaching an intersection")
elif name == 'PED':
parts.append("a pedestrian is nearby")

return "AV is " + ", ".join(parts) + " → adjusting trajectory"


class CWNet(nn.Module):
"""
Concept-Wrapper Network

包装任意预训练planner,添加可解释性
"""
def __init__(self, pretrained_planner: nn.Module,
embed_dim: int = 256):
super().__init__()

# 冻结预训练模型的特征提取层
self.planner = pretrained_planner
for param in self.planner.parameters():
param.requires_grad = False

# 概念分类器(可训练)
self.concept_classifier = ConceptClassifier(embed_dim)

# 新奖励层(可训练)
self.new_reward = nn.Sequential(
nn.Linear(self.concept_classifier.num_concepts, 64),
nn.ReLU(),
nn.Linear(64, 1)
)

def forward(self, scene: torch.Tensor,
trajectories: torch.Tensor) -> dict:
"""
Args:
scene: 场景上下文
trajectories: 候选轨迹集

Returns:
reward: 轨迹奖励
concepts: 概念分类
explanation: 人类可读解释
"""
# 使用冻结的planner提取嵌入
with torch.no_grad():
h = self.planner.scene_encoder(scene)
embeddings = []
for traj in trajectories:
z = self.planner.encoder(h, traj)
embeddings.append(z)
z = torch.stack(embeddings).squeeze(1)

# 概念分类
concept_logits = self.concept_classifier(z)

# 基于概念的新奖励
rewards = self.new_reward(torch.sigmoid(concept_logits))

# 解释
best_idx = rewards.argmax()
explanation = self.concept_classifier.explain(
z[best_idx:best_idx+1]
)

return {
'rewards': rewards,
'concept_logits': concept_logits,
'explanation': explanation
}


# 测试
if __name__ == "__main__":
# 模拟概念分类
classifier = ConceptClassifier()
z = torch.randn(1, 256)
result = classifier.explain(z)

print("概念分类结果:")
for c in result['active_concepts']:
print(f" {c['concept']}: {c['probability']:.2f}")
print(f"\n解释: {result['explanation']}")

实验结果

真实道路测试

测试维度 黑盒planner CW-Net 提升
驾驶性能 基准 ≈基准 无损
心智模型准确率 42% 67% +25%
行为预测能力 38% 61% +23%
情境意识 35% 58% +23%

在线大规模研究 (n=100)

场景 改善程度 说明
跟车过近 +28% 理解AV减速原因
自行车靠近 +24% 理解避让逻辑
车道变更 +19% 预测变道时机

对IMS/DMS的启示

1. DMS可解释性

当前问题 CW-Net方案
“疲劳得分0.85” “PERCLOS 35%+闭眼2s”
“分心警告” “视线偏离道路3.2s”
黑盒无法调试 概念层可审计
用户不信任 概念解释增强信任

2. L3接管请求可解释化

1
2
3
4
5
6
7
[传统方式]
系统: "请接管车辆" (无原因)
驾驶员: ??? 为什么?

[CW-Net方式]
系统: "请接管 — 前方施工+车流密集+传感器受限"
驾驶员: 理解情况,快速接管

3. 法规合规

GB 44721要求 CW-Net对应
明确接管请求 概念解释原因
事件记录 概念决策日志
系统行为可解释 概念→行为链路

总结

CW-Net的核心价值:

  • 因果忠实 — 概念直接决定行为,非事后解释
  • 即插即用 — 包装任意预训练模型
  • 无损性能 — 不降低原始精度
  • 心智模型提升25% — 人类更好理解AV行为
  • DMS应用 — 疲劳/分心检测可解释化
  • L3合规 — 满足GB 44721解释性要求