Simplex Latents for Editing Hyperspectral Scenes with Diffusion

A hyperspectral image records hundreds of narrow color bands per pixel, so each pixel carries a reflectance curve that acts like a chemical fingerprint. Most of those bands are redundant, because neighboring wavelengths measure nearly the same thing. In practice each pixel is well described as a mixture of a few pure materials ("endmembers") in proportions ("abundances") that are non-negative and sum to one. This note proposes to run a diffusion model (a generator that learns by gradually denoising random noise into samples) on these abundance proportions, written in coordinates where any vector, including the result of adding or subtracting "concept directions", maps back to a physically valid mixture. A real scene can then be inverted exactly into the model's noise space, edited along a direction such as "healthy crop → stressed crop" or "soil → impervious surface", and regenerated. The result is a full spectral cube whose edited region looks like a real instance of the target material and whose unedited region is preserved.

This matters for two reasons. Diffusion on hyperspectral data has so far been used only for forward tasks: denoising, super-resolution, fusion, and unconditional synthesis. Nobody has used it to ask counterfactual questions about a real scene. Meanwhile, the main way editing fails in RGB latent spaces is that arithmetic pushes codes off the data manifold. Hyperspectral physics hands us a decoder that is exactly linear in the latent, which is rare. The question this proposal tests is whether that structure makes latent arithmetic both physically valid and spatially realistic. It also tests whether the diffusion prior adds anything beyond simply editing abundances by hand.

Core Claim

The latent space is the per-pixel abundance vector $s \in \Delta^{K}$, meaning a point on the probability simplex over $K$ endmembers. It is mapped to unconstrained coordinates by the isometric log-ratio transform, $z = \mathrm{ilr}(s) \in \mathbb{R}^{K-1}$. This transform is a bijection between the open simplex and Euclidean space. Adding a vector in $z$ therefore corresponds to a multiplicative reweighting of material proportions, and it can never produce negative or non-normalized abundances. The cube is decoded as

$$ x = A\,\mathrm{ilr}^{-1}(z) + r_\theta(z), $$

where $x$ is the $L$-band spectrum at a pixel, $A \in \mathbb{R}^{L\times K}$ is the endmember matrix, and $r_\theta$ is a small learned residual with a norm penalty that absorbs nonlinear mixing and illumination effects.

A diffusion model is trained on spatial maps of $z$, and editing uses deterministic DDIM inversion. The claim is that this pipeline produces edits that satisfy three criteria simultaneously. First, the edits are physically realizable by construction, since simplex violations are zero. Second, they are spectrally faithful on round trip, which we measure by spectral angle. Third, they are spatially realistic, in that edited regions are statistically indistinguishable from real target-material regions. We expect per-pixel abundance arithmetic to meet the first two criteria but not the third. We expect learned nonlinear spectral latents to struggle with the first two.

Prior work plays three different roles here. The motivation comes from Deep Diffusion Models and Unsupervised Hyperspectral Unmixing for Realistic Abundance Map Synthesis. That paper trains a diffusion model on 3–5 dimensional abundance maps unmixed from PRISMA imagery, but it samples only from pure noise and explicitly leaves recombination into full cubes to future work. We close that loop and add inversion and editing. Unmixing Diffusion for Self-Supervised Hyperspectral Image Denoising likewise factors cubes into endmembers and abundances. It denoises each abundance slice independently with an RGB-pretrained prior. We instead model all abundances jointly with a prior trained on spectral data, and we target editing rather than restoration.

The editing machinery is borrowed from RGB work. Denoising Diffusion Implicit Models supplies the deterministic ODE that makes inversion invertible. DiffEdit and Context-Preserving Dermoscopic Editing contribute mask-guided fusion at an intermediate timestep. CPDE does this in a network bottleneck on RGB lesions, while we do it in a coordinate system whose axes are materials.

Two papers constrain the design. Cross-Modal Redundancy and the Geometry of Vision–Language Embeddings shows that raw-embedding arithmetic in CLIP goes off-distribution, with an OOD score of 0.97, and that restricting arithmetic to a concept subspace reduces it to 0.63. Our simplex coordinates are a physically defined analogue of such a subspace. AffineTok argues that nonlinear latent-to-semantics maps break the correspondence between linear latent moves and semantic moves. Our decoder is affine in abundance by construction, which tests that argument in a domain where the affine structure is physically true rather than imposed.

Research Program

The first stage builds the tokenizer. For each benchmark scene family, we unmix with a fixed blind method to obtain $A$ and initial abundances. We then fine-tune an abundance encoder jointly with $r_\theta$. The objective combines reconstruction error, spectral angle, and a penalty that keeps $r_\theta$ small relative to $A s$.

This joint fine-tuning addresses a failure reported by DMGASR, a group-autoencoder latent diffusion model for hyperspectral super-resolution. Its authors attribute their weak spectral-angle gains to training the autoencoder and the diffusion model in isolation. Following PS-VAE, which found that unfreezing the encoder for joint semantic and pixel objectives raised editing reward from 0.06 to 0.22, we run a short final stage that unfreezes the encoder while the diffusion loss backpropagates.

The second stage trains a class-conditional diffusion model on $z$-maps of size 128×128. We pretrain on PRISMA patches, the regime of the abundance-synthesis paper, and fine-tune per benchmark. The class labels are land-cover masks, which enables classifier-free guidance.

The third stage defines edits in three ways of increasing strength. The simplest is a clean-latent direction: the mean $z$ of class B pixels minus that of class A, added inside a mask. The second is noise-space arithmetic after DDIM inversion to timestep $t_1$. The third is a conditioning swap from A to B during regeneration from $t_1$, with the reconstruction branch fused outside the mask.

The analysis studies how realism, preservation, and spectral fidelity trade off as $t_1$ varies. It also asks whether the $r_\theta$ residual carries edit-relevant information. If it does, the "physically affine" story is incomplete, and we will report that.

Baselines

The naive reference point is direct abundance arithmetic with no generative model. This means taking the class-A region's ilr coordinates, adding the clean-latent class difference, and decoding through $A$. It uses the same unmixing, endmembers, and masks as the full method, so the comparison isolates exactly what the diffusion prior contributes. It is the most dangerous baseline because it already satisfies physical validity. Beating it means a lower realism distance to held-out real class-B regions at equal or better non-target preservation.

A second reference is copy-paste. A real class-B abundance patch is pasted into the mask. This bounds realism from above but ignores the scene's context.

The strongest existing system is a learned nonlinear spectral latent in the style of DMGASR, combined with the same DDIM-inversion-and-mask-fusion editing. Its group autoencoder compresses overlapping band groups and is the closest prior hyperspectral latent diffusion model. DMGASR reports a 0.5–0.8 dB PSNR gain over partial-band diffusion and 6.17 s versus 23.01 s inference at 256×256. No reported result found on Lacuna for any hyperspectral editing benchmark, so its editing numbers will come from our reimplementation. It gets the same training data, the same diffusion backbone and step count, and the same hyperparameter search budget. Beating it means lower simplex violation, which is nonzero for it once its latents are unmixed, lower round-trip spectral angle, and edit success at least as high.

The key ablation replaces the ilr-simplex latent with an unconstrained PCA latent of the same dimension, keeping everything else fixed. This is the classic linear-subspace answer to spectral redundancy, here evaluated in its Indian Pines classification role: SSME reports PCA at 65.76% overall accuracy versus 76.46% for spatial-spectral embedding. The ablation isolates whether the physical simplex, rather than mere linearity, prevents off-manifold edits.

A second ablation removes $r_\theta$. A third replaces our joint prior with Diff-Unmix's per-slice RGB prior.

Why not just…?

Why not just edit the abundances directly and recombine with the endmembers? This is the real threat, and the proposal is designed around it. Per-pixel arithmetic changes proportions, but it cannot invent the spatial structure the target class has, such as field rows, boundary sharpness, or within-class heterogeneity. The abundance-synthesis paper reports that simple unmixing yields blocky maps, whereas diffusion produces coherent transitions like river paths and field boundaries. That observation concerns generation, not editing, so it is suggestive only. The naive baseline above settles the question. If its realism distance matches the diffusion edit, we will conclude that the diffusion prior is unnecessary for editing and that its value lies only in closing the synthesis loop.

Why not just use a learned autoencoder latent like DMGASR's and run DDIM editing there? A nonlinear latent gives no guarantee that a shifted code decodes to a non-negative, normalized mixture. Its own authors report weak spectral-angle fidelity. The simplex-violation and round-trip spectral-angle measurements in our experiments test this directly. If the learned latent edits just as validly, our physical prior is redundant.

Why not just denoise abundance slices with a pretrained RGB diffusion model, as Diff-Unmix does? Treating each material's map independently cannot preserve cross-material coupling, for example vegetation loss coinciding with soil gain. RGB priors may also hallucinate texture in scientific imagery. We measure the per-slice variant's sum-to-one error before renormalization and its realism distance.

Proposed Experiments

The datasets are PRISMA patches for pretraining, plus Indian Pines, Salinas, Pavia University, and Chikusei for evaluation. The first two provide many agricultural classes, so pairs like different crop or tillage types give natural A→B edits. All use their standard land-cover labels, and edit evaluation uses held-out spatial blocks.

Round-trip inversion is measured by PSNR and spectral angle. Physical validity is measured as the fraction of pixels whose unmixed abundances leave the simplex, which is zero by construction for our method.

Edit success is the class-B rate under a frozen held-out classifier. We use DCT-Mamba3D, which reports 95.23% overall accuracy on Indian Pines with 10% training data, retrained on held-out blocks.

Realism is the Fréchet distance between that classifier's features on edited regions and on real class-B regions. We also compare spatial autocorrelation spectra of the abundance maps. Preservation is the spectral angle and PSNR outside the mask, the analogue of CPDE's non-target LPIPS of 0.012. Off-manifold drift is a nearest-neighbor OOD score in the spirit of the Cross-Modal Redundancy paper.

One check decides the outcome. On synthetic scenes, we generate abundances from known spatial processes and true endmembers, with ground-truth class-B realizations of the same region. There, we test whether the inversion edit is closer to ground truth than direct arithmetic, measured both per pixel and in spatial statistics. On real data, the decisive check is whether the diffusion edit beats direct arithmetic on realism without losing preservation.

If both checks favor direct arithmetic, the proposal narrows to a validated full-cube generator. If the PCA ablation matches the simplex latent on validity, the physical-coordinates claim fails.