Implement simple kNN backend