Lurker News
Here's a project I've been working on for the last few months.

It's a new (I think) algorithm, that allows to adjust smoothly - and in real time - how many calculations you'd like to do during inference of an LLM model.
It seems that it's possible to do just 20-25% of weight multiplications instead of all of them, and still get good inference results.
I implemented it to run on M1/M2/M3 GPU. The mmul approximation itself can be pushed to run 2x fast before the quality of output collapses.
The inference speed is just a bit faster than Llama.cpp's, because the rest of implementation could be better, but with a better development I think it can be a new method to speed up inference - in addition to quantization.
You could call it ad-hoc model distillation :)
You can change the speed / accuracy of a model at will, in real time.
Oh, and as a side effect, the data format allows to also choose how much of the model you want to load into the memory. You can decide to skip say 10-20-40% of the least important weights.
It's implemented for Mistral, it was also tested slightly on Mixtral and Llama. It's for FP16 for now, but Q8 is in the works.
The algorithm is described here, and the implementation is open source.
https://kolinko.github.io/effort/
I know these are bold claims, but I hope they survive the scrutiny :)

Comments (114) 32 threads

Earlier comments
thelastparadise1 reply#
Name idea: lobotomize
kolinko#
YES! That was an idea I had a year ago actually! I wanted to lobotomize models, cutting out weights and leaving only functionality that we want. Unlike distillation it would be a much more brutal process.

The idea went nowwhere for the time being, but if I ever get back to it, the project surely will be called Lobotomizer.

brrrrrm2 replies#
do you have a simple python impl? :)
kolinko1 reply#
It originally started as a fork to Recmo’s cria pure numpy llama impl :)

https://github.com/recmo/cria
Took a whole night to compute a few tokens, but I used it to do the first tests.
Also, my friend pasted the paper to claude and it produced a working basic impl instantly :D
But in all seriousness - I think MLX implementation would be doable, or a wrapper to the Metal gou functionality

kwikiel1 reply#
Will share python implementation soon as a kind of executable pseudo code which then can be ported to any platform.

This project is kind of like ultimate nerdsnipe as math is quite simple, you don’t need PhD to understand it and actually implementing things would teach you linear algebra faster vs just mindlessly doing exercises sets.

kolinko#
Haha yes :) Publish it, Kacper!

The project is a nerdsnipe for math geeks, because there are multiple small things that beg to be proven / described by math there. For example - what's the tradeoff between the number of bits we loose when embedding position vs the bits of information that we gain by knowing which bucket a weight belongs to?
In other words - is it possible that when storing weights in the bucketed form we can actually end up having a higher precision than using a regular form? For Q8 we get just 4 bits to store the weight (and 1 bit for sign, and 3 bits for location), but these 4 bits need to express numbers from a smaller range than before.

brrrrrm1 reply#
not sure why I got downvoted for asking this. seems like a reasonable thing in the ML space

anyway here's a numerical simulation written in PyTorch for those who want to consider this algo on their projects before fully integrating: https://gist.github.com/bwasti/78d7058aad7f42dc893d906c877b7...
happy hacking

kolinko#
If you got downvoted, it was briefly. That was a good question. PyTorch/numpy is awesome for initial testing.
xrd3 replies#
My takeaway is that this proves what was said on the recent latent.space podcast with David Luan from Adept.

https://www.latent.space/p/adept
"I think is going to commoditize a lot of the regular LLMs and soon regular multimodal models."
In other words, if you train your own models, you will not get to take advantage of breakthroughs like this that start with open models (like Mistral).
All the advantages are going towards the open models and this is an existential risk for OpenAI and other closed model companies.

quadrature2 replies#
Maybe, but theres nothing that stops OpenAI from stealing these tricks.
refulgentis2 replies#
It's extremely unlikely anyone will take any of this.

Quick take:
- it was 15x slower than llama.cpp when I used Apple's new proprietary ML framework on my MacBook
- So I made it possible to skip arbitrary amounts of work.
- I identified an arbitrary tradeoff that seems arbitrarily good to me.
- I've confirmed this by making GPT-4 write some prompt with questions. Then I had the normal version answer, and the "skip arbitrary work" version answer, and it LGTM.
- So I threw it up on GitHub, then on HN with a title "LLM inference 2x faster (possibly)", and people missed: [on my laptop] [in the ML framework I'm forcing myself to use] [based on an eval I made up] [based on an an eval where I am the evaluator]
This *really* shouldn't have the title it does, very misleading.
Author, please feel free to correct me, I'm sorry for not taking the time to find a gentler way to communicate this. I hope you kick ass. You did put possibly in a parenthetical, but its carrying the weight of the world here, people just see LLM 2x faster. That's why everyone is spinning off into grand speculation land, which I also see you valiantly commenting to dissuade

kolinko2 replies#
The whole inference is slow, but it's matrix multiplications that count. They work reliably on all the Macbooks that I tested - at 50% effort it's the same speed as the state of the art matrix multiplications, at 25% they are twice as fast.

The apple's MPS matrix multiplications from Apple are comparable in speed to the speed of Llama.cpp and the other models. When I was doing tests, I was comparing the Llama.cpp benchmarks ( https://github.com/ggerganov/llama.cpp/discussions/4167 ) to Apple's MPS - they match very closely. And then I was comparing Apple's MPS to my results.
Even if the end-results would show that the models somehow break (which they might on Q8), there is no other implemented method right now that would give you such speedups with matrixes of 25% sparsity. The usual methods break even with full matrix multiplications around 15% mark, and show speed improvements under 10% (as far as I know, but I'm new to the field, so I wait to be corrected).
As for the other metrics - I hope to get help from the community to get the implementation done properly. So far it's been 3 months of work 12 hours a day - even during Easter - to get this version going. It is as far as I can push it without the community support, which I'm happy I received over the last hour.
Also, I'm not sure what you'd expect really. A full production ready system on the day one? From a solo developer? Seriously? :)
Let's get the flame war going! :D

Continue this thread — 2 replies

xrd3 replies#
I think you are commenting on the "stealing" reply and not my original comment. And, I think you are making my point stronger.

OpenAI could easily (and will) put out a blog post or tweet saying "next models do inference 2.5x faster!" Koliko did that, or maybe he didn't and someone else put words in his mouth. I don't really care: I can validate and test your comments here (and they are great!) and I can try his experiments myself.
I cannot do that against "GPT-5-2.5x faster (c) 2024"-42B (because it isn't released yet publicly). Putting a paper and some vague ideas on Arvix isn't really doing much these days except adding to the confusion. Truly open work like koliko is doing is really exciting and feels like it can only be done against truly open models like Mistral.
Oh wait, Mistral isn't fully open either (ducks...).

Continue this thread — 3 replies

littlestymaar2 replies#
Exactly, that's the problem with the current state of things with open models, the players that keep their secret sauce keep an edge over the people doing things in open while benefiting from all of their work without contributing back.
kolinko3 replies#
That was the claim with a lot of the software in the past, but open source won in many places in the end.

Continue this thread — 3 replies

Hugsun#
In these fast moving early times of LLMs, they can maintain this advantage with simple things like proprietary datasets and greater compute.

The difference in quality between the best model that can be made with such proprietary utilities and without is likely to decrease over time as open datasets of greater quality are published and the field matures.
The difference in quality and number of competitors ultimately pays the bills and the harsher the competition is, the less money there will be, for each individual company, to maintain their possibly dwindling proprietary edge.
The greater access to compute is an edge companies will likely hold for a while. It will be interesting to see how much open models will be able to catch up and how great of an edge proprietary models will maintain.

kolinko#
In this case though, the algorithm should be just as useful to closed models as to open models. There is nothing there that is optimised specifically for Mistral - aside from the hard-coded dimensions in multiple places in the code :D

Having said that, it's awesome to have open source models out there, and I hope they will ultimately win in the end.

Havoc#
That seems fundamentally flawed to me. Closed providers can copy techniques from open models but not vice versa.

To me that reads as closed will always be a step ahead not an existential risk to OpenAI.

kolinko1 reply#
Here to answer questions!

A friend of mine has published the original link on HN before me, so I hope a double post won't be an issue :)

kolinko#
Thx! Although I'm happy you took your time and now I can brag until the end of time that I got 2 out of 5 top slots for a moment :D

Load more comments