This library is targeting production, a much smaller subset of engineers. See the 'why candle' section: https://github.com/huggingface/candle#why-candle. So you could use PyTorch to build models and Candle to serve them.
3,901 karma · joined March 30, 2014
This library is targeting production, a much smaller subset of engineers. See the 'why candle' section: https://github.com/huggingface/candle#why-candle. So you could use PyTorch to build models and Candle to serve them.
The tricky thing is that finetuning makes a big difference, and while it should be possible to hotswap LoRA adapters (at some cost to performance), I haven't figured that out yet.
it's reasonably straightforward for me to host this and serve public requests, but would likely just be a base model -- not sure if hosting (eg) 13B chat can serve peoples' use cases
- necessary functions / use cases (eg prefiltering, dense search)
- embeddings version management
- anticipated embedding size (the article only considers glove-100 on ANN-benchmarks, which is quite different from openai-ada-002 1536 - both in terms of their output distribution and the vector size)
- required precision / recall
- required ingestion speed
- required ingestion throughput / time to ingest periodic updates
- required query speed (percentiles, not average!)
- required query throughput
- required RBAC, data privacy, active-active, etc
...and so much more. ANN-benchmarks is a good start for thinking about this but remember that actual throughput is quite different from whatever you see in the algorithms benchmarking!This may not matter if you are not doing high throughput / have tight latency requirements, but in my case, it did. Of course you should weigh that versus the convenience of preexisting ES/OS clusters and so on. You can also use ES/OS together with a separate vector DB. (these tradeoffs are, of course, what make a static benchmarking post like this one so hard to think about).
Define a struct and tag it with golang's json comments. Then, give it a prompt and ...
type dinnerParty struct {
Topic string `json:"topic" jsonschema:"required" jsonschema_description:"The topic of the conversation"`
RandomWords []string `json:"random_words" jsonschema:"required" jsonschema_description:"Random words to prime the conversation"`
}
completer := openai.NewClient(os.Getenv("OPENAI_API_KEY"))
d := gollum.NewOpenAIDispatcher[dinnerParty]("dinner_party", "Given a topic, return random words", completer, nil)
output, _ := d.Prompt(context.Background(), "Talk to me about dinosaurs")
and you should get a response like expected := dinnerParty{
Topic: "dinosaurs",
RandomWords: []string{"dinosaur", "fossil", "extinct"},
}the same logic extends to using a self-hosted embedding model, which tend to be as good as Ada on most benchmarks, and yes, can be finetuned over your private data.
FWIW - Weaviate's pure Go implementation of cosine similarity is probably as fast as you can possibly get in pure go, without SIMD -- https://github.com/weaviate/weaviate/blob/2f44dbee52196656bd...
FWIW exhaustive search is still probably good enough for most use cases. IMO the exhaustive search should use a heap https://github.com/fennel-ai/fann/blob/main/src/main.rs#L12 as you're only looking for top-k, it reduces time and memory complexity greatly. On a relatively unoptimized Golang implementation (though much beefier hardware) I get ~100ms to process 1M vectors of 300 dim. Still quite a bit slower than approximate, of course, but in absolute terms probably good enough for most use cases, especially because many use cases don't have 1M vectors.
The wrapper is pretty straightforward, I can see how it's a teensy bit simpler to have Vercel manage things for you, but it's not really much easier...
GPT-4 gives a better response fwiw:
``` graph TB Start(Start) --> A[Insert one end of the shoelace into the bottom left eyelet] A --> B[Make sure the lace is even on both sides] B --> C[Cross right end over the left end] C --> D[Insert the right end into the second eyelet on the left side] D --> E[Pull laces tight] E --> F[Cross left end over the right end] F --> G[Insert the left end into the second eyelet on the right side] G --> H[Pull laces tight again] H --> I[Continue lacing the shoe in a crisscross pattern] I --> J[Reach the top of the shoe] J --> K[Tie laces in a bow or knot] K --> End(End) ```
Agree the formatting is not great. The tool is not intended to be 'perfect', with respect to formatting or to content, so if I continue working on this, I think the most useful step would be to add "export to Figma" -- and let you tweak there. I think this is most useful as a very fast prototyping tool.
There are quite a few other similar CLI's, but this is the only one that I'm aware of which implements streaming completions and has zero external dependencies (self-contained build, OS-agnostic).
In particular re Medium:
> On the backend, the way [Medium's] partner program works is that users’ membership fees are allocated proportionally to the writer based on how many articles the user read. Fine. Also there is something about clapping. I guess if I really like a writer I could make sure to read a lot of their articles so they can get some of that membership fee. But, as a consumer, I: a. can’t subscribe directly to the writer, and b. can’t signal that I value their content at more than $5 per month. No amount of claps can make up for that!
Writers and readers both don't get the right amount of value from their framework.