News for hackers. Stuff that matters.
Re:AI for AWS Documentation by underlines on Thursday July 06, 2023 @05:43PM (#36623497)
RAG is very difficult to do right. I am experimenting with various RAG projects from [1]. The main problems are:

- Chunking can interfer with context boundaries

- Content vectors can differ vastly from question vectors, for this you have to use hypothetical embeddings (they generate artificial questions and store them)

- Instead of saving just one embedding per text-chuck you should store various (text chunk, hypothetical embedding questions, meta data)

- RAG will miserably fail with requests like "summarize the whole document"

- to my knowledge, openAI embeddings aren't performing well, use a embedding that is optimized for question answering or information retrieval and supports multi language. SOTA textual embedding models can be found on the MTEB Leaderboard [2]. Also look into instructorEmbeddings

- the LLM used for the Q&A using your context should be fine-tuned for this task. There are several open (source?) LLMs based on openllama and others, that are fine tuned for information retrieval. They hallucinate less and are sticking to the context given.

1 https://github.com/underlines/awesome-marketing-datascience/...

2 https://github.com/embeddings-benchmark/mteb

Re:AI for AWS Documentation by darkteflon on Thursday July 06, 2023 @06:29PM (#36624104)
This comment was very helpful for me, thanks.

I’ve been working with RAG for months, too, and it’s vanishingly rare to see anything but toy examples in the wild. This is a solid, concise list of where the dragons are.

Any idea where all the RAG practitioners hang out and trade war stories? Is there a forum or Discord or something?

Re:AI for AWS Documentation by avereveard on Thursday July 06, 2023 @09:25PM (#36625798)
To solve the question embedding issue I prefer another approach, you store document embeddings as normal, then for searching you let LLM hallucinate an answer and use the wrongish answer embedding to do the vector search.
Re:AI for AWS Documentation by underlines on Friday July 07, 2023 @05:30PM (#36638584)
The inverse idea of Hypothetical Embeddings, HyDE [1] "HyDE is an embedding technique that takes queries, generates a hypothetical answer, and then embeds that generated document and uses that as the final example."

BriefGPT [2] is implementing this and it uses the following prompt at ingestion-time:

"Given the user's question, please generate a response that mimics the exact format in which the relevant information would appear within a document, even if the information does not exist. The response should not offer explanations, context, or commentary, but should emulate the precise structure in which the answer would be found in a hypothetical document. Factuality is not important, the priority is the hypothetical structure of the excerpt. Use made-up facts to emulate the structure. For example, if the user question is "who are the authors?", the response should be something like 'Authors: John Smith, Jane Doe, and Bob Jones' The user's question is:"

1 https://python.langchain.com/docs/modules/chains/additional/...

2 https://github.com/e-johnstonn/BriefGPT

Re:AI for AWS Documentation by cypress66 on Thursday July 06, 2023 @10:20PM (#36626219)
What context size is used? Can you "brute force" your way by using let's say 16k or 32k of context?
Re:AI for AWS Documentation by tomhamer on Thursday July 06, 2023 @10:26PM (#36626270)
Marqo provides automatic, configurable chunking (for example with overlap) and can allow you to bring your own model or choose from a wide range of opensource models. I think e5-large would be a good one to try. https://github.com/marqo-ai/marqo
Re:AI for AWS Documentation by d4rkp4ttern on Friday July 07, 2023 @08:08AM (#36630464)
Using Qdrant doesn’t require docker, like Marqo does (from the README). Any trade offs between the two? Doc chunking is an independent functionality and there are already line that help chunk with overlap etc,and also it’s not hard to roll your own.
Re:AI for AWS Documentation by zim1 on Friday July 07, 2023 @04:21AM (#36628800)
Have you found any particularly promising approach towards "hypothetical embeddings" that you can recommend?
Re:AI for AWS Documentation by d4rkp4ttern on Friday July 07, 2023 @08:10AM (#36630494)
That’s an interesting list (awesome-marketing-data science). Curious what is specific to marketing in that list, or maybe it’s just an inaccurate name.
Re:AI for AWS Documentation by underlines on Friday July 07, 2023 @05:21PM (#36638475)
historical repo name, it's really not that anymore, besides a very old list of marketing stuff that i rarely update. I should rename the repo, but I hesitate :)