UIUC's CoGuide Draws Apartment Floorplans From Walking Paths With 0.99 F1
Researchers at UIUC show how to reconstruct home floorplans from a person's walking trajectories using diffusion models guided by contrastive embeddings.
ProTakeaways
- CoGuide reconstructs 2D floorplans from human walking trajectories using diffusion guided by contrastive embeddings instead of a differentiable path planner.
- Standard likelihood-based guidance fails because A*-style planners are non-smooth: tiny wall changes produce huge path changes and exploding Jacobians.
- An InfoNCE-trained embedding provides a mathematically valid surrogate likelihood score, proven via the CPC likelihood-to-evidence-ratio derivation.
- On HouseExpo, CoGuide reaches 0.91 F1 in sparse trajectory regimes versus 0.79 for DPS+Neural A* and 0.86 for classifier-free guidance.
- Real-world UWB trajectories from student apartments show CoGuide generalizes better than CFG, which overfits to synthetic A* training distributions.
- Method extends to blind audio restoration, cutting Frechet Audio Distance from 2.88 to 0.84 versus the LTAS baseline. Project page.
Imagine handing a model nothing but the squiggly path a person walked around their apartment for a few minutes, and asking it to draw the floorplan. That is the inverse problem tackled by CoGuide, a new diffusion-based method from the University of Illinois Urbana-Champaign that reformulates likelihood guidance in a learned embedding space instead of through a broken forward operator. The result is a reconstruction pipeline that stays stable when the physics of the measurement process is non-smooth, partially known, or outright non-differentiable.
When the forward operator fights back
Most modern inverse solvers, from Diffusion Posterior Sampling onward, assume you can push a candidate reconstruction through a known operator, compare the result to the measurement, and backpropagate. That works beautifully for deblurring or inpainting. It falls apart when the forward operator is a path planner. The path planning operator is difficult to model and non-smooth, and various approximations of it, even when differentiable, produce poor results due to instability in optimization.
The problem is intuitive once you look at a picture of it. If a few pixels change slightly, the new chosen path can be dramatically different. Small doors introduced in lower vertical walls can prompt planners to significantly change their paths, indicating a highly non-smooth operator. Since likelihood gradients contain the Jacobian of the operator, and that Jacobian explodes near these discontinuities, diffusion guidance becomes numerically unstable.

The authors evaluated four planners as candidate forward operators: classical A*, Neural A*, TransPath, and the diffusion-based DiPPeR. All of them exhibit this cliff-like sensitivity, which is why plugging any of them into DPS produces artifacts rather than clean reconstructions.
The pivot: guide in embedding space, not pixel space
Instead of forcing gradients through the planner, CoGuide sidesteps it. Two encoders map floorplans and trajectories into a shared unit-hypersphere embedding. The embedding is trained with a contrastive objective that pulls matching floorplan-trajectory pairs together and pushes mismatched ones apart. During diffusion sampling, the likelihood score is replaced by the squared distance between the current denoised floorplan and the observed trajectory in that embedding space.
The clever theoretical bit is that this is not a heuristic swap. Following the InfoNCE analysis from Contrastive Predictive Coding, the optimal contrastive classifier recovers a likelihood-to-evidence ratio. Taking gradients with respect to the input cancels the evidence term, leaving exactly the likelihood score needed for posterior sampling. In other words, the contrastive similarity is a mathematically valid surrogate, not just a plausible one.

How a sampling step actually runs
The inference loop stitches together several pieces to keep the short DDIM schedule numerically well-behaved:
- Run one DDIM denoising step to get an estimate of the clean floorplan from the noisy current state.
- Encode both that estimate and the observed trajectory, then compute the squared distance between the two embeddings.
- Add an intersection penalty that counts pixels where the trajectory overlaps a predicted wall, since a real person cannot walk through walls.
- Apply the gradient update using Adam rather than plain SGD, with a short cosine annealing schedule on the learning rate and a hard stop late in sampling so the diffusion prior can polish the final output.
That last detail matters more than it sounds. Since DDIM uses fewer reverse steps than DDPM, plain gradient descent can under-integrate the embedding-based gradients, leading to poor convergence. Replacing it with Adam supplements reverse diffusion with higher-order information about the optimization landscape. The ablation table shows Adam pushing IoU from 0.76 to 0.85 under DDIM.
What the numbers say
Experiments use the HouseExpo dataset of about 35,000 2D floorplans downsampled to 64x64, with trajectories generated via A* at three densities corresponding to roughly 10, 25, and 40 percent of the open space covered. CoGuide is compared against six baselines: DPS wired to Neural A*, TransPath, and DiPPeR, plus DiffPIR, DMPlug, and classifier-free guidance.
| Method | Sparse F1 | Moderate F1 | Dense F1 |
|---|---|---|---|
| DPS+Neural A* | 0.79 | 0.79 | 0.79 |
| DPS+DiPPeR | 0.77 | 0.77 | 0.76 |
| DMPlug | 0.31 | 0.28 | 0.28 |
| DiffPIR | 0.63 | 0.64 | 0.65 |
| CFG | 0.86 | 0.93 | 0.97 |
| CoGuide | 0.91 | 0.94 | 0.95 |
| CFG+CoGuide | 0.93 | 0.97 | 0.99 |
The pattern is telling. CoGuide dominates in the sparse regime where the problem is most ill-posed, matches CFG in the moderate regime, and slightly trails CFG when trajectories are dense. Combining CFG as a conditional prior with CoGuide's contrastive guidance wins across the board. The DPS-plus-planner baselines never crack 0.80 F1, which quantitatively confirms that the non-smooth Jacobian really is the bottleneck.
Where CFG loses and CoGuide wins
The most interesting result is on real data. The authors collected trajectories in two student apartments using Qorvo DWM3000 ultrawideband beacons, which give roughly 10 cm localization accuracy. CoGuide substantially infers more wall segments and room structure, whereas CFG often misses or misplaces major walls. This gap is expected since CFG is explicitly trained to model the posterior density under the synthetic A*-generated trajectory distribution, and therefore struggles to generalize when faced with sparser, differently distributed real-world trajectories.
In other words, classifier-free guidance overfits to how the synthetic training trajectories are distributed, while CoGuide's decomposition of prior and likelihood generalizes better when real walking patterns differ from A*'s shortest paths.
Beyond floorplans
The paper argues the recipe applies to any blind inverse problem where you can generate synthetic measurement-signal pairs but cannot write down or differentiate the operator. To demonstrate, they apply CoGuide to blind restoration of historical piano recordings with unknown spectral coloration, clicks, and nonlinear degradations. Against the LTAS baseline from a recent diffusion-based equalizer, CoGuide restored audio scored 0.84 on Frechet Audio Distance with VGGNet features versus 2.88 for LTAS.
Other candidates the authors suggest include synthesizing city maps from vehicle GPS traces, inferring molecular structures from measured properties, and reconstructing internet topologies from packet analytics. The common thread is that any problem where the forward physics is a black box, but paired data can be simulated, is fair game.
Limitations worth knowing
- Performance degrades gracefully but noticeably with measurement noise, and denser trajectories help absorb sensor error.
- The current dataset does not include furniture, which real indoor navigation obviously involves.
- The 64x64 image resolution is a compromise because path planners scale poorly at higher sizes.
- When trajectories are dense, plain CFG matches or slightly beats CoGuide, so the method's advantage is strongest under ill-posed sparse-measurement conditions.
The project page hosts the code, audio demos, and additional qualitative results. The broader takeaway for anyone building diffusion-based inverse solvers is that when your operator is ugly, learning a smooth likelihood surrogate through contrastive pretraining may be a more tractable path than trying to differentiate through the operator itself.