3 ms·
Which things can be embedded as low-dimensional vectors? [edit] How exactly might these be used in LLMs? Personally, I know of Word2Vec, but I don't see its r
by ogogmad 4y ago
Which things can be embedded as low-dimensional vectors?
[edit]
How exactly might these be used in LLMs? Personally, I know of Word2Vec, but I don't see its relevance to LLMs like GPT.
- paulgb 4y agoThe typical use case is getting around prompt size limits for information retrieval tasks over large corpora. If you want to ask a question of a large corpus, you first use nearest-neighbor search in embedding space to retrieve snippets likely to contain the answer, and then stuff those snippets into the prompt.
- rnosov 4y agoFor example, you can look up semantically relevant ( to a user query ) paragraphs from some internal document. Then, include them in the LLM context so it would know how to answer the query. Basically, that's the idea behind many ChatGPT plugins.
- rolisz 4y agoThe use case is creating embeddings for paragraphs from documents. Then, when the user issues a query, you create an embedding for the query (you can also do more complicated stuff), you find the most similar embeddings from the documents and you insert those as context into ChatGPT so that it can rephrase the documents to answer the users question.
- losvedir 4y agoThis is fascinating, thanks for explaining this use case. It sounds like it's a fancy way to get a generic LLM to understand your domain by including the relevant context in a prompt. What about specializing the LLM in the first place? Could you fine-tune the model by training it on those internal documents instead? Then you don't need to mess about with the prompt, right, since the LLM has "learned" the data?
- alsodumb 4y agoIn context learning (i.e., tuning the LLM by adding all relevant info to prompts) seems to be preferred over fine-tuning. I'm not sure what exactly the reason is, perhaps because fine-tuning often doesn't make sense in a dynamic setting since it's fairly expensive? On the other hand, the only reason the entire pipeline for vector DB exists is because context size is relatively limited. I'd love to see a comparison between the two in terms of accuracy of the outputs and the degree of hallucinations.
- rolisz 4y agoWith fine-tuning you are training on a couple hundred thousand tokens, compared to the billions of tokens the original dataset the LLM was trained on. It won't have as much of an effect. Maybe the original dataset includes a company policy from 5 years ago and now you fine-tune on the new policy. It's hard to guarantee what the model will spit out. By giving the in-context prompt, it's more likely the model will choose the information you just gave it. Of course, there are use cases where fine-tuning is worth it. For example, someone recently finetuned a model on their Messenger group chat that was going on for years, about 500k messages, and now they have a model that can imitate all the members of the chat.
- avereveard 4y agoCurrent llm can only handle so much text per generation, are generally slow, and often you pay per token, so there's an incentive in using them sparingly. If you have a large text corpus to search that means restricting the search field with a query first, then feed the result on llm for extracting facts. So everything hinges on having an excellent search index to reduce the search space, and the best tool we have as of today is running a semantic search over representations of a text's topics in embedded format.
- marcinzm 4y agoMost LLM models are at a very high level very similar to Word2Vec in terms of inference on the encoder/non-generative side. Both convert a word/token into a vector representation. GPT does it contextually with all the other words in the input while Word2Vec does it independently for each word. One difference is that a LLM model can also create an "summary" embedding of all the words that's more than just a mean/max of the individual word embedding. So you can, for example, use a LLM to convert a document into a vector and then also use it to convert a search query into a vector. Then you can find the closest document vectors to the search vector.
- gdubs 4y agoTools like ChatGPT have a limit on how many tokens can fit into the context. So, let's say you want to converse with it about a specific book – and you want to minimize how much it hallucinates, or 'makes up' stuff about the book. You can't fit the entire book into the chat context. But, if you embed, say, each paragraph of the book as a vector then you can do the following: + Take the user message and embed it + Do cosine similarity between that message and all of the vectorized passages of the book to pull up the most relevant passages to the user message/question + Put just those passages into the context + Get a response from ChatGPT using that specific context. If you happened to see the "Generative Agents" paper that made a splash this week, this is the technique they used as part of the long-term memory retrieval and 'reflection' loop for their 'sims'.