Pose estimation means recovering an object's 3D rotation and position from a camera image. Modern systems for this task under clutter work in two steps. A neural network first proposes many candidate poses. A verification step then renders the object's 3D model at each candidate pose and compares the rendering with the observed depth image to pick the best one. Under heavy occlusion this comparison is the weak link. A hand or a neighbouring box in front of the object produces large disagreement between rendering and observation, so the scorer cannot tell a wrong pose from a correct pose that is simply hidden. We propose to stop treating the scoring function as a fixed formula. Instead, a large language model (LLM) writes it as a short program and repeatedly revises it. After each revision the program is compiled and run on occluded training scenes with known ground truth. The model then sees which visibility levels it failed on, how long it took, and whether it crashed.
What makes this more than prompt engineering is the setting. Occlusion-robust verification already spans two languages. The renderers and the rigid-body physics engines that check whether objects interpenetrate are compiled C++. The networks and the glue code are Python. Physics-based scene reasoning has shown it can resolve clutter, but at roughly 30 seconds per scene. We therefore let the refinement loop rewrite both the scoring logic and the placement of that logic across the language boundary: what runs in Python, what is moved into a compiled extension, and how depth buffers and contact queries are batched. Accuracy and runtime are judged by the same execution oracle. The two-sentence version is this. Search over the program that verifies poses, not only over the poses, using compile-and-run feedback on occluded scenes. Let that search also move the expensive parts of verification into compiled code, so that scene-level occlusion reasoning becomes affordable.
Core Claim
Take hypotheses from a strong existing multi-hypothesis pipeline and hold them fixed. An LLM-refined scoring program, allowed structural edits and given execution feedback, will select better poses on the low-visibility stratum than two alternatives. The first is the pipeline's own selection. The second is a parametric scorer of the same family tuned by black-box optimization with the same evaluation budget. The refined scorer will also stay within the runtime of fast BOP-challenge entries. Structural edits include explaining occluders by rendering other objects' hypotheses, adding non-penetration terms, and handling symmetry explicitly. The claim is deliberately narrow. We do not propose a new pose network, and we do not claim LLMs beat learned refiners in general. We claim that the verification stage contains occlusion-specific logic which is easier to search as code than as weights or hyperparameters. That claim fails cleanly if a tuned parametric scorer matches the refined one.
Prior Work and Where This Sits
Three lines of occlusion work motivate the target. Learning Analysis-by-Synthesis for 6D Pose Estimation in RGB-D Images showed that handcrafted pixel-difference scores fail under occlusion. It replaced them with a learned CNN energy searched by Metropolis sampling, and it noted that the search often misses the energy's global minimum. We keep the render-and-compare structure and change what is searched: the comparison logic itself. WALDO maintains multiple hypotheses with sampling biased toward visible regions and refines them numerically. Its weakness for our purposes is that its comparison logic is a fixed network. We reuse its kind of output (many hypotheses per object) as our input. VAPO shows that ranking keypoints by their visibility beats a fixed keypoint set. This is evidence that visibility-dependent selection logic matters, and it is exactly the kind of rule our loop could discover or adapt. Physics-based Scene-level Reasoning for Object Pose Estimation in Clutter prunes physically impossible poses with Bullet and Monte Carlo tree search. It constrains our design: scene-level physical consistency helps, but its roughly 30 seconds per complex scene is the runtime problem we must address rather than inherit.
The code-refinement literature supplies the method and its known failure modes. RobotGPT refines manipulation scripts against a PyBullet simulator. Vision-Guided Iterative Refinement for Frontend Code Generation refines code against rendered-image discrepancy. Neither touches 3D verification logic. POLO shows that profiling-directed multi-agent rewriting of multi-file C/C++ code yields 1.34x to 21.5x speedups over -O3; we borrow its profiling-in-the-loop design. Yan et al. (Iterative Refinement of Project-Level Code Context for Precise Code Generation with Compiler Feedback) found that compiler-feedback loops plateau quickly, and SlopCodeBench documents code erosion over iterations. These negative results push us toward two design choices. The first is a population of candidate programs, as in A2DEPT, rather than a single chain. The second is rollback to the last non-regressing version, as in MEIC.
On the systems side, the SuperdropNet–ICON coupling shows that sharing memory through pointers, rather than serializing between processes, is what makes embedded ML viable inside compiled simulators. We apply the same principle to depth buffers and contact queries. Xin Wang et al. (Xin Wang et al.) note that such glue is usually bespoke and fragile, which is the labour we hand to the loop. The closest work overall is WALDO for the pose side and POLO for the loop side. Neither synthesizes verification code, and neither treats the cross-language placement of verification as something to optimize.
Research Program
The base system has three parts. The first is a fixed hypothesis generator taken from a public multi-hypothesis pipeline. It produces $K$ candidate poses per detected object, plus the detections' masks.
The second is a fixed sandboxed scoring API. It exposes rendering of a pose to depth and mask, and the observed depth and RGB. It also exposes the other detections and their hypotheses in the same scene, the CAD model's points and symmetry annotations, and a batched non-penetration and support query backed by Bullet. Rendering and contact queries live in C++. They hand results to Python as shared GPU or CPU buffers without copying, through the standard tensor-exchange protocol that lets libraries share array memory.
The third part is the scoring program. It is a Python function that may also include a C++ extension compiled through pybind. Given one scene, it returns a score per hypothesis, or a joint assignment of hypotheses to objects.
The refinement loop maintains a population of scoring programs. It starts from simple seeds: truncated depth residual, mask IoU, and a visibility-weighted residual. At each round the LLM receives one parent program. It also receives that program's execution report on a search split of training scenes: compile errors, unit-test failures, recall broken down by visibility bins, the worst-scoring scenes with rendered residual images summarized as statistics, and a per-function profile. It proposes an edit. The unit tests check invariants a correct scorer must satisfy, including invariance under the object's symmetry group, determinism, and no reads outside the API.
A program enters the population if it improves the objective $$J = \mathrm{AR}_{v<0.5} + \mathrm{AR}_{\text{all}} - \lambda \max(0,\, t - t_{\text{budget}}),$$ where $\mathrm{AR}_{v<0.5}$ is BOP average recall on objects less than half visible, $\mathrm{AR}_{\text{all}}$ is average recall over all objects, $t$ is mean seconds per image, and $t_{\text{budget}}$ is set to the runtime of a fast reference pipeline. The low-visibility term is weighted explicitly because ordinary average recall over-represents fully visible objects. Both WALDO and BOP-Distrib argue this.
A separate held-out validation split chooses the final program. Test images are never touched until a single final evaluation.
We will analyse the surviving programs as artifacts. We will ask which edits carried the gains: occluder explanation by rendering neighbours, physics terms, visibility reweighting, symmetry handling, or moving loops into C++. We will also ask whether those edits are interpretable rules a person could have written. This analysis is part of the contribution. If the loop rediscovers something like VAPO's visibility ranking, that is useful confirmation. If it finds scene-level occluder reasoning that existing scorers lack, that is a new result.
Baselines
The naive reference keeps the hypotheses fixed and lets the generating pipeline select its own top-1 pose. Next to it we report the oracle that picks the best of the $K$ hypotheses using ground truth. Together these bound what any rescoring can achieve. The gap between them is the only room our method has to work in.
The strongest accuracy reference on the full benchmark is FreeZeV2.1. The BOP Challenge 2024 report gives it 82.1 AR on the classic BOP benchmark. On speed, the same report gives Co-op 75.9 AR at 0.8 s per image, against 24.9 s for slower entries. WALDO reports more than 2% gain under its unbiased average recall over the BOP datasets and more than 5% on IC-BIN, at 1.53 s per image. For scene-level physics, Physics-based Scene-level Reasoning reports 60.3% recall on LM-O at about 30 s per scene. Learning Analysis-by-Synthesis reports a 72.98% correct-pose rate on its occluded evaluation, against 63.24% for its baseline.
We will not claim to beat FreeZeV2.1 end to end. Our scorer is a plug-in, so the fair comparison runs each pipeline whose hypotheses we can obtain twice: once with its native selection, and once with our refined scorer over the identical hypothesis set. Hardware is the same for both runs, and runtime is measured end to end. Beating a baseline means a gain in low-visibility AR that holds across three independent loop runs with different seeds, with overall AR not dropping, and with runtime under that pipeline's own.
The ablation that isolates the key ingredient is a parametric scorer tuned by black-box optimization. It has the same API and the same seed programs. The seeds' constants, weights, thresholds and term on/off switches are exposed as about thirty parameters. Bayesian optimization tunes them on the same search split with the same number of program evaluations as the LLM loop. We add two further ablations. One runs the LLM loop with structural edits but without visibility-stratified feedback, receiving only aggregate AR. The other runs it confined to Python, with no compiled extensions, which isolates the cross-language component's contribution to runtime.
A learned comparison network in the spirit of Krull et al. is also included. It is trained on the same search split and scores the same hypotheses. It is the natural "use gradients instead of an LLM" competitor.
Why not just…?
Why not just tune a parametric scorer with Bayesian optimization? This is the most serious threat. If the useful occlusion logic is a weighted sum of known terms, tuning will find it more cheaply than code search. Our bet is that the decisive gains on low-visibility objects need structure, not constants. One example is jointly scoring neighbouring objects, so that one object's rendering explains another's missing depth. Another is conditioning on symmetry, which no fixed term set expresses. The matched-budget ablation settles this directly. If the tuned scorer comes within noise of the refined one on $\mathrm{AR}_{v<0.5}$, we will report that code synthesis adds nothing here, and the program analysis will show which terms mattered.
Why not just learn the scorer as a neural network? Krull et al. (Learning Analysis-by-Synthesis) did exactly this and gained substantially on occluded objects. But a learned energy has two weaknesses for our setting. It must be retrained for each new clutter regime, and it cannot easily absorb non-differentiable scene constraints such as Bullet contact checks. We include it as a baseline. If it wins in-distribution, we test the remaining claim: that a refined program transfers to a new clutter type (hand occlusions in HOT3D) with fewer labelled scenes than retraining needs.
Why not just use a stronger feed-forward pose model and skip verification? The BOP Challenge 2024 shows that detection on unseen objects remains roughly 35% worse than on seen ones. Under heavy occlusion a single prediction is ambiguous. Our method sits after any such model, so a better feed-forward model only improves our hypotheses. The oracle best-of-$K$ gap measures whether verification still has room to help.
Why not just write everything in PyTorch on the GPU and drop the C++ boundary? For rendering and residual computation this may well suffice. The Python-only ablation will show whether compiled extensions buy anything there. Physical consistency checks are different: they run in Bullet, and the 30 s scene-level runtime in Physics-based Scene-level Reasoning is the cost of using them as is. If the Python-only loop matches on both accuracy and runtime, we will drop the cross-language claim and keep the scoring result.
Proposed Experiments and Decisive Checks
We search on BOP training images, mixing synthetic renderings with a small real subset, and select programs on a held-out validation split. Testing covers LM-O, YCB-V, IC-BIN and T-LESS from BOP-Core under the standard VSD, MSSD and MSPD average recall. We also report WALDO's unbiased average recall and recall in visibility bins of 0–30%, 30–50% and above 50%. Runtime is wall clock per image.
The first decisive check comes before any LLM work. We measure the gap between native top-1 and oracle best-of-$K$ on the low-visibility bin. If that gap is under a few AR points, rescoring cannot matter and we stop.
The second check is the matched-budget comparison against Bayesian optimization, repeated across three seeds.
The third is transfer. We take the program refined on BOP-Core and run a short adaptation on HOT3D hand-object scenes from the BOP-H3 group, with a fixed small labelled budget. We compare it there against retraining the learned scorer on the same data.
The fourth is runtime. We ask whether the program that includes physics terms reaches within $t_{\text{budget}}$ the low-visibility gains that Mitash et al. obtained at 30 s. We will not invent a speedup target; the measured ratio is the result.
Finally, we audit the surviving programs for symmetry-test violations and search-split overfitting. Any program whose validation gain exceeds its test gain by a wide margin indicates the loop is fitting scenes rather than occlusion structure.
References
- Learning Analysis-by-Synthesis for 6D Pose Estimation in RGB-D Images
- WALDO: Where Unseen Model-based 6D Pose Estimation Meets Occlusion
- VAPO: Visibility-Aware Keypoint Localization for Efficient 6DoF Object Pose Estimation
- Physics-based scene-level reasoning for object pose estimation in clutter
- RobotGPT: Robot Manipulation Learning From ChatGPT
- Vision-Guided Iterative Refinement for Frontend Code Generation
- POLO: An LLM-Powered Project-Level Code Performance Optimization Framework
- Iterative Refinement of Project-Level Code Context for Precise Code Generation with Compiler Feedback
- SlopCodeBench: Measuring Code Erosion Under Iterative Specification Refinement
- A2DEPT: Large Language Model-Driven Automated Algorithm Design via Evolutionary Program Trees
- MEIC: Re-thinking RTL Debug Automation using LLMs
- Efficient and stable coupling of the SuperdropNet deep-learning-based cloud microphysics (v0.1.0) with the ICON climate and weather model (v2.6.5)
- CondensNet: enabling stable long-term climate simulations via hybrid deep learning models with adaptive physical constraints
- BOP-Distrib: Revisiting 6D Pose Estimation Benchmarks for Better Evaluation under Visual Ambiguities
- BOP Challenge 2024 on Model-Based and Model-Free 6D Object Pose Estimation