Instructions to use Aditharavind/swarm-laya with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Laya
How to use Aditharavind/swarm-laya with Laya:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: convaiinnovations/laya
|
| 4 |
+
tags:
|
| 5 |
+
- robotics
|
| 6 |
+
- swarm-robotics
|
| 7 |
+
- decision-making
|
| 8 |
+
- laya
|
| 9 |
+
- rlcd
|
| 10 |
+
datasets:
|
| 11 |
+
- Aditharavind/swarm-laya-decisions
|
| 12 |
+
pipeline_tag: text-classification
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# swarm-laya
|
| 16 |
+
|
| 17 |
+
> **Simulation-only.** Fine-tuned and evaluated entirely in a PyBullet swarm
|
| 18 |
+
> simulator — not tested on physical robots. See
|
| 19 |
+
> [Aditharavind/swarm-laya](https://github.com/Aditharavind/swarm-laya) for
|
| 20 |
+
> the full pipeline, and the **v1 — no vision** note there: this checkpoint
|
| 21 |
+
> decides from ground-truth structured state, not camera images.
|
| 22 |
+
|
| 23 |
+
A [Laya](https://github.com/NandhaKishorM/laya) checkpoint (ModernBERT-large
|
| 24 |
+
encoder, 421M params) fine-tuned via RLCD to make one decision per robot per
|
| 25 |
+
timestep in a synthetic swarm-robotics setting: given a robot's state
|
| 26 |
+
(position, battery, distance/heading to target and base, nearest-obstacle
|
| 27 |
+
clearance, nearest-teammate distance, radio and sensor-noise status), pick
|
| 28 |
+
one of `move_to_target`, `avoid_obstacle`, `return_to_base`,
|
| 29 |
+
`request_swarm_help`, `hold_position`.
|
| 30 |
+
|
| 31 |
+
## Training
|
| 32 |
+
|
| 33 |
+
- Base: `convaiinnovations/laya`
|
| 34 |
+
- Data: [Aditharavind/swarm-laya-decisions](https://huggingface.co/datasets/Aditharavind/swarm-laya-decisions) (5,368 training states from a PyBullet simulator + potential-field expert policy, soft-label RLCD targets)
|
| 35 |
+
- Recipe: RLCD (GRPO-style policy gradient over proper scoring rules + soft cross-entropy), 4 epochs, single 6GB consumer GPU, 8-bit AdamW (bitsandbytes) — plain fp32 AdamW does not fit a 421M encoder in 6GB
|
| 36 |
+
- Calibration: one temperature per question type, fit on the held-out `val` split after training
|
| 37 |
+
|
| 38 |
+
## Evaluation
|
| 39 |
+
|
| 40 |
+
| | in-distribution (test, n=611) | unseen swarms (ood, n=2,000) |
|
| 41 |
+
|---|---|---|
|
| 42 |
+
| decision accuracy | 83.1% | 90.2% |
|
| 43 |
+
| latency (p50 / p95) | 31.4 / 32.1 ms | 32.4 / 35.7 ms |
|
| 44 |
+
|
| 45 |
+
Closed-loop rollouts (this model driving every robot vs. the hand-coded
|
| 46 |
+
expert-policy oracle, 15 episodes each; episodes capped at 25 steps for eval
|
| 47 |
+
speed, so completion rate is a model-vs-expert comparison under identical
|
| 48 |
+
conditions, not an absolute success rate):
|
| 49 |
+
|
| 50 |
+
| | collision rate (expert / model) | task completion (expert / model) |
|
| 51 |
+
|---|---|---|
|
| 52 |
+
| in-distribution | 2.1% / 6.0% | 20.3% / 17.4% |
|
| 53 |
+
| unseen swarms | 3.9% / 6.9% | 11.9% / 15.0% |
|
| 54 |
+
|
| 55 |
+
"Unseen swarms" = 9-16 robots / 16-28 obstacles, never seen during training
|
| 56 |
+
(train/val/test used 2-8 robots / 3-14 obstacles).
|
| 57 |
+
|
| 58 |
+
The weakest per-class accuracy is `hold_position` (~4-5%) — it's the rarest
|
| 59 |
+
action in the training distribution before balancing; see the source repo's
|
| 60 |
+
README for more on this and other known limits.
|
| 61 |
+
|
| 62 |
+
## Use
|
| 63 |
+
|
| 64 |
+
```python
|
| 65 |
+
import laya
|
| 66 |
+
agent = laya.Agent("Aditharavind/swarm-laya")
|
| 67 |
+
|
| 68 |
+
state = {
|
| 69 |
+
"robot_id": 0, "position": [-3.4, -2.0], "battery_percent": 12.0,
|
| 70 |
+
"distance_to_target": 8.5, "heading_to_target_deg": -32.0,
|
| 71 |
+
"distance_to_base": 4.0, "sensor_noise_std_m": 0.0,
|
| 72 |
+
"radio_link_degraded": False, "teammates_in_comm_range": 1, "swarm_size": 5,
|
| 73 |
+
"nearest_obstacle": {"clearance_m": 2.0, "radius_m": 0.8},
|
| 74 |
+
"nearest_teammate": {"distance_m": 3.9, "battery_percent": 40.0, "radio_link_degraded": False},
|
| 75 |
+
}
|
| 76 |
+
questions = {
|
| 77 |
+
"next_action": {
|
| 78 |
+
"type": "choice",
|
| 79 |
+
"instructions": "Given this robot's state within the swarm, what should it do next?",
|
| 80 |
+
"criteria": {
|
| 81 |
+
"move_to_target": "No immediate hazard nearby and battery is sufficient; head toward the shared target.",
|
| 82 |
+
"avoid_obstacle": "An obstacle or a teammate is close enough that the direct path is unsafe; steer around it.",
|
| 83 |
+
"return_to_base": "Battery is low enough that continuing the mission risks stranding the robot; head back to base to recharge.",
|
| 84 |
+
"request_swarm_help": "The robot is blocked, lost communication reliability, or its sensors are too noisy to act confidently, and a nearby teammate could assist or relay.",
|
| 85 |
+
"hold_position": "Conditions are too uncertain or congested to move safely and no teammate is reachable to help; stay put and wait for the situation to clear.",
|
| 86 |
+
},
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
result = agent.predict(state, questions)
|
| 90 |
+
print(result["answers"]["next_action"]["choice"])
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
## License
|
| 94 |
+
|
| 95 |
+
Apache 2.0, matching [Laya](https://github.com/NandhaKishorM/laya)'s own
|
| 96 |
+
license.
|