3 ms·
I've been doing a lot of indie work with structured generation and llama.cpp, you can get extremely fast responses with caching and deterministic token skipping
by azeirah 3y ago
I've been doing a lot of indie work with structured generation and llama.cpp, you can get extremely fast responses with caching and deterministic token skipping.
When generating json, calling the llm when you already know that after
{ "brand": "Toyota"
Comes
, "year":
Is a massive waste. If the data itself is constrained too you can skip most of that too! You'll go down from needing 20 calls to the llm to just three for a simple piece of data like
{ "brand": "Toyota", "year": 1995 }
If they combine these techniques with a model that's specifically trained for structured output, along with a novel inference-time pruning technique that they were talking about in the post I can definitely see them getting these kinds of inference speeds.
I'm experimenting with a self hosted api that is fast enough to not even need a gpu for single user use cases (because the latency is good, but not batching). Once I'm done with the finishing touches I'll rent a GPU server for actual hosting.
- Incipient 3y agoHave you seen any blog posts that have some details on this? I can imagine, roughly, the concept but it sounds interesting and I'd like to get a better understanding.
- azeirah 3y agoYeah, dottxt has a post on this, it's a technique starting with a c I believe, something like continuum or something? The op also has something about compressing finite state machines, it's basically the same thing with slightly different details in the implementation.
- fzysingularity 3y agoCheck out outlines by .txt : https://github.com/outlines-dev/outlines https://github.com/outlines-dev/outlines sglang: https://arxiv.org/abs/2312.07104 https://arxiv.org/abs/2312.07104
- Incipient 3y agoThanks!