- The paper proposes an RL framework that leverages a single demonstration to achieve physically plausible swimming control in complex fluid environments.
- It utilizes a custom state representation and hybrid RL with a progressive eviction buffer to enhance sample efficiency and generalization.
- Experimental evaluations demonstrate robust performance across varied fluid dynamics, disturbances, and even geometry modifications, confirming its practical impact.
SWIM: Single-Instance Whole-Body Imitation for Physically-Based Swimming Control
Introduction
The paper "SWIM: Single-Instance Whole-Body Imitation for swiMming" (2605.31120) introduces SWIM, a reinforcement learning (RL) framework enabling physically-based characters to synthesize robust, task-driven swimming motions. The work addresses the long-standing challenge of simulating and controlling articulated humanoid swimmers, leveraging a highly data-efficient approach that generalizes from a single demonstration to unseen environments, tasks, and body geometries. The authors emphasize advances in physically plausible character animation, especially within complex, fully coupled fluid environments.
SWIM formulates swimming control as an MDP with a custom high-dimensional state integrating body kinematics, a multi-horizon goal encoding, and a structured local environment representation. The environment state captures near-body fluid characteristics via a smoothed per-body force/torque vector, crucially balancing informativeness and volatility resistance. The goal encoding employs dynamically updated intermediate waypoints along a reference path, providing both sparse and dense cues for policy training and improved generalization.
The action space is parameterized as joint residuals atop a cyclic reference swimming motion, implemented via a neural network outputting corrective targets. Reward functions include decomposable components penalizing goal deviation, body instability (especially excess roll), and motion temporal roughness, resulting in learning that jointly optimizes controllability, stability, and naturalness.
Figure 1: Visual depiction of reward components, multi-horizon intermediate goals, and ideal reference trajectories in SWIM's training task.
Hybrid RL Algorithm and Buffering Strategy
A key contribution is a hybrid on/off-policy RL regime tailored to the unique requirements of fluid-coupled locomotion. Built on PPO, the experience replay is maintained via ProgEvict, a progressive eviction buffer. Early training employs FIFO, while late training transitions (via a sigmoidal schedule) to a reward and recency-aware heuristic. This strategy efficiently exploits rare, high-quality, and informative failure trajectories, empirically accelerating convergence and improving sample efficiency over both vanilla PPO and naïve replay strategies.
Figure 2: Sample efficiency and reward curves for diverse environment state representations under FIFO and ProgEvict buffer management.
Physically-Based Rigid-Fluid Coupled Simulator
The simulation stack is a tightly coupled system integrating DFSPH (for Lagrangian incompressible SPH fluid dynamics) and PyBullet (for multi-link rigid body articulation). Surface force and torque integrations occur at the per-body-part level, exploiting particle-to-boundary interactions at a 10 cm offset from the mesh. This yields accurate, physically plausible force transmission necessary for naturalistic swimming, while maintaining tractable computational costs relative to high-resolution Eulerian solvers.
Experimental Evaluation
Ablation Over State Representation and Buffering
Comprehensive ablations demonstrate that SWIM's smoothed per-body force/torque (SmoothFT) combined with ProgEvict yields superior learning speed, reward maximization, and generalization. Simplified or coarsened environmental states fail to capture fluid effects meaningfully, while overly raw signals degrade learning through volatility. The structured, low-dimensional SmoothFT state is essential for robust task transfer.
Comparison to Prior Imitation and RL Baselines
Comparisons against DeepMimic, ADD, TD3, and multiple MimicKit-PPO variants highlight SWIM's unique capacity for full goal-reaching and fine-grained control within a restricted sample budget. Baselines are unable to progress beyond initial stabilization, frequently producing physically implausible or drift-prone behaviors in the presence of water dynamics.
Figure 3: Trajectory comparison between SWIM and alternative RL/imitation methods in a goal-reaching task.
Generalization: Unseen Goals, Trajectories, and Fluids
SWIM, trained on a single straight goal-reaching task in a small pool, demonstrates significant generalization capacity:
- Unseen goal positions: Maintains performance for goals up to 2.5× the lateral offset and angular deviation observed in training.
- Curved trajectories: Zero-shot transfer to nontrivial, polylined, and sinusoidal reference paths.
- Cross-fluid environment: Stable policy behavior is retained in oil-like, high-viscosity, and high-density fluids, as well as in the presence of surface waves and strong currents.
Figure 4: Boundary sweep of goal-reaching performance across lateral target angles and distances; training domain is marked for comparison.
Figure 5: Qualitative cross-environment and cross-style generalization: freestyle in oil, water with waves, and butterfly along control trajectories.
Figure 6: Policy robustness as a function of inflow speed and direction change in a 3 m pool.
Robustness to Perturbations and Geometry Modifications
Additional tests expose the policy to large impulsive and continuous disturbances, as well as modifications to body shape (e.g., fin attachments, limb removal). Moderate geometry changes such as adding fins improve propulsion, but larger modifications degrade control, reflecting the limits of the current state abstraction's generality.
Figure 7: Swimming speed increase realized by adding 10 cm fins to the feet in freestyle.
Theoretical and Practical Implications
SWIM demonstrates, for the first time, that RL-based character animation in full rigid-fluid coupling is feasible and highly data-efficient, requiring only a single demonstration. The results indicate progress toward generative, physics-constrained policies capable of robust motor control in highly nonstationary, underactuated environments. The approach is broadly extensible—beyond swimming—to other domains where fluid-structure interaction and generalization are required, for example, aquatic robotics, biomechanical hypothesis testing, and adaptive animation in virtual environments.
The buffer strategy and state space design are likely to influence general RL practice in high-cost, high-contact simulation domains. However, limitations remain in policy transferability to substantially altered body geometries and extreme fluid conditions, suggesting future work on geometry-invariant representations and curriculum-based RL.
Conclusion
SWIM provides a generalized, physically-based framework for swimming control, advancing the scope of RL-driven animation to the regime of challenging body-fluid interaction. The method's principled state design, efficient learning strategy, and demonstrated generalization establish a foundation for future research in motor skill learning, multi-modal control, and fluid-coupled agent simulation in both computer graphics and robotics.