Standard neural networks are remarkably rigid. Whether it is a Convolutional Neural Network (CNN) scanning an image or a Transformer processing a sequence of text, these models typically operate on fixed, regular grids. A $3 \times 3$ convolutional filter always looks at a perfect square of nine pixels, and a self-attention mechanism usually looks at tokens at fixed integer positions.
This rigidity is a problem because the world is not a grid. Objects in images rotate, stretch, and change scale; human speech varies in tempo; and physical phenomena described by sensors occur in continuous space. To handle these variations, researchers have developed a family of techniques that allow networks to learn where to look by making the sampling process itself differentiable.
The Problem of Discrete Grids
The fundamental challenge is that data structures like images (pixels), videos (frames), and text (tokens) are discrete. If a model wants to "nudge" its gaze by 0.5 pixels to the left to better align with an object's edge, it hits a mathematical wall: there is no pixel at index 5.5. Because indices must be integers, the operation of "picking a location" is traditionally non-differentiable, meaning we cannot use backpropagation to optimize the sampling coordinates.
To solve this, researchers use differentiable interpolation to bridge the gap between continuous coordinates and discrete grids.
Interpolation as a Differentiable Bridge
The core intuition is to treat the discrete grid as a continuous surface. Instead of picking a single pixel, the model samples a weighted average of the nearest neighbors.
In 2D images, this is typically done via bilinear interpolation. As Jifeng Dai and Haozhi Qi demonstrated in Deformable Convolutional Networks, if a model predicts a fractional offset $(x + 0.4, y + 0.6)$, the system samples the four surrounding pixels and weights their contribution based on their distance to that fractional point.
Because the weights of this average change smoothly as the coordinates move, the loss function becomes differentiable with respect to the coordinates. This allows the network to learn "offsets" that deform the sampling grid to fit the actual shape of the data.
Deforming the Receptive Field
This mechanism has been applied across various architectures to move beyond "square" thinking:
- Active and Deformable Convolutions: Yunho Jeon and Junmo Kim introduced the Active Convolution Unit, which treats the positions of synapses as learnable parameters. Similarly, DCLS by Ismail Khalfaoui-Hassani and Thomas Pellegrini uses Gaussian interpolation to let convolutional kernels learn their own spacing, which is particularly effective for audio classification where frequency patterns don't always align with a fixed grid.
- Scale-Adaptive Sampling: In Scale-Adaptive Convolutions, Rui Zhang and Sheng Tang use this technique to let the network "zoom in" or "zoom out" at every pixel location, automatically adjusting the receptive field to the size of the object being processed.
- Dense Captioning: Andrej Karpathy and Justin Johnson used bilinear interpolation in DenseCap to create a differentiable path between region coordinates and language generation, allowing the model to refine bounding box locations based on how well they describe the scene.
Extending to Time and 3D Space
The same logic applies to temporal and volumetric data. In video processing, Hao Shao and Shengju Qian developed the Temporal Interlacing Network, which uses learnable temporal offsets and linear interpolation to shift features between frames, capturing motion dynamics without the cost of 3D convolutions.
In medical imaging and robotics, the challenge is often bridging discrete grids (like MRI voxels) with continuous physical paths. Leon Y. Cai and Daniel Moyer demonstrated in their work on MRI tractography that trilinear interpolation allows a model to sample brain "wiring" at arbitrary 3D coordinates, enabling the error signal to flow from a continuous point back to the original discrete voxel grid.
Beyond Vision: Transformers and Graphs
The trend toward differentiable sampling is now reaching sequence models. Traditional Transformers use fixed positional encodings, but Contextual Position Encoding (CoPE) by Olga Golovneva and Sainbayar Sukhbaatar allows models to "count" positions based on context. By interpolating between discrete position embeddings, the model can represent "soft" distances that aren't tied to raw token counts.
Similarly, in DeformableTST, Donghao Luo applies these concepts to time-series forecasting, using linear interpolation to let the attention mechanism focus on critical, non-integer time points, bypassing the need for rigid patching.
Summary of Intuition
Differentiable sampling works because it replaces the "hard" operation of selecting an index with the "soft" operation of weighted averaging. By using interpolation kernels (linear, bilinear, or Gaussian), we turn the discrete data grid into a differentiable field. This allows the network to treat spatial and temporal coordinates as trainable parameters, enabling models to adaptively reshape their own receptive fields to match the underlying structure of the data.