Papers › Efficient Task-Specific Data Valuation for Nearest Neighbor Algorithms

Efficient Task-Specific Data Valuation for Nearest Neighbor Algorithms

22 Aug 2019arXiv:1908.08619archive 2025-07-28

Ruoxi Jia, David Dao, Boxin Wang, Frances Ann Hubis, Nezihe Merve Gurel, Bo Li, Ce Zhang, Costas J. Spanos, Dawn Song

Given a data set 𝒟 containing millions of data points and a data consumer who is willing to pay for \Xto train a machine learning (ML) model over𝒟, how should we distribute thisX$ to each data point to reflect its "value"? In this paper, we define the "relative value of data" via the Shapley value, as it uniquely possesses properties with appealing real-world interpretations, such as fairness, rationality and decentralizability. For general, bounded utility functions, the Shapley value is known to be challenging to compute: to get Shapley values for all N data points, it requires O(2ᴺ) model evaluations for exact computation and O(NlogN) for (ϵ, δ)-approximation. In this paper, we focus on one popular family of ML models relying on K-nearest neighbors ($K$NN). The most surprising result is that for unweighted $K$NN classifiers and regressors, the Shapley value of all N data points can be computed, exactly, in O(NlogN) time -- an exponential improvement on computational complexity! Moreover, for (ϵ, δ)-approximation, we are able to develop an algorithm based on Locality Sensitive Hashing (LSH) with only sublinear complexity O(N^(h(ϵ,K))logN) when ϵ is not too small and K is not too large. We empirically evaluate our algorithms on up to $10$ million data points and even our exact algorithm is up to three orders of magnitude faster than the baseline approximation algorithm. The LSH-based approximation algorithm can accelerate the value calculation process even further. We then extend our algorithms to other scenarios such as (1) weighed $K$NN classifiers, (2) different data points are clustered by different data curators, and (3) there are data analysts providing computation who also requires proper valuation.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1908.08619")

Code

Syntology Ran 3 of 5 code samples harvested from 1 repository linked to this paper; 2 have no recorded run. Of those that ran: 1 ran · honoured contract; 2 ran · violated contract.

By repository: official repository: 5 samples from 1 repository, 3 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

AI-secure/KNN-PVLDB officialpytorch report
jiachen-t-wang/softlabel-knnsv mentioned on GitHubpytorch report
aai-institute/pyDVL pytorchLGPL-3.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

5 samples harvested; 3 ran; 1 honoured the contract we drafted; 2 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
2ran · violated contract
2unverified

Licence: 5 of the 5 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from AI-secure/KNN-PVLDB. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

f_h AI-secure/KNN-PVLDB/LSH_sp.py official repository ran · violated contract fingerprinted no licence file found · pointer only · 2e9cc8a495e67787 · report
g_unnormalize AI-secure/KNN-PVLDB/LSH_sp.py official repository ran · violated contract fingerprinted no licence file found · pointer only · e67e143e38420a4d · report
get_true_KNN AI-secure/KNN-PVLDB/exact_sp.py official repository ran · honoured contract fingerprinted no licence file found · pointer only · 5d1ed50303465971 · report
compute_single_unweighted_knn_class_shapley AI-secure/KNN-PVLDB/exact_sp.py official repository unverified no licence file found · pointer only · 88ac4fa8eb9856bc · report
get_contrast AI-secure/KNN-PVLDB/LSH_sp.py official repository unverified no licence file found · pointer only · 4ac9acba6d2f7887 · report

Tasks

Data ValuationFairness

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections