Learned Optical Spectral Projections for Soil Property Sensing

Soil spectroscopy predicts chemistry such as organic carbon, nitrogen, pH and salinity by shining light on soil and reading how much comes back at each wavelength. It works, but the hardware that reads hundreds to thousands of wavelength channels, a spectrometer, is the expensive and power-hungry part of a field probe. The model that then turns those channels into a prediction needs far less. This proposal takes one idea from photonic computing and applies it to soil sensing. In wavelength-division multiplexed (WDM) accelerators, each wavelength carries one number. A filter weights each wavelength, and a single photodetector adds the weighted light for free. Diffuse light reflected from soil is already a vector indexed by wavelength. A small bank of optical filters, with transmission curves learned for the task, can therefore compute the first layer of a soil chemometric model in the light itself. Each filter feeds one cheap photodetector. The whole spectrometer is replaced by 8 to 32 detectors and a tiny digital head.

Two facts in the literature make this plausible. First, soil spectra are low-dimensional. A variational autoencoder compresses more than 1,700 mid-infrared channels into 32 latent numbers while keeping predictive accuracy (Self-supervised and Multi-fidelity Learning for Extended Predictive Soil Spectroscopy). Second, inner products computed optically on incoherent natural light have been demonstrated on an image sensor (Spectral convolutional neural network chip for in-sensor edge computing of incoherent natural light). The open question is whether such projections survive the constraints of real optics well enough for quantitative regression rather than classification. Those constraints are nonnegative and smooth transmission curves, thermal drift, and detector noise. The question also matters for another reason: they should beat the obvious cheap alternative of a few narrowband filters.

Core Claim

We claim the following. A bank of K broadband filters gives competitive accuracy if three conditions hold: the filters are trained jointly with a small digital regressor, their curves are restricted to what fabricable spectral filters can realize, and training includes thermal drift and detector noise. With K between 8 and 16, accuracy should come within a small margin of full-spectrum digital models on soil organic carbon, nitrogen, CaCO₃, pH and electrical conductivity (EC). The bank should also clearly beat the best selection of K narrow bands at equal detector count. The second part rests on a physical argument. When detector noise dominates, a narrow filter of width $\Delta$ collects signal proportional to $\Delta$. A broadband filter with mean transmission near one half collects signal proportional to roughly half the full range $B$. The SNR gain is therefore about $B/(2\Delta)$, which is the classic multiplex advantage of spectroscopy. When photon shot noise dominates instead, this gain shrinks, and we predict where the crossover falls.

Concretely, detector $k$ reads

$$y_k = \int T_k(\lambda)\, R(\lambda)\, S(\lambda)\, D(\lambda)\, d\lambda + \epsilon_k,$$

where $R(\lambda)$ is soil reflectance, $S(\lambda)$ the illumination spectrum, $D(\lambda)$ detector responsivity, $T_k(\lambda)\in[0,1]$ the learned transmission of filter $k$, and $\epsilon_k$ detector plus shot noise. Optics alone cannot apply a negative weight. Signed weights therefore come from differencing two detectors, the same trick used in broadcast-and-weight photonic hardware (OISA: Architecting an Optical In-Sensor Accelerator for Efficient Visual Computing).

Relation to Prior Work

The WDM literature supplies the mechanism but not the setting. Several accelerators multiply numbers carried on separate wavelengths by microring attenuation and sum them on one photodetector. These are OISA, An Efficient General-Purpose Optical Accelerator for Neural Networks, and the reconfigurable microcomb chip of Reconfigurable versatile integrated photonic computing chip. All three first convert electrical data into laser light, and none is evaluated on regression. We drop the laser entirely. The soil's own reflectance plays the role of the modulated input vector. The closest work is the spectral CNN chip, which places pixel-aligned spectral filters on a CMOS sensor. It cuts data to the electronics by 96% on face anti-spoofing and thyroid histology. That work targets the visible range, 2D images and classification. We target 450–2450 nm diffuse reflectance, single-point regression, and an explicit comparison against narrowband band selection that the spectral CNN chip does not make.

Two papers constrain the design. The analog optical computer of Analog optical computer for AI inference and combinatorial optimization reports that continuous regression is notably more sensitive to analog noise than classification. OISA runs at 2-bit activations and 4-bit weights. Together these warn against putting deep or nonlinear layers in analog optics. We keep only a single linear projection in optics and digitize K outputs at an explicitly studied bit depth. Thermal drift of resonant filters, flagged in OISA, is modeled as a wavelength shift during training rather than ignored.

The soil literature supplies the targets and the evidence of low dimensionality. On the Open Soil Spectral Library (OSSL), XGBoost on 30 principal components matches full-spectrum XGBoost for EC (Global Soil Salinity Prediction by Open Soil Vis-NIR Spectral Library). This is direct evidence that a few linear projections carry the signal. The 32-dimensional latent space of the multi-fidelity work points the same way. Small regional datasets give unstable models, with SOC concordance (Lin's CCC) swinging between 0.10 and 0.44 across splits (Evaluating validation strategies on the performance of soil property prediction from regional to continental spectral data). This constrains us to train filters on continental libraries and fit only the digital head locally.

Research Program

We will build a differentiable forward model of the sensor. Filter curves are parameterized by device families that can actually be fabricated. The first family is sums of a few Lorentzian resonances with bounded linewidth and depth, mimicking microring or Fabry-Perot elements. The second is smooth low-order curves with a minimum feature width, mimicking thin-film stacks. A realistic tungsten-halogen illumination spectrum is included, as is the responsivity of silicon detectors below about 1100 nm and InGaAs detectors above. The noise model has a detector-noise floor, shot noise scaled to a stated photon budget, ADC quantization at 8 to 16 bits, and a random per-sample thermal shift of all resonances.

Filters and a small digital head (linear or a two-layer MLP) are trained end to end on laboratory spectra, which are treated as $R(\lambda)$. One filter bank is shared across properties, so a single probe reads every target. The trained filters are then frozen. We test transfer to held-out regions by refitting only the head on small regional sets. As a hardware sanity check, the best filter bank is emulated on a bench by programming the learned transmission curves onto a broadband source. Real soil samples are measured with K single photodiodes and compared against the simulation's predicted error.

Baselines

The naive reference is full-spectrum PLSR, the linear chemometric workhorse. On OSSL EC it is reported at $R^2 = 0.39$, RMSE 2.41 dS m⁻¹ (Global Soil Salinity Prediction). Any K-detector design must clear it at modest K, or the idea fails.

There are two strongest full-spectrum digital competitors. On OSSL it is XGBoost: $R^2 = 0.59$ and RMSE 2.04 dS m⁻¹ on full spectra, and $R^2 = 0.69$ and RMSE 1.63 dS m⁻¹ with 30 principal components plus environmental covariates (Global Soil Salinity Prediction). On LUCAS 2015 it is the LSTM-CNN-Attention model, which reports $R^2$ 0.949 for OC, 0.916 for N, 0.943 for CaCO₃ and 0.926 for pH, with RPD 3.94, 3.74, 5.38 and 3.35 respectively (Spectral Data-Driven Prediction of Soil Properties Using LSTM-CNN-Attention Model). We rerun both on our exact splits: the OSSL split, and LUCAS with the 85/15 Latin hypercube split and 400–499.5 nm removed. The rerun spectra receive the same simulated noise as our sensor. These models set the accuracy ceiling. Beating them is not the goal. Our target for success is to come within 0.03 $R^2$ of them at K = 16 while using two orders of magnitude fewer detector channels. For EC on OSSL we will run the covariate variant too, because covariates add to any sensor.

The ablation that isolates the key ingredient is learned narrowband band selection. Its definition and its role as the main threat are given under the first Why not just…? question below. A second ablation uses fixed, unlearned projections, taking the top-K PLS loadings or principal components realized as signed differential filter pairs. This tests whether end-to-end training under physical constraints matters beyond linear dimensionality reduction. A third ablation trains the learned bank without drift and noise augmentation and then tests it with them, to measure the value of hardware-aware training. All methods get the same hyperparameter search budget, the same photon budget per measurement, and the same ADC bit depth per channel.

Why not just…?

Why not just pick the K most informative wavelengths and use narrowband filters? This is the most serious threat. A multispectral sensor with K narrow LEDs or filters is simple and already common. Our answer is physical: under detector-limited noise, broadband filters collect roughly $B/(2\Delta)$ times more signal. We will test this rather than assume it. Both designs are swept across photon budgets from detector-limited to shot-limited. If band selection matches learned filters at realistic photon budgets, we will report that and conclude that cheap narrowband sensing suffices.

Why not just put a miniature spectrometer and a small MLP or XGBoost on a microcontroller? For accuracy this is likely the ceiling, and a 32-feature MLP is trivial digital compute. OISA's power argument, that the converters dominate sensor power, motivates fewer channels. But we do not claim compute energy as the win. The claimed gains are detector count, SNR per measurement, and component cost. We will report accuracy against channel count and photon budget next to the full-spectrum digital model, so a reader can judge whether 16 photodiodes justify the accuracy gap.

Why not just use PCA or PLS loadings as filters? These loadings carry negative weights and sharp features that real filters cannot reproduce. Fitting them after the fact discards accuracy that joint training could recover. The fixed-projection ablation measures exactly this gap. A small gap would mean filter design can be decoupled from model training, which would be a useful negative result.

Why not just run the deep chemometric model on a WDM photonic accelerator? That would still need a full spectrometer and electro-optic conversion. It would also put continuous regression into analog nonlinear layers, which the analog optical computer study finds especially noise-sensitive. We therefore keep the optics linear and shallow.

Proposed Experiments

The main experiment sweeps K over {4, 8, 16, 32}. At each K we compare learned constrained filters, band selection, fixed PLS/PCA projections and full-spectrum digital models. The test properties are EC on OSSL and OC, N, CaCO₃ and pH on LUCAS 2015, reported as $R^2$, RMSE, RPD and Lin's CCC. A second experiment varies the photon budget and locates the noise regime where learned broadband filters stop beating band selection. If no such advantage appears at any realistic budget, the core claim is refuted. A third experiment shifts all resonances by ±1 to 5 nm, as a proxy for temperature change, and quantizes outputs at 8, 10, 12 and 16 bits. It reports the smallest bit depth that holds RPD above 3 on LUCAS OC. This directly tests the tension between analog precision and quantitative regression raised by OISA and the analog optical computer study.

A fourth experiment trains filters on LUCAS 2009 continental data and refits only the digital head on each of the five French regional sets (110–248 samples). Over 50 random splits it measures whether the frozen low-dimensional sensor reduces the CCC instability reported in the validation-strategy study relative to full-spectrum regional models. Fewer free inputs should mean less overfitting on small data. Finally, the bench emulation on a few dozen soils checks that measured error falls within the simulation's predicted error band. If it does not, the forward model and every conclusion drawn from it must be revised.