Method for optimizing retrieval and response generation based on rag, and apparatus for performing the same

KR102999080B1Active Publication Date: 2026-08-03LE MONT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
KR1020250140951
Authority / Receiving Office
KR · KR
Patent Type
Patents
Current Assignee / Owner
Filing Date
2025-09-29
Publication Date
2026-08-03
Estimated Expiration
2045-09-29

Smart Images

  • Figure 112025110863752-PAT00004_ABST
    Figure 112025110863752-PAT00004_ABST
Patent Text Reader

Abstract

A method for optimizing RAG-based search and response generation is disclosed. A method according to one aspect of the technical concept of the present disclosure comprises: a step of searching for document-unit data related to a query from a search database using RAG parameters; a step of generating a response to a query using a large-scale language model having the document-unit data as a context; a step of calculating an accuracy index of the response using a query-response dataset; a step of searching for combinations of multiple RAG parameters based on the accuracy index; a step of searching for document-unit data related to a query; a step of generating a response; a step of calculating an accuracy index; and a step of repeating the step of searching for combinations of multiple RAG parameters N times (N is a natural number); when the step of searching for combinations of multiple RAG parameters is completed, a step of determining a combination of RAG parameters that maximizes the accuracy index; and a step of generating a final response to a query using a large-scale language model by applying the determined combination of RAG parameters, and displaying the generated final response through a user interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technology Field

[0001] The technical concept of the present disclosure relates to a method for optimizing RAG-based search and response generation and an apparatus for performing the same, and more specifically, to a method for providing a framework that finds a combination of RAG parameters that exhibits optimal performance for a specific set of documents in a document database-based RAG system. Background Technology

[0003] Recently, Retrieval-Augmented Generation (RAG) technology has garnered attention as a key technique for improving response quality in Large Language Models (LLMs). A RAG system comprises two main stages. These two main stages are a search stage, which divides unstructured documents into specific chunks, embeds them, and stores them in a vector database (Vector DB); when a user query is input, it retrieves k relevant chunks through similarity-based search. The second stage is a response generation stage, which provides the retrieved chunks as context for the LLM, enabling the LLM to generate richer and more accurate answers.

[0004] In this context, unstructured documents refer to text data with an irregular structure, such as lecture subtitles, reports, emails, theses, manuals, and legal documents; for large-scale language models to process these documents, a process of dividing them into fixed units is required first.

[0005] Dividing unstructured documents into chunks not only overcomes the limitations on input length that large-scale language models can process at once, but also enables comparison by semantic unit during searching, thereby providing accurate and highly relevant search results.

[0006] Each partitioned chunk is converted into a numeric vector through the embedding process, and these vectors are stored in a vector database. Embedding is a technique that represents the meaning between sentences in a high-dimensional numerical space, enabling semantic search rather than simple keyword matching. When a user enters a query, the query is also vectorized through the same embedding model, and the top k most relevant chunks are retrieved by calculating their similarity (e.g., cosine similarity) with the stored chunk vectors.

[0007] The chunks retrieved through the search phase are provided together with the input context of a large-scale language model, and the LLM generates an answer based on this. At this stage, rather than simply outputting the search results as is, the inference capabilities of the large-scale language model can be utilized to construct a logical and consistent response that fits the query. The problem to be solved

[0009] In RAG systems, decisions regarding document preprocessing, chunk size and overlap ratios, and the number of documents to retrieve or similarity criteria significantly impact the system's performance. However, the optimal combination of these factors varies greatly depending on the characteristics of the corpus, requiring re-searching for each corpus. Previously, finding the optimal combination required manual settings by humans or exhaustive search.

[0010] Furthermore, there is a problem in that the search space for RAG parameter combinations in the RAG system becomes very large in order to find the optimal combination. For example, combinations increase multiplicatively through document splitting methods (5 types) x chunk size (10 levels) x overlap ratio (10 levels) x number of searches (10 levels), requiring millions to tens of millions of iterations for brute-force search. Ultimately, existing RAG systems suffer from the problem of high execution costs and time consumption associated with large-scale language models. Since the cost of calling large-scale language models is substantial, brute-force search was practically impossible; moreover, there is inefficiency because the optimal combination varies depending on the nature of the document, requiring adjustments every time. For instance, lecture subtitle data, exam question data, and legal document data each require different optimal RAG settings.

[0011] Accordingly, the present disclosure is devised in response to the aforementioned background technology and the search and response generation technology of existing RAG systems, and relates to a method for optimizing RAG-based search and response and an apparatus for performing the same, which automatically searches for combinations of multiple RAG parameters, measures and verifies the accuracy of responses of large-scale language models using Q&A datasets, and finds the optimal combination of RAG parameters with only a limited number of searches.

[0012] However, the problems to be solved in this disclosure are not limited to those mentioned above, and other unmentioned problems may be clearly understood based on the description below. means of solving the problem

[0014] A method according to one embodiment of the present disclosure is disclosed for realizing the aforementioned objectives. The method comprises the steps of: searching for document unit data related to the query from a search database using RAG parameters; generating a response to the query using a large-scale language model having the document unit data as a context; calculating an accuracy index of the response using a query-response dataset; searching for combinations of a plurality of RAG parameters based on the accuracy index; repeating the steps of searching for document unit data related to the query, generating the response, calculating the accuracy index, and searching for combinations of a plurality of RAG parameters N times (N is a natural number); determining the combination of RAG parameters that maximizes the accuracy index when the step of searching for combinations of a plurality of RAG parameters is completed; and generating a final response to the query using the large-scale language model by applying the determined combination of RAG parameters, and displaying the generated final response through a user interface.

[0015] A computing device for optimizing RAG-based search and response generation according to one embodiment of the present disclosure for realizing the aforementioned tasks is disclosed. The above device comprises a processor including at least one core, a memory including program code executable on the processor, a network unit for receiving a query from a user device, and a user interface for displaying a final response and optimization process for the query. The processor is configured to perform the following steps: searching for document-unit data related to the query from a search database using RAG parameters; generating a response to the query using a large-scale language model with the document-unit data as a context; calculating an accuracy index of the response using a query-response dataset; searching for combinations of multiple RAG parameters based on the accuracy index; and repeating the steps of searching for combinations of multiple RAG parameters N times (N is a natural number), and when the step of searching for combinations of multiple RAG parameters is terminated, determining the combination of RAG parameters that maximizes the accuracy index. Effects of the invention

[0017] According to the search optimization method for a RAG system and the apparatus for performing the same of the technical concept of the present disclosure, by automatically searching for various parameters such as document splitting size, overlap ratio, number of chunks to be retrieved during search (k), and embedding model, the response accuracy of the RAG can be significantly improved compared to manual settings or the use of default values. Through this, more relevant and reliable answers can be provided to the user's questions.

[0018] The present disclosure enables achieving the same or better optimization results with only a limited number of searches for optimal parameter combinations. This saves the cost of large-scale language model calls and computational resources, and reduces optimization time, thereby increasing system operational efficiency.

[0019] The present disclosure can automatically find a combination of parameters optimized for a document by considering the characteristics of the document set. Therefore, a domain-specific RAG pipeline can be constructed by performing separate optimization processes for different fields and datasets.

[0020] The present disclosure provides a user interface in the form of a sidebar and a chatbot, allowing even users without programming knowledge to intuitively perform parameter settings and experiments. Additionally, operational convenience is improved by enabling monitoring and analysis of the exploration process and results through a dashboard and visualization pages.

[0021] The present disclosure performs optimization on the entire dataset during the initial setup of the RAG system and enables updates through periodic partial optimization without a full re-search, even when some new documents are added thereafter. This allows for efficient operation even in large-scale databases (with chunk sizes ranging from millions to tens of millions) and minimizes the cost burden when expanding the system.

[0022] The present disclosure enables optimization based on objective and quantitative criteria by automating the parameter selection process, which previously relied on expert experience and manual work. This reduces deviations caused by subjective human judgment and provides consistent and reproducible RAG optimization results. Brief explanation of the drawing

[0024] FIG. 1 is a conceptual diagram of a system for optimizing RAG-based search and response generation according to one embodiment of the present disclosure. FIG. 2 is a block diagram of a RAG-based search and response generation optimization device according to one embodiment of the present disclosure. FIG. 3 is a block diagram of a RAG-based search and response generation optimization device according to one embodiment of the present disclosure. Figure 4 is an example diagram illustrating the entire processing process of a RAG-based search and response optimization system. FIGS. 5 and 6 are drawings illustrating the configuration of a user interface of a RAG-based search and response generation optimization system according to one embodiment of the present disclosure. FIG. 7 is a diagram illustrating the configuration of a user interface of a RAG-based search and response generation optimization system according to one embodiment of the present disclosure. FIG. 8 is a diagram showing an example of a question-and-answer dataset according to one embodiment of the present disclosure. FIG. 9 is a diagram illustrating the configuration of a user interface of a RAG-based search and response generation optimization system according to one embodiment of the present disclosure. FIG. 10 is a flowchart illustrating a method for optimizing RAG-based search and response generation according to one embodiment of the present disclosure. Specific details for implementing the invention

[0025] Specific structural or functional descriptions of embodiments according to the concept of the present invention disclosed herein are provided merely for the purpose of explaining embodiments according to the concept of the present invention, and embodiments according to the concept of the present invention may be implemented in various forms and are not limited to the embodiments described herein.

[0026] Embodiments according to the concept of the present invention may be subject to various modifications and may take various forms; therefore, embodiments are illustrated in the drawings and described in detail in this specification. However, this is not intended to limit the embodiments according to the concept of the present invention to specific disclosed forms, and includes modifications, equivalents, or substitutions that fall within the spirit and scope of the present invention.

[0027] Terms such as "first" or "second" may be used to describe various components, but said components shall not be limited by said terms. For the sole purpose of distinguishing one component from another, for example, without departing from the scope of rights according to the concept of the present invention, the first component may be named the second component, and similarly, the second component may be named the first component.

[0028] When it is stated that one component is "connected" or "connected" to another component, it should be understood that while it may be directly connected or connected to that other component, there may also be other components in between. Conversely, when it is stated that one component is "directly connected" or "directly connected" to another component, it should be understood that there are no other components in between. Expressions describing the relationships between components, such as "between," "exactly between," or "directly adjacent to," should be interpreted in the same way.

[0029] The terms used herein are used merely to describe specific embodiments and are not intended to limit the invention. Singular expressions include plural expressions unless the context clearly indicates otherwise. In this specification, terms such as “comprising” or “having” are intended to specify the existence of the described features, numbers, steps, actions, components, parts, or combinations thereof, and should be understood as not precluding the existence or addition of one or more other features, numbers, steps, actions, components, parts, or combinations thereof.

[0030] Unless otherwise defined, all terms used herein, including technical or scientific terms, have the same meaning as generally understood by those skilled in the art to which the present invention pertains. Terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant technology, and should not be interpreted in an ideal or overly formal sense unless explicitly defined in this specification.

[0032] In this specification, the term "document" does not refer merely to a simple text file, but rather to a document encompassing all units of information referenced for searching and generating responses to a user's query. A "document" is a unit of knowledge stored in an external knowledge repository (Corpus) to construct an answer to a user's query, and is an information block consisting of one or more texts, image descriptions, tables, codes, or combinations thereof that are utilized as search targets in a RAG system.

[0033] In this specification, the term 'processor' may refer to hardware capable of performing functions and operations according to each name described in this specification, computer program code capable of performing specific functions and operations, or an electronic recording medium loaded with computer program code capable of performing specific functions and operations.

[0034] In other words, the term "processor" may refer to a functional and / or structural combination of hardware for carrying out the technical concept of the present invention and / or software for driving said hardware.

[0036] Hereinafter, embodiments will be described in detail with reference to the attached drawings. However, the scope of the patent application is not limited or restricted by these embodiments. Identical reference numerals in each drawing indicate identical components.

[0038] FIG. 1 is a conceptual diagram of a system for optimizing RAG-based search according to one embodiment of the present disclosure.

[0039] Referring to FIG. 1, a system (1000) for optimizing RAG-based search and response generation according to one embodiment of the present disclosure includes a user device (100), a user interface providing device (200) (hereinafter, a RAG-based search and response generation optimization device (200)), and / or a database (20). According to an embodiment, the system (1000) for optimizing RAG-based search and response generation may include a plurality of users.

[0040] A RAG-based search and response generation optimization device (200) according to one embodiment of the present disclosure can receive a query from a user through a user device (100).

[0041] For example, a query received from a user through a user device (100) may be, "Which of the following is not a correct three elements of architecture by the ancient Roman architect Virudvius?" The user's "query" may be composed of at least one word, at least one phrase, or at least one sentence, but this is merely an example and may be a query of a different form depending on the user's choice or request for service, and the form of the query does not limit the scope of the rights of the present invention.

[0042] A RAG-based search and response generation optimization device (200) according to one embodiment of the present disclosure can generate a response to a query. The generated response can be conveyed to a user through a user interface screen of a user device (100) and / or a user interface screen of a RAG-based search and response generation optimization device (200).

[0043] A RAG-based search and response generation optimization device (200) according to one embodiment of the present disclosure can optimize the RAG-based search step so as to improve the quality of the response to the query.

[0044] The RAG-based search and response generation optimization device (200) can automatically search for combinations of RAG parameters, which are sets of parameters representing document splitting rules, overlap ratios, search counts, embedding models, etc.

[0045] Specifically, the RAG-based search and response generation optimization device (200) can search for document-unit data related to the query from a search database using RAG parameters. Here, document-unit data refers to a minimum unit of data block (e.g., a chunk) created to allow the system (1000) for optimizing RAG-based search and response generation to divide and process predetermined documents or unstructured data into units of a fixed size. The RAG-based search and response generation optimization device (200) can generate a response to a query by using a large-scale language model that uses document-unit data as context. The RAG-based search and response generation optimization device (200) can calculate an accuracy indicator of the response using a question-response dataset. Here, a question-response dataset refers to a set of data consisting of question-correct answer pairs that includes the correct response corresponding to a given user's query. In this specification, the 'accuracy indicator' may also be referred to as 'performance'. The RAG-based search and response generation optimization device (200) can search for combinations of multiple RAG parameters based on an accuracy indicator. The steps of searching for document-unit data related to the query, generating the response, calculating the accuracy indicator, and searching for combinations of multiple RAG parameters, that is, the three steps described above, can be referred to as a single 'search process'. The RAG-based search and response generation optimization device (200) can repeat the search process N times (N is a natural number), and repeating the search process N times can be referred to as a 'repeated search process' or an 'optimization process'. During the optimization process, the accuracy indicator that changes repeatedly, the fact that the number of repetitions is N times, and the RAG parameters that change repeatedly can be displayed on the user interface.

[0046] When searching for document unit data related to the above query, RAG parameters may be set randomly initially. Here, RAG parameters are a series of variable(s) set to optimize the performance of the retrieval and response stages in a system (1000) for optimizing RAG-based search and response generation, and include parameters representing document splitting methods, document chunking parameters, document retrieval parameters, embedding model parameters, database parameters, etc. Document chunking parameters, document retrieval parameters, embedding model parameters, and database parameters may be referred to as element parameters.

[0047] There are various strategies for splitting documents, such as character count, sentence, or paragraph-based splitting, as well as recursive or semantic-based splitting. A document splitting method refers to a document chunking strategy.

[0048] Document splitting parameters are parameters related to document splitting and can be defined as parameters set to split documents into searchable units. Document splitting is performed during the initial preprocessing stage of a RAG system and significantly impacts search accuracy and speed. Document splitting parameters may represent the length of document-unit data or the length of overlap between document-unit data. When splitting documents, it is common practice to include overlap areas to prevent contextual disconnection between different document-unit data, which consequently introduces overlap between document-unit data.

[0049] Document search parameters can be defined as parameters set to search for the documents most relevant to a user's query. Document search parameters are configured during the document search phase to efficiently retrieve document-level data that is highly relevant to the user's query. Document search parameters may represent the number of documents to be retrieved during a search, the number of top-level document data to be returned, the method for calculating similarity between vectors, and the minimum similarity score of the search results.

[0050] An embedding model refers to a model that vectorizes the semantics of documents and queries. Embedding model parameters indicate the type of embedding model used.

[0051] Database parameters can be parameters that indicate what type of database structure is being used.

[0052] A combination of RAG parameters refers to a combination of multiple element parameters. For example, a combination of RAG parameters may consist of a document splitting parameter that defines splitting documents into 400-character units and applying about 30% overlap, a document search parameter that defines retrieving the top 4 documents from the database during a search and sorting the search results based on cosine similarity, an embedding parameter that defines using a BERT model, and a database parameter that defines a vector database structure.

[0053] A RAG-based search and response generation optimization device (200) according to one embodiment of the present disclosure can determine a combination of RAG parameters that maximizes the accuracy index when the step of searching for a combination of a plurality of RAG parameters is completed.

[0054] A RAG-based search and response generation optimization device (200) according to one embodiment of the present disclosure can apply a combination of determined RAG parameters to provide searched document unit data, i.e., recovered document unit data, as a context for a large-scale language model and generate a final response through a large-scale language model.

[0055] A RAG-based search and response generation optimization device (200) according to one embodiment of the present disclosure can optimize the search so as to improve the quality of the response to the query.

[0056] The user device (100) is an electronic device capable of capturing and / or outputting images or videos and inputting and / or outputting text, and can be implemented as a laptop computer, mobile phone, smartphone, tablet PC, mobile internet device (MID), PDA (personal digital assistant), EDA (enterprise digital assistant), digital still camera, digital video camera, PMP (portable multimedia player), PND (personal navigation device or portable navigation device), handheld game console, e-book, or smart device. The smart device can be implemented as a smart watch, smart band, or smart ring.

[0057] A database (20) according to one embodiment of the present disclosure may store unstructured data such as predetermined documents and queries. For example, the database (20) may store document vectors generated by embedding document unit data, and identification information and division unit information for each document vector and the corresponding document. For example, the database (20) may store query vectors generated by embedding queries. The database (20) may be a vector database. A database (20) according to one embodiment of the present disclosure may be updated non-periodically or periodically according to user settings.

[0059] FIG. 2 is a block diagram of a RAG-based search and response generation optimization device according to one embodiment of the present disclosure.

[0060] A RAG-based search and response generation optimization device (200) according to one embodiment of the present disclosure may be a hardware device or part of a hardware device that performs comprehensive processing and computation of data, or it may be a software-based computing environment connected to a communication network. For example, the RAG-based search and response generation optimization device (200) may be a server that performs intensive data processing functions and is an entity that shares resources, or it may be a client that shares resources through interaction with the server. Additionally, the RAG-based search and response generation optimization device (200) may be a cloud system that enables multiple servers and clients to interact to comprehensively process data. Since the above description is merely one example regarding the type of RAG-based search and response generation optimization device (200), the type of RAG-based search and response generation optimization device (200) may be configured in various ways within a range understandable to a person skilled in the art based on the contents of the present disclosure.

[0061] Referring to FIG. 2, a RAG-based search and response generation optimization device (200) according to one embodiment of the present disclosure may include a processor (210), a memory (220), and / or a network unit (230). However, since FIG. 2 is merely an example, the RAG-based search and response generation optimization device (200) may include other configurations for implementing a computing environment. Additionally, only some of the disclosed configurations may be included in the RAG-based search and response generation optimization device (200).

[0062] A processor (210) according to one embodiment of the present disclosure may be understood as a constituent unit comprising hardware and / or software for performing computing operations. For example, the processor (210) may read a computer program and perform data processing for machine learning. The processor (210) may output optimal RAG parameters by executing an artificial intelligence model stored in memory (220). An artificial neural network (or neural network) model that can be implemented by the processor (210) may include a statistical learning algorithm that mimics biological neurons in machine learning and cognitive science. According to one embodiment, an artificial intelligence model that can be implemented by the processor (210) according to an embodiment of the present disclosure may include a natural language processing model and / or a natural language generation model. An artificial intelligence model according to one embodiment of the present disclosure may be a pre-trained natural language processing model and / or natural language generation model. The processor (210) may process computational processes such as processing input data for machine learning, extracting features for machine learning, and calculating errors based on backpropagation.

[0063] A processor (210) for performing such data processing may include a central processing unit (CPU), a general purpose graphics processing unit (GPGPU), a tensor processing unit (TPU), an application specific integrated circuit (ASIC), or a field programmable gate array (FPGA). Since the above-described type of processor (210) is merely an example, the type of processor (210) may be configured in various ways within a range understandable to a person skilled in the art based on the contents of this disclosure.

[0064] A processor (210) according to one embodiment of the present disclosure can control a series of processes for generating a response using a query received from a user device, initial RAG parameters, etc., calculating an accuracy index, searching for a combination of RAG parameters, determining an optimal RAG parameter, and generating a final response.

[0065] A memory (220) according to one embodiment of the present disclosure may be understood as a configuration unit comprising hardware and / or software for storing and managing data processed by a RAG-based search and response generation optimization device (200). That is, the memory (220) may store data of any form generated or determined by the processor (210) and data of any form received by the network unit (230). For example, the memory (220) may include at least one type of storage medium among a flash memory type, a hard disk type, a multimedia card micro type, a card type memory, RAM (random access memory), SRAM (static random access memory), ROM (read-only memory), EEPROM (electrically erasable programmable read-only memory), PROM (programmable read-only memory), magnetic memory, a magnetic disk, or an optical disk. Additionally, the memory (220) may include a database system that controls and manages data in a predetermined system. Since the above-described type of memory (220) is merely an example, the type of memory (220) may be configured in various ways within a range understandable to a person skilled in the art based on the contents of this disclosure.

[0066] A network unit (230) according to one embodiment of the present disclosure may be understood as a configuration unit that transmits and receives data through any known form of wired or wireless communication system. For example, the network unit (230) may perform data transmission and reception using wired or wireless communication systems such as a local area network (LAN), wideband code division multiple access (WCDMA), long term evolution (LTE), wireless broadband internet (WiBro), 5th generation mobile communication (5G), ultrawide-band wireless communication, ZigBee, radio frequency (RF) communication, wireless LAN, wireless fidelity (Wi-Fi), near field communication (NFC), or Bluetooth. Since the communication systems described above are merely examples, wired or wireless communication systems for data transmission and reception of the network unit (230) may be applied in various ways other than those described above.

[0067] According to one embodiment, the network unit (230) may receive a user query from a user device. The network unit (230) may transmit a response to the user query, a final response, an accuracy indicator for the response or the final response, the number of repetitions, and / or RAG parameters to the user device.

[0069] FIG. 3 is a block diagram of a RAG-based search and response generation optimization device according to one embodiment of the present disclosure.

[0070] Referring to FIGS. 2 and FIGS. 3, the RAG-based search and response generation optimization device (300) of FIG. 3 can be applied to the RAG-based search and response generation optimization device (200) of FIG. 2.

[0071] Referring to FIG. 3, a RAG-based search and response generation optimization device (300) according to one embodiment of the present disclosure may include a document segmentation module (310), an embedding and search module (320), an optimization module (330), and / or a user interface module (340).

[0072] The document splitting module (310) can split a predetermined document or query into document-unit data using a predetermined document splitting method. When splitting a document or query, the document splitting module (310) includes overlapping sections to minimize semantic discontinuity of the document and to enable a large-scale language model to better understand the context. The split document-unit data is then passed to the embedding and search module (320) and vectorized. In this specification, 'predetermined document' refers to a document stored in a search database to pre-build a basic search database for use by a system to optimize RAG-based search and response generation. All documents required for search can be built in the vector database by document set, and this is performed in advance regardless of user queries.

[0073] The embedding and search module (320) can embed document unit data of a predetermined document and convert it into a document vector. At this time, a first embedding model may be used. The converted document vector may be stored in a search database along with metadata indicating the document source or location information. The embedding and search module (320) can search for document unit data related to a query from the search database using RAG parameters. Specifically, the embedding and search module (320) can embed a user's query and convert it into a query vector. At this time, a second embedding model may be used. The embedding and search module (320) can calculate the similarity between the query vector and multiple document unit data vectors stored in the search database. The embedding and search module (320) can retrieve the top k (k is a natural number) document unit data in order of highest similarity. To prevent performance degradation when including unnecessary documents, the user interface module (340) may determine the number (k) of document-unit data using an artificial intelligence model. The k retrieved document-unit data are then input into a large-scale language model and provided as context along with the query.

[0074] The optimization module (330) performs the role of iteratively exploring and optimizing combinations of RAG parameters to iteratively improve the performance of search and response generation. The optimization module (330) is configured to calculate the optimal combination of RAG parameters for a specific document database unit. Accordingly, combinations of document splitting parameters, document search parameters, embedding model parameters, and database parameters suitable for the characteristics of each document database can be determined. The optimization module (330) can generate a response using a large-scale language model for each combination of RAG parameters. The optimization module (330) calculates an accuracy metric by comparing the generated response with a pre-prepared question-answer dataset. The optimization module (330) can iteratively explore multiple combinations of RAG parameters, including document splitting parameters, document search parameters, embedding model parameters, and database parameters, by utilizing the accuracy metric as feedback. The exploration of RAG parameter combinations can be obtained using an artificial intelligence model that takes the accuracy metric as input and the optimal RAG parameter as output. The search for RAG parameter combinations may be terminated when N times exceed a preset threshold (e.g., 50 times) or when the accuracy indicator exceeds a preset reference value (e.g., 95%). When the search for RAG parameter combinations is terminated, the optimization module (330) finally determines the combination of RAG parameters at the point where the accuracy indicator is maximized.

[0075] In addition, the optimization module (330) can respond to the latest data by performing partial optimization periodically (e.g., once or twice a year) without repeating a full search of the entire database even when some new documents are added or existing documents are changed. This significantly reduces the cost of the full search and ensures the scalability of the system.

[0076] The user interface module (340) is responsible for interaction with the user (or user device) and can visually display the entire search and optimization process. The user interface module (340) can receive a query from the user device and display the query. The user interface module (340) can display the final response generated by applying a confirmed combination of RAG parameters. The user interface module (340) can visualize accuracy metrics, iteration count (N), parameter changes during search, optimization results, etc., in the form of a real-time dashboard. Additionally, the user interface module (340) can visualize the search range, number of searches, budget limit, etc., so that the user can directly input them.

[0077] A RAG-based search and response generation optimization device (300) according to one embodiment of the present disclosure is designed to be applicable to large-scale document databases containing millions to tens of millions or more of document unit data, and can provide stable performance and optimization results even with an increase in the amount of documents.

[0079] Figure 4 is an example diagram illustrating the entire processing process of a RAG-based search and response optimization system.

[0080] The system illustrated in Figure 4 is largely divided into a Luminir RAG area and a Q&A Set area, with the left side showing the configuration of the search database and the RAG parameter optimization process, and the right side showing the evaluation and verification process using the question-and-answer dataset.

[0081] Referring to step 1 of Fig. 4, when document data such as lecture text is input, the document data can be divided into document unit data by classifying and separating it according to subject ID. The divided document unit data can be converted into document vectors using the first embedding model. The converted document vectors and metadata can be stored in a search database (vector DB).

[0082] Referring to step 2 of Fig. 4, a query entered by a user is converted into a query vector through a second embedding model, and document unit data related to the query can be retrieved from a search database using the initially set RAG parameters.

[0083] Referring to step 3 of Fig. 4, the retrieved document-unit data can be passed as an input context to a large-scale language model. For example, document-unit data such as “Vitruvius’s three elements of architecture are strength, utility, and beauty” can be passed to a large-scale language model.

[0084] Referring to step 4 of Fig. 4, a large-scale language model can receive context and a user's query together, logically infer the answer process, and generate and return an answer (response or final response). For example, the final response could be, “The three elements of architecture proposed by Vitruvius are strength, utility, and beauty. Therefore, the incorrect one is number 3 (material).” The generated final response can be evaluated by including both the predicted answer (pred_answer) and the actual correct answer (real_answer).

[0085] Referring to step 5 of Figure 4, the evaluation result (i.e., the accuracy metric) can be calculated by comparing the final response generated by the large-scale language model with the correct answer in the question-answer dataset. Therefore, the accuracy metric can be used as input for the subsequent optimization process.

[0086] Referring to step 6 of FIG. 4, the evaluation result, i.e., the accuracy metric, is passed to an optimization module and used to automatically search for combinations of multiple RAG parameters. The optimization module utilizes an automation tool such as Optuna to repeatedly combine and change parameters, and can terminate the search at the point where the accuracy metric is maximized or at the point where the number of searches for a preset threshold value is reached. In the process of RAG-based search and response generation using lecture text, performing a complete search would require approximately 45 million experiments, but according to the method of the present disclosure, the optimal combination could be reached in 17 out of approximately 50 searches.

[0088] FIGS. 5 and 6 are drawings illustrating the configuration of a user interface of a RAG-based search and response generation optimization system according to one embodiment of the present disclosure.

[0089] Figure 5 shows a chatbot page where a user can directly set and test RAG parameters.

[0090] The chatbot page (500) may include a sidebar area (502) and a question-and-answer area (504). The chatbot page (500) is designed so that the user can quickly check the performance of the RAG-based search and response generation optimization system.

[0091] Various options necessary for the operation of RAG are placed in the sidebar area (502). In the sidebar area (502), the user can manually set RAG parameters, namely document splitting parameters, document search parameters, embedding model parameters, database parameters, etc. For example, the user can select how to split documents (e.g., RecursiveCharacterSplitter), and input or select chunk size, overlap ratio, number of documents to search (Top-k), and type of embedding model. These setting values ​​are subsequently directly reflected in the operation process of the search database and large-scale language model.

[0092] In the Q&A area (504), the user can directly input a query and check the actual search and response generation results with the configured RAG parameter values ​​applied. For example, when a specific document, such as a lecture textbook, learning material, or internal company regulation document, is registered in the database, if the user inputs a question related to that document into the Q&A area (504), the user can check the search result document-unit data and the final response generated by the large-scale language model together. Through this, the user can test various combinations of RAG parameters in real time and immediately compare the results.

[0093] Figure 6 shows a performance optimization page that allows real-time monitoring of the optimization process, which automatically explores RAG parameters based on quantitative accuracy indicators.

[0094] Unlike the chatbot page (500), the performance optimization page (600) provides a function to automatically search for and optimize combinations of RAG parameters based on quantitative accuracy indicators rather than the user's subjective judgment.

[0095] The user can directly set the range (602) of the search target options on the performance optimization page (600). For example, the searchable range can be set for various options, such as setting the chunk size to between 300 and 500 or specifying the number of documents to search (Top-k) to between 3 and 5. Once the settings are complete, the user can click the Run button (604) to start the search.

[0096] When the Run button (604) is clicked, the RAG-based search and response generation optimization system automatically generates multiple combinations of RAG parameters based on the set search range and starts testing. For each combination of RAG parameters, a large language model generates a response, and the accuracy metric is calculated by comparing the generated response with the actual correct answer in the question-and-answer dataset (Q&A Set). The calculated accuracy metric is input into a search algorithm (e.g., Optuna) to automatically adjust the next search combination in a direction that maximizes accuracy.

[0097] The optimization status monitoring area (606) visually provides the user in real time with the number of trials performed so far, the results of accuracy indicators for each trial, the combination of RAG parameters currently being searched, and the combination of RAG parameters that recorded the highest accuracy. Through this, the user can intuitively check how much the automatic search of RAG parameters has progressed and how much the performance has improved.

[0099] FIG. 7 is a diagram illustrating the configuration of a user interface of a RAG-based search and response generation optimization system according to one embodiment of the present disclosure.

[0100] Figure 7 shows an optimization process visualization page that visualizes multiple search results performed by the optimization module, allowing the user to intuitively compare and analyze changes in search performance.

[0101] The optimization process visualization page (700) is a function provided to quantitatively compare and analyze the results of the search of RAG parameters, and can display changes in performance indicators (e.g., accuracy indicators) for multiple searches in the form of an Empirical Distribution Function Plot.

[0102] The optimization process visualization page (700) may include a search ID selection area (702) and / or a cumulative probability distribution graph (704).

[0103] The user can select multiple search IDs in the search ID selection area (702). For example, search results such as 'study_courses_full_20250718_report' and 'study_courses_full_20250722_11-07-27' can be selected simultaneously. By selecting multiple search IDs in this way, two or more search results can be compared on the same graph.

[0104] The X-axis of the cumulative probability distribution graph (704) may represent an objective value indicating the performance of the search, such as an accuracy value or an F1-score value. The Y-axis of the cumulative probability distribution graph (704) may represent the cumulative probability for the corresponding performance value. The closer the value of the Y-axis is to 1, the more search results there are in which the accuracy value satisfies the performance level.

[0105] In the graph (70) with search ID 'study_courses_full_20250718_report', objective indicator values ​​are evenly distributed from about 0.6 to 0.7, so it can be seen that the search performance is varied and some combinations of RAG parameters remain at low performance. In the graph (72) with search ID 'study_courses_full_20250722_11-07-27', objective indicator values ​​are mostly clustered around 0.7, so it can be seen that the search performance is good and stable search for combinations of RAG parameters that have high performance.

[0106] According to the optimization process visualization page (700), you can see at a glance what performance differences different RAG parameter combinations showed in the same question-and-answer dataset, which search process was relatively superior, and how the performance distribution changed in a specific search process.

[0107] Although not illustrated in the diagram, the dashboard page is a feature provided to monitor the options used and performance during the optimization process. During the iterative search, it is possible to monitor which RAG parameters were used and what accuracy metrics were obtained in a table format.

[0109] FIG. 8 is a diagram showing an example of a question-and-answer dataset according to one embodiment of the present disclosure.

[0110] Figure 8 assumes that actual lecture content is used in a RAG-based search and response generation optimization system. Lecture videos are automatically converted into subtitle text using Speech-to-Text technology, and the converted text is stored separately by subject of the lecture, and can subsequently be divided into document-unit data and stored in a search database.

[0111] In one embodiment of the present invention, text data for 320 lecture videos in a total of 8 subjects in the fields of architecture and repair was utilized. Such text data is subsequently used as base data to retrieve document-unit data related to a user's query during the search phase of a RAG-based search and response generation optimization system.

[0112] To quantitatively evaluate the performance of a RAG-based search and response generation optimization system, the present disclosure uses a question-and-answer dataset along with lecture content. The question-and-answer dataset may include multiple-choice question data collected from external sources. The number of questions for the test for each subject consists of approximately 170 to 200, and the total number of questions for all 8 subjects combined is 1,589. This is presented in a table as follows.

[0113] Course_id Subject Name Number of questions 202402 Construction Process Management 176 202403 Building regulations 165 202404 Building Equipment I 180 202405 Building Facilities II 174 202502 Theory of Architectural Production 180 202418 Mathematics I 174 202422 Thermodynamics I 310 202425 Fluid Mechanics I 230 Total 1,589

[0114] A RAG-based search and response generation optimization device according to one embodiment of the present disclosure can perform an optimization process while evaluating the answer results for 1,589 questions in total across all 8 subjects. The question-answer dataset has the same subject and scope as the lecture text, and through this, the RAG-based search and response generation optimization device according to one embodiment of the present disclosure can evaluate whether it generates a correct response to a question.

[0115] Referring to Fig. 8, the course_id, which is the subject identifier of the question, the question type, the query content, the options, the correct answer, the explanation, and the label, which is an identifier for the category or classification of the question, are displayed. The content corresponding to the Question is provided as input to a large-scale language model, and the large-scale language model utilizes document-unit data retrieved from the search database as context to select one of the options as the final response. When the large-scale language model selects one of the options from 1 to 4, an accuracy index can be calculated based on whether it matches the actual answer. Through the process described above, accuracy indices for a total of 1,589 questions can be calculated.

[0117] FIG. 9 is a diagram illustrating the configuration of a user interface of a RAG-based search and response generation optimization system according to one embodiment of the present disclosure.

[0118] FIG. 9 shows the optimization result visualization (Parallel Coordinate Plot) page. The optimization result visualization page (900) simultaneously displays the relationship between the combination of RAG parameters obtained during the iterative search process performed by the optimization module and the corresponding accuracy indicator in multiple dimensions.

[0119] The Y-axis of the optimization result visualization graph represents vector_store (database parameter), Objective Value (accuracy metric), chunk_overlap (document splitting parameter / overlap ratio), chunk_size (document splitting parameter / size of document-unit data), embed_method (embedding model parameter), and document search parameter (number of document-unit data to retrieve from the search database). k It refers to the respective values ​​or result indicators of retrieve_k corresponding to ) and search_type corresponding to the document search parameter (search method).

[0120] Each search process is represented by a single polyline, and the color of the line indicates the accuracy indicator of the corresponding combination. In this embodiment, only the top four combinations showing the highest performance are highlighted in dark blue, and the other combinations are displayed in gray.

[0121] Since the four polylines displayed in dark blue cluster in the 350–450 range of the chunk_size axis, it can be seen that this range is appropriate for the document unit data size. In this embodiment, it can be seen that 440 is particularly appropriate for the document unit data size. Additionally, it can be seen that the four polylines displayed in dark blue concentrate at retrieve_k = 4.

[0122] Referring to FIG. 8, the accuracy index reached 0.7124 in one of the four polylines shown in dark blue, that is, in a combination of RAG parameters of one of the multiple search processes, which represents the highest performance in this embodiment.

[0123] Users can intuitively compare the correlation between document splitting parameters, document search parameters, embedding parameters, and database parameters on accuracy metrics on a single screen.

[0125] FIG. 10 is a flowchart illustrating a method for optimizing RAG-based search and response generation according to one embodiment of the present disclosure.

[0126] A RAG-based search and response generation optimization device according to one embodiment of the present disclosure can divide a predetermined document using a predetermined document splitting method. The RAG-based search and response generation optimization device can convert document unit data generated by dividing the predetermined document into document vectors using a first embedding model. The RAG-based search and response generation optimization device can store the document vectors and metadata regarding the embedded document unit data in a search database.

[0127] A RAG-based search and response generation optimization device according to one embodiment of the present disclosure can receive a query from a user device (S100).

[0128] A RAG-based search and response generation optimization device according to one embodiment of the present disclosure can search for document unit data related to a query from a search database using RAG parameters (S101).

[0129] RAG parameters may include document segmentation parameters, document search parameters, embedding model parameters, and database parameters.

[0130] A RAG-based search and response generation optimization device according to one embodiment of the present disclosure can convert a query into a query vector using a second embedding model. The RAG-based search and response generation optimization device can calculate the similarity between the query vector and a plurality of document-unit data vectors stored in a database. The RAG-based search and response generation optimization device can retrieve the top k (k is a natural number) document-unit data in order of highest similarity.

[0131] A RAG-based search and response generation optimization device according to one embodiment of the present disclosure can generate a response to a query by using a large-scale language model that has document-unit data as a context (S102).

[0132] A RAG-based search and response generation optimization device according to one embodiment of the present disclosure can calculate an accuracy indicator of a response using a question-response dataset (S103).

[0133] A RAG-based search and response generation optimization device according to one embodiment of the present disclosure can search for combinations of multiple RAG parameters based on an accuracy index (S104). According to one embodiment, the RAG-based search and response generation optimization device may output optimal RAG parameters by using an artificial intelligence model that takes an accuracy index as input.

[0134] A RAG-based search and response generation optimization device according to one embodiment of the present disclosure may repeat steps S101 to S104 N times (S105). That is, a RAG-based search and response generation optimization device according to one embodiment of the present disclosure may repeat the steps of searching for document unit data related to a query, generating the response, calculating the accuracy index, and searching for combinations of the plurality of RAG parameters N times (N is a natural number). The step of searching for combinations of the plurality of RAG parameters may be terminated when N times exceed a preset threshold value or when the accuracy index exceeds a preset reference value.

[0135] A RAG-based search and response generation optimization device according to one embodiment of the present disclosure can determine a combination of RAG parameters that maximizes the accuracy index when the step of searching for a combination of a plurality of RAG parameters is completed (S106).

[0136] A RAG-based search and response generation optimization device according to one embodiment of the present disclosure can generate a final response to a query using a large-scale language model by applying a combination of determined RAG parameters, and display the generated final response through a user interface (S107). The RAG-based search and response generation optimization device can display an optimization process through a user interface that displays an accuracy indicator, the number of iterations N, and RAG parameters.

[0137] A user-customized text conversion device can collect metadata about the user and the original text for which the user requests analysis (S600). The metadata may include information about at least one of the user's age, occupation, educational background, work area, degree of multilingual exposure, or the type of documents created, viewed, or downloaded during a certain period.

[0138] A user-customized text conversion device according to one embodiment of the present disclosure can analyze the subject and sentence structure of the original text.

[0139] A user-customized text conversion device according to one embodiment of the present disclosure can generate at least one query related to the original text or the user (S602).

[0140] A user-customized text conversion device according to one embodiment of the present disclosure can dynamically generate user literacy data using a first artificial intelligence model that takes at least one query and a user response to at least one query as input (S604). The first artificial intelligence model may include a natural language processing model and a machine learning model. The literacy data may be data calculated based on at least one of the accuracy of the user response, the response time, words included in the user response, and the response pattern by type of at least one query.

[0141] A user-customized text conversion device according to one embodiment of the present disclosure can determine a difficulty parameter of the customized text using literacy data (S606). The difficulty parameter may be a value representing the difficulty of at least one of the words, sentence length, and sentence structure type of the customized text.

[0142] A user-customized text conversion device according to one embodiment of the present disclosure can generate customized text using a second artificial intelligence model that takes a difficulty parameter as input (S608). The second artificial intelligence model may include a natural language generation model. The second artificial intelligence model may take the topic and difficulty parameter of the original text as input. The customized text may be text in which the words or sentence structures included in the original text are modified, or example sentences are added.

[0143] A user-customized text conversion device according to one embodiment of the present disclosure can provide customized text to a user through a user interface (S610).

[0144] A user-customized text conversion device according to one embodiment of the present disclosure may receive a user response to at least one query or user feedback regarding customized text. A user-customized text conversion device according to one embodiment of the present disclosure may dynamically generate user literacy data by using a first artificial intelligence model that takes at least one query, a user response to at least one query, and user feedback as input.

[0146] As described above, exemplary embodiments have been disclosed in the drawings and specification. Although specific terms have been used to describe the embodiments in this specification, they are used only for the purpose of explaining the technical concept of this disclosure and are not intended to limit the meaning or the scope of this disclosure as defined in the claims. Therefore, those skilled in the art will understand that various modifications and equivalent alternative embodiments are possible therefrom. Accordingly, the true technical scope of protection of this disclosure should be determined by the technical concept of the appended claims.

Claims

Claim 1 A method for optimizing RAG-based search and response generation executed by at least one processor, comprising: a step of setting an initial combination of RAG parameters; a step of searching for document unit data related to a user query from a search database using the initial combination of RAG parameters; a step of generating a response to the query using a large-scale language model having the document unit data as a context; a step of calculating an accuracy index of the response using a query-response dataset; a step of searching for a combination of multiple RAG parameters to update a combination of multiple RAG parameters including document segmentation parameters, document search parameters, embedding model parameters, and database parameters based on the accuracy index; a step of repeating the steps of searching for document unit data related to the query, generating the response, calculating the accuracy index, and searching for a combination of multiple RAG parameters N times (N is a natural number) as a single search process; and a step of determining a combination of RAG parameters that maximizes the accuracy index based on the result of the search process. A method comprising the step of generating a final response to the query using the large-scale language model by applying the combination of the determined RAG parameters and displaying the generated final response through a user interface. Claim 2 A method for optimizing RAG-based search and response generation according to claim 1, wherein the RAG parameters include document segmentation parameters, document search parameters, embedding model parameters, and database parameters. Claim 3 A method for optimizing RAG-based search and response generation, further comprising: a step of dividing a predetermined document using a predetermined document splitting method; a step of converting document unit data generated by dividing the predetermined document into a document vector using a first embedding model; and a step of storing metadata for the document vector and the embedded document unit data in the search database. Claim 4 A method for optimizing RAG-based search and response generation, wherein the step of searching for document unit data related to the query from the database comprises: converting the query into a query vector using a second embedding model; calculating the similarity between the query vector and a plurality of document unit data vectors stored in the database; and retrieving the top k (k is a natural number) document unit data in order of highest similarity. Claim 5 A method for optimizing RAG-based search and response generation according to claim 4, wherein the step of searching for a combination of the plurality of RAG parameters is terminated when the N times become greater than or equal to a preset threshold value or when the accuracy indicator becomes greater than or equal to a preset reference value. Claim 6 A method for optimizing RAG-based search and response generation, further comprising the step of displaying an optimization process through a user interface that displays the accuracy indicator, the number of N iterations, and the RAG parameters in claim 5. Claim 7 A method for optimizing RAG-based search and response generation according to claim 6, wherein the step of searching for a combination of multiple RAG parameters based on the accuracy index comprises the step of outputting an optimal RAG parameter using an artificial intelligence model that takes the accuracy index as input. Claim 8 A computing device for optimizing RAG-based search and response generation executed by at least one processor, comprising: a processor including at least one core; a memory including program codes executable by said processor; and a network unit for receiving a user query from a user device; A computing device comprising: a user interface that displays the final response and optimization process for the user query; wherein the processor sets an initial combination of RAG parameters, searches for document unit data related to the user query from a search database using the initial combination of RAG parameters, generates a response to the query using a large-scale language model that uses the document unit data as a context, calculates an accuracy index of the response using a query-response dataset, searches for combinations of multiple RAG parameters to update combinations of multiple RAG parameters including document segmentation parameters, document search parameters, embedding model parameters, and database parameters based on the accuracy index, and is configured to perform the steps of searching for document unit data related to the query, generating the response, calculating the accuracy index, and searching for combinations of multiple RAG parameters N times (N is a natural number) as a single search process, and determine the combination of RAG parameters that maximizes the accuracy index based on the results of the search process.