News for hackers. Stuff that matters.
Re:Run and create custom ChatGPT-like bots with OpenChat by forgingahead on Wednesday June 07, 2023 @08:54AM (#36226175)
* Don't use a single embedding per content item, use multiple to increase retrieval quality

Can you share some specific examples of what you mean by this? How would you process specific info types (eg: news article, or web page, or product catalogue data) this way, and how would you handle retrieval that makes the quality "better"?

Re:Run and create custom ChatGPT-like bots with OpenChat by lgas on Wednesday June 07, 2023 @09:42AM (#36226695)
I'm curious about more sophisticated answers to this question, but the obvious approach would be to split the article or web page into sentences and do an embedding per sentence.
Re:Run and create custom ChatGPT-like bots with OpenChat by mrtranscendence on Wednesday June 07, 2023 @10:06AM (#36226944)
When I was playing around with search via embeddings (as a test I was using Vampire the Masquerade V5 sourcebooks, and asking rules questions), I got the best results -- in terms of correct answers -- by using sentence embeddings. I'd search the query against the sentence embeddings, and then retrieve more context surrounding the winning sentence(s). That context would be passed to the LLM.

It wasn't perfect, though. I'm tempted to try the avenue of having an LLM generate questions for each passage and then use those embeddings, but it sounds a bit expensive to set up given the length of the books.

Re:Run and create custom ChatGPT-like bots with OpenChat by lgas on Friday June 09, 2023 @09:04PM (#36266498)
Sentence embeddings + retrieving context makes sense.

By any chance, have you done any work with indexing code using embeddings? I'd like to do something similar there, but there's no obvious notion of "sentence", especially across languages.

Probably the closest analogue is just lines of code, but breaking lines on newlines might break an expression in the middle removing meaning from both halves.

I was planning on trying indexing overlapping groups of lines but haven't had time yet.

Re:Run and create custom ChatGPT-like bots with OpenChat by sandkoan on Wednesday June 07, 2023 @09:34AM (#36226610)
* * *
Re:Run and create custom ChatGPT-like bots with OpenChat by iamflimflam1 on Wednesday June 07, 2023 @09:50AM (#36226773)
There are a couple of things that can help. As has been pointed out by other commenters - chunking up content is very useful.

The other often neglected approach is to use an LLM to derive new content and use the embedding of this as well.

E.g. ask the LLM “give me a list of questions that can be answered by the following passage”

You then use embeddings of the generated questions instead of embeddings of the original content.

Re:Run and create custom ChatGPT-like bots with OpenChat by jerpint on Wednesday June 07, 2023 @09:58AM (#36226856)
another approach is HyDE, where you ask the LLM to come up with a plausible (but likely wrong) answer, and use the embedding of the wrong answer to find the appropriate chunk, pretty clever