-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f7389b
commit fa43e4a
Showing
41 changed files
with
219 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
![[Pasted image 20240716000730.png]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
![[Pasted image 20240715234606.png]] | ||
|
||
[[LLMs, chunking strategies]] | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
![[Pasted image 20240716000446.png]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
![[Pasted image 20240716000853.png]] | ||
|
||
LLMs can acquire new information in at least two ways: | ||
1. Fine-tuning | ||
2. RAG (retrieval augmented generation) | ||
|
||
Retrieval-augmented generation (RAG) is the practice of extending the “memory” or knowledge of LLM by providing access to information from an external data source. | ||
|
||
Traditional semantic search consists of a two-part process. | ||
First, an initial retrieval mechanism does an approximate sweep over a collection of documents and creates a document list. | ||
|
||
Then, a re-ranker mechanism will take this candidate document list and re-rank the elements. With [[Rerank]], we can improve your models by re-organizing your results based on certain parameters. | ||
|
||
Why is Re-Ranking Required ? | ||
⮕ The recall performance for LLMs decreases as we add more context resulting in increased context window(context stuffing) | ||
|
||
⮕ Basic Idea behind reranking is to filter down the total number of documents into a fixed number . | ||
|
||
⮕ The re-ranker will re-rank the records and get the most relevant items at the top and they can be sent to the LLM | ||
|
||
⮕ The Reranking offers a solution by finding those records that may not be within the top 3 results and put them into a smaller set of results that can be further fed into the LLM | ||
|
||
Reranking basically enhance the relevance and precision of retrieved results. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
![[Pasted image 20240715235013.png]] | ||
|
||
⮕ [[Unstructured Data]] (Text): This includes plain text documents, web pages, and other free-form textual sources. | ||
|
||
⮕ [[Semi-Structured Data]] (PDF): PDF documents, such as research papers, reports, and manuals, contain a mix of textual and structural information. | ||
|
||
⮕ [[Structured Data]] (Knowledge Graphs): Knowledge graphs, such as Wikipedia and Freebase, represent information in a structured and interconnected format. | ||
|
||
⮕ [[LLM-Generated Content]]: Recent advancements have shown that LLMs themselves can generate high-quality content that can be used as a retrieval source. This approach leverages the knowledge captured within the LLM's parameters to generate relevant information. | ||
|
||
All this data gets converted into embeddings and gets stored in a vector database. When a user query comes in, it also gets converted into an embedding (query embedding) and the most relevant answer will be retrieved using semantic search. The vector database becomes knowledge base to search for the contextually relevant answer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
![[Pasted image 20240716000053.png]] | ||
|
||
But to make RAG work perfectly, here are some key points to consider: | ||
1. Quality of External Knowledge Source | ||
|
||
2. [[Embedding Mode]]l: The choice of the embedding model used for retrieving relevant documents. | ||
|
||
3. [[Chunking]] Size & Retrieval Strategy: Experiment with different chunk sizes to find the optimal length for context retrieval. | ||
|
||
4. Integration with Language Model: The way the retrieved information is integrated with the language model's generation process is crucial. | ||
|
||
5. Evaluation & Fine-tuning: Evaluating the performance of the RAG model on relevant datasets and tasks is important to identify areas for improvement. | ||
|
||
6. Ethical Considerations: Ensure that the external knowledge source is unbiased and does not contain offensive or misleading information. | ||
|
||
7. Vector database: Having a vector database that supports fast ingestion, retrieval performance, hybrid search is utmost important. | ||
|
||
8. LLM models: Consider LLM models that are robust and fast enough to build your RAG application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
![[Pasted image 20240715235811.png]] | ||
|
||
Retrieval component, Augmentation component, Generation component. | ||
|
||
⮕ [[Retrieval]]: This component helps you fetch the relevant information from the external knowledge base like a vector database for any given user query. This component is very crucial as this is the first step in curating the meaningful and contextually correct responses. | ||
|
||
⮕ [[Augmentation]]: This part involves enhancing and adding more relevant context to the retrieved response for the user query. | ||
|
||
⮕ [[Generation]]: Finally, a final output is presented to the user with the help of a large language model (LLM). The LLM uses its own knowledge and the provided context and comes up with an apt response to the user’s query. | ||
|
||
These three components are the basis of a RAG pipeline to help users to get the contextually-rich and accurate responses they are looking for. That is the reason why RAG is so special when it comes to building chatbots, question-answering systems, etc. | ||
|
||
Along with RAG, AI frameworks like LangChain and LlamaIndex make the LLM-applications more efficient by providing the required toolkit. | ||
|
||
Let’s build a simple AI application that can fetch the contextually relevant information from our own data for any given user query. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
![[Pasted image 20240716000624.png]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
![[Pasted image 20240716000406.png]] |
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.