simoswish commited on
Commit
8d55064
Β·
verified Β·
1 Parent(s): 45e6793

Model card: refresh against the re-run evaluation and fix the video link

Browse files
Files changed (1) hide show
  1. README.md +182 -169
README.md CHANGED
@@ -1,169 +1,182 @@
1
- ---
2
- license: mit
3
- library_name: pytorch
4
- tags:
5
- - reinforcement-learning
6
- - multi-agent-reinforcement-learning
7
- - deep-reinforcement-learning
8
- - dqn
9
- - dueling-dqn
10
- - multi-agent-systems
11
- - drone-swarm
12
- - fault-tolerance
13
- - domain-randomization
14
- ---
15
-
16
- # Multi-Drone Cooperative Search with Random Faults β€” trained policy
17
-
18
- Trained weights for the Multi-Agent Systems course project (MSc Artificial
19
- Intelligence, University of Bologna, A.Y. 2025/26).
20
-
21
- A team of `N` drones searches a 32Γ—32 occupancy grid for one hidden target under
22
- partial observability, range-limited communication and a fixed time budget,
23
- while **any drone can permanently break at any moment**, with no central
24
- authority to announce the loss. A single Dueling Double DQN with parameter
25
- sharing drives every drone; per-episode domain randomization plus a compact
26
- context vector make that one policy a generalist across team size, sensing,
27
- communication range, obstacle density and fault rate.
28
-
29
- - **Code:** https://github.com/simoswish02/Multi-Agent-Systems-Project
30
- - **Report (49 pp.):** [`report/main.pdf`](https://github.com/simoswish02/Multi-Agent-Systems-Project/blob/main/report/main.pdf)
31
- - **Video walkthrough (~4 min):** https://youtu.be/az1LtAcZYZo
32
-
33
- ## Files
34
-
35
- | File | Description |
36
- |---|---|
37
- | `mas_50k_dr_faults_ep50000.pt` | Final checkpoint of the 50,000-episode run. **Every number in Section 7 of the report comes from this file.** This is the one to download for normal use. |
38
- | `checkpoints/mas_50k_dr_faults_ep*.pt` | The 20 periodic snapshots taken every 2,500 episodes, including a copy of the final one. Needed only to reproduce the learning curve (`--axis epoch`), which re-evaluates each of them; ~5.1 GB in total. |
39
-
40
- ## Usage
41
-
42
- ```bash
43
- git clone https://github.com/simoswish02/Multi-Agent-Systems-Project
44
- cd Multi-Agent-Systems-Project
45
- conda env create -f environment.yaml && conda activate rl-drone
46
-
47
- # download the checkpoint into checkpoints/
48
- huggingface-cli download simoswish/MAS_MultiDroneExploration \
49
- mas_50k_dr_faults_ep50000.pt --local-dir checkpoints/
50
-
51
- # watch it fly
52
- python main.py --mode eval --checkpoint checkpoints/mas_50k_dr_faults_ep50000.pt \
53
- --fault-prob 0.003
54
-
55
- # reproduce the experiments of Section 7
56
- python testing/evaluate_policy.py --axis all --seeds 500 \
57
- --checkpoint checkpoints/mas_50k_dr_faults_ep50000.pt
58
- ```
59
-
60
- Loading it directly:
61
-
62
- ```python
63
- import torch
64
- ckpt = torch.load("mas_50k_dr_faults_ep50000.pt", map_location="cpu")
65
- state_dict = ckpt["q_net"] # 22.4M parameters
66
- # the file also carries optimizer / scheduler / epsilon state, so training
67
- # can be resumed with `python main.py --mode train --resume <file>`
68
- ```
69
-
70
- ## Model
71
-
72
- **Architecture** (`agents/networks.py`, report Section 4.4):
73
-
74
- - **Global trunk** over six 32Γ—32 belief planes (Visited, Obstacle, Trajectory,
75
- Target, Own\_Position, Broken): a ConvNeXt-style CNN, stages of width
76
- 96 β†’ 192 β†’ 384 at resolutions 32 β†’ 16 β†’ 8, with per-stage FiLM conditioning,
77
- followed by a 3-layer / 8-head Transformer over the 8Γ—8 = 64 spatial tokens
78
- plus a CLS token and a context token.
79
- - **Local trunk** over a 13Γ—13 egocentric crop with five channels: three
80
- stride-1 ConvNeXt blocks at width 96 (the middle one dilated) β†’ 384.
81
- - **Fusion and head:** concat (1024 + 384 + 5) β†’ FC 1536 β†’ 768 β†’ 384 β†’ dueling
82
- head, `Q = V + A βˆ’ mean(A)`, over 4 actions (up / down / left / right).
83
- - 22.4M parameters, float32.
84
-
85
- **Context vector** (`CTX_DIM = 5`), rebuilt every round for every drone:
86
- `[vision_radius, comm_range, n_agents, agent_id, n_alive_belief]`, each
87
- normalized by the domain-randomization maxima (6, 12, 4, 4, 4). `agent_id`
88
- breaks the parameter-sharing symmetry so co-located drones split up from step 0;
89
- `n_alive_belief` is that drone's *own* belief about how many teammates remain β€”
90
- decentralized, and possibly stale.
91
-
92
- ## Training
93
-
94
- Independent / parameter-sharing Dueling Double DQN, one shared network, single
95
- phase of 50,000 episodes; Adam, weight decay 1e-6, gradient clip 1.0, Ξ³ = 0.97,
96
- 3-step returns, Huber loss, uniform replay of 2·10⁡ transitions, batch 16, one
97
- gradient step every 4 agent-turns, hard target sync every 500 steps. Ξ΅ decays
98
- 1.0 β†’ 0.05 (Γ—0.9995/episode, floor at episode 5,990); the learning rate warms up
99
- over the first 10% of episodes to 5·10⁻⁴, then anneals cosine-wise to 10⁻⁢.
100
-
101
- Per-episode domain randomization: vision radius ∈ [1, 6], communication range
102
- ∈ [2, 12], team size ∈ [1, 4], obstacle density ∈ [0.10, 0.30], per-turn fault
103
- probability ∈ [0, 0.003]. The grid size (32) is the one constant.
104
-
105
- ## Results
106
-
107
- At the reference operating point (N = 3, r_vis = 3, r_comm = 5, ρ = 0.2, T = 200,
108
- no faults), 500 seeded instances, greedy:
109
-
110
- | | |
111
- |---|---|
112
- | Success rate | **87.6%** (Wilson CI [84.4, 90.2]) |
113
- | Map coverage | 53.7% |
114
- | SPL | 0.541 |
115
-
116
- Generalization (success %, endpoints of each sweep):
117
-
118
- | Axis | In-distribution | OOD probe |
119
- |---|---|---|
120
- | Team size N | 71.0 (N=1) β†’ 89.2 (N=4) | 89.6, 90.4 (N = 5, 6) |
121
- | Vision r_vis | 70.6 β†’ 87.2 | 87.0, 85.6 (r = 7, 8) |
122
- | Comm. r_comm | 87.4 β†’ 89.0 | 87.6, 88.0, 89.6 (r = 0, 14, 16) |
123
- | Density ρ | 96.2 (0.10) β†’ 53.4 (0.30) | 99.0, 34.6, 24.2 (ρ = 0, 0.35, 0.40) |
124
-
125
- Fault robustness β€” the project's headline result:
126
-
127
- | p_fault | 0 | 0.001 | 0.002 | 0.003 | 0.005 | 0.010 |
128
- |---|---|---|---|---|---|---|
129
- | Success [%] | 87.6 | 86.0 | 84.4 | 82.0 | 77.2 | 66.2 |
130
- | Drones lost (mean) | 0.00 | 0.22 | 0.42 | 0.58 | 0.91 | 1.51 |
131
-
132
- Across the entire trained fault range success falls by under six points while
133
- the team loses more than half a drone on average; at more than triple the
134
- trained maximum it still completes two missions in three, with no cliff.
135
-
136
- ## Limitations
137
-
138
- - Simulation only: 4-connected grid moves, noiseless sensing, instantaneous
139
- range-limited fusion. No sim-to-real transfer is claimed or tested.
140
- - Faults are i.i.d. across drones and turns and produce inert, non-blocking
141
- wrecks. Correlated failures, passage-blocking wrecks and an adversary
142
- choosing whom to disable are outside the model.
143
- - Obstacle density is the one axis whose extrapolation degrades, though a
144
- breadth-first check of the evaluation instances shows most of that to be the
145
- instance distribution becoming unsolvable rather than the policy failing
146
- (Section 7.3 of the report).
147
- - Statistical, not formal, evidence: confidence intervals bound sampling error,
148
- not worst-case behaviour on an unseen instance.
149
-
150
- Section 8 of the report discusses the dual-use profile of the capability, its
151
- treatment under the GDPR and the EU AI Act, and why this specific system would
152
- be unacceptable as an autonomous weapon.
153
-
154
- ## Citation
155
-
156
- ```bibtex
157
- @misc{rimondi2026multidrone,
158
- author = {Rimondi, Simone},
159
- title = {Multi-Drone Cooperative Search with Random Faults},
160
- year = {2026},
161
- note = {Multi-Agent Systems project, MSc Artificial Intelligence,
162
- University of Bologna},
163
- url = {https://github.com/simoswish02/Multi-Agent-Systems-Project}
164
- }
165
- ```
166
-
167
- ## License
168
-
169
- MIT.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: pytorch
4
+ tags:
5
+ - reinforcement-learning
6
+ - multi-agent-reinforcement-learning
7
+ - deep-reinforcement-learning
8
+ - dqn
9
+ - dueling-dqn
10
+ - multi-agent-systems
11
+ - drone-swarm
12
+ - fault-tolerance
13
+ - domain-randomization
14
+ ---
15
+
16
+ # Multi-Drone Cooperative Search with Random Faults β€” trained policy
17
+
18
+ Trained weights for the Multi-Agent Systems course project (MSc Artificial
19
+ Intelligence, University of Bologna, A.Y. 2025/26).
20
+
21
+ A team of `N` drones searches a 32Γ—32 occupancy grid for one hidden target under
22
+ partial observability, range-limited communication and a fixed time budget,
23
+ while **any drone can permanently break at any moment**, with no central
24
+ authority to announce the loss. A single Dueling Double DQN with parameter
25
+ sharing drives every drone; per-episode domain randomization plus a compact
26
+ context vector make that one policy a generalist across team size, sensing,
27
+ communication range, obstacle density and fault rate.
28
+
29
+ - **Code (GitHub mirror):** https://github.com/simoswish02/Multi-Agent-Systems-Project
30
+ - **Code (course repository, GitLab):** https://dvcs.apice.unibo.it/pika-lab/courses/ai-ethics/projects/rimondi2526-mas
31
+ - **Report (49 pp.):** [`Rimondi-MultiDroneSearch-MAS.pdf`](https://github.com/simoswish02/Multi-Agent-Systems-Project/blob/main/report/Rimondi-MultiDroneSearch-MAS.pdf)
32
+ - **Video walkthrough (~4 min):** https://youtu.be/8dnRG6ZneP8
33
+
34
+ ## Files
35
+
36
+ | File | Description |
37
+ |---|---|
38
+ | `mas_50k_dr_faults_ep50000.pt` | Final checkpoint of the 50,000-episode run. **Every number in Section 7 of the report comes from this file.** This is the one to download for normal use. |
39
+ | `checkpoints/mas_50k_dr_faults_ep*.pt` | The 20 periodic snapshots taken every 2,500 episodes, including a copy of the final one. Needed only to reproduce the learning curve (`--axis epoch`), which re-evaluates each of them; ~5.4 GB in total. |
40
+
41
+ ## Usage
42
+
43
+ ```bash
44
+ git clone https://github.com/simoswish02/Multi-Agent-Systems-Project
45
+ cd Multi-Agent-Systems-Project
46
+ conda env create -f environment.yaml && conda activate rl-drone
47
+
48
+ # download the checkpoint into checkpoints/
49
+ hf download simoswish/MAS_MultiDroneExploration \
50
+ mas_50k_dr_faults_ep50000.pt --local-dir checkpoints/
51
+
52
+ # watch it fly
53
+ python main.py --mode eval --checkpoint checkpoints/mas_50k_dr_faults_ep50000.pt \
54
+ --fault-prob 0.003
55
+
56
+ # reproduce the experiments of Section 7
57
+ python testing/evaluate_policy.py --axis all --seeds 500 \
58
+ --checkpoint checkpoints/mas_50k_dr_faults_ep50000.pt
59
+ ```
60
+
61
+ Loading it directly:
62
+
63
+ ```python
64
+ import torch
65
+ ckpt = torch.load("mas_50k_dr_faults_ep50000.pt", map_location="cpu")
66
+ state_dict = ckpt["q_net"] # 22.4M parameters
67
+ # the file also carries optimizer / scheduler / epsilon state, so training
68
+ # can be resumed with `python main.py --mode train --resume <file>`
69
+ ```
70
+
71
+ ## Model
72
+
73
+ **Architecture** (`agents/networks.py`, report Section 4.4):
74
+
75
+ - **Global trunk** over six 32Γ—32 belief planes (Visited, Obstacle, Trajectory,
76
+ Target, Own\_Position, Broken): a ConvNeXt-style CNN, stages of width
77
+ 96 β†’ 192 β†’ 384 at resolutions 32 β†’ 16 β†’ 8, with per-stage FiLM conditioning,
78
+ followed by a 3-layer / 8-head Transformer over the 8Γ—8 = 64 spatial tokens
79
+ plus a CLS token and a context token.
80
+ - **Local trunk** over a 13Γ—13 egocentric crop with five channels: three
81
+ stride-1 ConvNeXt blocks at width 96 (the middle one dilated) β†’ 384.
82
+ - **Fusion and head:** concat (1024 + 384 + 5) β†’ FC 1536 β†’ 768 β†’ 384 β†’ dueling
83
+ head, `Q = V + A βˆ’ mean(A)`, over 4 actions (up / down / left / right).
84
+ - 22,445,183 parameters, float32.
85
+
86
+ **Context vector** (`CTX_DIM = 5`), rebuilt every round for every drone:
87
+ `[vision_radius, comm_range, n_agents, agent_id, n_alive_belief]`, each
88
+ normalized by the domain-randomization maxima (6, 12, 4, 4, 4). `agent_id`
89
+ breaks the parameter-sharing symmetry so co-located drones split up from step 0;
90
+ `n_alive_belief` is that drone's *own* belief about how many teammates remain β€”
91
+ decentralized, and possibly stale.
92
+
93
+ ## Training
94
+
95
+ Parameter-sharing Dueling Double DQN: one shared network trained on the pooled
96
+ experience of the whole team, in a single phase of 50,000 episodes. Adam, weight
97
+ decay 1e-6, gradient clip 1.0, Ξ³ = 0.97, 3-step returns, Huber loss, uniform
98
+ replay of 2·10⁡ transitions, batch 16, one gradient step every 4 agent-turns,
99
+ hard target sync every 500 steps. Ξ΅ decays 1.0 β†’ 0.05 (Γ—0.9995/episode, floor at
100
+ episode 5,990); the learning rate warms up over the first 10% of episodes to
101
+ 5·10⁻⁴, then anneals cosine-wise to 10⁻⁢.
102
+
103
+ Per-episode domain randomization: vision radius ∈ [1, 6], communication range
104
+ ∈ [2, 12], team size ∈ [1, 4], obstacle density ∈ [0.10, 0.30], per-turn fault
105
+ probability ∈ [0, 0.003]. The grid size (32) is the one constant.
106
+
107
+ ## Results
108
+
109
+ At the reference operating point (N = 3, r_vis = 3, r_comm = 5, ρ = 0.2,
110
+ T = 200, no faults), 500 seeded instances, greedy (Ξ΅ = 0):
111
+
112
+ | | |
113
+ |---|---|
114
+ | Success rate | **97.6%** (Wilson CI [95.9, 98.6]) |
115
+ | Map coverage | 53.4% |
116
+ | SPL | 0.715 |
117
+ | Time to find | 53.9 rounds |
118
+
119
+ Generalization (success %, endpoints of each sweep, 500 seeds per point):
120
+
121
+ | Axis | In-distribution | OOD probe |
122
+ |---|---|---|
123
+ | Team size N | 79.0 (N=1) β†’ 97.6 (N=4) | 98.8, 99.0 (N = 5, 6) |
124
+ | Vision r_vis | 80.2 (r=1) β†’ 96.6 (r=6) | 96.4, 95.6 (r = 7, 8) |
125
+ | Comm. r_comm | 96.8 (r=2) β†’ 98.0 (r=12) | 95.6, 98.2, 98.8 (r = 0, 14, 16) |
126
+ | Density ρ | 99.0 (ρ=0.10) β†’ 83.6 (ρ=0.30) | 99.2, 80.0, 86.0 (ρ = 0, 0.35, 0.40) |
127
+
128
+ No axis shows a cliff, in or out of distribution, including beyond the trained
129
+ maxima of team size, vision and communication. Obstacle density is the one
130
+ factor that genuinely governs difficulty, costing 15 points across its trained
131
+ range alone.
132
+
133
+ Fault robustness β€” the project's headline result:
134
+
135
+ | p_fault | 0 | 0.001 | 0.002 | 0.003 | 0.005 | 0.010 |
136
+ |---|---|---|---|---|---|---|
137
+ | Success [%] | 97.6 | 96.0 | 93.6 | 91.0 | 85.4 | 72.6 |
138
+ | SPL | 0.715 | 0.695 | 0.682 | 0.666 | 0.631 | 0.536 |
139
+ | Drones lost (mean) | 0.00 | 0.16 | 0.30 | 0.48 | 0.78 | 1.37 |
140
+
141
+ Across the entire trained fault range (0 β†’ 0.003) success falls by under seven
142
+ points while the team sheds, on average, close to half a drone; at more than
143
+ triple the trained maximum it still completes nearly three missions in four,
144
+ with no cliff. Conditioning on survivors instead: a team that finishes intact
145
+ succeeds 98.7% of the time, losing one drone costs six points (92.5%), and even
146
+ a lone survivor still finds the target in 65.9% of episodes.
147
+
148
+ ## Limitations
149
+
150
+ - Simulation only: 4-connected grid moves, noiseless sensing, instantaneous
151
+ range-limited fusion. No sim-to-real transfer is claimed or tested.
152
+ - Faults are i.i.d. across drones and turns and produce inert, non-blocking
153
+ wrecks. Correlated failures, passage-blocking wrecks and an adversary
154
+ choosing whom to disable are outside the model.
155
+ - Above ρ β‰ˆ 0.30 the density sweep stops measuring the same task. The target is
156
+ always drawn from the spawn's connected component, and at high clutter the
157
+ free space fragments until that component holds under a quarter of the free
158
+ cells, so the apparent rebound at ρ = 0.40 is a structurally shorter mission
159
+ rather than a better policy (Section 7.3 of the report).
160
+ - Statistical, not formal, evidence: confidence intervals bound sampling error,
161
+ not worst-case behaviour on an unseen instance.
162
+
163
+ Section 8 of the report discusses the dual-use profile of the capability, its
164
+ treatment under the GDPR and the EU AI Act, and why this specific system would
165
+ be unacceptable as an autonomous weapon.
166
+
167
+ ## Citation
168
+
169
+ ```bibtex
170
+ @misc{rimondi2026multidrone,
171
+ author = {Rimondi, Simone},
172
+ title = {Multi-Drone Cooperative Search with Random Faults},
173
+ year = {2026},
174
+ note = {Multi-Agent Systems project, MSc Artificial Intelligence,
175
+ University of Bologna},
176
+ url = {https://github.com/simoswish02/Multi-Agent-Systems-Project}
177
+ }
178
+ ```
179
+
180
+ ## License
181
+
182
+ MIT.