Semantic chunking method and device for rag-based search

KR103021267B1Active Publication Date: 2026-09-18LLOYDK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
KR1020250180141
Authority / Receiving Office
KR · KR
Patent Type
Patents
Current Assignee / Owner
Filing Date
2025-11-25
Publication Date
2026-09-18
Estimated Expiration
2045-11-25

Smart Images

  • Figure 112025131981420-PAT00001_ABST
    Figure 112025131981420-PAT00001_ABST
Patent Text Reader

Abstract

The present invention relates to a semantic chunking method for RAG-based search. The semantic chunking method for RAG-based search comprises the steps of receiving a document as input, dividing the document into a plurality of regions based on structural semantic units, generating a plurality of chunks corresponding to each region based on the data type of each region included in the plurality of regions, generating a plurality of embedding vectors corresponding to the generated plurality of chunks, and associating the plurality of chunks and the plurality of embedding vectors and storing them in a database.
Need to check novelty before this filing date? Find Prior Art

Description

Technology Field

[0001] The present invention relates to a semantic chunking method and apparatus for RAG-based search. Background Technology

[0003] With the recent advancement of artificial intelligence technology, language models such as AI chatbot systems are being used in various industrial fields. For example, language models understand input queries, generate answers related to the queries, and return them to the user. In this case, language models use techniques such as retrieval-augmented generation (RAG), which references external data when providing answers, to prevent hallucinations.

[0004] Meanwhile, chunking of documents is performed to construct the external data used when employing the RAG technique. In other words, external data is divided into chunks of a fixed size and stored. The search performance of the RAG technique is determined by how well the embedding model converts these chunks into semantically clear vectors. However, because the existing fixed-size chunking method mechanically divides text based on a set number of characters, it can cause the problem of 'semantic fragmentation,' where a single complete semantic unit is fragmented across multiple chunks. In this case, the embedding vector generated from the fragmented text becomes an ambiguous vector with mixed meanings, or the core meaning is diluted, leading to a loss of distinctiveness from other vectors within the vector space. The problem to be solved

[0006] The present invention provides a semantic chunking method for RAG-based search to solve the above-mentioned problems, a computer program stored on a computer-readable medium, a computer-readable medium storing the computer program, and a device (system). means of solving the problem

[0008] The present invention may be implemented in various ways, including a method, an apparatus (system), a computer program stored on a computer-readable medium, or a computer-readable medium on which a computer program is stored.

[0009] According to one embodiment of the present invention, a semantic chunking method for RAG-based search performed by at least one processor comprises the steps of receiving a document, dividing the document into a plurality of regions based on structural semantic units, generating a plurality of chunks corresponding to each region based on the data type of each region included in the plurality of regions, generating a plurality of embedding vectors corresponding to the generated plurality of chunks, and associating the plurality of chunks and the plurality of embedding vectors and storing them in a database.

[0010] According to one embodiment of the present invention, the step of generating a plurality of chunks corresponding to each region based on the data type of each region included in a plurality of regions includes, when the data type of a first region included in a plurality of regions is text, the step of extracting text included in the first region and generating a first chunk associated with the first region.

[0011] According to one embodiment of the present invention, if the data type of the first region is text, the method further includes the step of generating a document name of a document including the first region as first auxiliary information. The step of associating and storing a plurality of chunks and a plurality of embedding vectors in a database includes the step of associating and storing a first chunk, a first embedding vector corresponding to the first chunk, and first auxiliary information in a database.

[0012] According to one embodiment of the present invention, the method further includes the steps of receiving a search term regarding a first chunk and providing the received search term to a language model to generate answer data associated with the first chunk based on the first chunk, a first embedding vector, and first auxiliary information.

[0013] According to one embodiment of the present invention, the step of generating a plurality of chunks corresponding to each region based on the data type of each region included in a plurality of regions includes, when the data type of a second region included in a plurality of regions is a table, the step of extracting text included in the table to generate a second chunk associated with the second region.

[0014] According to one embodiment of the present invention, if the data type of the second region is a table, the method further includes the step of generating a JSON table corresponding to the table as second auxiliary information. The step of associating and storing a plurality of chunks and a plurality of embedding vectors in a database includes the step of associating and storing a second chunk, a second embedding vector corresponding to the second chunk, and second auxiliary information in a database.

[0015] According to one embodiment of the present invention, the step of generating a JSON table corresponding to a table as second auxiliary information includes providing the table to a learned artificial intelligence model to generate a JSON table corresponding to the table.

[0016] According to one embodiment of the present invention, the method further includes the steps of receiving a search term regarding a second chunk and providing the received search term to a language model to generate answer data associated with the second chunk based on the second chunk, a second embedding vector, and second auxiliary information.

[0017] According to one embodiment of the present invention, the step of generating a plurality of chunks corresponding to each region based on the data type of each region included in a plurality of regions includes, when the data type of a third region included in a plurality of regions is an image, the step of generating summary information describing an image and the step of generating a third chunk associated with the third region using the generated summary information.

[0018] According to one embodiment of the present invention, the step of generating summary information describing an image includes providing the image to a trained artificial intelligence model to generate summary information describing the image.

[0019] According to one embodiment of the present invention, if the data type of the third region is an image, the method further includes the step of generating a storage location of the image as third auxiliary information. The step of associating and storing a plurality of chunks and a plurality of embedding vectors in a database includes the step of associating and storing a third chunk, a third embedding vector corresponding to the third chunk, and third auxiliary information in a database.

[0020] According to one embodiment of the present invention, the method further includes the steps of receiving a search term regarding a third chunk and providing the received search term to a language model to generate answer data associated with the third chunk based on the third chunk, a third embedding vector, and third auxiliary information.

[0021] According to one embodiment of the present invention, the method further includes the step of generating auxiliary information according to the data type of each region included in a plurality of regions. The step of associating and storing a plurality of chunks and a plurality of embedding vectors in a database includes the step of associating and storing a plurality of chunks, a plurality of embedding vectors, and auxiliary information in a database.

[0022] According to one embodiment of the present invention, the method further includes the steps of generating relationship information indicating the relationship between a plurality of regions and associating a plurality of chunks and relationship information and storing them in a database.

[0023] According to one embodiment of the present invention, the step of generating relationship information indicating the relationship between a plurality of regions includes the step of generating relationship information based on the location of a plurality of regions within a document and text associated with the relationship among the content included in the plurality of regions.

[0024] According to one embodiment of the present invention, the method further includes the steps of receiving a search term and providing the received search term to a language model to generate answer data associated with the search term based on a plurality of chunks, a plurality of embedding vectors, auxiliary information, and relational information.

[0025] According to one embodiment of the present invention, the method further comprises the steps of: extracting a first chunk included in a plurality of chunks; extracting a first set of auxiliary chunks having a relationship with the first chunk based on keyword similarity or positional similarity between the first chunk and the remaining chunks excluding the first chunk; defining a connection relationship between the first chunk and the extracted first set of auxiliary chunks to generate relationship information; and associating the plurality of chunks and the relationship information and storing them in a database.

[0026] According to one embodiment of the present invention, the step of extracting a first set of chunks having a relationship with a first chunk comprises the step of extracting at least one representative keyword from the first chunk and the step of extracting an auxiliary chunk of the first set including at least one keyword among the extracted at least one representative keyword among the remaining chunks.

[0027] According to one embodiment of the present invention, the method further comprises the steps of: calculating the number of auxiliary chunks of a first set; comparing the calculated number of auxiliary chunks of the first set with a threshold number to determine whether the number of auxiliary chunks of the first set exceeds the threshold number; if it is determined that the number exceeds the threshold number, providing the first chunk and the auxiliary chunks of the first set to an artificial intelligence model to calculate a similarity score; extracting an amount of auxiliary chunks of the second set equal to the threshold number in order of highest calculated similarity score among the auxiliary chunks of the first set; and redefining the connection relationship between the first chunk and the auxiliary chunks of the second set to regenerate relationship information.

[0028] According to one embodiment of the present invention, the method further includes the step of calculating a threshold number based on the computing resources of a computing device performing semantic chunking and the number of a plurality of chunks.

[0029] According to one embodiment of the present invention, the method further includes the steps of receiving a search term and providing the received search term to a language model to generate answer data associated with the search term based on a plurality of chunks, a plurality of embedding vectors, and relationship information.

[0030] A computer program stored on a computer-readable recording medium is provided to execute the above-described method according to one embodiment of the present invention on a computer.

[0031] A computing device according to one embodiment of the present invention includes a communication module, a memory, and at least one processor connected to the memory and configured to execute at least one computer-readable program included in the memory. The at least one program includes instructions for receiving a document, dividing the document into a plurality of regions based on structural semantic units, generating a plurality of chunks corresponding to each region based on the data type of each region included in the plurality of regions, generating a plurality of embedding vectors corresponding to the generated plurality of chunks, and associating the plurality of chunks and the plurality of embedding vectors to store them in a database. Effects of the invention

[0033] In various embodiments of the present invention, the AI ​​agent can effectively improve the precision of the answer by utilizing auxiliary information according to the data type and refining it into a form optimized for use when the language model generates the actual answer.

[0034] In various embodiments of the present invention, when answer data is generated by extracting chunks, auxiliary information, and / or relational information together, the language model can understand the contents of the chunks more clearly, and accordingly, more precise answer data can be generated.

[0035] In various embodiments of the present invention, the computing device can continuously check and regenerate relationship information of each chunk even when a new chunk is created and the database is updated.

[0036] In various embodiments of the present invention, when defining the connection relationships of chunks, the computing device generates relationship information using only simple parameters such as keywords and locations, and calculates similarity using an artificial intelligence model only when the number of auxiliary chunks exceeds a threshold number, thereby enabling efficient use of computing resources required for database construction when generating relationship information.

[0037] In various embodiments of the present invention, when a computing device constructs a database, it may not simply perform chunking, but may store auxiliary information and / or relational information corresponding to a plurality of chunks generated by chunking together, and accordingly, when generating an answer from a language model, auxiliary information and / or relational information associated with the chunks may be additionally utilized, thereby effectively improving answer performance.

[0038] In various embodiments of the present invention, the computing device can significantly improve response performance by using a hybrid search that combines keyword-based search using multiple chunks and vector-based search using multiple embedding vectors, while additionally utilizing auxiliary information according to each data type.

[0039] In various embodiments of the present invention, the computing device can effectively extract chunks and / or data for answer generation by taking into account even the relationships between each region of the document.

[0040] The effects of the present invention are not limited to those mentioned above, and other unmentioned effects will be clearly understood by a person skilled in the art to which the present invention pertains (referred to as "person skilled in the art") from the description in the claims. Brief explanation of the drawing

[0042] Embodiments of the present invention will be described with reference to the accompanying drawings described below, wherein similar reference numerals indicate similar elements, but are not limited thereto. FIG. 1 is a functional block diagram showing the internal configuration of a computing device according to one embodiment of the present invention. FIG. 2 is a diagram illustrating a chunking process according to each data type included in a document according to an embodiment of the present invention. FIG. 3 is a block diagram showing an example of relationship information of a first chunk generated according to an embodiment of the present invention. FIG. 4 is a block diagram showing an example in which relationship information of a first chunk is regenerated according to an embodiment of the present invention. FIG. 5 is a block diagram showing an example of a language model generating an answer according to one embodiment of the present invention. FIG. 6 is a flowchart illustrating an example of a semantic chunking method for RAG-based search according to one embodiment of the present invention. FIG. 7 is a block diagram showing the hardware configuration of a computing device according to one embodiment of the present invention. Specific details for implementing the invention

[0043] Hereinafter, specific details for implementing the present invention will be described in detail with reference to the attached drawings. However, in the following description, specific descriptions regarding widely known functions or configurations will be omitted if there is a risk of unnecessarily obscuring the essence of the present invention.

[0044] In the attached drawings, identical or corresponding components are assigned the same reference numerals. Additionally, in the description of the following embodiments, the description of identical or corresponding components may be omitted. However, even if a description of a component is omitted, it is not intended that such component is not included in any embodiment.

[0045] The advantages and features of the disclosed embodiments and the methods for achieving them will become clear by referring to the embodiments described below in conjunction with the accompanying drawings. However, the present invention is not limited to the embodiments disclosed below but may be implemented in various different forms, and these embodiments are provided merely to make the present invention complete and to fully inform those skilled in the art of the scope of the invention.

[0046] The terms used in this specification will be briefly explained, and the disclosed embodiments will be described in detail. The terms used in this specification have been selected to be as generally used as possible, taking into account their functions in the present invention; however, these terms may vary depending on the intent of those skilled in the relevant field, case law, the emergence of new technologies, etc. Additionally, in specific cases, terms may be arbitrarily selected by the applicant, and in such cases, their meanings will be described in detail in the relevant description of the invention. Therefore, the terms used in this invention should be defined not merely by their names, but based on their meanings and the overall content of the present invention.

[0047] In this specification, singular expressions include plural expressions unless the context clearly specifies them as singular. Additionally, plural expressions include singular expressions unless the context clearly specifies them as plural. Throughout the specification, when a part is described as including a certain component, this means that, unless specifically stated otherwise, it does not exclude other components but may include additional components.

[0048] In the present invention, terms such as “comprising,” “comprising,” etc. may indicate the presence of features, steps, operations, elements, and / or components, but do not exclude the addition of one or more other functions, steps, operations, elements, components, and / or combinations thereof.

[0049] In the present invention, where a specific component is described as being "combined," "combined," "connected," or "reacting" with any other component, the specific component may be directly combined, combined, and / or connected, or react with the other component, but is not limited thereto. For example, one or more intermediate components may exist between the specific component and the other component. Additionally, in the present invention, "and / or" may include each of the one or more listed items or a combination of at least some of the one or more items.

[0050] In the present invention, terms such as "first," "second," etc. are used to distinguish a specific component from another component, and the components described above are not limited by these terms. For example, the "first" component may be an element of the same or similar form as the "second" component.

[0051] In the present invention, the term "language model" may refer to an artificial intelligence model capable of natural conversational interaction by learning large-scale language data to understand sentence structure, grammar, semantics, etc. The language model may include a large language model and / or a small language model.

[0052] In the present invention, "chunk" may refer to a text chunk generated by dividing a document.

[0053] In the present invention, "embedding vector" may refer to a vector generated by an embedding model that converts unstructured data, such as sentences, words, images, and codes, into a vector.

[0054] FIG. 1 is a functional block diagram showing the internal configuration of a computing device (100) according to one embodiment of the present invention. According to one embodiment, the computing device (100) may refer to a device for building a database (110) for retrieval-augmented generation (RAG) based search, or for generating and providing answers based on data stored in the database (110). As illustrated, the computing device (100) may include an AI agent (102) and a language model (104).

[0055] According to one embodiment, a computing device (100) can construct a database (110) for RAG-based search. That is, the computing device (100) can perform the task of storing materials in the database (110) to be referenced when the language model (104) generates answer data for an input query. For example, when a document is input, the computing device (100) can construct the database (110) by performing chunking on the input document, and generate answer data using the constructed database (110).

[0056] According to one embodiment, the AI ​​agent (102) may refer to a model for constructing a database (110) by performing chunking on documents. For example, when receiving a document, the AI ​​agent (102) may divide the document into multiple regions based on structural semantic units and generate multiple chunks corresponding to each region based on the data type of each region included in the multiple regions. Here, dividing the document into structural semantic units may refer to dividing the document according to a structural hierarchical structure such as chapters, sections, and clauses, rather than dividing the document into fixed-size units. In this way, when the document is divided into structural semantic units, the problem of semantic fragmentation, in which a single completed semantic unit is segmented across multiple chunks, can be effectively resolved.

[0057] When multiple chunks are generated, the AI ​​agent (102) can generate multiple embedding vectors corresponding to the multiple chunks. The AI ​​agent (102) can associate the multiple chunks and the multiple embedding vectors and store them in the database (110). For example, the AI ​​agent (102) can generate embedding vectors corresponding to each chunk using a model such as BERT (Bidirectional Encoder Representations from Transformers), but any other embedding model may also be used.

[0058] According to one embodiment, an AI agent (102) can build a database (110) by generating and combining auxiliary information according to the data type of each area of ​​a document. Here, the auxiliary information may refer to text and / or metadata for the language model (104) to more clearly recognize the meaning of the document when generating an answer. For example, the AI ​​agent (102) can build a database (110) by classifying the data types of the areas into text, tables, and images, and generating and combining auxiliary information according to each data type. In this case, the AI ​​agent (102) can generate the auxiliary information using a separate artificial intelligence model (e.g., a language model).

[0059] Additionally, the AI ​​agent (102) can further refine the generated auxiliary information to produce refined auxiliary information. For example, the AI ​​agent (102) can use an arbitrary artificial intelligence model (e.g., a language model) to further refine the auxiliary information into a form suitable for the language model (104) to answer. Here, the arbitrary artificial intelligence model may be the same language model as the language model (104) that generates the answer. That is, while using auxiliary information according to the data type, the AI ​​agent (102) can effectively improve the precision of the answer by refining it into a form optimized for use when the language model (104) generates the actual answer.

[0060] Additionally or alternatively, the AI ​​agent (102) may generate relationship information indicating the relationship between multiple regions and associate multiple chunks and relationship information to store them in the database (110). Here, the relationship information defines the connection relationship between chunks that are similar in keywords and / or locations, and may be data in the form of a graph, but is not limited thereto. The AI ​​agent (102) may extract auxiliary chunks that have a relationship based on keyword similarity or location similarity between one chunk and other chunks. In this case, the AI ​​agent (102) may generate relationship information by defining the connection relationship between the corresponding chunk and the extracted auxiliary chunks.

[0061] When a database (110) is constructed or created through the process described above, the language model (104) can generate an answer by extracting data related to a search term from the database (110). For example, when receiving a search term regarding an arbitrary chunk (e.g., a search term querying the content of the chunk), the language model (104) can extract the chunk, an embedding vector corresponding to the chunk, and auxiliary information associated with the chunk (e.g., first auxiliary information and / or second auxiliary information) from the database (110), and generate answer data based thereon.

[0062] Additionally or alternatively, when receiving a search term regarding any chunk (e.g., a search term querying the content of the chunk), the language model (104) may extract the chunk, the embedding vector corresponding to the chunk, auxiliary information associated with the chunk (e.g., first auxiliary information and / or second auxiliary information), and relationship information from the database (110), and generate answer data based thereon. When generating answer data by extracting the chunk, auxiliary information, and / or relationship information together in this manner, the language model (104) can understand the content of the chunk more clearly, and accordingly, more precise answer data can be generated.

[0063] In FIG. 1, each functional configuration included in the computing device (100) is described separately, but this is merely to aid in understanding the invention, and one computing device may perform two or more functions. With such a configuration, when the computing device (100) constructs a database (110), it may not simply perform chunking, but may store auxiliary information and / or relational information corresponding to multiple chunks generated by chunking together. Accordingly, when generating an answer for the language model (104), auxiliary information and / or relational information associated with the chunks can be additionally utilized, thereby effectively improving the answer performance.

[0064] FIG. 2 is a diagram illustrating a chunking process according to each data type included in a document (200) according to an embodiment of the present invention. As described above, when a document (200) is input, a computing device (100 of FIG. 1) may divide the document (200) into multiple regions based on structural semantic units and generate multiple chunks corresponding to each region based on the data type of each region included in the multiple regions. In this case, the computing device may generate auxiliary information based on the data type of each region and store each chunk together with the generated auxiliary information in a database. As illustrated, the document (200) may include a text region ('Text') (210), a table region ('Table') (220), and an image region ('Image') (230).

[0065] According to one embodiment, a computing device may generate a first chunk ('text') corresponding to a text area (210) of a document (200). For example, the computing device may generate a first chunk associated with the text area (210) by extracting text contained in the text area (210). In this case, the computing device may generate a first embedding vector ('vector') corresponding to the first chunk. Additionally, the computing device may generate a document name ('filename') of the document (200) containing the text area (210) as first auxiliary information ('meta') corresponding to the first chunk.

[0066] Additionally or alternatively, the computing device may generate a second chunk ('text') corresponding to a table area (220) of the document (200). For example, the computing device may generate a second chunk associated with the table area (220) by extracting text contained within the table of the table area (220). In this case, the computing device may generate a second embedding vector ('vector') corresponding to the second chunk. Additionally, the computing device may generate a JSON table corresponding to the table as second auxiliary information ('meta') corresponding to the second chunk. For example, the JSON table may be generated by an artificial intelligence model (e.g., a language model) trained to receive a table as input and generate a JSON table.

[0067] Additionally or alternatively, the computing device may generate a third chunk ('text') corresponding to an image area (230) of the document (200). For example, the computing device may generate summary information ('summary') by providing the image contained in the image area (230) to an artificial intelligence model (e.g., a language model) trained to receive an image and output a description of the image. The summary information thus generated may be used as a third chunk of the image area (230). In this case, the computing device may generate a third embedding vector ('vector') corresponding to the third chunk. Additionally, the computing device may generate the storage location ('url') of the image as third auxiliary information ('meta').

[0068] According to one embodiment, when a computing device receives a search term, it provides the received search term to a language model to generate answer data using a plurality of chunks, a plurality of embedding vectors, and / or auxiliary information. With such a configuration, the computing device can significantly improve answer performance by utilizing a hybrid search that combines a keyword-based search using a plurality of chunks and a vector-based search using a plurality of embedding vectors, while additionally utilizing auxiliary information according to each data type.

[0069] FIG. 3 is a block diagram showing an example of relationship information of a first chunk (310) generated according to an embodiment of the present invention, and FIG. 4 is a block diagram showing an example of relationship information of a first chunk (310) regenerated according to an embodiment of the present invention. According to an embodiment, a computing device (100 of FIG. 1) can generate relationship information by extracting an auxiliary chunk for each chunk included in a plurality of chunks.

[0070] According to one embodiment, a computing device may extract a first chunk (310) included in a plurality of chunks as a main chunk, and extract a first set of auxiliary chunks (320) having a relationship with the first chunk (320) based on keyword similarity or positional similarity between the first chunk (310) and the remaining chunks excluding the first chunk. In the illustrated example, the first set of auxiliary chunks (320) may include a first-1 chunk (320_1), a first-2 chunk (320_2), ..., a first-N chunk (320_N).

[0071] According to one embodiment, the computing device can extract at least one representative keyword from the first chunk (310). Additionally, the computing device can extract a first set of auxiliary chunks (320) that includes at least one keyword among the extracted at least one representative keyword among the remaining chunks excluding the first chunk (310). Here, the keyword may be extracted based on an artificial intelligence model trained to extract keywords (e.g., a topic extraction model, etc.). Additionally or alternatively, the computing device can extract the first set of auxiliary chunks (320) based on the location of the chunks. For example, the computing device may extract a chunk that is locationally adjacent to the first chunk (310) within a document as the first set of auxiliary chunks (320). When the first set of auxiliary chunks (320) is extracted in this manner, the computing device may generate relationship information by defining a connection relationship between the first chunk (310) and the first set of auxiliary chunks (320).

[0072] According to one embodiment, the computing device may regenerate relationship information by extracting only a portion of the first set of auxiliary chunks (320). For example, the number of auxiliary chunks having a connection relationship with one main chunk may be limited to a threshold number. That is, by limiting the number of auxiliary chunks having a relationship with each chunk, the computing device can solve the problem of reduced search speed and search efficiency caused by numerous chunks being cited during a search. Here, the number of auxiliary chunks may be calculated based on the computing resources of the computing device and the number of multiple chunks. For example, the threshold number may increase as the computing resources are higher, and the threshold number may decrease as the number of multiple chunks increases. In another example, the threshold number may be set by the user.

[0073] According to one embodiment, the computing device may calculate the number of a first set of auxiliary chunks (320) and determine whether the number of the first set of auxiliary chunks (320) exceeds the threshold number by comparing the calculated number of the first set of auxiliary chunks (320) with the threshold number. Then, if the computing device determines that the number exceeds the threshold number, it may provide the first chunk (310) and the first set of auxiliary chunks (320) to an artificial intelligence model to calculate a similarity score (420). Here, the artificial intelligence model may include a cross encoder trained to calculate semantic similarity for two inputs.

[0074] According to one embodiment, the computing device may extract a threshold number of second set auxiliary chunks (410) in order of highest similarity score (420) among the first set of auxiliary chunks (320). In the illustrated example, the second set of auxiliary chunks (410) may include a second-1 chunk (410_1), a second-2 chunk (410_2), ..., a second-3 chunk (410_3). The computing device may regenerate relationship information by redefining the connection relationship between the first chunk (310) and the second set of auxiliary chunks (410). That is, the computing device may continuously check and regenerate the relationship information of each chunk even when a new chunk is created and the database is updated.

[0075] According to one embodiment, when a computing device receives a search term, it provides the received search term to a language model to generate answer data associated with the search term based on a plurality of chunks, a plurality of embedding vectors, and relationship information. For example, when a first chunk (310) is extracted in response to a search term, a second set of auxiliary chunks (410) having a connection relationship with the first chunk (310) may be extracted together. In this case, the computing device can generate answer data using the first chunk (310) and the second set of auxiliary chunks (410).

[0076] With this configuration, the computing device generates relationship information using only simple parameters such as keywords and locations when defining the connection relationships of chunks, and calculates similarity using an artificial intelligence model only when the number of auxiliary chunks exceeds a threshold, thereby enabling efficient use of computing resources required for database construction when generating relationship information.

[0077] FIG. 5 is a block diagram illustrating an example in which a language model (104) according to an embodiment of the present invention generates an answer. According to an embodiment, the language model (104) may refer to a RAG-based search model that generates an answer by referencing data stored in a database. According to an embodiment, the database may include a set of chunks (502), embedding vectors (504), auxiliary information (506), and relation information (508) corresponding to each area of ​​a document.

[0078] According to one embodiment, when a search term is input, the language model (104) can generate answer data (510) using a chunk (502) and an embedding vector (504). In this case, the language model (104) can generate a search vector corresponding to the search term based on an embedding model. Then, the language model (104) can generate answer data (510) by combining keyword search of the search term and chunk (502) and vector search between the search vector and the embedding vector (504).

[0079] Additionally or alternatively, when a search term is entered, the language model (104) can generate answer data (510) using a chunk (502), an embedding vector (504), and auxiliary information (506). In this case, the language model (104) can generate answer data (510) by referencing the auxiliary information (506), while combining keyword search of the search term and chunk (502) with vector search between the search vector and the embedding vector (504). For example, if the auxiliary information (506) is a JSON table, the language model (104) can recognize the form and content of the table using the auxiliary information (506). In another example, if the auxiliary information (506) is the storage location of an image, the language model (104) can recognize the original image through the storage location.

[0080] Additionally or alternatively, when a search term is entered, the language model (104) can generate answer data (510) using chunks (502), embedding vectors (504), and relationship information (508). In this case, when the language model (104) performs a keyword search of the search term and chunks (502), it can extract all specific chunks that were keyword-searched and other chunks that have a relationship with those chunks. Then, the language model (104) can generate answer data (510) by combining this keyword search and a vector search between the search vectors and embedding vectors (504).

[0081] FIG. 6 is a flowchart illustrating an example of a semantic chunking method (600) for RAG-based search according to an embodiment of the present invention. The semantic chunking method (600) for RAG-based search may be performed by at least one processor (e.g., at least one processor of a computing device). The semantic chunking method (600) for RAG-based search may be initiated by the processor receiving a document (S610).

[0082] According to one embodiment, the processor can divide a document into multiple regions based on structural semantic units (S620). For example, the document may be a document having a hierarchical structure such as chapters, sections, and clauses, and the processor can divide the document into multiple regions according to this hierarchical structure.

[0083] According to one embodiment, the processor may generate a plurality of chunks corresponding to each region based on the data type of each region included in the plurality of regions (S630). For example, if the data type of a first region included in the plurality of regions is text, the processor may extract the text included in the first region and generate a first chunk associated with the first region. In another example, if the data type of a second region included in the plurality of regions is a table, the processor may extract the text included in the table and generate a second chunk associated with the second region. In yet another example, if the data type of a third region included in the plurality of regions is an image, the processor may generate summary information describing the image and use the generated summary information to generate a third chunk associated with the third region.

[0084] According to one embodiment, the processor can generate a plurality of embedding vectors corresponding to a plurality of generated chunks (S640). In this case, an embedding model such as BERT may be used. The processor can associate the plurality of chunks and the plurality of embedding vectors and store them in a database (S650). The plurality of chunks and the plurality of embedding vectors stored in this way can be used for RAG-based search.

[0085] According to one embodiment, if the data type of the first region is text, the processor may generate a document name of a document including the first region as first auxiliary information and associate a first chunk, a first embedding vector corresponding to the first chunk, and the first auxiliary information and store them in a database. Additionally, if the data type of the second region is a table, the processor may generate a JSON table corresponding to the table as second auxiliary information and associate a second chunk, a second embedding vector corresponding to the second chunk, and the second auxiliary information and store them in a database. Additionally, if the data type of the third region is an image, the processor may generate a storage location of the image as third auxiliary information and associate a third chunk, a third embedding vector corresponding to the third chunk, and the third auxiliary information and store them in a database.

[0086] According to one embodiment, a processor may extract a first chunk included in a plurality of chunks and extract a first set of auxiliary chunks having a relationship with the first chunk based on keyword similarity or positional similarity between the first chunk and the remaining chunks excluding the first chunk. For example, the processor may extract at least one representative keyword from the first chunk and extract a first set of auxiliary chunks containing at least one keyword among the at least one representative keyword extracted from the remaining chunks.

[0087] The processor can generate relationship information by defining a connection relationship between a first chunk and an extracted first set of auxiliary chunks, and can associate multiple chunks and relationship information and store them in a database. Additionally, the processor can calculate the number of auxiliary chunks in the first set and determine whether the number of auxiliary chunks in the first set exceeds a threshold by comparing the calculated number of auxiliary chunks in the first set with a threshold count. In this case, the processor can calculate the threshold count based on the computing resources of the computing device performing semantic chunking and the number of multiple chunks.

[0088] If it is determined that the threshold number is exceeded, the processor provides the first chunk and the first set of auxiliary chunks to an artificial intelligence model to calculate a similarity score, and can extract the second set of auxiliary chunks equal to the threshold number in order of highest calculated similarity score among the first set of auxiliary chunks. Then, the processor can regenerate relationship information by redefining the connection relationships between the first chunk and the second set of auxiliary chunks.

[0089] Relationship information indicating the relationship between multiple regions can be generated, and multiple chunks and relationship information can be associated and stored in a database. For example, the processor can generate relationship information based on the locations of multiple regions within a document and text associated with relationships among the content contained in the multiple regions.

[0090] According to one embodiment, when a processor receives a search term, it provides the received search term to a language model to generate answer data associated with the search term based on a plurality of chunks, a plurality of embedding vectors, auxiliary information and / or relational information. For example, the processor may optionally use auxiliary information and / or relational information to generate answer data associated with the search term.

[0091] FIG. 7 is a block diagram showing the hardware configuration of a computing device (100) according to an embodiment of the present invention. According to an embodiment, the computing device (100) may include a memory (710), a processor (720), a communication module (730), and an input / output interface (740). As shown in FIG. 7, the computing device (100) may be configured to communicate information and / or data over a network using the communication module (730).

[0092] The memory (710) may include any non-transient computer-readable recording medium. According to one embodiment, the memory (710) may include a permanent mass storage device such as random access memory (RAM), read-only memory (ROM), disk drive, solid state drive (SSD), flash memory, etc. As another example, a permanent mass storage device such as ROM, SSD, flash memory, disk drive, etc. may be included in the computing device (100) as a separate permanent storage device distinct from the memory. Additionally, an operating system and at least one program code may be stored in the memory (710).

[0093] These software components may be loaded from a computer-readable recording medium separate from the memory (710). This separate computer-readable recording medium may include a recording medium that can be directly connected to the computing device (100), for example, a computer-readable recording medium such as a floppy drive, disk, tape, DVD / CD-ROM drive, or memory card. As another example, the software components may be loaded into the memory (710) via a communication module (730) rather than a computer-readable recording medium. For example, at least one program may be loaded into the memory (710) based on a computer program installed by files provided through the communication module (730) by developers or a file distribution system that distributes installation files for the application.

[0094] The processor (720) may be configured to process instructions of a computer program by performing basic arithmetic, logic, and input / output operations. Instructions may be provided to a user terminal (not shown) or another external system by memory (710) or a communication module (730).

[0095] The communication module (730) may provide a configuration or function for a user terminal (not shown) and a computing device (100) to communicate with each other via a network, and may provide a configuration or function for the computing device (100) to communicate with an external system (e.g., a separate cloud system). For example, control signals, commands, data, etc. provided under the control of the processor (720) of the computing device (100) may be transmitted to the user terminal and / or the external system through the communication module (730) and the network, and through the communication module of the user terminal and / or the external system.

[0096] Additionally, the input / output interface (740) of the computing device (100) may be a means for interfacing with a device (not shown) for input or output that is connected to the computing device (100) or that the computing device (100) may include. In FIG. 7, the input / output interface (740) is shown as an element configured separately from the processor (720), but is not limited thereto, and the input / output interface (740) may be configured to be included in the processor (720). The computing device (100) may include more components than those shown in FIG. 7. However, there is no need to clearly illustrate most of the prior art components.

[0097] The processor (720) of the computing device (100) may be configured to manage, process, and / or store information and / or data received from a plurality of user terminals and / or a plurality of external systems.

[0098] The methods and / or various embodiments described above may be realized in digital electronic circuits, computer hardware, firmware, software, and / or combinations thereof. Various embodiments of the present invention may be executed by a data processing device, for example, one or more programmable processors and / or one or more computing devices, or implemented as a computer program stored on a computer-readable recording medium and / or a computer program stored on a computer-readable recording medium. The computer program described above may be written in any form of programming language, including a compiled language or an interpreted language, and may be distributed in any form, such as a standalone program, a module, a subroutine, etc. The computer program may be distributed through a single computing device, a plurality of computing devices connected through the same network, and / or a plurality of computing devices distributed to be connected through a plurality of different networks.

[0099] The above-described methods and / or various embodiments may be performed by one or more processors configured to execute one or more computer programs that process, store, and / or manage any functions, functions, etc. by operating based on input data or generating output data. For example, the methods and / or various embodiments of the present invention may be performed by special-purpose logic circuits such as a Field Programmable Gate Array (FPGA) or an Application Specific Integrated Circuit (ASIC), and an apparatus and / or system for performing the methods and / or embodiments of the present invention may be implemented as a special-purpose logic circuit such as an FPGA or an ASIC.

[0100] One or more processors executing a computer program may include one or more processors of a general-purpose or special-purpose microprocessor and / or any type of digital computing device. The processor may receive instructions and / or data from each of read-only memory and random access memory, or receive instructions and / or data from read-only memory and random access memory. In the present invention, components of a computing device performing the methods and / or embodiments may include one or more processors for executing instructions and one or more memory devices for storing instructions and / or data.

[0101] According to one embodiment, a computing device may exchange data with one or more mass storage devices for storing data. For example, the computing device may receive and / or receive data from a magnetic disc or an optical disc, and may transfer data to a magnetic disc or an optical disc. A computer-readable storage medium suitable for storing instructions and / or data associated with a computer program may include, but is not limited to, any form of non-volatile memory including semiconductor memory devices such as EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable PROM), and flash memory devices. For example, a computer-readable storage medium may include magnetic discs such as internal hard disks or removable disks, optical magnetic discs, CD-ROMs, and DVD-ROMs.

[0102] To provide interaction with a user, the computing device may include, but is not limited to, a display device for providing or displaying information to the user (e.g., CRT (Cathode Ray Tube), LCD (Liquid Crystal Display), etc.) and a pointing device (e.g., keyboard, mouse, trackball, etc.) on which the user can provide input and / or commands, etc. on the computing device. That is, the computing device may further include any other type of device for providing interaction with the user. For example, the computing device may provide any form of sensory feedback to the user for interaction with the user, including visual feedback, auditory feedback and / or tactile feedback. In this regard, the user may provide input to the computing device through various gestures such as visual, vocal, and motion.

[0103] In the present invention, various embodiments may be implemented in a computing system comprising backend components (e.g., data servers), middleware components (e.g., application servers), and / or frontend components. In this case, the components may be interconnected by any form or medium of digital data communication, such as a communication network. For example, the communication network may include a Local Area Network (LAN), a Wide Area Network (WAN), etc.

[0104] A computing device based on the exemplary embodiments described herein may be implemented using hardware and / or software configured to interact with a user, including a user device, a user interface (UI) device, a user terminal, or a client device. For example, the computing device may include a portable computing device such as a laptop computer. Additionally or alternatively, the computing device may include, but is not limited to, Personal Digital Assistants (PDAs), tablet PCs, game consoles, wearable devices, Internet of Things (IoT) devices, Virtual Reality (VR) devices, Augmented Reality (AR) devices, etc. The computing device may further include other types of devices configured to interact with a user. Additionally, the computing device may include a portable communication device suitable for wireless communication over a network such as a mobile communication network (e.g., a mobile phone, a smartphone, a wireless cellular phone, etc.). A computing device may be configured to communicate wirelessly with a network server using wireless communication technologies and / or protocols such as radio frequency (RF), microwave frequency (MWF) and / or infrared frequency (IRF).

[0105] Various embodiments of the present invention, including specific structural and functional details, are exemplary. Accordingly, the embodiments of the present invention are not limited to those described above and may be implemented in various other forms. Furthermore, the terms used in the present invention are intended to describe some embodiments and are not to be interpreted as limiting the embodiments. For example, singular words and the above may be interpreted to include plural forms unless the context clearly indicates otherwise.

[0106] In this invention, 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 such concepts belong. Furthermore, commonly used terms, such as those defined in advance, should be interpreted as having a meaning consistent with their meaning in the context of the relevant technology.

[0107] Although the present invention has been described in relation to some embodiments, various modifications and changes may be made without departing from the scope of the invention as understood by a person skilled in the art to which the invention pertains. Furthermore, such modifications and changes should be considered to fall within the scope of the claims appended to this specification. Explanation of the symbols

[0109] 100: Computing device 102: AI Agent 104: Language Models 110: Database

Claims

Claim 1 A semantic chunking method for RAG-based search performed by at least one processor, comprising: receiving a document; dividing the document into multiple regions based on structural semantic units; generating multiple chunks corresponding to each region based on the data type of each region included in the multiple regions; generating multiple embedding vectors corresponding to the generated multiple chunks; and associating the multiple chunks and the multiple embedding vectors and storing them in a database; wherein the step of generating multiple chunks corresponding to each region based on the data type of each region included in the multiple regions comprises: generating summary information describing the image when the data type of a third region included in the multiple regions is an image; and generating a third chunk associated with the third region using the generated summary information. Claim 2 A semantic chunking method for RAG-based search according to claim 1, wherein the step of generating a plurality of chunks corresponding to each region based on the data type of each region included in the plurality of regions comprises, when the data type of a first region included in the plurality of regions is text, the step of extracting text included in the first region and generating a first chunk associated with the first region. Claim 3 A semantic chunking method for RAG-based search according to claim 2, further comprising the step of generating a document name of the document including the first area as first auxiliary information when the data type of the first area is text; and the step of associating and storing the plurality of chunks and the plurality of embedding vectors in a database comprises the step of associating and storing the first chunk, the first embedding vector corresponding to the first chunk, and the first auxiliary information in the database. Claim 4 A semantic chunking method for RAG-based search according to claim 3, further comprising: receiving a search term regarding the first chunk; and providing the received search term to a language model to generate answer data associated with the first chunk based on the first chunk, the first embedding vector, and the first auxiliary information. Claim 5 A semantic chunking method for RAG-based search according to claim 1, wherein the step of generating a plurality of chunks corresponding to each region based on the data type of each region included in the plurality of regions comprises the step of, when the data type of a second region included in the plurality of regions is a table, extracting text included in the table to generate a second chunk associated with the second region. Claim 6 A semantic chunking method for RAG-based search according to claim 5, further comprising the step of generating a JSON table corresponding to the table as second auxiliary information when the data type of the second area is a table, and the step of associating and storing the plurality of chunks and the plurality of embedding vectors in a database, comprising the step of associating and storing the second chunk, the second embedding vector corresponding to the second chunk, and the second auxiliary information in the database. Claim 7 In claim 6, the step of generating a JSON table corresponding to the table as second auxiliary information comprises providing the table to a learned artificial intelligence model to generate the JSON table corresponding to the table; a semantic chunking method for RAG-based search. Claim 8 A semantic chunking method for RAG-based search according to claim 6, further comprising: receiving a search term regarding the second chunk; and providing the received search term to a language model to generate answer data associated with the second chunk based on the second chunk, the second embedding vector, and the second auxiliary information. Claim 9 delete Claim 10 A semantic chunking method for RAG-based search according to claim 1, wherein the step of generating summary information describing the image comprises the step of providing the image to a learned artificial intelligence model to generate summary information describing the image. Claim 11 A semantic chunking method for RAG-based search according to claim 1, further comprising the step of generating a storage location of the image as third auxiliary information when the data type of the third region is an image; and the step of associating and storing the plurality of chunks and the plurality of embedding vectors in a database comprises the step of associating and storing the third chunk, the third embedding vector corresponding to the third chunk, and the third auxiliary information in the database. Claim 12 A semantic chunking method for RAG-based search according to claim 11, further comprising: receiving a search term regarding the third chunk; and providing the received search term to a language model to generate answer data associated with the third chunk based on the third chunk, the third embedding vector, and the third auxiliary information. Claim 13 A semantic chunking method for RAG-based search according to claim 1, further comprising the step of generating auxiliary information according to the data type of each region included in the plurality of regions; and the step of associating and storing the plurality of chunks and the plurality of embedding vectors in a database, comprising the step of associating and storing the plurality of chunks, the plurality of embedding vectors, and the auxiliary information in the database. Claim 14 A semantic chunking method for RAG-based search according to claim 13, further comprising: a step of generating relationship information indicating the relationship between the plurality of regions; and a step of associating the plurality of chunks and the relationship information and storing them in the database. Claim 15 In claim 14, the step of generating relationship information indicating the relationship between the plurality of regions comprises the step of generating the relationship information based on the location of the plurality of regions within the document and text associated with the relationship among the content included in the plurality of regions; a semantic chunking method for RAG-based search. Claim 16 A semantic chunking method for RAG-based search according to claim 14, further comprising: a step of receiving a search term; and a step of providing the received search term to a language model to generate answer data associated with the search term based on the plurality of chunks, the plurality of embedding vectors, the auxiliary information, and the relationship information. Claim 17 A semantic chunking method for RAG-based search according to claim 1, further comprising: a step of extracting a first chunk included in the plurality of chunks; a step of extracting a first set of auxiliary chunks having a relationship with the first chunk based on keyword similarity or positional similarity between the first chunk and the remaining chunks excluding the first chunk; a step of generating relationship information by defining a connection relationship between the first chunk and the extracted first set of auxiliary chunks; and a step of associating the plurality of chunks and the relationship information and storing them in the database. Claim 18 A semantic chunking method for RAG-based search according to claim 17, wherein the step of extracting a first set of chunks having a relationship with the first chunk comprises: a step of extracting at least one representative keyword from the first chunk; and a step of extracting an auxiliary chunk of the first set among the remaining chunks that includes at least one keyword among the extracted at least one representative keyword. Claim 19 A semantic chunking method for RAG-based search according to claim 17, further comprising: a step of calculating the number of auxiliary chunks of the first set; a step of determining whether the number of auxiliary chunks of the first set exceeds the threshold number by comparing the calculated number of auxiliary chunks of the first set with a threshold number; a step of providing the first chunk and the auxiliary chunks of the first set to an artificial intelligence model to calculate a similarity score if it is determined that the number exceeds the threshold number; a step of extracting an amount of auxiliary chunks of the second set equal to the threshold number among the auxiliary chunks of the first set in order of highest calculated similarity score; and a step of regenerating the relationship information by redefining the connection relationship between the first chunk and the auxiliary chunks of the second set. Claim 20 A semantic chunking method for RAG-based search according to claim 19, further comprising the step of calculating the threshold number based on the computing resources of a computing device performing semantic chunking and the number of the plurality of chunks. Claim 21 A semantic chunking method for RAG-based search according to claim 17, further comprising: a step of receiving a search term; and a step of providing the received search term to a language model to generate answer data associated with the search term based on the plurality of chunks, the plurality of embedding vectors, and the relationship information. Claim 22 A computer program stored on a computer-readable recording medium for executing a method according to any one of paragraphs 1 through 8 and paragraphs 10 through 21 on a computer. Claim 23 A computing device comprising: a communication module; a memory; and at least one processor connected to the memory and configured to execute at least one computer-readable program included in the memory, wherein the at least one program comprises instructions for receiving a document, dividing the document into a plurality of regions based on structural semantic units, generating a plurality of chunks corresponding to each region based on the data type of each region included in the plurality of regions, generating a plurality of embedding vectors corresponding to the generated plurality of chunks, associating the plurality of chunks and the plurality of embedding vectors and storing them in a database, and, if the data type of a third region included in the plurality of regions is an image, generating summary information describing the image, and generating a third chunk associated with the third region using the generated summary information.

Citation Information

Patent Citations

  • Method and system for advanced retrieval-augmented generation through metadata extraction and retrieval engine mixing

    KR1020250161877A

  • Search system using hierarchical metadata based on retrieval augmented generation and method thereof

    KR102824126B1