File size: 6,049 Bytes
8d287b6
 
372c993
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8d287b6
372c993
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
---
license: apache-2.0
library_name: pytorch
tags:
  - robotics
  - VLA
  - vision-language-action
  - robot-manipulation
  - bridgedata
  - Qwen3-VL
  - imitation-learning
datasets:
  - bridgedata-v2
language:
  - en
metrics:
  - mse
pipeline_tag: robotics
---

# FrozenVLA-2B β€” Lightweight Vision-Language-Action for Robot Manipulation

A 50M-parameter trainable head on top of frozen **Qwen3-VL-2B-Instruct**, trained on **BridgeData v2** (2,617 episodes) for general-purpose robotic manipulation.

---

## 🧠 Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Qwen3-VL-2B-Instruct (FROZEN)    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Vision Enc. β”‚ -> β”‚   LLM (28L)     β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  hidden=2048    β”‚  β”‚
β”‚                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                              β”‚           β”‚
β”‚                     last_token_hidden    β”‚
β”‚                         (2048-dim)       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   MLP Projector     β”‚  ← Trainable (1.3M)
                    β”‚  2048 β†’ 512 β†’ 512   β”‚
                    β”‚  GELU + Dropout     β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Action Head       β”‚  ← Trainable
                    β”‚    512 β†’ 7          β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                    EEF delta: [dx, dy, dz, ax, ay, az, gripper]
```

| Component | Params | Status |
|-----------|--------|--------|
| Qwen3-VL-2B (Vision + LLM) | 2,127,532,032 | ❄️ Frozen |
| MLP Projector | 1,314,824 | πŸ”₯ Trained |
| Action Head | 513 | πŸ”₯ Trained |
| **Total** | **2,128,847,369** | 1.3M trainable |

---

## πŸ“Š Training

| Item | Detail |
|------|--------|
| **Dataset** | BridgeData v2 (LeRobot format) |
| **Episodes** | 2,617 |
| **Action format** | EEF delta 7D: [dx, dy, dz, ax, ay, az, gripper] |
| **Action normalization** | Z-score (mean/std per dimension) |
| **Hardware** | Alibaba Cloud PAI Β· NVIDIA A10 24GB |
| **Framework** | PyTorch 2.6.0 Β· Transformers 4.51+ Β· CUDA 12.6 |
| **Epochs** | 4 (of 5 planned) |
| **Effective batch size** | 64 (32 Γ— gradient_accumulation=2) |
| **Optimizer** | AdamW (lr=1e-4, wd=1e-2) |
| **Schedule** | Cosine annealing Β· 500 warmup steps |
| **Precision** | bfloat16 Β· gradient clip=1.0 |
| **Image size** | 448Γ—448 (Qwen3-VL default) |
| **Frames** | All frames per episode (frame_sampling=all) |

### Training Loss (per epoch)

| Epoch | Approx MSE Loss | Checkpoint |
|-------|----------------|------------|
| 1 | β€” | `epoch_1.pt` (15MB) |
| 2 | β€” | `epoch_2.pt` (15MB) |
| 3 | β€” | `epoch_3.pt` (15MB) |
| 4 | β€” | `epoch_4.pt` (15MB) |

### Inference Requirements

| Platform | VRAM | Notes |
|----------|------|-------|
| RTX 4060 Laptop 8GB | ~4 GB | βœ… Verified Β· sdpa Β· bf16 |
| A10 24GB | ~4 GB | βœ… Training env |
| T4 16GB | ~4 GB | βœ… Should work |

---

## πŸš€ Quick Start

### 1. Clone & Install

```bash
# Requirements
pip install torch>=2.5.0 transformers>=4.51.0 accelerate sentencepiece protobuf Pillow

# Clone this repo
git clone https://huggingface.co/YOUR_USERNAME/frozenvla
cd frozenvla
```

### 2. Download Base Model

```bash
# Qwen3-VL-2B-Instruct (from HuggingFace)
huggingface-cli download Qwen/Qwen3-VL-2B-Instruct --local-dir ./Qwen3-VL-2B-Instruct
```

### 3. Load & Infer

```python
import torch
from PIL import Image
from model import FrozenVLA

# Load model with trained head
model = FrozenVLA(
    llm_name="./Qwen3-VL-2B-Instruct",
    mlp_hidden_dim=512,
    mlp_depth=2,
    action_dim=7,
    attn_implementation="sdpa",  # "flash_attention_2" on A100/H100
)
model.load_trainable("epoch_4.pt")
model = model.to("cuda").eval()

# Cast head to bf16 (to match Qwen3-VL output dtype)
model.mlp_projector = model.mlp_projector.to(dtype=torch.bfloat16)
model.action_head = model.action_head.to(dtype=torch.bfloat16)

# Inference
image = Image.open("robot_view.jpg").convert("RGB")
instruction = "pick up the red block"

with torch.no_grad():
    action = model([image], [instruction])
    # action: (1, 7) EEF delta [dx, dy, dz, ax, ay, az, gripper]
    print(action.float().cpu().numpy())
```

### 4. Deploy Script (One-Click)

```bash
python deploy.py --checkpoint epoch_4.pt --test-image robot_view.jpg
```

---

## πŸ“ Files

| File | Description |
|------|-------------|
| `epoch_4.pt` | Best trained head (MLP + ActionHead, 15MB) |
| `epoch_1~3.pt` | Intermediate checkpoints |
| `model.py` | Full model architecture (FrozenVLA class) |
| `config.yaml` | Training configuration |
| `deploy.py` | One-click deployment + inference script |

---

## ⚠️ Limitations

- **Action space**: BridgeData EEF delta only β€” NOT directly compatible with joint-space robots without IK conversion.
- **Domain**: Trained on BridgeData scenes (tabletop manipulation). Zero-shot generalization to novel environments is limited.
- **Single image input**: Uses the current frame only; no temporal context from video history.
- **Language**: English instructions only.

---

## πŸ“ Citation

```bibtex
@misc{frozenvla-2026,
  title  = {FrozenVLA-2B: Lightweight VLA from Frozen Qwen3-VL on BridgeData},
  author = {},
  year   = {2026},
  url    = {https://huggingface.co/YOUR_USERNAME/frozenvla}
}
```

## πŸ“„ License

Apache 2.0