LabCompiler: A Framework for Verifiable Human-Machine Laboratory Execution from Imperfect Protocols
Organizations: Shanghai Jiao Tong University · Shanghai Artificial Intelligence Laboratory · Fudan University · Shenzhen Institutes of Advanced Technology ·
Abstract
Closing the loop of AI-driven science requires reliably translating natural-language protocols into executable laboratory workflows despite protocol defects and heterogeneous hardware. Existing approaches often couple scientific interpretation with device-specific code generation, making errors difficult to localize and limiting reuse across laboratory platforms. We introduce LabCompiler, a robust protocol-to-execution framework that transforms imperfect natural-language protocols into verifiable human-machine workflows. Its protocol firewall diagnoses and repairs defects before compilation while preserving unaffected content, guided by troubleshooting knowledge accumulated through perturbation-guided self-evolution. A two-level, device-agnostic graph representation separates experimental semantics from hardware-specific implementation and supports capability-based device assignment with coordinated human execution. We further introduce a protocol recovery benchmark covering four controlled perturbation types and naturally occurring errors collected from protocols written by iGEM participants. Experiments show that LabCompiler outperforms frontier LLMs in protocol error correction while enabling coordinated human-machine execution across heterogeneous, partially automated laboratory settings.
Figures & tables
| Perturbation | Construction | Illustrative example |
| Parameter or reagent replacement | Replace a valid experimental parameter or reagent with an incompatible alternative. | Incubate at incubate at . |
| Critical-step deletion | Remove an operation required to establish the state assumed by a downstream step. | Delete the quenching step before washing labeled cells. |
| Cross-step inconsistency | Modify a reference, quantity, or material such that two distant steps become inconsistent. | Prepare samples but later use reagents for samples. |
| Operation or parameter ambiguity | Replace an explicit operation or quantitative specification with an expression insufficient to determine the intended procedure. | Add of PBS add an appropriate amount of buffer. |
| Method | Critical-step deletion | Operation or parameter ambiguity | Parameter or reagent replacement | Cross-step inconsistency | ||||
| Acc. | Rep. | Acc. | Rep. | Acc. | Rep. | Acc. | Rep. | |
| MiniMax-M3 | 68.0 | 26.0 | 26.6 | 15.0 | 45.0 | 29.0 | 38.2 | 39.9 |
| Qwen3.8-Max | 65.2 | 29.0 | 32.0 | 20.0 | 55.0 | 35.4 | 45.0 | 44.6 |
| DeepSeek-V4-Pro | 69.8 | 37.3 | 37.0 | 23.7 | 49.0 | 35.0 | 47.4 | 47.7 |
| Gemini-3.1-Pro | 68.0 | 36.4 | 39.8 | 22.0 | 52.0 | 32.0 | 51.4 | 45.9 |
| Kimi-K3 | 74.0 | 36.0 | 42.4 | 24.0 | 58.2 | 38.5 | 44.6 | 42.2 |
Appendix figures & tables20 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | Protocol defect repair | Explicit protocol verification | Device-agnostic IR | Hierarchical representation | Device capability grounding | Human hybrid workflow | Auditable intermediate artifacts |
| XDL ( Mehr et al., 2020 ) | Partial | Supported | Supported | Partial | Partial | Not explicitly reported | Supported |
| LabOP ( Bartley et al., 2023 ) | Not explicitly reported | Supported | Supported | Partial | Partial | Supported | Supported |
| BPL ( Song et al., 2026 ) | Partial | Supported | Supported | Partial | Supported | Supported | Partial |
| BioProAgent ( Liu et al., 2026b ) | Partial | Supported | Partial | Partial | Supported | Partial | Partial |
| ProtoAct ( Liu et al., 2026c ) | Partial | Partial | Partial | Partial | Supported | Partial | Partial |
| ProtoPilot ( Jiang et al., 2026 ) | Supported | Supported | Partial | Partial | Supported | Partial | Supported |
| Category | Check | Failure handling |
| Report structure | Required screening fields and protocol artifact consistency | The screening report is rejected and returned for revision |
| Experimental content preservation | Preservation of explicit operations, materials, preparation commitments, and protocol constraints | The candidate protocol is rejected if valid content is removed or altered without justification |
| Consistency checking | Consistency among steps, materials, parameters, and dependencies | Feedback is returned for another repair attempt |
| Ambiguity classification | Classification of remaining ambiguities into blocking or deferred cases | Blocking ambiguity leads to unresolved status; deferred ambiguity may be carried forward |
| Evidence-supported completion | Completion of missing information only when supported by available evidence or justified inference | Unsupported assumptions remain unresolved rather than being inserted |
| Field | Type | Description |
| operation_id | String | Unique identifier of the semantic operation. |
| operation_type | String | Semantic operation type before canonical action normalization. |
| source_text | String | Exact excerpt from the approved effective protocol supporting the operation. |
| objects | Array | Logical materials, samples, containers, or collections participating in the operation, together with their semantic roles. |
| parameters | Object | Quantitative parameters, experimental conditions, and other operation-level values explicitly represented by the protocol. |
| dependencies | Array | Identifiers of predecessor operations. |
| Field | Description |
| normalized_operation_id | Unique identifier of the normalized operation. |
| canonical_action | One of the 26 canonical action identifiers listed in Table C.5 . |
| sequence_index | Position of the operation in the normalized operation sequence. |
| derived_from_semantic _operation_ids | Semantic operations from which the canonical operation is derived. |
| source_texts | Source excerpts corresponding to the contributing semantic operations. |
| objects | Mapping between action-specific logical roles and logical objects. |
| Canonical action | Semantics and logical roles | Key semantic restriction |
|---|---|---|
| liquid_transfer | Move liquid from one logical source to one logical destination. | Single-source, single-destination liquid movement; it does not represent mixing or liquid disposal. |
| liquid_distribution | Distribute liquid from one source to multiple logical destinations. | Used when one source supplies a logical destination collection. |
| liquid_consolidation | Collect liquid from multiple logical sources into one destination. | Distinguished from a single-source liquid transfer. |
| liquid_removal | Remove liquid from a source to a discard destination; a protected material may remain in the source. | Represents removal rather than productive transfer of the removed liquid. |
| non_liquid_sample_transfer | Move a discrete non-liquid sample to a logical destination. | Used for non-liquid sample movement rather than liquid transfer. |
| solid_combination | Combine a solid component and a liquid component into a resulting product. | Material phase must be supported by the interpreted protocol. |
| Criterion | Grouping rule |
| Local experimental objective | Actions that jointly accomplish the same local experimental operation may be grouped when no intervening boundary requires independent execution. |
| Material continuity | Actions operating on the same logical sample or material state may remain in the same unit when the intermediate state does not need to be exposed to another unit. |
| Dependency structure | The original prerequisite relations in are preserved. Grouping does not remove a dependency required by a downstream operation. |
| Control boundary | A waiting period, incubation boundary, conditional operation, experimental endpoint, or measurement whose result is consumed downstream may separate execution units. |
| Resource continuity | Actions may be grouped only when a compatible realization exists for the resulting unit. A required change of executor or physical carrier can therefore introduce a unit boundary. |
| Intermediate-material use | When an intermediate material or state is independently consumed by another part of the workflow, its producing and consuming operations remain separated by an explicit dependency boundary. |
| Mode | Eq. (3) executor | Retained routing information |
| Automated | Canonical-operation lineage and dependencies, compatible-device set, physical-resource bindings, generated backend artifact, and validation result. | |
| Human-coordinated | HUMAN | Source operation and canonical-operation context, dependencies, human-execution instruction, relevant runtime inputs, and optional device-class or device-model guidance. |
| Device | Backend family | Supported canonical actions | Integration | Key constraints | Validation |
|---|---|---|---|---|---|
| Opentrons OT-2 | Opentrons | liquid_transfer , liquid_distribution , liquid_consolidation , liquid_removal , pipette_mixing , orbital_shaking , temperature_control , incubation , thermal_cycling , magnetic_separation | Adapter + compiler | Positive liquid volumes; mixing volume up to 1000 uL; shaking 200–3000 rpm; temperature, thermal-cycling, and magnetic-module constraints are checked when applicable. | Official sim. |
| Opentrons Flex | Opentrons | liquid_transfer , liquid_distribution , liquid_consolidation , liquid_removal , pipette_mixing | Adapter + compiler | Positive liquid volumes and compatible liquid-handling resources. | Official sim. |
| Hamilton STAR | PyLabRobot | liquid_transfer , liquid_distribution , liquid_consolidation , liquid_removal , pipette_mixing | Adapter + compiler | Eight-channel liquid handling; volumes up to 1000 uL; compatible plate, reservoir, and tube-rack resources. | Offline sim. |
| Hamilton Nimbus | PyLabRobot | liquid_transfer , liquid_distribution , liquid_consolidation , liquid_removal , pipette_mixing | Adapter + compiler | Eight-channel liquid handling; volumes up to 1000 uL. | Offline sim. |
| Hamilton Vantage | PyLabRobot | liquid_transfer , liquid_distribution , liquid_consolidation , liquid_removal , pipette_mixing | Adapter + compiler | Eight-channel liquid handling; volumes up to 1000 uL. | Offline sim. |
| Tecan EVO | PyLabRobot | liquid_transfer , liquid_distribution , liquid_consolidation , liquid_removal , pipette_mixing | Adapter + compiler | Eight-channel liquid handling; volumes up to 1000 uL. | Offline sim. |
| Compatibility component | Requirement |
| Action compatibility | Every canonical action in the execution unit must have a supported realization on the candidate device. |
| Object and resource compatibility | Required logical objects, carriers, labware types, and input/output shapes must be compatible with the device interface. |
| Parameter compatibility | Required parameters must be present where necessary and satisfy the applicable unit, range, and device-capability constraints. |
| Backend compatibility | An applicable adapter and backend realization must exist for the action–device combination. |
| Validation compatibility | The realization must admit the validation pathway associated with the backend, including simulator validation or contract validation as applicable. |
| Validation level | What is checked | Interpretation |
| Static and device-constraint validation | Action mapping, required parameters, object/resource compatibility, device-capability constraints, backend contract, and physical-layout consistency when applicable. | Required for an automated realization. |
| Simulator validation | Generated backend artifact is evaluated using the simulator associated with the selected device backend. | Applied when a simulator is available. |
| Contract validation | The normalized device command is checked against the registered device-command and parameter contract. | Used for backends without an applicable simulator. |
| Perturbation | Construction rule | Quality-control constraint |
| Critical-step deletion | Delete one complete operation required to establish a state used by a downstream step. | All remaining source steps retain their original content and relative order, except for necessary step renumbering. The deletion must create the intended missing prerequisite rather than modifying unrelated content. |
| Operation or parameter ambiguity | Retain the underlying operation while making one execution-critical operation or quantitative specification underdetermined, for example by removing a numerical value, unit, or required range. | No additional step is inserted or deleted, the step order is unchanged, and the target is not replaced by a different concrete reagent or parameter. |
| Parameter or reagent replacement | Replace one explicit experimental parameter or reagent identity with an incompatible alternative. | The underlying operation, number of steps, step order, and unrelated parameters remain unchanged. |
| Cross-step inconsistency | Modify a later reference to a sample, reagent, component, quantity, or state established by an earlier step. | The modified statement remains locally plausible while introducing a cross-step inconsistency. Unrelated steps are preserved. |
| Dataset / category | Accepted | Unique source protocols | Self-evolution | Dev. | Test | Expert audit |
| Critical-step deletion | 600 | 600 | 100 | 0 | 500 | 100 |
| Operation or parameter ambiguity | 600 | 600 | 100 | 0 | 500 | 100 |
| Parameter or reagent replacement | 600 | 600 | 100 | 0 | 500 | 100 |
| Cross-step inconsistency | 600 | 600 | 100 | 0 | 500 | 100 |
| Controlled total | 2,400 | – a | 400 | 0 | 2,000 | 400 |
| iGEM real-world subset | 259 | 259 | 0 | 0 | 259 | 259 |
| Perturbation category | One-pass repair | Iterative repair | |
| Critical-step deletion | 38.1 | 39.8 | +1.7 |
| Operation or parameter ambiguity | 27.9 | 31.2 | +3.3 |
| Parameter or reagent replacement | 44.3 | 53.4 | +9.1 |
| Cross-step inconsistency | 53.2 | 63.6 | +10.4 |
| Overall | 40.9 | 47.0 | +6.1 |
| Fidelity | Stability | |||||
| Representation | Operation | Detail | Relation | Operation | Detail | Relation |
| Direct-to-canonical (w/o ) | 88.6 | 87.6 | 85.4 | 89.7 | 86.5 | 83.2 |
| Two-level ( ) | 96.4 | 96.2 | 94.6 | 95.8 | 97.3 | 98.2 |
| +7.8 | +8.6 | +9.2 | +6.1 | +10.8 | +15.0 | |
| Routing granularity | Execution-unit grouping | Route accuracy (%) | Device executability (%) |
| Action-wise routing | No | 61.2 | 49.5 |
| Execution-unit routing | Yes | 72.9 | 59.6 |
| – | +11.7 | +10.1 |
| Metric | Evaluation unit | Raw scale | Within-protocol denominator | Final aggregation |
| Classification accuracy | Protocol | 0/1 | All evaluated controlled protocols | Mean correctness over protocols |
| Repair score | Protocol | 0–2 per judge | All protocols with paired judge scores | Two-judge mean, linearly mapped to 0–100 |
| IR fidelity | Protocol | 0–5 per dimension | 50 original protocols | Mean across protocols |
| IR stability | Rewrite | 0–5 per dimension | 100 rewrites per transformation | Average within source protocol, then across source protocols |
| Route accuracy | Execution unit | 0/1 | Reference execution units in each protocol | Protocol-level accuracy, then mean across protocols |
| Device executability | Automated execution unit | 0/1 | Reference automated execution units in each protocol | Protocol-level success rate, then mean across protocols |
| Task | Score-audit fraction | Independent expert ratings per response |
| Protocol repair | 30% | 2 |
| IR fidelity | 30% | 2 |
| IR stability | 30% | 2 |
| Code fidelity | 30% | 2 |
| Evaluation | Source protocols | Evaluation instances | Notes |
| Controlled protocol recovery | 2,000 | 2,000 | 500 protocols in each of four perturbation categories |
| iGEM protocol recovery | 259 | 259 | Independent real-world held-out subset |
| Representation fidelity | 50 | 50 | Source protocol |
| Representation stability | 50 | 500 rewrites | 10 rewrites per source protocol; 100 instances for each of five transformations |
| Execution grounding | 100 | 643 execution units | 376 Automated and 267 HUMAN reference units |
| Method | Accuracy | Precision | Coverage |
| Human | 0.79 | 0.87 | 0.91 |
| Claude 3.5 Sonnet | 0.48 | 0.66 | 0.73 |
| Claude 3 Opus | 0.52 | 0.62 | 0.84 |
| Gemini 1.5 Pro | 0.47 | 0.58 | 0.81 |
| GPT-4o | 0.53 | 0.56 | 0.95 |
| GPT-4 Turbo | 0.37 | 0.59 | 0.62 |
Laboratory Automation
Laboratory automation uses robotics, software, and AI to plan, execute, monitor, and analyze experiments with less manual intervention.
See all 62 papers