Swim2Real calibrates the simulator of a soft robotic fish from videos of the robot swimming. A vision-language model compares the real and simulated motion, diagnoses the mismatch, and proposes which of 16 fluid, motor and joint parameters to change. A backtracking line search keeps a step only if it lowers the error between simulated and tracked marker positions.
The model's proposals point in useful directions. We compared them with random directions and with the model's own proposals scrambled across parameters, under the same line search and simulator budget. In an independent, preregistered fifty-seed replication, they lowered the mean best-so-far marker error by 63.4 mm and 53.2 mm against these two controls (both p < 10−5, conditional on run completion). A second vision-language model shows the same effect.
Abstract
Calibrating a soft aquatic robot simulator requires matching coupled deformation and propulsion from limited pool recordings. Swim2Real uses a vision-language model (VLM) to compare real and simulated swimming videos and propose updates to 16 simulator parameters. A backtracking line search tests each direction and accepts updates that reduce marker error. To test whether the proposals carry useful directions, we compare them with random and signed-permuted directions under the same line search and simulator budget. In an independent, preregistered fifty-seed replication, Swim2Real reduces the mean best-so-far error over 40 simulator evaluations by 63.4 mm against random directions and 53.2 mm against permuted directions. Both paired comparisons pass Holm correction (p < 10−5), conditional on run completion. A 24-seed experiment with a second VLM supports the same direction effect. Backtracking averages 16.1 VLM proposals per run versus 39 for Vid2Sid, which attains lower error at the same simulator budget. Ten hardware trials demonstrate open-loop execution of simulator-generated motor commands.
Before and after calibration
How it works
A simulator can match one part of a swimming motion while missing another: the tail may bend with the wrong amplitude, or the body may advance too slowly. A scalar trajectory error measures the mismatch but does not say which parameters to change. Swim2Real asks a vision-language model to read the mismatch from video.
The calibration data are overhead recordings of the robot swimming at eight tail-beat frequencies, with nine markers tracked along its centerline.
Each round, Gemini 2.5 Pro receives overlay videos of the simulated and real centerlines at each fitted frequency and the real video at the worst-matching one. It also receives the marker errors, the swimming speeds, the current parameters with their bounds, and the outcomes of its earlier proposals. It returns a physical diagnosis and new values for the parameters it wants to change.
Swim2Real treats each proposal as a direction rather than an answer. A backtracking line search tries the full step, then the half and quarter steps, and keeps the first one that lowers marker error. If none does, the proposal is rejected and the model is told so in its next prompt. In a fifteen-seed study, 46 of the 97 accepted updates (47%) came from a half or quarter step, after the full step had not improved on the best error.
The 16 parameters are five fluid coefficients, the motor arm length, and the stiffness and damping of each of the tail's five joints. They are searched jointly rather than in hand-designed stages. Each run has a budget of 40 simulator evaluations and uses 16.1 VLM proposals on average. An evaluation of all eight recorded frequencies takes about 13 s on one CPU core.
### Instruction You are diagnosing a MuJoCo fish simulation that does not match real-world behavior. Your task is to: 1. Identify which parameters are MOST RESPONSIBLE for the current sim-real mismatch. 2. Propose specific values for those parameters based on your physical reasoning. Your proposed values will be evaluated directly — propose the best values you can based on your physical reasoning. The fish has 9 tracked markers along its centerline (M0=nose to M8=tail tip). Error is measured as L2 distance between sim and real marker positions in head-frame coordinates, averaged across all 8 motor frequencies (0.5-2.25 Hz). This is optimization round 1. ### Current Parameters Parameter | Current | Bounds | Description --------------------------------------------------------------------------- fluidCoef_0 | 8.5131 | [0.0, 10.0] | Pressure drag on blunt surfaces fluidCoef_1 | 9.9527 | [0.0, 10.0] | Skin friction on slender surfaces fluidCoef_2 | 2.4957 | [0.0, 10.0] | Rotational drag in water fluidCoef_3 | 2.6903 | [0.0, 10.0] | Kutta lift (circulation/fin effect) fluidCoef_4 | 2.8791 | [0.0, 10.0] | Magnus lift (spinning body parts) motorArmLength | 0.0405 | [0.01, 0.06] | Crank arm driving tendons (m) hingeStiffness_0 | 2.6644 | [0.1, 5.0] | Joint 0 (body-tail0) stiffness hingeStiffness_1 | 1.9407 | [0.1, 5.0] | Joint 1 (tail0-tail1) stiffness hingeStiffness_2 | 3.8937 | [0.1, 5.0] | Joint 2 (tail1-tail2) stiffness hingeStiffness_3 | 3.3523 | [0.1, 5.0] | Joint 3 (tail2-tail3) stiffness hingeStiffness_4 | 3.7233 | [0.1, 5.0] | Joint 4 (tail3-tail4) stiffness hingeDamping_0 | 1.6793 | [0.0, 2.0] | Joint 0 (body-tail0) damping hingeDamping_1 | 1.0098 | [0.0, 2.0] | Joint 1 (tail0-tail1) damping hingeDamping_2 | 1.3163 | [0.0, 2.0] | Joint 2 (tail1-tail2) damping hingeDamping_3 | 0.9216 | [0.0, 2.0] | Joint 3 (tail2-tail3) damping
Show the full prompt
### Instruction
You are diagnosing a MuJoCo fish simulation that does not match real-world behavior.
Your task is to:
1. Identify which parameters are MOST RESPONSIBLE for the current sim-real mismatch.
2. Propose specific values for those parameters based on your physical reasoning.
Your proposed values will be evaluated directly — propose the best values you can based on your physical reasoning.
The fish has 9 tracked markers along its centerline (M0=nose to M8=tail tip).
Error is measured as L2 distance between sim and real marker positions in
head-frame coordinates, averaged across all 8 motor frequencies (0.5-2.25 Hz).
This is optimization round 1.
### Current Parameters
Parameter | Current | Bounds | Description
---------------------------------------------------------------------------
fluidCoef_0 | 8.5131 | [0.0, 10.0] | Pressure drag on blunt surfaces
fluidCoef_1 | 9.9527 | [0.0, 10.0] | Skin friction on slender surfaces
fluidCoef_2 | 2.4957 | [0.0, 10.0] | Rotational drag in water
fluidCoef_3 | 2.6903 | [0.0, 10.0] | Kutta lift (circulation/fin effect)
fluidCoef_4 | 2.8791 | [0.0, 10.0] | Magnus lift (spinning body parts)
motorArmLength | 0.0405 | [0.01, 0.06] | Crank arm driving tendons (m)
hingeStiffness_0 | 2.6644 | [0.1, 5.0] | Joint 0 (body-tail0) stiffness
hingeStiffness_1 | 1.9407 | [0.1, 5.0] | Joint 1 (tail0-tail1) stiffness
hingeStiffness_2 | 3.8937 | [0.1, 5.0] | Joint 2 (tail1-tail2) stiffness
hingeStiffness_3 | 3.3523 | [0.1, 5.0] | Joint 3 (tail2-tail3) stiffness
hingeStiffness_4 | 3.7233 | [0.1, 5.0] | Joint 4 (tail3-tail4) stiffness
hingeDamping_0 | 1.6793 | [0.0, 2.0] | Joint 0 (body-tail0) damping
hingeDamping_1 | 1.0098 | [0.0, 2.0] | Joint 1 (tail0-tail1) damping
hingeDamping_2 | 1.3163 | [0.0, 2.0] | Joint 2 (tail1-tail2) damping
hingeDamping_3 | 0.9216 | [0.0, 2.0] | Joint 3 (tail2-tail3) damping
hingeDamping_4 | 1.7621 | [0.0, 2.0] | Joint 4 (tail3-tail4) damping
### Full-Spectrum Sweep (all 8 frequencies)
Freq (Hz) | L2 (mm) | Per-Marker L2 [M0..M8] (mm) | Sim vel | Real vel
-------------------------------------------------------------------------
0.50 | 98.8 | [43, 42, 64, 115, 117, 117, 120, 123, 147] | -0.0013 | 0.0199
0.75 | 152.5 | [117, 117, 123, 168, 169, 169, 173, 172, 165] | -0.0016 | 0.0424
1.00 | 196.6 | [184, 184, 190, 204, 207, 203, 203, 199, 194] | -0.0019 | 0.0682
1.25 | 266.6 | [244, 245, 258, 276, 276, 275, 282, 271, 272] | -0.0022 | 0.0973
1.50 | 338.7 | [306, 306, 336, 357, 329, 360, 345, 356, 353] | -0.0023 | 0.1235
1.75 | 419.0 | [398, 398, 421, 425, 429, 425, 424, 422, 428] | -0.0025 | 0.1574
2.00 | 478.8 | [482, 482, 488, 492, 428, 457, 478, 500, 502] | -0.0027 | 0.1992
2.25 | 542.6 | [550, 550, 560, 566, 490, 512, 539, 554, 561] | -0.0027 | 0.2211
MEAN | 311.7 |
### Previous Optimization Rounds
(first round)
### Videos (multi-frequency diagnostic)
You are provided with 9 videos:
1. Real video at 2.25 Hz — perspective-corrected footage
2. Skeleton overlay at 0.50 Hz — sim (blue) vs real (red) centerline
3. Skeleton overlay at 0.75 Hz — sim (blue) vs real (red) centerline
4. Skeleton overlay at 1.00 Hz — sim (blue) vs real (red) centerline
5. Skeleton overlay at 1.25 Hz — sim (blue) vs real (red) centerline
6. Skeleton overlay at 1.50 Hz — sim (blue) vs real (red) centerline
7. Skeleton overlay at 1.75 Hz — sim (blue) vs real (red) centerline
8. Skeleton overlay at 2.00 Hz — sim (blue) vs real (red) centerline
9. Skeleton overlay at 2.25 Hz — sim (blue) vs real (red) centerline
The skeleton overlays show sim (blue) vs real (red) 9-marker centerline on dark
background with per-frame L2 error. Compare how the mismatch changes across
frequencies to identify which parameters need adjustment.
### Output
Select ANY parameters you believe are responsible for the mismatch and propose new values for each. You may change as few as 1 or as many as ALL parameters — use your physical reasoning to decide which parameters need adjustment and by how much.
For each parameter, explain your physical reasoning for the proposed value.
All proposed values MUST be within the bounds shown above.
Respond with a single JSON object:
{
"diagnosis": "<str: 2-4 sentences on what the data reveals about the mismatch>",
"selected_parameters": ["<param1>", "<param2>", ...],
"proposed_values": {"<param1>": <float>, "<param2>": <float>, ...},
"reasoning": "<str: why these parameters and values — include direction of change>",
"confidence": <float: 0.0 to 1.0>
}
VLM directions beat matched controls
Two matched controls keep the line search, the step sizes and the 40-evaluation budget, and change only the direction. Random directions use no model. Permuted directions query the VLM in the same way, then shuffle which parameters receive the proposed changes and randomize their signs. The step keeps its size but no longer targets the parameters the model named.
The preregistered replication ran all three methods from fifty fresh initializations and compared AUC40, the mean best-so-far error over the 40 evaluations. The paired analysis covers 42 initializations: the 41 that all three methods completed, and one that failed in all three. On these, Swim2Real lowered AUC40 by 63.4 mm against random directions and by 53.2 mm against permuted directions. Its AUC40 was lower in 34 of the 41 completed pairs against random directions and in 32 against permuted directions. Both comparisons pass Holm correction (p = 1.2 × 10−7 and 7.9 × 10−6).
Per-seed AUC40 values
| Seed | Swim2Real | Random | Permuted |
|---|---|---|---|
| 1248 | 148.1 | 118.2 | 162.8 |
| 1249 | 180.7 | 239.4 | 169.2 |
| 1250 | 53.4 | 82.1 | 82.7 |
| 1251 | 189.7 | 173.8 | 116.2 |
| 1252 | 126.6 | 173.3 | 287.6 |
| 1254 | 148.3 | 128.4 | 298.1 |
| 1255 | 61.5 | 92.9 | 88.2 |
| 1256 | 123.4 | 108.4 | 111.0 |
| 1258 | 54.2 | 70.2 | 92.4 |
| 1259 | 78.0 | 62.6 | 61.6 |
| 1262 | 76.8 | 270.9 | 76.6 |
| 1263 | 94.2 | 242.9 | 117.7 |
| 1264 | 75.3 | 248.5 | 260.8 |
| 1265 | 241.6 | 319.5 | 136.3 |
| 1266 | 78.3 | 279.7 | 149.9 |
| 1267 | 59.3 | 99.2 | 90.2 |
| 1268 | 71.5 | 111.8 | 90.3 |
| 1269 | 67.0 | 106.4 | 227.7 |
| 1270 (shared failure) | 1000.0 | 1000.0 | 1000.0 |
| 1271 | 141.0 | 195.7 | 130.9 |
| 1272 | 72.8 | 125.9 | 181.7 |
| 1273 | 77.5 | 226.8 | 214.9 |
| 1274 | 63.4 | 50.2 | 54.6 |
| 1275 | 136.2 | 156.4 | 214.4 |
| 1276 | 66.8 | 199.8 | 263.7 |
| 1277 | 57.8 | 129.3 | 106.2 |
| 1278 | 69.6 | 165.7 | 132.1 |
| 1280 | 137.1 | 187.0 | 251.3 |
| 1281 | 63.0 | 113.3 | 149.4 |
| 1282 | 47.2 | 47.4 | 47.4 |
| 1283 | 59.1 | 57.4 | 153.9 |
| 1284 | 97.3 | 299.1 | 150.1 |
| 1288 | 111.7 | 296.8 | 137.0 |
| 1289 | 68.6 | 228.5 | 207.2 |
| 1290 | 72.3 | 172.2 | 137.6 |
| 1291 | 65.7 | 79.2 | 115.0 |
| 1292 | 60.6 | 114.2 | 182.3 |
| 1293 | 51.5 | 55.0 | 68.1 |
| 1294 | 55.3 | 187.0 | 180.9 |
| 1295 | 68.9 | 77.5 | 165.9 |
| 1296 | 163.8 | 248.3 | 90.9 |
| 1297 | 50.1 | 105.3 | 63.7 |
A second model shows the same effect
With GLM-5.3-Flash in place of Gemini 2.5 Pro, on 24 paired initializations with the same budget and line search, Swim2Real again had lower AUC40 than both controls. Its median AUC40 was 71.1 mm, against 161.1 mm for random and 113.2 mm for permuted directions (Holm-adjusted p = 1.7 × 10−5 and 9.1 × 10−5).
Lower error at frequencies left out of the fit
In an eight-seed study, each method was fitted on five of the eight frequencies and assessed once on the other three. On those three, Swim2Real's error was 53.1 ± 3.8 mm (mean ± SD), against 102.2 ± 64.9 mm for random directions and 65.4 ± 28.5 mm for Bayesian optimization. It had the lower error in 7 of 8 pairs against random directions and in 6 of 8 against Bayesian optimization.
One run, round by round
The figure below replays the run shown at the top of the page: every evaluation, every proposal and every diagnosis as the model wrote it. The diagnoses are hypotheses, and the simulator decides which steps are kept.
Full step accepted: best error 285.4 → 50.8 mm
- Full step50.8accepted
The tick marks the best error before this round.
- fluid Kutta lift9.00 → 4.00
- motor Arm length55.0 → 45.0 mm
- tail Stiffness, joint 51.00 → 0.20
- tail Stiffness, joint 41.00 → 0.40
- tail Stiffness, joint 31.00 → 0.60
Bars show each change as a fraction of the parameter's range, on one scale for every round. Stiffness in N·m/rad, damping in N·m·s/rad, fluid coefficients dimensionless.
The simulation exhibits a strong frequency-dependent mismatch. At low frequencies (0.5-1.5 Hz), the simulated fish is overpowered, with excessive tail beat amplitude and forward velocity compared to reality. Conversely, at high frequencies (1.75-2.25 Hz), the simulation is severely overdamped, causing the tail motion to stall and forward velocity to plummet, in stark contrast to the real fish which continues to accelerate.
Show the model's reasoning
The proposed changes address the two primary issues. First, to correct the overpowered swimming at low frequencies, I am significantly reducing `fluidCoef_3` (Kutta lift) from 9.0 to 4.0 and decreasing `motorArmLength` from 0.055 to 0.045. This will lower thrust generation and reduce the input tail beat amplitude. Second, to fix the stalling at high frequencies, I am drastically reducing all `hingeDamping` values from 0.2 to 0.05, as the high current damping dissipates too much energy at high joint velocities. Finally, to promote a more natural swimming gait, I am introducing a decreasing stiffness gradient along the tail (`hingeStiffness_1` to `hingeStiffness_4`) to better mimic the passive flexibility of a real fish.
The robot and its simulator
The robot is 0.6 m long and weighs 1.5 kg including electronics. Its compliant tail is built from super-elastic nitinol rods held by five 3D-printed spine segments. Antagonistic tendons, driven by a dual-output crank-slider, bend the tail into an S-shape.
The recordings were made with an overhead 4K camera in a 2 m × 3 m pool. The simulator is a MuJoCo model that splits the tail into five rigid segments joined by hinges and uses a fluid model with five coefficients.
Simulator commands on the real robot
Motor commands generated in simulation also run on the robot. In ten open-loop pool trials, we replayed motor commands from soft actor-critic policies trained with an earlier simulator. The robot's displacement along its initial heading was positive in every trial, 0.38 ± 0.22 m on average.
Code and data
The code (MIT) and the run records (CC BY 4.0) are on GitHub. The records hold every simulator evaluation and VLM reply from 318 calibration runs, and one command recomputes the paper's calibration results from them in a few seconds.
Citation
@article{qiu2026swim2real, title = {{Swim2Real: Vision-Language Models for Simulator Calibration of a Soft Robotic Fish}}, author = {Qiu, Kevin and Walker, Kyle Liam and Michelis, Mike Yan and Cygan, Marek and Hughes, Josie}, journal = {IEEE Robotics and Automation Letters}, year = {2026}, doi = {10.1109/LRA.2026.3752343}, url = {https://arxiv.org/abs/2603.20827}}