WorksComputer Science
Random Voronoi Networks
Abstract
Nearest-neighbor methods are local, simple, and interpretable, but their non-parametric form makes them memory-intensive, expensive at inference, and difficult to integrate into differentiable neural architectures. We introduce Random Voronoi Networks (RVNs), a family of structured three-layer MLPs that express nearest-neighbor geometry through sampled Voronoi comparisons. The first layer computes Random Voronoi Features (RVF) from affine pairwise separators between selected training samples, the second layer aggregates these comparisons into Voronoi cells or top-k neighborhood scores, and the readout layer produces classification or regression predictions. We show that, when all samples and pairwise comparisons are included, step RVNs recover exact Euclidean k-NN, while ReLU RVNs provide a violation-score realization for 1-NN that can be relaxed into a differentiable soft weighting. Subsampling yields approximate RVNs with explicit control over the number of cells and features. We study several unsupervised sampling methods that trade off random coverage, directional diversity, coordinate sparsity, and empirical feature variance. Empirically, RVFs produce a highly effective data encoding strategy, providing performance boosts to downstream methods ranging from linear to modern tabular deep learning models. Finally, we showcase that RVF provides an interpretable feature map due to its k-NN based construction and ties to pairwise local directions. These results position our Random Voronoi formulation as a bridge between nearest-neighbor rules, random features, and modern tabular models.
Introduction
Nearest-neighbor rules require very few parametric assumptions, adapt naturally to local structure, and come with classical statistical consistency guarantees [7, 27, 8]. At the same time, their strengths are tied to properties that modern deep learning pipelines often find inconvenient: prediction requires access to the reference set, memory and latency scale with the number of stored examples, and the winner-take-all nearest-neighbor operator is not differentiable. Furthermore, the curse of dimensionality can degrade nearest-neighbor performance in high dimensions, while the unrestricted binary -NN classification class has infinite VC dimension, ruling out distribution-free uniform generalization bounds based solely on its class complexity.
The core object behind 1-NN is the Voronoi tessellation induced by the training set. Prediction is constant inside each cell and changes only across Voronoi boundaries [20, 26], which are defined as a combination of hyperplanes. This observation suggests a natural parallelism between Voronoi tessellation and multi-layer perceptrons (MLPs), since both construct decision regions by composing affine separators with nonlinear aggregation. This paper develops that viewpoint through Random Voronoi Networks (RVNs). RVNs are a family of structured three-layer networks that recover 1-NN Preprint. when every training sample is used as an anchor and each anchor is compared with every other training sample. The first layer generates Voronoi features by applying sampled pairwise Voronoi separators derived from the training set. The second layer generates Voronoi cells by aggregating these comparisons onto cell-membership or top- neighborhood indicators. Finally, a readout layer provides the classification or regression prediction. RVN can be instantiated both using step and ReLU activations, inheriting the local inductive bias of prototype methods while remaining compatible with standard neural tooling.
Our contributions are as follows: (1) We formulate Random Voronoi Networks as structured three-layer MLPs whose layers correspond to Voronoi features, Voronoi cells, and readout predictions. (2) We show that step RVNs recover exact Euclidean -NN in the full-sample, full-comparison regime, while ReLU RVNs provide a neural violation-score realization of the 1-NN geometry. (3) We analyze uniform comparison sampling and define feasible, label-agnostic selectors using random coverage, directional diversity, coordinate sparsity, and empirical feature variance. The structured selectors are evaluated empirically and do not inherit the uniform-sampling bounds. (4) We empirically separate the exact nearest-neighbor recovery role of RVN from the practical feature-encoding role of RVF, showing improvements over standard random features, comparisons with learned neighborhood models, and interpretable local feature directions.
Together, these results position RVNs as a bridge between nearest-neighbor rules, random feature maps, and neural networks: they preserve the locality and interpretability of prototype methods while offering fixed, scalable, and neural-compatible feature representations.
Related work
Nearest neighbors and prototype methods. The classical analysis of nearest-neighbor rules begins with the seminal result of Cover and Hart [7] and the consistency theory of Stone [27]; a broader treatment appears in the monograph of Devroye et al. [8]. Prototype-based methods such as learning vector quantization (LVQ) compress the reference set into a smaller number of representatives and therefore induce Voronoi decision regions by design [3, 24]. More recent prototype literature emphasizes interpretability, robustness, and efficient certification [23, 28]. RVNs share the local geometric bias of these methods, but use sampled pairwise Voronoi comparisons as an explicit intermediate representation.
Neural Voronoi and -NN implementations. Neural implementations of nearest-neighbor and Voronoi decision rules predate this work: Murphy’s 1-NN perceptron uses bisecting-plane comparisons [19], Bose and Garga construct an exact Voronoi network [4], Chen et al. implement -NN through an iterative procedure [6], and Gentile and Sznajer simplify Voronoi classifiers using feedback and hyperborder structure [11, 12]. RVN instead emphasizes a static feedforward construction with explicit anchor and comparison budgets (, ), structured comparison subsampling, and reuse of the selected comparisons as a fixed label-agnostic feature map for downstream predictors.
Differentiable and learned neighborhood models. A complementary line of work learns or smooths nearest-neighbor retrieval so that locality can be inserted inside larger differentiable pipelines. Examples include neural nearest-neighbor blocks [21], TabR [13], and ModernNCA [30]. TabR and ModernNCA learn task-specific representations and neighborhood behavior through specialized training objectives or architectures. RVF instead fixes a Euclidean, label-agnostic comparison map before supervised training and can be attached to linear models, generic MLPs, or specialized tabular predictors without changing their losses. We therefore view RVF as complementary to learned retrieval methods rather than as a replacement for them.
Generalization bounds for nearest-neighbor limits. A related theoretical line studies why nearest-neighbor rules can generalize despite their large unrestricted capacity. Graepel and Herbrich [15] derive PAC-Bayesian bounds for -NN by viewing it as the limiting case of a kernel classifier with vanishing bandwidth, while Chaudhuri and Dasgupta [5] give finite-sample, distribution-dependent convergence rates for nearest-neighbor classification. Our perspective is complementary: rather than deriving -NN from a kernel classifier, RVNs realize the same limiting nearest-neighbor geometry through a structured MLP built from Voronoi comparisons, which allows us to characterize how finite comparison budgets approximate nearest-neighbor cells and pairwise rank geometry.

Figure 1. Random Voronoi Network overview. Pairwise bisectors partition the dataset and define the Voronoi geometry. A query is mapped by and to Voronoi features , routed by into cell scores whose argmax identifies the nearest prototype, and mapped by to the final nearest-neighbor prediction.
Random features and random ReLU networks. RVNs also connect to the large literature on random features, where nonlinear dictionaries are sampled and only a simple downstream head is trained [22, 17]. Unlike random Fourier or random ReLU features, Voronoi features are data-dependent: each coordinate is tied to a specific pairwise separator between reference samples. The resulting representation therefore carries an explicit local and interpretable geometry while retaining the computational benefits of a fixed feature map.
Voronoi geometry of -NN. The geometric structure of nearest-neighbor classifiers can be analyzed via Voronoi diagrams and their higher-order variants [20, 26]. We use this geometry constructively: pairwise bisectors become affine features, sampled rank tests become cells, and the complete comparison graph provides the exact -NN endpoint around which the budgeted approximation is defined.
Random Voronoi Networks
Random Voronoi Networks (RVNs) are explicit three-layer multi-layer perceptrons whose weights are determined by Euclidean Voronoi geometry. The first layer computes Voronoi features, which are pairwise comparisons between selected training samples. The second layer computes Voronoi cells, or more generally top- neighborhood indicators, by aggregating those comparisons. The final layer averages the values attached to the active cells. By changing only the threshold in the cell layer, the same architecture recovers either 1-nearest neighbor or -nearest neighbors, assuming no distance ties.
The -nearest-neighbor hypothesis class
Let be a reference dataset of samples, with query and target . For regression, is a scalar or vector response; for classification, may be a one-hot label vector. Write and . For a query , let be the ordering of the reference samples by increasing squared Euclidean distance with respect to , so that . Ties are resolved by a fixed deterministic rule. The -nearest-neighbor set with respect to is
The Euclidean 1-NN predictor returns the value attached to the closest reference sample:
where the arg min uses the same deterministic tie-breaking rule. Thus 1-NN is a Voronoi-cell predictor: each input receives the value attached to the sample whose Voronoi cell contains it. The Euclidean -NN predictor averages the values attached to the closest reference samples:
For classification, when is one-hot, stores empirical class frequencies among the nearest neighbors, and prediction is . We refer to the unrestricted Euclidean -nearest-neighbor hypothesis class by . For binary classification (, , with thresholded one-hot class scores ), this class has infinite VC dimension [25]: for any nonempty finite set of query points, one can place labeled reference sites arbitrarily close to each query point so as to realize any binary labeling. Thus .
Random Voronoi Networks as three-layer MLPs
RVNs are structured piece-wise parameterizations of nearest-neighbor geometry. The RVN is constructed using a set of anchors consisting of training samples , where is a selected sample of indices with . Let be a set of ordered comparison pairs, with for all ; the second index may be any reference sample. Each pair defines one Voronoi feature comparing sample against sample . We write . The pairs in are used to construct the Random Voronoi Feature layer , the set of anchors provide the basis for the Random Voronoi Cell layer , and the set of labels are used to construct the final readout layer that completes the Random Voronoi Network .
The RVN can be written in the following structured network form, with , , and .
In the step variant, is the vector of active cells. If and the comparison graph consists of all ordered pairs of distinct selected anchors, precisely cells are active whenever their distances to are pairwise distinct. For a fixed dataset, denotes the family with fixed geometric hidden layers for each , activation , and free affine readout parameters.
Random Voronoi Features
The first layer of an RVN constructs the Voronoi feature map . Its coordinates are indexed by the randomly selected ordered comparison pairs . Each coordinate compares the distance from the query to a main anchor and a selected reference sample . For each comparison pair, define the signed Voronoi margin:
Thus exactly when is at least as close to as is. Therefore, each Voronoi comparison is an affine neuron. For , the corresponding first-layer parameters are
so that . The activation determines how this comparison is encoded. With a step activation ,
so the feature records whether anchor is no farther than anchor . With a ReLU activation, the orientation is reversed so that the feature records the amount by which the comparison for is violated:
Here the ReLU version uses the opposite orientation of the affine margin, so that is zero when is at least as close as , and positive otherwise. Thus the first layer stores the sampled Voronoi bisectors determined by . The randomness selects which pairwise comparisons are included; after and are fixed, the weights and biases are completely determined by the selected reference samples.
Random Voronoi Cells
The second layer aggregates pairwise Voronoi features into anchor-level cell activations . For each selected anchor , , let denote its sampled rivals and let . Define the routing matrix by
Thus sums exactly the comparisons associated with anchor .
For the step RVN, choose and . Then
Hence exactly when loses to at most of its sampled rivals, equivalently when it wins at least sampled comparisons. If exactly, , and distances to the selected anchors are distinct, this activates precisely the top- anchors within ; for , it is their hard Voronoi-cell indicator.
For the ReLU RVN, the cell layer instead gates the accumulated comparison violation. Since is zero when is at least as close as , define
Thus when loses to none of its sampled rivals, and otherwise measures the total violation margin. With gate width , choose and , giving
This is a shrinking violation gate: it equals 1 when the sampled comparisons for are all satisfied, decays linearly for , and vanishes once . For fixed , this ReLU map is differentiable almost everywhere.
Readout Layer
The readout layer converts anchor-level cell activations into the final prediction by attaching each selected anchor , , to its target . For regression, is the response associated with ; for classification, is the one-hot encoding of its class label.
For the step RVN, is binary and is designed to activate the selected neighbors. We therefore choose and , so that
When exactly cells are active, this is the average of the targets attached to those anchors. However, under budgeted comparison sampling, the number of active cells may differ from , so the readout may not be a normalized neighborhood average.
For the ReLU RVN, is generally soft and is intended to select a single nearest anchor as . We therefore use the unnormalized readout with , giving
For finite , this combines the targets of anchors with nonzero ReLU cell activity.
In classification, the output is interpreted as a vector of class scores and prediction is . In regression, is used directly as the predicted response.
Equivalence between RVN and k-NN
We now state when RVNs exactly recover nearest-neighbor predictors. Exact recovery uses the full-anchor, full-comparison endpoint, and . For fixed finite , this is a finite construction rather than an asymptotic budget limit. The complete ordered graph is
Let denote the set of query points with no distance ties among the reference samples .
Theorem 3.1 (Step RVNs recover -NN). Fix a reference dataset and . If and , then the step RVN with the canonical readout , , satisfies
for every with no distance ties.
Theorem 3.2 (ReLU RVNs recover 1-NN at finite gate width). Fix a reference dataset with . Suppose and , and use the canonical readout , .
Fix . If , let and index the nearest and second-nearest reference samples, and define their squared-distance gap by . Then, for every ,
If , the same equality holds for every . Consequently, for every ,
The proofs are given in Appendix § 8.§ 1 and Appendix § 8.§ 2.
Budgeted Approximation and Rank Geometry
The anchor and comparison budgets control two distinct approximations. We write for the number of main anchors and when each main anchor uses sampled rivals, with and . At the cell level, controls how accurately sampled comparisons resolve nearest neighbors. At the feature level, we analyze how controls preservation of the complete pairwise ranking geometry under uniform random pair sampling.
Cell-level approximation. For each main anchor , rivals are sampled uniformly without replacement from . Define the global reference distance rank
so a reference sample has rank 1 exactly when it attains the minimum distance to . For a sampled rival set with , define
Then, for , .
Proposition 3.3 (Sampled comparisons control top- activation). Fix , , and a main anchor with reference set rank . If is sampled uniformly without replacement with , then
Let denote the number of active main-anchor cells.
Corollary 3.4 (Comparison budget controls effective neighborhood size). Fix , , and . Suppose is sampled uniformly from with , and each samples rivals uniformly from . Assume that the reference samples have pairwise distinct distances to the query . Then
Practically, for , define the effective neighborhood size
Together, Proposition 3.3 and Corollary 3.4 quantify the effect of comparison subsampling: controls how reliably lower-ranked anchors are rejected, while is the expected number of active cells and therefore the effective support of the approximate RVN. Smaller broadens this support, whereas and recover the exact -NN support. This gives a direct, practical link between the feature budget and geometric smoothing; proofs are given in Appendix C.
Feature-level approximation. The reference set induces, for every no-tie input , a ranking of all reference samples by increasing distance. For one canonical orientation , define and let . A ranking disagreement between two inputs is a pair that the two induced rankings order differently. Jiao and Vert [18] showed that normalized signed pairwise comparisons give an explicit feature map for the Kendall kernel. The following proposition identifies this map with complete signed step RVFs on reference-distance rankings.
Proposition 3.5 (Complete RVFs encode Kendall rank geometry). Assume and . The complete signed step-RVF kernel satisfies
where counts pairwise ranking disagreements. Hence is the Kendall rank correlation between the two reference-distance rankings and is positive semidefinite.
ReLU RVFs retain the same binary ranking comparisons: for inputs without distance ties, . Thus, the Kendall kernel is recoverable by thresholding ReLU coordinates, although it is not their raw inner product.
Corollary 3.6 (Random RVFs preserve rank geometry with logarithmic feature growth). *Assume , and let be a fixed set of queries. Fix , , and an integer . Sample independent reference pairs independently and uniformly with replacement, and let be their average signed comparison product. Then for all . With probability at least ,
whenever
Proposition 3.5 and Corollary 3.6 show that complete step RVFs encode the full reference-distance ranking through a Kendall kernel, while uniformly preserves these similarities over fixed queries. Thus, under uniform independent pair sampling, a finite random RVF map can approximate ranking geometry without materializing all canonical comparisons. This provides a baseline theoretical justification for comparison subsampling, while the structured selectors considered below depart from this sampling model and are evaluated empirically. Proofs are given in Appendix § 9.
Feature-pair selectors for approximate RVF
For each main anchor , a selector chooses distinct rivals and forms . The selectors below differ only in how these rivals are chosen. All are unsupervised and label-agnostic, and aim to use the fixed comparison budget efficiently.
Cosine Diversity selector. For a main anchor and candidate , let . The Cosine Diversity selector greedily accepts when
for , filling any remaining slots uniformly at random. This discourages nearly parallel comparisons and spreads each cell across more angular directions.
Sparse Dimension selector. The Sparse Dimension selector favors pairs whose differences are concentrated in few coordinates. For , score candidates by Hoyer sparsity [16],
with the following conventions: set in every dimension. When and , set . For each , the selector chooses the candidates with largest . These comparisons produce more axis-aligned and interpretable Voronoi hyperplanes.
High Variance selector. The High Variance selector prioritizes comparisons whose bisectors split the empirical data mass. For a candidate pair , define . On a subset , compute
For each , the selector chooses the candidates with largest . Since is maximized near , selected comparisons tend to cut through the data rather than produce nearly constant activations. The four selectors trade off simplicity, angular coverage, coordinate sparsity, and empirical informativeness under the same budgets and . Detailed implementations are given in Appendix § 10.
Experimental Results
We evaluate three aspects of RVNs: nearest-neighbor recovery, RVF as a fixed tabular encoding, and geometric interpretability. Experimental details are given in Appendix § 11, with compute resources in Appendix § 11.6.
Equivalence between RVN and 1-NN
We verify that RVF construction selects the same nearest-neighbor index as exact Euclidean 1-NN. For each query , we compare , and , with , where is the Voronoi-cell score for sample .
Consistent with the cell-level approximation theory in § 3.7, Figure 2 shows that increasing the rival budget improves rank resolution by reducing the chance that a lower-ranked anchor misses closer competitors, while increasing increases anchor coverage. Sparse Dimension selection gives substantially better recovery at small rival budgets, showing that structured allocation can identify useful comparisons more efficiently than uniform sampling. All selectors converge to exact 1-NN when both anchor and comparison coverage become complete.

Figure 2. RVNs recover exact nearest-neighbor indices. Left: index-matching accuracy versus ; Sparse Dimension performs best at small budgets, while all selectors converge to exact agreement. Right: accuracy versus and , reaching 1 as both approach full coverage.
Random Voronoi Feature Encoding
We next evaluate RVF as a fixed, label-agnostic, data-dependent encoding for supervised tabular learning. Given an encoder , we train downstream predictors on transformed inputs . We compare raw inputs, Random Fourier Features (RFF) [22], Random ReLU Features (RRF) [17], Nyström RBF Features (RBF), and two RVF variants:
RVF uses the pairwise ReLU margins , while RVF+VC additionally includes the aggregated cell representation . We evaluate on TabArena-Lite [10] with ElasticNet, TorchMLP, and TabM-Mini [14]; TabR [13] and ModernNCA [30] are included as specialized learned neighborhood-model references. Full protocol details are given in Appendix § 11.
Figure 3 shows that RVF-based encoders achieve the strongest aggregate rankings among the evaluated feature maps. ElasticNet benefits strongly, indicating that RVF makes useful local structure more linearly accessible. Interestingly, ModernNCA and TabR, which employ learned neighborhood representations, achieve performance comparable to ElasticNet with RVF. We view this comparison as indication that RVF can inject a strong local geometric bias into non-specialized models.

Figure 3. RVFs improve downstream tabular performance. Left: aggregate Elo across downstream models show that RVF encodings outperform benchmark feature maps. Right: ElasticNet Elo versus feature count compared to raw baseline, showing an early performance elbow and efficient data-dependent encoding.
The feature-budget curve further shows a strong performance elbow with comparatively few encoded features. Overall, these results support the role of RVF as a reusable representation rather than merely a neural reproduction of Euclidean -NN. A classifier-versus-encoder ablation is reported in Appendix § 11.§ 2, and individual dataset results are shown in Appendix § 11.§ 1.
Interpretability of Random Voronoi Features
RVFs support interpretation at both global and query-specific levels, since each coordinate corresponds to a reference pair , with comparison direction and bisector midpoint . For a linear classifier with class scores , where denotes the encoded feature supplied to the classifier, coefficient magnitudes identify globally influential comparisons, while gives each comparison’s signed contribution to the score for a particular query.
Figure 4 illustrates both levels. On moons, we display the comparisons with the largest coefficient magnitudes, revealing global directions concentrated near discriminative regions. On MNIST, a simple logistic regression model trained on RVF features reaches 91% accuracy. We select the feature with the largest absolute contribution to the predicted class score for each displayed query, and visualize its reference pair and signed image difference. The strongest feature often contains an anchor from the same class as the query, providing a visually meaningful local comparison. Vision-specific modeling is outside our scope, but this experiment illustrates that RVF-based encodings are inherently inspectable: predictions can be decomposed into sample-pair comparisons and local directions.

Figure 4. RVF interpretability. Left: top 15 logistic-regression RVFs on moons, shown as directions at midpoints ; influential features concentrate near discriminative regions and align with class separation. Right: MNIST examples showing the highest-contributing RVF for each query.
Limitations and Conclusion
RVNs benefit from locality, making them useful for piecewise or prototype-like tasks and naturally interpretable through sample-pair comparisons. However, they can suffer in high dimensions and scale poorly if all pairwise anchor comparisons are materialized. Practical variants should use better representations or metrics, subsampling, pruning, distance-based computation, or approximate comparisons. Future extensions include learned Mahalanobis metrics, anisotropic cells, and task-adaptive selectors to better align Voronoi partitions with real tabular data geometry.
Random Voronoi Networks provide a structured neural formulation of nearest-neighbor geometry through pairwise affine comparisons and Voronoi-cell aggregation. Step RVNs recover Euclidean -NN at the full-comparison endpoint, while ReLU RVNs provide a differentiable 1-NN relaxation. Budgeted RVFs retain this geometry with far fewer comparisons and improve downstream tabular models while remaining interpretable. Overall, RVNs connect nearest-neighbor methods, random features, and neural networks through a common Voronoi construction.
AI Use Statement
AI tools were used to assist with drafting, editing, and improving the presentation of this manuscript, including refinement of prose, organization, and mathematical formulation. All content, claims, derivations, and results were reviewed and verified by the authors who take full responsibility for the accuracy and content of the paper.
RVN Formulation
The -nearest-neighbor hypothesis class
Let be a reference dataset with and , and write and . For a query , let be the deterministic ordering of the reference points by increasing squared Euclidean distance to , breaking distance ties by increasing dataset index, and define . The Euclidean -NN predictor is
For regression this is the average response among the nearest reference points. For classification with one-hot labels, it gives empirical class frequencies and predicts . The case is the usual Voronoi-cell nearest-neighbor rule.
For a fixed dataset , the expression above defines one predictor. The corresponding -site Euclidean -nearest-neighbor hypothesis class is obtained by allowing both the reference sites and their attached values to vary:
The unrestricted, nonparametric -NN class allows the number of reference sites to vary:
For binary classification with and (denoting the resulting binary classifier class by ), this unrestricted class has infinite VC dimension. Indeed, given any distinct points and any binary labeling, place reference sites sufficiently close to each , all with the prescribed label of , choosing the neighborhoods disjoint. Then the nearest neighbors of each are exactly its local reference sites, so the classifier realizes the prescribed labeling. Since this shatters finite sets of arbitrary size,
This standard shattering argument is often cited as the reason that unrestricted nearest-neighbor classifiers have infinite VC dimension; see, for example, [25].
Three-layer MLPs RVN Hypothesis Class
This appendix subsection makes explicit the hypothesis class induced by the three-layer Random Voronoi Network (RVN) construction. The purpose is to separate three sources of variation: the choice of anchors, the choice of sampled Voronoi comparisons, and the free readout parameters. Throughout, the reference dataset
is fixed. Let denote the selected anchor indices, with , and let
denote the selected ordered comparison graph. The hidden-layer parameters of the RVN are determined by and the Euclidean geometry of the anchor points. The only trainable, or freely chosen, parameters in the class below are the readout weights and biases. For an activation choice and neighborhood parameter , define
Each function in the class has the three-layer form
where the feature layer computes sampled Voronoi comparisons and the cell layer aggregates those comparisons into anchor-level activations. Thus the class is a structured subfamily of three-layer MLPs: it has the same input–hidden–hidden–output architecture as a standard MLP, but the first two layers are not arbitrary parameters. They are fixed by the selected anchors and by the selected comparison graph.
The quantity controls the number of prototype cells available to the network, while controls the number of pairwise Voronoi constraints used to define those cells. In the full-anchor and full-comparison case,
the step version recovers the usual Euclidean -nearest-neighbor rule, up to the deterministic tie convention. For strict statements below, we work away from distance ties, or equivalently assume a fixed perturbation or tie-breaking rule.
Step RVN
The step RVN is the hard-cell version of the construction. It uses the Heaviside activation
in both hidden layers. For each ordered comparison pair , the first layer computes the binary Voronoi comparison
Thus exactly when anchor is no farther than anchor in distance to the query.
For each anchor , write
The second layer sums the sampled wins of anchor and thresholds the result:
Equivalently, if
denotes the number of sampled rivals that are strictly closer to than , then, away from distance ties and ,
Hence a step cell is active exactly when its anchor loses to at most sampled rivals. For , this is the sampled hard Voronoi-cell condition. For general , it is a sampled top- condition.
The canonical -NN readout attaches the target value to the cell for anchor :
which gives
When the comparison graph is exactly , , and distances to the selected anchors are pairwise distinct, exactly the anchors whose distance rank among is at most are active. Therefore,
where denotes the nearest anchors to among the selected anchor set . In particular, if and all ordered comparisons are included, the step RVN exactly realizes the Euclidean -nearest-neighbor predictor on .
Allowing arbitrary readout parameters gives the full hypothesis class in (34). The canonical readout above is the particular member that recovers the usual -NN averaging rule.
ReLU RVN
The ReLU RVN is a soft-cell relaxation of the hard Voronoi rule. Instead of recording whether a comparison is won or lost, the first layer records the amount by which the comparison for anchor is violated. For each ordered pair , define
Then whenever is at least as close to as is, and it is positive precisely when beats . The value of the feature is the nonnegative part of the signed violation margin.
For each anchor , the accumulated sampled violation is
Thus when all sampled Voronoi inequalities for anchor are satisfied, and increases as the query moves outside the sampled cell of anchor . With gate width , the ReLU cell activation is
This cell equals one when the sampled comparisons for anchor are all satisfied, decays linearly for accumulated violations between 0 and , and vanishes once .
The ReLU RVN readout is affine:
The canonical nearest-neighbor readout uses
so that
When the comparison graph is complete over with , the only anchor with zero accumulated violation is the nearest anchor, provided there are no distance ties. Hence, as , the ReLU RVN selects the same cell as the hard 1-nearest-neighbor rule:
again away from ties. Consequently, with the canonical readout,
If , this is exactly the Euclidean 1-nearest-neighbor predictor on the full reference dataset.
Thus the ReLU RVN is a standard three-layer ReLU MLP realization of Voronoi geometry: the first hidden layer computes violation margins for sampled bisectors, the second hidden layer converts accumulated violations into soft cell activations, and the readout layer combines the targets or logits attached to the active cells. Unlike the step RVN, which directly realizes hard top- selection, the ReLU construction is most naturally interpreted as a soft nearest-cell relaxation whose zero-width limit recovers 1-NN.
Proofs of the main statements
Proof of Theorem 3.1
Theorem 3.1 (restated). Fix a reference dataset and . If and
then the step RVN with canonical readout and satisfies
for every with no distance ties.
Proof. Fix denoting the set of query points with no distance ties among the reference samples, and take and . If , necessarily and there are no comparisons. The step-cell activation is , so the result is immediate. Henceforth assume .
Let denote the Euclidean distance rank of among , with for the nearest reference sample. Because , there are no distance ties. For the step Voronoi feature,
Hence beats exactly the reference samples that are farther from than is:
In the full-comparison regime, . Substituting (49) into the step cell layer yields
Since is integer-valued,
Therefore, the active step RVN cells are exactly the nearest neighbors of .
With readout
the RVN output is
This proves the theorem.
Proof of Theorem 3.2
Theorem 3.2 (restated). Fix a reference dataset with . Suppose and
and use the canonical readout , .
Fix . For , let
be the squared-distance gap between the nearest and second-nearest reference samples. Then
for every .
If , this equality holds for every . Consequently, for every ,
Proof. Fix , and take and .
If , there are no comparisons, so and for every . The canonical readout therefore gives . Henceforth assume .
Let
be the unique nearest neighbor of . The ReLU Voronoi feature records the amount by which the comparison for anchor is violated:
For the nearest anchor ,
Therefore and
Its accumulated violation is therefore
Now take any . Since the comparison graph is complete, the comparison is present. Moreover,
Hence
Thus every non-nearest anchor has strictly positive accumulated violation:
Since is the second-nearest reference sample, for every we have
The second-nearest anchor loses only to the nearest anchor, so . Thus, for every , the ReLU gate gives and for every . The canonical readout therefore satisfies
Since , the limit as follows.
Budgeted Approximation: Proofs
Sampled comparisons control top- activation
Proposition 3.3 (restated). For a main anchor , sample uniformly without replacement with . If is the full-reference rank defined in Equation (16), then
and exactly when .
Proof. Fix an input and a main anchor . Write . By definition of full-reference rank, exactly of the possible rivals are strictly closer to than , while the remaining rivals are at least as far from as .
The set is drawn uniformly from all subsets of rivals. The loss count records how many of the sampled rivals come from the closer reference points. To obtain exactly losses, the sample must contain of those closer points and of the non-closer points. The number of such rival sets is therefore
Dividing by the total number of size- rival sets gives
with infeasible binomial coefficients interpreted as zero. This is exactly the probability mass function of .
By Equation (17) and the step-cell rule, iff . Hence
If , at most closer reference points exist, so the cell is active for every possible rival sample. At the complete rival budget , all possible rivals are observed and deterministically; therefore the selected main anchor is active exactly when its global reference rank is at most .
Comparison budget controls effective neighborhood size
Corollary 3.4 (restated). Fix , , and . Suppose is sampled uniformly from with , and for each , rivals are sampled uniformly from . Assume that the reference samples have pairwise distinct distances to the query . Then
For , .
Proof. After sampling the main-anchor set , let be an index chosen uniformly from the elements of . Since itself is a uniformly sampled size- subset of , is marginally uniform on the full reference set:
Conditional on , its rival set is a uniformly sampled size- subset of . Let , so . For any fixed subset of size and any ,
where the second equality follows from . Thus is uniformly distributed over all -subsets of the reference set and, conditional on , the distinguished main anchor is uniform over the elements of .
Order the elements of by increasing distance to . Away from ties, one element occupies each relative rank in . Because is uniform on , its relative rank is uniform:
The sampled loss count is exactly , since every element of ranked before is one sampled rival closer to . Therefore
There are admissible ranks among the equally likely possibilities, and hence
Finally, because is uniform among the selected main anchors,
Multiplying by proves
For , the minimum equals . Substituting yields
At , this becomes ; when also , it reduces to the exact active cells of full -NN. □
Complete RVFs encode Kendall rank geometry
Proposition 3.5 (restated). Assume and . Let and . Then
so equals Kendall rank correlation and is positive semidefinite.
Proof. For an unordered reference pair , call the pair concordant if and rank and in the same order, and discordant if the order is reversed. Equivalently, for a concordant pair and for a discordant pair. Let and denote the numbers of concordant and discordant pairs. Then , and the Kendall disagreement count is . Therefore
This is Kendall rank correlation. Moreover, for the explicit feature map , proving positive semidefiniteness.
Ranking information retained by ReLU RVFs
For inputs without distance ties, is positive exactly when reference sample is closer than . Therefore,
Thus, thresholding the complete ReLU-RVF map recovers the signed comparisons and hence the Kendall kernel in Proposition 3.5. The concentration bound also applies to these thresholded features under independent uniform pair sampling, but does not extend directly to raw ReLU inner products which also contain information regarding magnitude. Bachrach et al. [2] established a Hoeffding bound for estimating Kendall’s rank correlation between two rankings by uniformly sampling comparison pairs. A union bound gives the following guarantee over a fixed set of queries.
Random RVFs preserve rank geometry with logarithmic feature growth
Corollary 3.6 (restated). Assume , and let be a fixed set of queries. If canonical reference pairs are sampled independently and uniformly, then is unbiased for . All pairwise kernel values on are within of their complete values with probability at least whenever
Proof. For a uniformly sampled canonical reference pair , define . Uniformity over the reference pairs gives
Hence is unbiased. Since the sampled pairs are independent and each , Hoeffding’s inequality yields
Apply this bound to the at most ordered query pairs and use the union bound:
Requiring the right-hand side to be at most gives
which proves the simultaneous approximation guarantee. Equivalently, suffices.
Selector Algorithms
The selectors in § 3.8 are defined in Algorithms 1, 2, 3, and 4.
For the Cosine Diversity selector (assuming , , and distinct reference locations), is computed for each dataset based on the ambient dimension and group size . Using a Gaussian approximation for pairwise cosine similarities, we set a Bonferroni-corrected baseline for the comparisons at nominal level : . To account for dimensional constraints when , we also use the Welch coherence lower bound . Finally, we take with safety margin , and clip between 0.1 and 0.9 to prevent overly restrictive or permissive selection. This threshold is a heuristic: the Welch bound provides a necessary lower bound on coherence rather than a guarantee that a feasible subset exists among the candidate directions. If the greedy scan selects fewer than rivals, the selector samples the remaining slots uniformly without replacement from the unused rivals. This gives exactly rivals whenever .
Algorithm 1 Random selector
Require: Dataset {x_i}_{i=1}^N, Number of features M_F, Number of cells M_C
1: Set Number of features per cell H ← M_F/M_C
2: Sample main anchors A ⊆ [N] uniformly with |A| = M_C
3: Initialize selected pair set E ← ∅
4: for i ∈ A do
5: Sample S_i ⊆ [N] \ {i} uniformly with |S_i| = H
6: Add {(i, j) : j ∈ S_i} to E
7: end for
8: return E
Additional experimental details
Individual Dataset Results
Classifier and encoder ablation
To separate RVN’s role as a nearest-neighbor classifier from RVF’s role as a reusable encoder, we compare standard -NN, the aggregated Voronoi Cell representation, the pairwise Voronoi Feature representation, and their combination with the same ElasticNet downstream model where applicable.
Table 1 shows that the pairwise Voronoi Features account for most of the downstream gain: RVF+ElasticNet and RVF+VC+ElasticNet reach about 1140 Elo, whereas standard -NN and Algorithm 2 Cosine Diversity selector
| Configuration | Elo |
| Voronoi Features + Cells + ElasticNet | 1142 |
| Voronoi Features + ElasticNet | 1140 |
| Raw + ElasticNet | 971 |
| Standard -NN | 881 |
| Voronoi Cells + ElasticNet | 866 |
Table 1. Classifier-versus-encoder ablation. Elo scores separate the nearest-neighbor/cell representation from the pairwise RVF representation.
Require: Distinct dataset , Number of features , Number of cells , threshold
Set Number of features per cell
Sample main anchors uniformly with
Initialize selected pair set
for do
Initialize selected neighbor set
Randomly order candidates
for do
Compute
if and or then
Add to
end if
if then
break
end if
end for
if then
Fill with uniformly sampled remaining candidates until
end if
Add to
end for
return
Algorithm 3 Sparse Dimension selector
Require: Dataset , Number of features , Number of cells
Set Number of features per cell
Sample main anchors uniformly with
Initialize selected pair set
for do
for do
Compute
Compute sparsity score via (27)
end for
Select as the candidates with largest
Add to
end for
return
Voronoi Cells+ElasticNet remain below 900. The small difference between RVF and RVF+VC suggests that the individual pairwise margins, rather than the aggregated cell representation alone, drive most of the improvement.
Benchmark protocol
We evaluate supervised RVF encoders on TabArena-Lite [10]. The datasets used here range from roughly 500 to 81,000 samples and span classification and regression tasks, feature dimensions, and tabular domains. This is the practical fixed-budget evaluation of RVF and is distinct from the full-RVN diagnostic in § 4.1. The goal is to test whether an encoder improves downstream learning across heterogeneous tabular problems, rather than on a single curated benchmark. Following the established benchmark protocol that is shown to be a good indicator of performance [10], we test on fold 0. All RVF anchors, comparison pairs, scalers, and categorical encoders are fit using only the training split, avoiding test-set leakage. We encode all categorical features with one-hot encoding.
For each dataset, we compare the following input encodings:
None: the raw input representation;
Algorithm 4 High Variance selector
Require: Dataset , Number of features , Number of cells , nonempty evaluation subset
Set Number of features per cell
Sample main anchors uniformly with
Initialize selected pair set
for do
for do
for do
Compute
end for
Estimate
Score candidate by
end for
Select as the candidates with largest
Add to
end for
return
RFF: Random Fourier Features, which use random sinusoidal projections to approximate shift-invariant kernels [22];
RRF: Random ReLU Features, which use data-agnostic random affine projections followed by ReLU activations [17];
RBF: Nyström RBF features, which approximate data-dependent radial basis functions by random sampling [29].
RVF: ReLU Random Voronoi Features ;
RVF+VC: the concatenated representation .
We apply these encodings to the following models as downstream predictors:
ElasticNet: a generalized linear model with combined and regularization, used to test whether the encoding exposes useful linear structure;
TorchMLP: a standard multilayer perceptron, used to test interaction with generic neural predictors;
TabM-Mini: a modern tabular neural model, used to test whether RVF improves specialized tabular architectures.
For additional neighborhood-model context, we report TabR [13] and ModernNCA [30] as aggregate Elo reference lines in Figure 3. These models learn task-specific retrieval or neighborhood representations.
Metrics and ranking
To aggregate results over heterogeneous tasks, we adapt TabArena’s Elo-based ranking methodology [9, 10], and use F1 for classification and for regression. Elo ratings are computed from pairwise comparisons induced by dataset-level task metrics, allowing classification and regression results to be summarized in a common ranking. All Elo ratings are initialized at 1000. We estimate uncertainty using 200 bootstrap replicates, each sampling the original number of datasets with replacement and refitting Elo ratings. We report the 2.5th and 97.5th percentiles of the resulting ratings as the 95% bootstrap interval.
For Figure 3 (right), rankings are computed for each dataset–encoder pair for the same number of features. Concatenated RVF+VC features are adjusted accordingly to maintain the same size as the competitors to maintain fairness. As stated, RVF encodings do not increase their performance as TabR and ModernNCA already specialize for geometric nearest-neighbor bias. With RVF embeddings, TabR and ModernNCA get elo of 980 and 1020 respectively.

Figure 5. Individual Dataset Results. Percentage improvement for each dataset over all models and encoders compared to raw (non-encoded) baseline. Classification measured using F1 score (above black line) and regression measured using score (below black line). RVF Based encoders perform better than other encoders for most datasets within the same model group. These results are especially pronounced for Modern Tabular Models like TabM. All classification datasets are above the black horizontal line, while regression tasks are below.
Hyperparameter optimization
For every dataset, encoder, and downstream model combination, we perform automated hyperparameter optimization with Optuna [1] using the TPESampler. Each experiment is run for up to 50 trials, optimizing over 1 fold validation set separate from test and train sets. We adopted the search spaces from Erickson et al. [10] for torchMLP and TabM. For the linear model with ElasticNet regularization, we used a custom wide search. Details of these are provided in Table 2-Table 4.
| Hyperparameter | Space |
| alpha | LogUniform([1e-05, 1.0]) |
| l1_ratio | Uniform([0.0, 1.0]) |
| scaler | Choice(["standard", "quantile"]) |
Table 2. Hyperparameter search space for ElasticNet.
| Hyperparameter | Space |
arch_type | Choice(["tabm-mini"]) |
tabm_k | Choice([32]) |
share_training_batches | Choice([False]) |
batch_size | Choice(["auto"]) |
patience | Choice([16]) |
lr | LogUniform([1e-4, 3e-3]) |
weight_decay_choice | Choice([0.0, 1.0]) |
gradient_clipping_norm | Choice([1.0]) |
amp | Choice([False]) |
compile_model | Choice([False]) |
n_blocks | Choice([2, 3, 4, 5]) |
d_block | Choice(128:16:1024) (step size = 16) |
dropout_choice | Choice([0.0, 1.0]) |
d_embedding | Choice([8, 12, 16, 20, 24, 28, 32]) |
num_emb_n_bins | UniformInt([2, 128]) |
eval_batch_size | Choice([128]) |
bool_to_cat | Choice([True]) |
average_logits | Choice([False]) |
Table 4. Hyperparameter search space for TabM.
For the encoders, we perform HPO over number of features ranging from 5 to 25000. For RVF based encoders, ranges from 50 to 500, while also optimizing over the selectors, and choosing . For RFF and Nystroem RBF, the gamma parameter is optimized over the range of 0.0001 to 100.0. For all encoders, we perform standard scaling before and after encoding.
| Hyperparameter | Space |
hidden_dim | UniformInt([8, 256]) |
activation | Choice(["relu", "elu"]) |
n_layers | UniformInt([1, 5]) |
learning_rate | LogUniform([0.0001, 0.03]) |
weight_decay | LogUniform([1e-12, 0.1]) |
dropout_rate | Uniform([0.0, 0.4]) |
use_batch_norm | Choice([True, False]) |
scaler | Choice(["standard", "quantile"]) |
Table 3. Hyperparameter search space for MLP.
Computational resources
All experiments were run on cluster machines. The TabM and MLP benchmark experiments were run on NVIDIA A100 GPUs with 40GB of VRAM. All remaining experiments, including ElasticNet benchmarks, interpretability experiments, and 1-NN/RVF equivalence experiments, were run on CPU. For these CPU experiments, each dataset–model–encoding–group configuration required less than 10GB of RAM.
References
- [1]Takuya Akiba, Shotaro Sano, Toshihiko Yanase, Takeru Ohta, and Masanori Koyama. Optuna: A next-generation hyperparameter optimization framework. In The 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 2623–2631, 2019.arxiv.org/abs/1907.10902
- [2]Yoram Bachrach, Ralf Herbrich, and Ely Porat. Sketching algorithms for approximating rank correlations in collaborative filtering systems. In Jussi Karlgren, Jorma Tahrio, and Heikki Hyyrö, editors, String Processing and Information Retrieval, pages 344–352, Berlin, Heidelberg, 2009. Springer Berlin Heidelberg. doi: 10.1007/978-3-642-03784-9_34.DOI
- [3]John S. Baras and Anthony LaVigna. Convergence of a neural network classifier. In Advances in Neural Information Processing Systems 3, pages 839–845, 1990.
- [4]Nirmal K. Bose and Amulya K. Garga. Neural network design using voronoi diagrams. IEEE Transactions on Neural Networks, 4(5):778–787, 1993.
- [5]Kamalika Chaudhuri and Sanjoy Dasgupta. Rates of convergence for nearest neighbor classification. In Advances in Neural Information Processing Systems, volume 27, pages 3437–3445. Curran Associates, Inc., 2014.arxiv.org/abs/1407.0067
- [6]Yan Qiu Chen, Robert I. Damper, and Mark S. Nixon. On neural-network implementations of k-nearest neighbor pattern classifiers. IEEE Transactions on Circuits and Systems I: Fundamental Theory and Applications, 44(7):622–629, 1997.
- [7]Thomas M. Cover and Peter E. Hart. Nearest neighbor pattern classification. IEEE Transactions on Information Theory, 13(1):21–27, 1967.DOI
- [8]Luc Devroye, László Györfi, and Gábor Lugosi. A Probabilistic Theory of Pattern Recognition. Springer, 1996.DOI
- [9]A.E. Elo. The USCF Rating System: Its Development, Theory, and Applications. United States Chess Federation, 1966. URL https://books.google.es/books?id=onUazQEACAAJ.
- [10]Nick Erickson, Lennart Purucker, Andrej Tschalzev, David Holzmüller, Prateek Desai, David Salinas, and Frank Hutter. Tabarena: A living benchmark for machine learning on tabular data. In Advances in Neural Information Processing Systems, volume 38, 2025. doi: 10.52202/085713-0519.DOI
- [11]Camillo Gentile and Mario Sznajer. An improved voronoi-diagram-based neural net for pattern classification. IEEE Transactions on Neural Networks, 12(5):1227–1234, 2001.
- [12]Camillo Gentile and Mario Sznajer. Hyperborders in the voronoi-diagram-based neural net for pattern classification. In Proceedings of the 2002 International Joint Conference on Neural Networks (IJCNN’02), volume 3. IEEE, 2002.DOI
- [13]Yury Gorishniy, Ivan Rubachev, Nikolay Kartashev, Daniil Shlenskii, Akim Kotelnikov, and Artem Babenko. Tabr: Tabular deep learning meets nearest neighbors. In International Conference on Learning Representations, 2024.
- [14]Yury Gorishniy, Akim Kotelnikov, and Artem Babenko. Tabm: Advancing tabular deep learning with parameter-efficient ensembling. In The Thirteenth International Conference on Learning Representations, 2025. URL https://openreview.net/forum?id=Sd4wYY0hMγ.arxiv.org/abs/2410.24210
- [15]Thore Graepel and Ralf Herbrich. A pac-bayesian analysis of distance-based classifiers: Why nearest-neighbour works! arXiv preprint arXiv:2109.13889, 2021. doi: 10.48550/arXiv.2109.13889. URL https://arxiv.org/abs/2109.13889.
- [16]Patrik O. Hoyer. Non-negative matrix factorization with sparseness constraints. Journal of Machine Learning Research, 5:1457–1469, 2004.
- [17]Daniel Hsu, Clayton H. Sanford, Rocco Servedio, and Emmanouil V. Vlatakis-Gkaragkounis. On the approximation power of two-layer networks of random relus. In Proceedings of the Thirty Fourth Conference on Learning Theory, volume 134 of Proceedings of Machine Learning Research, pages 2423–2461, 2021.arxiv.org/abs/2102.02336
- [18]Yunlong Jiao and Jean-Philippe Vert. The kendall and mallows kernels for permutations. In Francis Bach and David Blei, editors, Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pages 1935–1944. PMLR, 2015. URL https://proceedings.mlr.press/v37/jiao15.html.
- [19]Owen J. Murphy. Nearest neighbor pattern classification perceptrons. Proceedings of the IEEE, 78(10):1595–1598, 1990.DOI
- [20]Atsuyuki Okabe, Barry Boots, and Kokichi Sugihara. Spatial Tessellations: Concepts and Applications of Voronoi Diagrams. John Wiley & Sons, 1992.
- [21]Tobias Plötz and Stefan Roth. Neural nearest neighbors networks. arXiv preprint arXiv:1810.12575, 2018.arxiv.org/abs/1810.12575
- [22]Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In Advances in Neural Information Processing Systems 20, 2007.
- [23]Sascha Saralajew, Lars Holdijk, Maike Rees, and Thomas Villmann. Prototype-based neural network layers: Incorporating vector quantization. arXiv preprint arXiv:1812.01214, 2019.arxiv.org/abs/1812.01214
- [24]Atsushi Sato and Keiji Yamada. Generalized learning vector quantization. In Advances in Neural Information Processing Systems 8, pages 423–429, 1996.
- [25]Shai Shalev-Shwartz and Shai Ben-David. Understanding machine learning: From theory to algorithms. Cambridge university press, 2014.
- [26]Chawin Sitawarin, Evgenios M. Kornaropoulos, Dawn Song, and David Wagner. Adversarial examples for k-nearest neighbor classifiers based on higher-order voronoi diagrams. In Advances in Neural Information Processing Systems 34, 2021.arxiv.org/abs/2011.09719
- [27]Charles J. Stone. Consistent nonparametric regression. The Annals of Statistics, 5(4):595–620, 1977.DOI
- [28]Václav Voráček and Matthias Hein. Probably adversarially robust nearest prototype classifiers. In Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pages 22019–22057, 2022.arxiv.org/abs/2207.07208
- [29]Christopher K. I. Williams and Matthias Seeger. Using the nyström method to speed up kernel machines. In Advances in Neural Information Processing Systems, volume 13, pages 682–688, 2001.
- [30]Han-Jia Ye et al. Revisiting nearest neighbor for tabular data: A deep tabular baseline two decades later. In International Conference on Learning Representations, 2025.arxiv.org/abs/2407.03257
AI tools statement
This work lists 1 AI tool.
AI tools · AI tool
- Roles
- Writing — original draftWriting — review & editing
- Verification
- self-declared at submission
Recorded on the work at submission, not per version. Names and roles are shown as submitted; roles use the CRediT taxonomy.