---
title: Hash Grid Feature Pruning
url: https://www.emergentmind.com/topics/hash-grid-feature-pruning
type: topic
---

# Hash Grid Feature Pruning

Hash grid feature pruning is a technique for reducing storage and transmission overhead in neural fields based on hash grids, particularly for applications involving Gaussian splatting and implicit scene representations. The method leverages the spatial sparsity and non-uniform distribution of target elements in the input domain to identify and eliminate unused or redundant features in the hash grid, thereby improving rate-distortion performance and computational efficiency without compromising reconstruction accuracy.

## 1. Hash Grid Structures for Gaussian Splatting

Hash grids encode features arising from spatial coordinates in $D=3$ (typically for 3D scenes). A multi-resolution hierarchical grid is constructed with $L$ levels and per-level resolution $R_\ell$ ($R_\ell = R_{min} \cdot 2^{\ell-1}$). Each level $\ell$ contains $T$ table entries, with each entry representing a feature vector $f^\ell_i \in \mathbb{R}^F$. 

Spatial coordinates $X = (x, y, z)$ are min-max normalized and scaled to grid resolution:

$$
X_R^\ell = \frac{(x, y, z) - X_{min}}{X_{max} - X_{min}} \cdot R_\ell
$$

For interpolation, the surrounding $2^D=8$ grid vertices $X_{V,k}^\ell$ are identified via component-wise flooring and offsetting by $\delta_x,\delta_y,\delta_z \in \{0,1\}$. Feature values are obtained by trilinear interpolation across these vertices, using hashed indices:

$$
f^\ell(X) = \sum_{k=1}^8 w_k \cdot f^\ell_{h(X_{V,k}^\ell)}
$$

Hashing employs fixed large primes:

$$
h(X_V) = ((x_V \cdot \pi_x) \oplus (y_V \cdot \pi_y) \oplus (z_V \cdot \pi_z)) \mod T
$$

Outputs from all levels are summed or concatenated and input to a downstream neural decoder.

## 2. Identification of Valid and Invalid Hash Features

Due to the spatial sparsity and irregularity of Gaussian splats, many hash table entries—i.e., feature vectors—are never queried during inference. A binary validity mask $v^\ell_i$ for each hash entry, at each level $\ell$, is defined as:

$$
v^\ell_i = 
\begin{cases}
1 & \text{if } \exists X \text{ such that } i \in \{h(X_{V,k}^\ell) \ |\ k=1,\ldots,2^D\} \\
0 & \text{otherwise}
\end{cases}
$$

Features $f^\ell_i$ with $v^\ell_i = 0$ are redundant and subject to pruning.

## 3. Hash Grid Feature Pruning Algorithm

Pruning proceeds in five steps:
1. **Scan input splat positions $X^{(n)}, n=1..N$ and grid levels $\ell=1..L$.**
2. **For each splat and level:**
   - Scale coordinates $X_R^{(n,\ell)}$.
   - Compute $2^D$ neighboring vertices $X_{V,k}^{(n,\ell)}$.
   - Hash each neighbor to obtain index $i = h(X_{V,k}^{(n,\ell)})$.
   - Set $v^\ell_i \leftarrow 1$.
3. **Gather valid indices $S^\ell = \{i | v^\ell_i=1\}$.**
4. **Retain and entropy-encode $\{f^\ell_i | i \in S^\ell\}$; discard others.**
5. **At the decoder, reconstruct $S^\ell$ using decoded positions, refill the pruned feature subset.**

Pseudocode:

```python
# Input: positions {X^(n)}, levels ℓ=1..L, hash size T
initialize v^ℓ[0..T-1] ← 0 for all ℓ
for n in 1..N:
    for ℓ in 1..L:
        X_R ← scale(X^(n), R_ℓ)
        for δ in {0,1}^D:
            X_V ← floor(X_R) + δ
            i ← h(X_V)
            v^ℓ[i] ← 1
for ℓ in 1..L:
    S^ℓ ← { i | v^ℓ[i]=1 }
    encode { f^ℓ_i for i in S^ℓ }
```

Time complexity: $\mathcal{O}(N \cdot L \cdot 2^D)$. Space complexity: $\mathcal{O}(T \cdot L)$ for masks and $\mathcal{O}(|S^\ell| \cdot L)$ for pruned features [2512.22882].

## 4. Rate–Distortion Performance and Empirical Evaluation

The method demonstrates bitrate savings under the AVS-VRU i3DV v3.0 codec in the standard test conditions (CTC). Bitrate reduction is measured by:

$$
\Delta R / R = \frac{R_{base} - R_{pruned}}{R_{base}}
$$

Rate–distortion curves, plotting PSNR vs. bitrate, show that pruning preserves PSNR at all operating points, shifting rates downward without fidelity loss. Across diverse sequences (DanceDunhuang, ShowGroups, VRUgz, VRUdg4), pruning yields average bitrate reduction of 8%. Peak savings reach 22.3% for DanceDunhuang.

| Sequence        | Base Rate (MB/f) | Pruned Rate (MB/f) | $\Delta R / R$ |
|-----------------|------------------|--------------------|---------------|
| DanceDunhuang   | 0.231            | 0.198              | 15.5%         |
| ShowGroups      | 0.066            | 0.062              | 4.6%          |
| VRUgz           | 0.104            | 0.099              | 4.8%          |
| VRUdg4          | 0.118            | 0.109              | 7.4%          |
| **Average**     | —                | —                  | **8.08%**     |

Encoding and mask computation overhead are negligible ($\mathcal{O}(N \cdot L)$), with reconstruction quality—measured in PSNR and visually—identical to unpruned baselines [2512.22882].

## 5. Trainable Hash Grid Sparsification: HollowNeRF

An alternative pruning methodology is presented in HollowNeRF, which leverages a trainable 3D saliency mask $G \in \mathbb{R}^{T \times T \times T}$ embedded in the hash-grid NeRF pipeline. For a spatial point $x$, saliency $p(x) \in (0,1)$ is computed via trilinear interpolation and sigmoid activation:

$$
p(x) = \sigma\left( \sum_{i=1}^8 w_i g_i \right)
$$

Features are weighted as $v(x) = p(x) f(x)$ prior to MLP decoding. Sparsity is enforced via an ADMM-based augmented Lagrangian:

$$
L_{aug}(W, H, G; \gamma) = L(W, H, G) + \gamma(\|\sigma(G)\|_1 - C) + \frac{\rho}{2} \big[ \max(\|\sigma(G)\|_1 - C, 0) \big]^2
$$

Here, the photometric loss $L$ is minimized under the constraint $\|\sigma(G)\|_1 \leq C$, driving many coarse-grid saliency parameters to zero (pruning them).

Hash collisions—inherent to hashed encoding—are mitigated by steering unused capacity ($p(x) \to 0$ for empty voxels), focusing representational resources on visible surfaces. The SoftZeroGate $\hat{g}(v) = \tanh(\alpha \|v\|_2)$ ensures pruned features yield exactly zero density.

Quantitatively, HollowNeRF achieves PSNR parity or improvement compared to Instant-NGP, using only 31–56% of the parameters. For example, with hashgrid size $2^{17}$ and $C=0.04$, PSNR is 32.53 dB (31% parameters vs. 32.29 dB in Instant-NGP). At $2^{18}$ (56% parameters), PSNR gain reaches +1 dB [2308.10122].

## 6. Limitations and Prospects

Hash grid feature pruning, when performed as a post-training step, is static: it does not adapt to changes in the distribution of splats at runtime. Only "hard" (binary) pruning is utilized; learning sparsity priors or soft-pruning during training remains for future work. Further integration into the entropy model, rather than via bitmap masking and post-filtering, may provide additional efficiency. Dynamic adaptation to changing grid resolution or hash size per frame is not addressed.

In trainable pruning schemes, exploration of optimal grid resolutions, sparsity budgets, and soft gating mechanisms remains ongoing. The use of end-to-end ADMM and differentiable gating (HollowNeRF) permits significantly reduced model size for high-fidelity volumetric rendering.

A plausible implication is that such pruning methodologies can be more broadly applied to learning-based compression and neural field representations wherever spatial sparsity is pronounced.

Source: https://www.emergentmind.com/topics/hash-grid-feature-pruning