---
title: 'HistoAE: Histogram AutoEncoder in Particle Physics'
url: https://www.emergentmind.com/topics/histogram-autoencoder-histoae
type: topic
---

# HistoAE: Histogram AutoEncoder in Particle Physics

The Histogram AutoEncoder (HistoAE) is a deep unsupervised representation learning architecture designed for high precision measurement and structured latent interpretability in particle physics applications, specifically silicon microstrip detectors. HistoAE incorporates a tailored histogram-based loss function to enforce physically meaningful organization of the latent space, enabling direct, quantitative decoding of particle charge and inter-strip impact position from raw detector signals. The architecture facilitates both measurement tasks and generative simulation, achieving resolutions on real beam-test datasets that match conventional supervised approaches and providing substantial speed advantages in detector simulation contexts [2511.22246].

## 1. Architecture and Input Preprocessing

HistoAE leverages an autoencoder framework that processes silicon-microstrip-detector clusters via a specialized preprocessing stage termed “vecoding” (*Editor's term*). For each event cluster, the five readout channels with the largest signals are selected. Each channel’s raw ADC value—varying from $\mathcal{O}(1)$ to $\mathcal{O}(10^4)$—is encoded into a fixed-length, digit-wise base-10 vector, including one digit after the decimal point. For example, $x=9764.4$ is encoded as $[0,9,7,6,4,4]$. Concatenation across five channels yields a $30$-dimensional input vector.

The encoder consists of fully-connected layers sequentially mapping $30 \rightarrow 256 \rightarrow 128 \rightarrow 64 \rightarrow 32$ units, followed by batch normalization and SiLU activation after each layer, and a final $2$-dimensional linear projection producing the latent code $z=(z_c,z_p)$. The decoder mirrors the encoder: $2 \rightarrow 32 \rightarrow 64 \rightarrow 128 \rightarrow 256$ units, with similar normalization and activation, projecting back to a $30$-dimensional output vector reshaped as five decoded channel vecodings.

## 2. Histogram-Based Latent-Space Loss (HistoLoss)

Central to HistoAE is the custom histogram-based loss function ("HistoLoss") that enforces structure in the latent space. This loss guides the autoencoder to represent charge and position in the latent codes $(z_c,z_p)$:

- **Target Density $H_{\mathrm{target}}(x,y)$**: Encodes physical priors—a Gaussian mixture for charge (integer nuclear $Z$ species in the observed range) combined with a uniform distribution for normalized impact positions:
  $$
  H_{\mathrm{target}}(x, y) = \left[\, \sum_{k=Z_{\min}}^{Z_{\max}} w_k\, N(x\,|\,\mu_k,\sigma_k^2)\, \right] \cdot \mathrm{Uniform}(y \in [0,1])
  $$
- **Empirical Density $H_{\mathrm{emp}}(x, y)$**: Computed by linearly rescaling $z_c$ and $z_p$ to $[0,1]$ and constructing mini-batch histograms (binned or kernel-smoothed with Gaussian kernels):
  $$
  H_{\mathrm{emp}}^j = \frac{1}{N} \sum_{i=1}^N \mathbb{1}\left\{\, (z_{c,i},z_{p,i}) \in \text{bin}\, j \,\right\}
  $$
  or
  $$
  H_{\mathrm{emp}}(x,y) = \frac{1}{N} \sum_{i=1}^N K_\sigma(x-z_{c,i}) K_\sigma(y-z_{p,i})
  $$
- **Loss**: The HistoLoss is the $L_1$ distance between empirical and target histograms:
  $$
  L_{\mathrm{histo}} = \| H_{\mathrm{emp}} - H_{\mathrm{target}} \|_1 = \sum_j | H_{\mathrm{emp}}^j - H_{\mathrm{target}}^j |
  $$
- **Full Objective**:
  $$
  L_{\mathrm{total}} = L_{\mathrm{recon}} + \lambda_{\mathrm{histo}} L_{\mathrm{histo}}
  $$
  where $L_{\mathrm{recon}}$ is the mean-squared error between input and output vecodings, and $\lambda_{\mathrm{histo}}$ regulates latent-space regularization.

This approach directs $z_c$ to cluster at integer charge values (via Gaussian peaks) and $z_p$ to span the full inter-strip region uniformly, recovering latent coordinates directly aligned with physical observables, without additional supervision.

## 3. Latent-Space Interpretability and Physical Mapping

The HistoLoss shapes the distribution of the latent codes such that:

- $z_c$ forms $K$ equidistant peaks, each corresponding to a distinct nuclear charge $Z\in\{3,\ldots,22\}$ (the experimental range), matching the Gaussian mixture specified in $H_{\mathrm{target}}$.
- $z_p$ is distributed smoothly and uniformly in $[0,1]$, encoding the normalized sub-strip impact position between adjacent detector strips.

This mapping emerges solely from unsupervised histogram matching, requiring no explicit physical labels during training. Physical interpretability is validated post hoc by comparing the latent codes against beam-test ground truth, confirming precise alignment with charge and position.

## 4. Training Protocol and Dataset

HistoAE training utilizes approximately $5\,\mathrm{M}$ real beam-test clusters acquired at the CERN SPS, probing mixed nuclei ($A/Z=2$, $150\,\mathrm{GeV}/n$). Data is partitioned $80\%$ for training, $20\%$ for testing. Training employs a two-stage strategy:

1. **Pre-training**: Restricted to $Z\in[3,13]$, batch size $10{,}000$, run for $10{,}000$ epochs.
2. **Post-training**: Extended to $Z\in[3,22]$, batch size $40{,}000$, additional $10{,}000$ epochs.

Optimisation uses AdamW with weight decay $10^{-4}$ and initial learning rate $10^{-3}$, following a schedule of linear warm-up for $10$ epochs and cosine annealing to $10^{-5}$. Mixed-precision training via torch.amp enhances speed and numerical stability.

## 5. Measurement Extraction and Performance

After training, physical observables are extracted from the latent space via streamlined post-processing routines:

- **Charge Extraction**:
  - Cluster $z_{c,i}$ from the test set, identify local maxima in the $z_c$ distribution, corresponding to integer $Z$ via $k\mapsto Z=k+Z_{\min}-1$.
  - Define charge estimator $\hat{y}_{\mathrm{charge}} = a\,z_c + b$ by linear interpolation between the first and last charge peaks.
  - The achieved charge resolution is $\sigma_{\mathrm{charge}}(Z) = \sqrt{E[(\hat{y}_{\mathrm{charge}}-Z_{\mathrm{true}})^2]}$, yielding $\sigma_{\mathrm{charge}}\lesssim 0.3\,e$ across $Z=3\ldots22$, mean $0.25\,e$.

- **Position Extraction**:
  - Raw $z_p\in[0,1]$ is ambiguous under left-right symmetry; resolved using the two largest channels to compute $\eta=S_R/(S_L+S_R)$.
    - If $\eta<0.5$, retain $z_p$; else replace $z_p \to 1-z_p$.
  - Rescale to physical sub-strip coordinate $x\in[0,\mathrm{pitch}]$.
  - Position resolution: $\sigma_{\mathrm{pos}} = \sqrt{E[(x_{\mathrm{AE}} - x_{\mathrm{true}})^2]}$, achieving $\sigma_{\mathrm{pos}}\simeq 3\,\mu\mathrm{m}$, equivalent to conventional interpolation.

These results demonstrate competitive measurement precision in fully unsupervised mode.

## 6. Fast Detector Simulation via Generative Decoding

HistoAE’s decoder models $p(\mathrm{cluster}|z_c,z_p)$, facilitating efficient cluster simulation:

1. Select target $(Z,x)$, map to latent mean $(\mu_Z,x_{\mathrm{norm}})$.
2. Sample perturbed latents $z'_c\sim N(\mu_Z,\sigma^2_{\mathrm{charge}})$, $z'_p\sim N(x_{\mathrm{norm}},\sigma^2_{\mathrm{pos}})$.
3. Decode to obtain five synthetic channel signals.

This generative mode produces strip-cluster patterns orders of magnitude faster than traditional Geant4-based simulation, reproducing charge and position distributions consistent with the measurement branch.

## 7. Significance and Outlook

HistoAE constitutes the first framework for unsupervised, interpretable, and quantitatively precise measurement of both charge and impact position in silicon microstrip detectors. Its architecture—combining deep autoencoders, histogram-based latent regularization, and minimal post-processing—enables not only direct measurement but also rapid simulation, with demonstrable parity to established supervised approaches [2511.22246]. This suggests broader applicability to other measurement-driven unsupervised learning tasks in high energy physics and beyond, provided suitable alignment of latent priors and physical distributions.

Source: https://www.emergentmind.com/topics/histogram-autoencoder-histoae