Manuscript Offprint
arXiv:2610.21644Efficient Pairwise Difference Learning: A Comparative Study of Encoding Strategies and Training Pair Selection
Bernard Georges , Mohamed Karim Belaid , and Manuel Rodrigues
University of Minho, ALGORITMI CENTER LASI, Braga, Portugal pg53698@uminho.pt, manuel.rodrigues@algoritmi.uminho.pt
IDIADA Fahrzeugtechnik GmbH, Munich, Germany karim.belaid@idiada.com
Abstract. Pairwise Difference Learning for Classification (PDC) enhances supervised learning in low-data regimes by training a binary similarity classifier on pairs of instances rather than individual samples, effectively inflating the training set from n to examples. However, the PDC framework leaves critical implementation choices underspecified, particularly regarding input representation and pair selection strategies. This work systematically investigates these design decisions through extensive empirical evaluation. We compare four feature encoders—paired features, triplet with relative difference, absolute difference, and a novel triplet with absolute difference—alongside four pair selection strategies ranging from exhaustive to kernel-thinning-based schemes. Experiments across nearly 200 benchmark classification datasets using Decision Tree, Multilayer Perceptron, Gaussian Naïve Bayes, and Support Vector Classifier as base models reveal that the proposed triplet with absolute difference encoder ( ) achieves the highest average F1 scores. More notably, restricting training to upper-triangle pairs reduces computational time by approximately 40% with negligible accuracy loss. Kernel thinning-based selection provided no accuracy benefits while substantially increasing computational overhead. Overall, PDC configurations outperformed base models in 94% of tested cases, though no single configuration dominated universally, suggesting dataset-specific optimization remains an open challenge.
Keywords: Pairwise Difference Learning · Classification · Low-data regimes · Feature encoding · Pair selection
1 Introduction
Many machine learning applications operate in regimes where labeled examples are limited or expensive to acquire. In such settings, simply increasing model complexity is often less effective than enriching the supervision signal extracted from the available data. Pairwise learning schemes offer one such avenue: instead of learning from isolated samples, they create additional supervision by forming
Preprint (version submitted before peer review). Published in: Recent Trends and Challenges in Information Systems and Technologies (WorldCIST 2026), LNNS vol. 2092, Springer, https://doi.org/10.1007/978-3-032-32023-0_31
B. Georges et al.
pairs of instances and encoding their relative relationships. Recent work has shown that pairwise methods can improve accuracy and robustness in regression and classification, especially in low-data regimes [11, 13, 6, 8, 10, 15, 4, 7, 1, 2, 12].
In this work, we focus on Pairwise Difference Learning for classification (PDC) [1]. PDC solves a multiclass classification task by training a binary “similar vs. dissimilar” classifier on pairs of examples and then using its outputs to reconstruct class posteriors. Intuitively, instead of asking the model to predict the label of a single point, PDC asks how likely two points are to share the same class. By pairing the n training points, the method inflates the number of effective training examples to , exposing the learner to rich comparative information that is particularly useful when data are scarce.
Formally, let with and . PDC first selects a set of index pairs
and applies a feature map
Which encodes joint information about the two inputs (for example, their concatenation and/or their differences). Each pair receives a binary label.
Indicating whether the two instances share the same class. A base classifier g is trained on the paired dataset.
Learning to distinguish similar from dissimilar pairs. At prediction time, a query point x is compared to a set of training anchors , producing scores
which estimate how likely x is to share its class with anchor . Aggregating these scores over anchors of each class k yields an estimate of the posterior class probabilities, from which the final prediction is obtained by selecting the class with the highest estimated probability.
Research gap. While the PDC framework is conceptually simple, it leaves several important implementation choices open. In practice, different PDC variants [4, 7, 1] differ at least along two dimensions: (i) the input representation used for the similarity model g, and (ii) the definition of the pair set P, that is, which pairs are generated and used for training and prediction. The original PDC variant of [1] adopts a specific encoding and an almost exhaustive triplet-based pairing scheme, which can be computationally expensive and may include many weakly informative pairs. To the best of our knowledge, there is no systematic comparison of alternative input formats and pairing strategies within a unified experimental protocol.
Contributions. We build on the PDC formulation of [1] and systematically study how these implementation choices affect its behaviour in practice. Our contributions are:
-
We compare three different input formats for the similarity model in PDC, varying how the two instances and their differences are represented in , and study their impact on predictive performance and computational cost.
-
We compare four pairing strategies for PDC, ranging from exhaustive to more selective schemes, and analyze how the choice of P influences accuracy, training time, and effective dataset size.
-
We conduct an empirical evaluation on a suite of benchmark classification datasets, providing practical guidance on which PDC design choices are most effective under different data and resource constraints.
Subsequent contributions focused on structured and additive modeling. [6, 8] developed pairwise strategies for structured data by applying Radial Basis Function (RBF) transformations to create augmented points, which are then paired with the original instances. In parallel and independently, [10] worked on both the theoretical and practical scope of pairwise learning in chemical data, proposing the method later adopted in PDC, where instances are paired using both their original features and their differences.
Further advances addressed automation and scalability. [15] demonstrated the feasibility of scaling pairwise models to large, complex datasets, marking a shift toward practical applicability. This direction was reinforced by [4], who emphasized evaluating pairwise models under heterogeneous and distributionally shifted data, using a pairing strategy based solely on absolute differences.[12] offered a critical perspective by analyzing the theoretical limitations of pairwise methods, informing more principled model design. Both approaches incorporated point selection algorithms, leveraging random subsampling of the majority class and k-nearest neighbors, respectively.
The most recent work has emphasized refinement and adaptation. [7] proposed adaptive pairwise strategies that allow models to dynamically adjust to evolving input distributions, highlighting the growing importance of flexibility in modern applications. Complementing this, [1, 2] introduced pairwise weighting mechanisms to balance data contributions during training, advancing fairness, generalization, and interpretability in pairwise learning frameworks.
B. Georges et al.
Regarding point selection, [5] proposed a coreset-based approach that reduces the original dataset by iteratively partitioning instances into two balanced subsets using kernel computations, followed by selecting the optimal subset as the resulting dataset.
3 Method
3.1 Feature representation of a pair of datapoints
A central design choice in PDC is how to represent a pair of inputs before passing it to the similarity model . Given two datapoints , an encoder
Maps the pair to a feature vector , which is then used to predict whether the two instances belong to the same class. Different encoders trade off information content, symmetry, and dimensionality, and may therefore lead to different accuracy-cost profiles.
In the following, we consider four natural encoders that are all compatible with the same PDC pipeline (same classifier g and same aggregation rule). They differ only in how the pair is represented.
Paired features ( ). The simplest encoder keeps only the original features of the two datapoints, without any explicit difference term, an approach used in several pairwise classification schemes [8, 6, 7]:
Here, the model is expected to infer useful similarity or difference patterns internally from the concatenated inputs. The dimensionality is 2d, and the encoder exposes the full original feature vectors to the classifier without imposing any particular structure on their relationship.
Triplet with relative difference ( ). A common PDC-style representation [10, 1] extends this idea by explicitly adding the signed, component-wise difference between the two inputs:
This encoder concatenates both inputs and their relative difference. The representation is directional: swapping i and j changes the sign of the last d components. The additional block provides the classifier with explicit information about how the two instances differ along each feature dimension.
Absolute difference ( ). A more compact alternative, inspired by SAME-style representations [4], discards the original features and keeps only the component-wise absolute difference:
where subtraction and absolute value are applied element-wise. This encoder is invariant to the order of the pair, i.e., , so symmetric pairs do not need to be generated. It has the lowest dimensionality among the encoders considered here, which may reduce computational cost, but it also removes information about the absolute position of and in feature space.
Triplet with absolute difference ( ). Finally, we propose a non-directional triplet representation that combines the full original features with an order-invariant difference term:
Compared to , this encoder removes the sign of the difference while retaining both original feature vectors. It therefore preserves essentially the same information, but it no longer encodes which of the two points is “larger” along a given dimension. This can simplify the learning task for g by making the representation less sensitive to the ordering of the pair, while still providing a rich description of both absolute and relative structure.
Illustrative example. To make the four encoders concrete, consider two Titanic passengers described by two numeric features: Age (in years) and Fare (ticket price in US dollars). Let
so that
Table 1 shows the resulting representations. For the same underlying pair , keeps only who the passengers are, keeps only how much they differ, augments the concatenation with signed differences, and combines the concatenation with absolute differences in a single feature vector.
3.2 Input pair selection
Beyond the feature encoder , PDC also depends on how many and which pairs are actually generated during training. Given a training set
The naïve construction forms all ordered pairs
B. Georges et al.
Table 1: Example of the four pair encoders on two Titanic passengers with features Age (years) and Fare (US$).
| Encoder | Output vector |
|---|---|
| (22, 8, 38, 72) | |
| (22, 8, 38, 72, -16, -64) | |
| (16, 64) | |
| (22, 8, 38, 72, 16, 64) |
Which can be visualized as an matrix of pairs. This “full grid” includes self-pairs on the diagonal and symmetric duplicates and off the diagonal. While this maximizes the number of training examples ( pairs), it also introduces redundancy and increases computational cost.
In this work, we model pair selection as an operator.
which indicates whether a pair is kept or discarded . We consider four patterns, which can be visualized as different “shadings” of the pair matrix.
All pairs . The baseline pattern keeps all ordered pairs, including both symmetric counterparts and the diagonal:
This setting maximizes the training set size but also maximizes redundancy between and , especially when is symmetric (e.g., absolute-difference encoders).
Unordered pairs . To remove symmetric duplicates while keeping self-pairs, we restrict to the upper triangle (including the diagonal):
Each unordered pair appears exactly once, and diagonal elements are retained. This preserves self-pairs, which can be interpreted as “perfect matches” and may serve as a useful reference for the similarity model.
non symmetric unordered pairs . A more aggressive reduction removes both symmetric duplicates and self-pairs by keeping only the strict upper triangle:
This pattern eliminates self-pairs and uses each unordered pair exactly once. It allows us to test whether self-pairs are actually beneficial or merely inflate the training set with easy, potentially uninformative examples.
Kernel thinning ( ). We additionally consider a data-dependent selection pattern called kernel thinning [5], in contrast to , and , which keep or discard pairs solely based on their position in the grid. Kernel thinning selects a subset of points that is well spread with respect to a chosen kernel, with the goal of producing a smaller training set that better represents the underlying distribution, thereby reducing imbalance and mitigating overfitting. Formally, it takes the original training set of size and returns a thinned subset of size approximately , where is a splitting parameter: each increment in doubles the number of thinning steps and halves the dataset size.
In our notation, denotes the mask induced by applying kernel thinning either before or after pair construction, and corresponds to the number of pairs that the similarity model receives. If thinning is applied before pairing, we first obtain of size data points and then build unordered pairs using . The resulting number of pairs is
If thinning is applied after pairing, we first construct of size and then thin the set of pairs by the same factor , yielding.
In practice, we restrict to small values (here ) to avoid excessively small training sets, and we primarily use pre-pairing thinning to better respect the i.i.d. assumption on the inputs. This data-adaptive mask therefore provides a fourth, complementary way to control the effective number of training pairs seen by PDC, trading off computational cost against distributional coverage.
Illustrative example. To visualize the effect of the different selection patterns, consider a toy dataset of four datapoints represented by the four card suits,
Table 2 shows how is transformed by the masks , , , and (with ). The first three patterns are purely index-based: they keep all pairs, only the upper triangle with diagonal, or only the strict upper triangle, respectively. The kernel-thinning pattern instead keeps half of the pairs (here illustrated by an arbitrary subset of cells).
4 Evaluation
4.1 Benchmarking datasets
The datasets used in these experiments are from the OpenML repository, [3]. These datasets were selected and used by [1], and in order to ensure consistency
B. Georges et al.
Table 2: Toy example of pair-selection patterns on . Each matrix entry denotes the ordered pair ; empty cells indicate discarded pairs. For with , an arbitrary half of the pairs are kept.
and continuity across all experimental runs, the PDC application contains a parquet file that contains the IDs of the used datasets. This list is then used to retrieve the datasets needed from the OpenML repository. Furthermore, in order to confirm the use of the same datasets across all analysis, in case of errors or other random events during execution, the meta-algorithm extracts key descriptors from the API and dataset, including the number of features, number of instances, class distribution and other 8 descriptor values that are then cross-verified to ensure that the identical datasets will be used across all comparisons and analyses done with the results.
PDC also performs some basic pre-processing on the datasets utilising the methods available in the [9] library. Namely, it uses OrdinalEncoder, OneHotEncoder and StandardScaler. After which, it drops columns containing null values. In the wake of the pre-processing, the data is then put through the cross-validation method that divides it into 5 folds. These steps were not altered, meaning that a faithful reproduction can be obtained through the algorithm presented in the original repository.
4.2 Base ML models
PDC is a meta-algorithm, meaning that it works on top of multiple ML models. These models have different paradigms, meaning different requirements and strategies. Due to this, 4 paradigms were chosen, each represented by a model. Decision Tree is our baseline model, meaning it will be used to test all initial approaches; the best results will then also be used with the other 3 models.
– Decision Tree (DT) - Its interpretability, simplicity, and ability to handle both categorical and numerical data make it one of the most widely used models.
– Multilayer Perceptron Classifier (MLP) - MLP is a neural network. These models are capable of approximating highly non-linear decision boundaries
– Gaussian Naïve Bayes Classifier (GNB) - A probabilistic model, meaning it computes the likelihood of each possible class and assigns the instance to the class with the highest probability.
– Support Vector Classifier (SVC) - based on the principles of Support Vector Machines (SVMs), it aims to find an optimal separating hyperplane in the feature space that maximises the margin between classes.
4.3 Metric
This study focused primarily on two metrics: accuracy and computational time. For accuracy, the selected metric was the score as it provides a balanced and interpretable measure of model performance and is particularly suited for evaluating imbalanced datasets, such as those generated by the PDL algorithm. The analysis further extends beyond individual dataset-specific scores to include the mean score, , computed across all datasets within a given experiment. As for computational performance, it is primarily assessed through the total execution time of each run, including training and testing time. To further validate the results, following the identification of the most effective improvements on these metrics, a t-test and Bayesian posterior coefficients are conducted to determine the statistical significance and validity of the results with 95% significance.
4.4 Results & Discussion
| All Pairs () | 0.804 ± 0.151 | 0.797 ± 0.154 | 0.810 ± 0.150 | |
| Time [min] | 81 | 68 | 81 | |
| UT w/ diagonal () | 0.806 ± 0.148 | 0.796 ± 0.155 | 0.810 ± 0.148 | |
| Time [min] | 43 | 50 | 44 | |
| UT w/o diagonal () | 0.806 ± 0.148 | N/A | 0.809 ± 0.147 | |
| Time [min] | 44 | N/A | 48 |
Table 3: score Comparison of different input combinations
As reported in Table 3, the method achieved the highest average scores. This was achieved both with and yielding 0.810, meaning improvements of 0.006 and 0.004 over the baseline, , respectively.
B. Georges et al.

Fig. 1: Histogram of the score difference of between a method and
Nonetheless, when closely examined and as presented in figure 1, presents higher amounts of big improvements, improvements greater than 0.05, while also having more deterioration, negative differences. These differentials demonstrate that even though presents higher averages than , the later still presents good functionalities in specific datasets. Furthermore, when examined closely and subjected to a paired statistical test such as Student -test, no statistically significant effects were detected meaning the improvements may have been too inconsistent.
The most substantial benefit of these representations lies instead within the method, which consistently presented the best or a slightly lower score with an average of decrease on the time taken to accomplish the experiments.
| Baseline | Before Pairing (m=1) | After Pairing (m=1) | After Pairing (m=2) | |
|---|---|---|---|---|
| Results (80 DS) | 0.838 | 0.811 | 0.838 | 0.825 |
| Time [min] | 7 | 7 | 209 | 147 |
Table 4: Comparison of and run time across Different Kernel Thinning Settings for 80 Datasets per experiment
For the point selection, the results did not present any improvements, with the best case when selection is done after pairing. Nonetheless, in this case, the computation complexity presents a major increase, with an increase of or 207 minutes, and no improvement in the accuracy.
With these results in mind, the best improvements and chosen methods to continue experimentation on the remaining 3 models were combined with and , and .
The notation for this figure is based on the original work with: and
| Model (num of datasets) | No PDL | ||||
|---|---|---|---|---|---|
| MLP (187 DS) | 0.759 ± 0.168 | 0.794 ± 0.168 | 0.810 ± 0.159 | 0.803 ± 0.162 | 0.794 ± 0.169 |
| GaussianNB (195 DS) | 0.727 ± 0.179 | 0.603 ± 0.230 | 0.691 ± 0.212 | 0.684 ± 0.215 | 0.327 ± 0.088 |
| SVC (70 DS) | 0.869 ± 0.152 | 0.871 ± 0.157 | 0.880 ± 0.141 | 0.880 ± 0.144 | N/A |
| Decision Tree (195 DS) | 0.782 ± 0.152 | 0.804 ± 0.151 | 0.810 ± 0.150 | 0.810 ± 0.148 | N/A |
Table 5: score of every experiment done in the different models
MLP presented the best improvement with 0.016 for this was closely followed by with 0.803. These results presented the general trend of all the results with having the highest score, closely followed by with either the same or a slight decrease. This came with great improvements in time and complexity. In the case of MLP, there was a decrease in time. These results, similarly to what happened to DT, did not present significance with the -test. Nevertheless, they did present a Bayesian probability higher than of being better than , which is significant.
As for GNB, the result showed the highest increase with an increase of 0.088 in between and . Nonetheless, this improvement is not enough to beat the base model without PDC, this being the only case where PDC presented a deterioration when compared to the model.
SVC maintains the trend with the highest result. This model, however, also showed the highest amount of prediction errors, with 10 datasets not being able to complete their predictions due to the model not predicting any instance as the class.

Fig. 2: Pie Chart of All Methods with Best Results per Dataset
Fig. 3: Pie Chart of the PDC Results vs Base Model Results per Dataset
For a final analysis, it was comprised all the scores across all the common datasets done through the experiment. The chart shows the amount of datasets in which each method presented the best result with a precision of 5 decimal
The notation for this figure is based on the original work with: , , , and .
B. Georges et al.
points. As seen in Figure 3 in its entirety PDC generally presented improvements in the score, with only 4 out of 70 cases reporting a better score in the base model. However, as presented in Figure 2, no single method consistently presents the best score, with the highest amount being presented by , 22 datasets which is 30% of the total datasets. This example further demonstrates the inconsistency of such methods, which achieve great improvements while also having a low averages.
5 Conclusion
A closer inspection of the prediction evaluation revealed that a significant improvement is possible on a per-dataset basis, where the PDL, when evaluated collectively in its different configurations, was able to reach the best score in most tested cases. Nevertheless, no single configuration can be distinguished as each presents some datasets in which it outperforms its peers. To pursue the idea of an optimiser that selects the most adequate configuration for a given field of application or dataset class is once again beyond the scope of this study.
In spite of the absence of statistical significance, the obtained results provided good insights into the working of the PDC algorithm, particularly in the design and evaluation of its training phase. During the study, some of the proposed modifications presented promising results, particularly with the pairing function demonstrating strong performance in three cases, namely when the meta-algorithm used either the DT, MLP, or SVC as its underlying base models. Moreover, the investigation into the training scope has also revealed an interesting trade-off. As training in the upper triangle, , has shown a statistically non-significant decrease in accuracy when compared to its full matrix counterpart, , it significantly decreased the complexity and time spent in training.
On the other hand, the research experimented with the use of point selection during the training phase, which was subsequently discarded as a valid enhancement feature. In fact, the point selection method resulted in a great increase in time with no gratification presented in return for its drawback. Beyond this, the results corroborated the finding mentioned in [1] regarding the ineffectiveness of the GNB classifier as a base model for the PDC meta-algorithm. The collected results presented with 95% certainty a significant decrease in scores when compared to other base models.
References
-
Belaid, M.K., Rabus, M., Hüllermeier, E.: Pairwise difference learning for classification. In: International Conference on Discovery Science. pp. 284–299. Springer (2024)
-
Belaid, M.K., Wibiral, T., Rabus, M., Hüllermeier, E.: Weighted Pairwise Difference Learning. In: proc. of LWDA'24. CEUR-WS.org, Würzburg (2024)
-
Bischl, B., Casalicchio, G., Feurer, M., Gijsbers, P., Hutter, F., Lang, M., Mantovani, R.G., van Rijn, J.N., Vanschoren, J.: Openml: A benchmarking layer on top of openml to quickly create, download, and share systematic benchmarks. NeurIPS (2021), https://datasets-benchmarks-proceedings.neurips.cc/paper_files/paper/2021/hash/c7e1249ffc03eb9ded908c236bd1996d-Abstract-round2.html
-
Corbara, S., Moreo, A., Sebastiani, F.: Same or different? diff-vectors for authorship analysis. ACM Transactions on Knowledge Discovery from Data 18(1), 1–36 (2023)
-
Dwivedi, R., Mackey, L.: Kernel thinning. Journal of Machine Learning Research 25(152), 1–77 (2024)
-
Izonin, I., Tkachenko, R., Dronyuk, I., Tkachenko, P., Gregus, M., Rashkevych, M.: Predictive modeling based on small data in clinical medicine: Rbf-based additive input-doubling method. Math. Biosci. Eng. (2021)
-
Izonin, I., Tkachenko, R., Havryliuk, M., Gregus, M., Yendyk, P., Tolstyak, Y.: An adaptation of the input doubling method for solving classification tasks in case of small data processing. Procedia Computer Science (2024)
-
Izonin, I., Tkachenko, R., Shakhovska, N., Lotoshynska, N.: The additive input-doubling method based on the svr with nonlinear kernels. Symmetry (2021)
-
Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., Vanderplas, J., Passos, A., Cournapeau, D., Brucher, M., Perrot, M., Duchesnay, E.: Scikit-learn: Machine learning in Python. Journal of Machine Learning Research 12, 2825–2830 (2011)
-
Tynes, M., Gao, W., Burrill, D.J., Batista, E.R., Perez, D., Yang, P., Lubbers, N.: Pairwise difference regression: a machine learning meta-algorithm for improved prediction and uncertainty quantification in chemical search. Journal of chemical information and modeling 61(8), 3846–3857 (2021)
-
Vitynskyi, P., Tkachenko, R.: Neiropodibna struktura dlya zadach prohnozuvannya v umovakh korotkykh vyborok danykh. Sci. Bull. UNFU (2019)
-
Wetzel, S.J.: How to get the most out of Twinned Regression (Jan 2023)
-
Wetzel, S.J., Ryczko, K., Melko, R.G., Tamblyn, I.: Twin neural network regression. Applied AI Letters 3(4), e78 (2020)
-
Wetzel, S.J., Ryczko, K., Melko, R.G., Tamblyn, I.: Twin neural network regression. Applied AI Letters 3(4), e78 (2022)
-
Xie, J., Kaiwei, C., Kong, L., Zhou, J., Qu, W.: Automated essay scoring via pairwise contrastive regression. In: proc. of the 29th COLING (2022)