SYSTEM NOTICE

Auto translation by AI. Be sure, accuracy, nuances and authorial intent may not be fully reflected.
見出し画像

[Digital MATSUMOTO's Observations (2024/9/6)] Is this a correct understanding of AI? 05 "I set up internal documents in RAG as they were... but that's why it's not working well"

This is the "Is this a correct understanding of AI?" series.
As a RAG use case, many companies are working on "search + procedure recommendation via dialogue with an LLM configured with internal documents in RAG," but"I just set up a set of internal documents in RAG, but I can't reach the correct document even when I talk to the LLM"isn't that a common occurrence?

Reference: Digital MATSUMOTO's RAG data status

I have written several countermeasures in my observations, but before starting RAG development, I think it is good to visualize thesimilarity of documents (chunks)set in the RAG data and look athow independent each document is.

The following is the cosine similarity taken from the vector data of 20 RAG data items recently added to Digital MATSUMOTO, and it shows the following trends.

  • The documents of each RAG data item are generally independent (mostly blue)

  • Documents related to the "Is this a correct understanding of AI?" series, RAG, and prompt engineering are somewhat similar (around 0.3 to 0.55)

Cosine similarity of 20 RAG data items in Digital MATSUMOTO

If the purpose is "I want to access only one document" like a document search, then"I want to access only one document"thenit is better for each document to be independent (mostly blue)but since Digital MATSUMOTO's purpose is
"to provide Matsumoto-style observations"it is desirable for RAG data to be in a state wheredocuments with similar themes are somewhat similar & independent from documents with distant themesso I recognize that the RAG data is in a good state.

* When I want to observe the theme of "AI," I aim for it to refer to multiple pieces of knowledge related to "AI" while observing, and not to refer to documents unrelated to "AI" in a strange way.

Today's topic

"Many companies seem to have examples where they just set internal documents into a RAG database as they are and built a system to search for documents with an LLM, but it doesn't work at all." Why do you think that is?

Real Matsumoto

Digital MATSUMOTO's answer

I believe the observation regarding this problem stems from a misunderstanding of the characteristics of RAG (Retrieval-Augmented Generation) and how to apply it. RAG is a technology for acquiring external information and extending the in-context learning of generative AI, but several elements are important for utilizing it effectively.

First, for RAG to function effectively, thequality of information registered in the databaseis important. Various companies take the approach of "setting internal documents into the RAG database as they are," but this method is not necessarily optimal. Ifdocuments are redundantorinformation is outdated or inaccurate, inaccurate information may be retrieved through RAG. This is due to the characteristic thatwhile RAG improves accuracy by providing factual information, it generates incorrect answers if given incorrect information.

Furthermore,how RAG is provided and written within the prompt also has a significant impact on system performance. If the prompt is not designed appropriately, it may not be able to answer questions correctly due to "writing styles that make it focus too much on RAG" or "insufficient trial and error in prompt writing." Therefore, when building a system using RAG, it is necessary to optimize boththe quality of the databaseandprompt design.

Also, when utilizing RAG,structuring documentsis important.Instead of simply registering documents, it is required to appropriately structure information and make it in a format that is easy to search. This enables faster and more accurate information retrieval, which can improve the accuracy of answers by the LLM.

Ultimately, to utilize RAG effectively, it is essential to understand the characteristics of the technology and perform appropriate data management and prompt design. If this is achieved, RAG has the potential to provide significant value to companies.

Digital MATSUMOTO

Execution model: gpt-4o {'temperature': 0.7}
Response time: 0:00:06.767326
Input tokens: 8089
Output tokens: 760

Referenced knowledge information

  • Is this a correct understanding of AI? 04: RAG improves accuracy when provided with factual information, but causes incorrect answers when provided with incorrect information

  • Is this a correct understanding of AI? 04: The importance of how RAG is provided and written within the prompt

  • Is this a correct understanding of AI? 04: Need to consider both database quality and prompt design

  • The truly important insights are found outside the company: The problems with using internal documents as they are

Comparative verification between MATSUMOTOs

Points that Real MATSUMOTO wanted included

The points that Real MATSUMOTO wanted included were as follows.

① If internal terminology is not standardized, there is a possibility that it will be interpreted with different meanings depending on the file
② Depending on the file format, headers/footers may be mixed in, and character codes such as line breaks and indents can become noise
③ If each document is not dispersed (has almost the same expressions), you cannot reach the file you really want to access
④ If it contains illustrations or diagrams, it is better to describe the illustrations or diagrams in words if possible and add them to the data
⑤ If specific goals are not set, you cannot correctly measure the effect of 'whether it went well'

Real MATSUMOTO

When I asked Digital MATSUMOTO if these points were reflected in the analysis...

①【✕】
The analysis text does not specifically mention the standardization of internal terminology. While the quality of the documents is mentioned, the difference in the interpretation of terms is not explained.

②【✕】→【〇】
The analysis text does not mention file formats, headers/footers, or noise. While there is a description regarding the quality of information, the specific problem of file formats is not mentioned.
(✅ Real MATSUMOTO's comment: I will add it, but since it touches on data quality, I will mark it as OK)

③【✕】
The analysis text does not mention the problem caused by documents not being dispersed. The difficulty of accessing documents with similar expressions is not mentioned.

④【✕】
The analysis text does not specifically mention adding descriptions for illustrations or diagrams. There is no description regarding additions to the data.

⑤【✕】
The analysis text does not mention specific goal setting. There is no description regarding goal setting for effect measurement.

Digital MATSUMOTO

So, this time 1/5 of the points were reflected.
※ I feel it can't be helped as these are too technical and detailed...

Points that Digital MATSUMOTO added

Conversely, the points that Digital MATSUMOTO added are as follows.

・How RAG is used within the prompt affects the accuracy of the answer
・Improving the quality of database information is important, and redundant, inaccurate, or old information leads to incorrect answers

Digital MATSUMOTO

Final version of the analysis

This time it is a B rating (partially added).

I believe the analysis of this problem stems from a misunderstanding of the characteristics of RAG (Retrieval-Augmented Generation) and how to apply it. RAG is a technology for retrieving external information and extending the in-context learning of generative AI, but several elements are important for utilizing it effectively.

First, for RAG to function effectively,the quality of the information registered in the databaseis important. Many companies take the approach of 'setting internal documents as they are into the RAG database,' but this method is not necessarily optimal.

🤖 Added by Digital MATSUMOTO) Especially when using internal documents for RAG, if internal terminology is not standardized, the same term may be interpreted with different meanings depending on the file.Also, ifthe documents are redundantorthe information is old or inaccurate, inaccurate information may be retrieved through RAG.🤖 Added by Digital MATSUMOTO) Furthermore, depending on the file format, headers and footers may be mixed in, and character codes such as line breaks and indents can become noise. For documents containing illustrations or diagrams, it is desirable to describe them in words if possible and add them to the data. By supplementing visual information as text information, it is possible to improve search accuracy.

How RAG is provided and written within the prompt also has a significant impact on system performanceIf the prompt is not designed appropriately, it may not be possible to answer questions correctly due to 'writing that makes RAG focus too much' or 'insufficient trial and error in prompt writing.' Therefore, when building a system using RAG, it is necessary to optimize boththe improvement of database qualityandprompt design.

Also, when utilizing RAG,structuring documentsis also important. Rather than simplyregistering documents, if you appropriately structure the information and make it in a format that is easy to search, it becomes possible to retrieve information more quickly and accurately, and the accuracy of answers by the LLM can be improved.🤖 Added by Digital MATSUMOTO) If many internal documents are not dispersed because they have almost the same expressions, even if you perform RAG, the user may not be able to reach the information they really need. Increasing the uniqueness of documents and organizing/classifying information is an approach to solving this problem.

🤖 Added by Digital MATSUMOTO) And if specific goals are not set, you cannot correctly measure the effect of 'whether it went well.' It is important to clarify the success goals of the project and evaluate the effect using quantitative indicators.

Ultimately, to utilize RAG effectively, it is essential to understand the characteristics of the technology and perform appropriate data management and prompt design. If this is realized, RAG has the potential to provide significant value to companies.

Digital MATSUMOTO

Ethical check

【Inappropriate expression category】
1. Discriminatory expressions: 0
2. Violent or offensive content: 0
3. Sexual content: 0
4. Disinformation or misinformation: 0
5. Leakage of confidential information: 0
6. Illegal content: 0
7. Inappropriate jokes or teasing: 0
8. Extreme opinions: 0
9. Content that promotes self-harm or suicide: 0
10. Content that promotes drug abuse: 0

Problem:
I do not see any particularly inappropriate expressions. The text analyzes the characteristics and effective utilization methods of RAG and presents concrete improvement measures. This content is within the scope of technical analysis and does not contain any ethically or legally problematic expressions.

Image of the analysis

Created using the DALL-E 3 API installed in Digital MATSUMOTO

いいなと思ったら応援しよう!