DEV Community

Cover image for SmartKNN v2 — Bigger, Faster, Smarter. Coming Soon.
Jashwanth Thatipamula
Jashwanth Thatipamula

Posted on

SmartKNN v2 — Bigger, Faster, Smarter. Coming Soon.

SmartKNN started as a crazy idea:

How far can we push K-Nearest Neighbors if we remove every bottleneck… instead of accepting them?

V1 proved something important — KNN can still be used in production.
With weighted features, prototype compression, optimized distance rules and SmartKNN became a real production-ready tabular model.

Now it’s time for v2.

And v2 is not just an upgrade… it’s the beginning of the next era.


What’s coming in SmartKNN v2?

1. Native Classification Support

No more “only regression” limitation.
SmartKNN v2 automatically detects the target type and switches intelligently between:

Classification
Regression

One fit() -> SmartKNN knows what to do.
No configs. No confusion.


2. Faster Prediction (Like… way faster)

SmartKNN v2 integrates an ANN backend - but here’s the twist:

ANN finds the nearest candidates ->> SmartKNN’s brain finishes the job.

So we get:
ANN-level speed
SmartKNN-level accuracy

Best of both worlds. KNN doesn’t have to be slow anymore.


3. Full Vectorization

We’re removing raw Python loops (the main slowdown of KNN everywhere).

v2 uses full vectorization for distance math, weight computation and voting.

Result:

  • Faster training
  • Faster prediction
  • Scales better on bigger datasets

4. Smarter Feature Weights (Rethinking MI + LR + RF)

Right now SmartKNN uses a mix of:

  • Mutual Information
  • Linear Regression
  • Random Forest importance

It works insanely well… but it doesn’t scale to millions of rows.

For v2 we are experimenting with a new mathematical formula that:

  • doesn’t need huge computation
  • scales to massive datasets
  • keeps (or improves) accuracy

Not guaranteed to land in v2.
But research is happening.


The Philosophy of SmartKNN (still unchanged)

Even with ANN support and huge optimizations — SmartKNN v2 is not chasing maximum speed at the cost of accuracy.

The priority stays: accuracy + interpretability + simplicity
with better speed as a bonus.

This is just the classification entry + first speed boost.
The future will go even further.


Beyond v2 — What’s next?

After v2, SmartKNN will eventually ship with its own special ANN backend built only for SmartKNN conditions (not a generic ANN library).

That’s where we expect:

  • 10× prediction speed
  • Near Boosting models latency on CPU
  • Full explainability (unlike tree models)

The long-term mission:

Make a neighbour-based model that is fully production-grade for tabular ML.


Final Words

SmartKNN v2 is not about reinventing KNN.

It’s about proving that:

with the right engineering + math + shortcuts + structure,
KNN can be a modern production model — not a toy baseline.

Thank you to everyone supporting SmartKNN so far.
v2 is on the way. Stay tuned.


Stay Updated

Install SmartKNN

pip install smart-knn

Enter fullscreen mode Exit fullscreen mode

GitHub Repository
https://github.com/thatipamula-jashwanth/smart-knn

Benchmarks Page
https://www.kaggle.com/jashwanththatipamula

Release Announcements
(You can follow the repo to get notified when v2 drops)

Follow SmartKNN on GitHub

Jashwanth Thatipamula - Creator SmartKNN

Top comments (0)