EndoRSI: Physical-Evidence-Driven Recursive Improvement of Endoscopic Robot Policies
Organizations: Department of Electronic Engineering, The Chinese University of Hong Kong, Hong Kong SAR, China · Department of Computer Science and Engineering, The Chinese University of Hong Kong, Hong Kong SAR, China
Abstract
Artificial intelligence is beginning to automate scientific discovery, yet physical robot-policy research still relies on scientists and engineers to interpret experimental failures and decide how controllers should be revised. We present EndoRSI (Endoscopic Recursive Self-Improvement), a human-governed, self-improving robotic research system in which the embedded EndoForge coding agent iteratively develops and refines endoscopic robot policies using evidence from physical experiments. Physical execution remains isolated within a safety-constrained runtime under human authorisation. In motorised endoscopy, validation evidence first caused the agent to reject an initial action representation, while subsequent physical experiments falsified an offline-supported insertion strategy by revealing hazardous closed-loop behaviour absent from the source data. Failed physical rollouts were then incorporated into policy revision; insertion success subsequently increased from 2/21 in the first generation to 17/21 in the fourth. The frozen final policy retained competence across visual and hardware shifts and was the best performing autonomous policy across six independent ex-vivo porcine specimens. These results show that physical robot interaction can serve as experimental evidence for agent-driven robot policy research.
Figures & tables
| Policy arm | Success / | Success, % (95% CI) | Emergency stop |
|---|---|---|---|
| ZS-A rule composition | 0/16 | 0.0 (0.0–19.4) | 16 |
| CNN behaviour cloning | 0/21 | 0.0 (0.0–15.5) | 0 |
| Action-chunking transformer | 1/21 | 4.8 (0.8–22.7) | 1 |
| Diffusion Policy | 2/21 | 9.5 (2.7–28.9) | 0 |
| IBVS | 3/21 | 14.3 (5.0–34.6) | 0 |
| Success-only, final iteration | 3/21 | 14.3 (5.0–34.6) | 0 |
| Stage | Scientific role | Evidence and decision | Frozen output |
|---|---|---|---|
| 1 | Audit source skills | Verify image–action correspondence, episode splits, ranges and task statistics | Locked splits, normalisation and audit report |
| 2 | Test policy hypotheses | Reject v1 on validation; replace discrete residual actions with continuous chunks and temporal ensembling (TE) | Selected source-policy checkpoint and validation report |
| 3 | Operationalise a task hypothesis | Human specifies align-then-advance; agent quantifies source-task support, rejects unsupported navigation-centroid steering and implements three candidates | Cross-task analysis; zero-shot composition A (ZS-A), dual-policy router and vision–language–action (VLA) manifests |
| 4 | Falsify physically | Sixteen consecutive ZS-A emergency stops reject discontinuous rule composition | Sealed outcome set and transition to reactive policy |
| 5 | Develop reactive insertion | Agent develops its pre-frozen VLA direction after physical falsification and a human requirement for end-to-end stop-capable behaviour | Gen1 checkpoint and manifest |
| 6 | Evolve from evidence | Gen1 Gen2 clones success only; failure relabelling first enters the Gen2 Gen3 update | Gen2–Gen4 outcome records, recipes and research ledger |
| Component | Input and operation | Output and authority |
|---|---|---|
| Human investigators | Define the task and constraints; reset and authorise each trial | Retain deployment and emergency-stop authority; assign terminal S/F/E outcomes |
| Coding agent | Audit data and results; implement and revise candidates between trials | Prepare a future checkpoint, manifest, instruction and execution limits for human authorisation |
| Frozen candidate | One authorised checkpoint, manifest, instruction and limit configuration | Remains fixed throughout the armed trial |
| Visual processing | Full endoscopic frames pass through preprocessing and asynchronous inference | Semantic action predictions enter an action queue |
| Execution runtime | The 20-Hz loop selects valid queued actions | Deterministic magnitude, watchdog and slew limits bound the command |
| Platform adapter | Convert semantic commands to the selected platform’s motor mapping | Send platform-specific packets to serial firmware |
| Platform | Instrument | Dataset or experiment role | Lower controller |
|---|---|---|---|
| ER1 | Olympus GIF-Q260J medical gastroscope, 9.9 mm | Tracking source dataset in discarded ex-vivo pig stomach | Four-motor firmware |
| ER2 | Ailishi S50 industrial endoscope, 6.0 mm | Navigation source dataset; development and evolution aperture; low illumination; phantom-configuration shift; both ex-vivo cohorts | Six-channel firmware (four motors are used); M1–M4 active, M5/M6 zero |
| ER3 | Ailishi S50 industrial endoscope, 3.9 mm | Different-instrument transfer arm | Same six-channel firmware (four motors are used) and active-channel pattern as ER2 |
| Layer | Input and output | Reproducible role in the archive |
|---|---|---|
| Platform collection | Camera, timestamp and executed device command recorded episode | Three device-facing collection paths preserve the raw embodiment and acquisition context |
| Dataset conversion | Recorded episode aligned image–semantic-action records | Validates image/action correspondence, constructs episode-disjoint splits and converts commands to |
| Training | Canonical records and task normalisation frozen checkpoint and manifest | Learns the action controller without embedding a raw ER1/ER2/ER3 serial packet |
| Inference runtime | Current image, instruction and frozen manifest bounded semantic action | Runs asynchronous model inference and a deterministic 20-Hz watchdog/safety boundary |
| Hardware adapter | Semantic action plus platform profile device motor packet | Applies channel expansion, sign, scale, gain, bias and inactive-channel rules |
| Lower firmware | Device motor packet motor actuation | Separate four-motor medical and six-channel industrial Keil projects |
| Task | Episodes | Action rows | Split | Test | Collection system and environment |
|---|---|---|---|---|---|
| Tracking | 100 | 12,710 | 80/10/10 | 10 episodes | ER1, Olympus GIF-Q260J; ex-vivo pig stomach |
| Navigation | 100 | 16,534 | 80/10/10 | 10 episodes | ER2, Ailishi S50 6.0 mm; colon phantom |
| Tracking | Navigation | |||
|---|---|---|---|---|
| Policy | Validation | Held-out | Validation | Held-out |
| CNN behaviour cloning | 2.619 | 2.316 | 19.463 | 23.580 |
| Agent v1 | 2.654 | 2.065 | 19.811 | 23.608 |
| Agent v2 | 2.615 | 2.255 | 19.091 | 22.032 |
| Agent v2+TE | 2.426 | 2.112 | 18.791 | 21.683 |
| Task | Policy | MAE | RMSE | Sign accuracy |
|---|---|---|---|---|
| Tracking | Classical visual servoing | 2.846 | 4.006 | 0.778 |
| Diffusion Policy | 2.340 | 3.891 | 0.780 | |
| Action-chunking transformer | 2.417 | 3.830 | 0.781 | |
| CNN behaviour cloning | 2.316 | 3.697 | 0.817 | |
| Image-only VLA | 2.622 | 4.223 | 0.611 | |
| v1 | 2.065 | 3.884 | 0.741 |
| Task | Original | Seed 1 | Seed 2 | Mean s.d. | CNN reference |
|---|---|---|---|---|---|
| Tracking | 2.112 | 2.076 | 1.995 | 2.316 | |
| Navigation | 21.683 | 21.257 | 21.615 | 23.580 |
| Claim or candidate | Sample size | Evidence | Decision |
|---|---|---|---|
| Tracking centre error predicts bending | 10,284 frames | ( ), 0.370 ( ) | Retain as alignment primitive |
| Navigation dark-centroid error predicts bending | 13,810 frames | ( ), 0.004 ( ) | Reject |
| Low bending predicts advancement | 13,810 frames | Mean in lowest quartile, otherwise | Retain as conditional advance principle |
| ZS-A composes both rules safely | 16 physical attempts | 0 success; 16 emergency stops | Physical falsification rejects rule composition |
| Update | Source-batch outcomes | Training use | Successor outcome |
|---|---|---|---|
| Gen1 Gen2 | 2 success; 19 failure/emergency stop | Success only; 175 cloning samples; 300 steps; loss 0.4662 0.2851 | 8/21 |
| Gen2 Gen3 | 8 success; 13 failure/emergency stop | Failure-derived: 68 cloning + 144 mirrored avoidance samples from 12 contributing records; nine records supplied no sample; loss 0.2243 0.0918 | 14/21 |
| Gen3 Gen4 | 14 success; 7 failure | Failure-derived: 240 cloning + 160 avoidance samples; 300 steps; loss 0.0914 0.0643 | 17/21 |
| Success-only control | 1/21 3/21 3/21 3/21 | Each update used successes from its own preceding batch and discarded unsuccessful outcomes | 3/21 final |
| Group | Arm | Success / | Success, % (95% CI) | Emergency stop |
| Physical falsification | ZS-A | 0/16 | 0.0 (0.0–19.4) | 16 |
| Fixed reference | CNN behaviour cloning | 0/21 | 0.0 (0.0–15.5) | 0 |
| Action-chunking transformer | 1/21 | 4.8 (0.8–22.7) | 1 | |
| Diffusion Policy | 2/21 | 9.5 (2.7–28.9) | 0 | |
| IBVS | 3/21 | 14.3 (5.0–34.6) | 0 | |
| Success-only | Iteration 1 | 1/21 | 4.8 (0.8–22.7) | 0 |
| Comparison | Odds ratio | Role | |
|---|---|---|---|
| Gen4 versus Gen1 | 40.38 | Overall generation contrast | |
| Gen4 versus IBVS | 25.50 | Best fixed classical reference | |
| Gen4 versus final Success-only iteration | 25.50 | Failure-evidence mechanism control | |
| Gen2 versus Gen1 | 5.85 | 0.0670 | Generation comparison |
| Gen3 versus Gen2 | 3.25 | 0.121 | Generation comparison |
| Gen4 versus Gen3 | 2.13 | 0.484 | Generation comparison |
| Human investigators | Coding agent |
|---|---|
| Define research goal, align-then-advance task and bounded deployment authority. | Plan dataset audit, validation-based revision and physical evaluation. |
| Provide existing tracking and navigation datasets and experimental constraints. | Audit image-action records, lock episode splits and implement comparison policies. |
| Require validation evidence to guide policy improvement. | Reject v1 on validation. Implement continuous action chunks and causal temporal ensembling. |
| Specify insertion as tracking plus navigation. Require freezing before insertion outcomes. | Quantify cross-task support. Reject centroid steering. Freeze ZS-A, ZS-B and instructed VLA. |
| Authorise ZS-A tests and use emergency stop in all 16 attempts. | Analyse discontinuous advancement and absence of a reactive stop response. |
| Prioritise end-to-end VLA development and specify stop-on-contact behaviour. | Develop the previously frozen VLA direction into Gen1 using source-derived supervision. |
| Policy | Specimen | S | F | E | Success navigation time, s | |
|---|---|---|---|---|---|---|
| IBVS | 1 | 7 | 3 | 3 | 1 | 6.2 [4.9–14.6] |
| 2 | 7 | 3 | 3 | 1 | 2.0 [1.9–2.1] | |
| 3 | 7 | 3 | 4 | 0 | 2.5 [1.9–3.2] | |
| Gen1 | 1 | 7 | 2 | 5 | 0 | 9.3 [8.9–9.6] |
| 2 | 7 | 4 | 3 | 0 | 3.5 [2.4–4.5] | |
| 3 | 7 | 3 | 3 | 1 | 6.7 [4.7–6.7] |
| Condition | Success / | Success, % (95% CI) | Exploratory vs Gen4 | Scope |
| Initial block cohort | ||||
| Gen4 | 21/21 | 100.0 (84.5–100.0) | – | Frozen evolved policy |
| Success-only | 11/21 | 52.4 (32.4–71.7) | Final success-only control | |
| Gen1 | 9/21 | 42.9 (24.5–63.5) | Initial reactive policy | |
| IBVS | 9/21 | 42.9 (24.5–63.5) | Classical reference | |
| Interleaved replication cohort | ||||
| Arm | Outcome | Mean, s | Median [IQR], s | Range, s | Emergency stop | |
| Success-only 1 | F | 20 | 4.6 | 4.1 [3.6–5.0] | 3.3–10.2 | 0 |
| Success-only 2 | F | 18 | 3.5 | 3.2 [3.1–3.7] | 2.5–7.0 | 0 |
| Success-only 3 | F | 18 | 3.8 | 3.5 [3.2–4.2] | 3.0–5.6 | 0 |
| Success-only 4 | F | 18 | 4.8 | 4.2 [3.5–4.6] | 2.7–13.9 | 0 |
| Gen1 | F+E | 19 | 12.4 | 5.3 [3.8–6.9] | 1.9–97.8 | 5 |
| Gen2 | F | 13 | 9.2 | 8.0 [6.9–9.9] | 3.4–21.2 | 0 |
| Domain | Comparison | Exact-path | Agreement, % | Reliability |
|---|---|---|---|---|
| All scored trials | Relevant live record vs external evaluator 1 | 546 | 100.0 | Cohen’s |
| All scored trials | Three rating sources per trial | 546 | 100.0 | Fleiss’ |
| Phantom | Benchtop operator 1 vs video evaluator 1 | 315 | 100.0 | Cohen’s |
| Phantom | Benchtop operator 1 vs external evaluator 1 | 315 | 100.0 | Cohen’s |
| Phantom | All three rating sources | 315 | 100.0 | Fleiss’ |
| Initial ex vivo | Initial ex-vivo operator 1 vs video evaluator 2 | 84 | 100.0 | Cohen’s |
| Cohort | Analysis | Estimate | 95% CI | Interpretation | |
|---|---|---|---|---|---|
| Initial block | ICC(A,1) | 48 | 0.994 | 0.978–0.998 | Individual-rating agreement |
| Initial block | ICC(A, ) | 48 | 0.998 | 0.993–0.999 | Three-rating mean reliability |
| Interleaved replication | ICC(A,1) | 76 | 0.956 | 0.873–0.984 | Individual-rating agreement |
| Interleaved replication | ICC(A, ) | 76 | 0.985 | 0.954–0.995 | Three-rating mean reliability |
| Initial block cohort | ||||
|---|---|---|---|---|
| Protocol condition | Specimen 1 | Specimen 2 | Specimen 3 | Total |
| IBVS | 3/7 | 3/7 | 3/7 | 9/21 |
| Gen1 | 2/7 | 4/7 | 3/7 | 9/21 |
| Success-only, original configuration | 3/7 | 4/7 | 4/7 | 11/21 |
| Gen4 | 7/7 | 7/7 | 7/7 | 21/21 |
| Interleaved replication cohort | ||||