Data retrieval for AI models

By splitting data into master and sub-chunks and mapping matched sub-chunks back to their master chunks, the method addresses the challenge of balancing chunk size in RAG systems, enhancing data retrieval accuracy and LLM performance.

GB2641725APending Publication Date: 2025-12-17MASTERCARD INT INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
GB2024008051
Authority / Receiving Office
GB · GB
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2025-12-17

AI Technical Summary

Technical Problem

Existing retrieval augmented generation (RAG) systems face challenges in balancing the need for smaller data chunks for accurate semantic matching and larger chunks for contextual understanding, leading to inefficiencies and hallucinations in large language models (LLMs).

Method used

The method involves splitting data into master chunks and further subdividing them into sub-chunks, matching sub-chunks to queries, and mapping matched sub-chunks back to their corresponding master chunks for input into LLMs, ensuring accurate semantic matching while providing sufficient context.

Benefits of technology

This approach enhances the accuracy and efficiency of data retrieval, reducing hallucinations and improving the performance of LLMs by ensuring precise matching and sufficient contextual input.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

A computer implemented method of retrieving data to input into a machine learning model, e.g. a large language model (LLM), for use in a retrieval augmented generation (RAG) system comprises accessing
Need to check novelty before this filing date? Find Prior Art

Description

Field The present invention relates to methods and systems configured to retrieve data to input into a machine learning model for use in a retrieval augmented generation system. In particular, the method and systems allow for data to be retrieved that corresponds to a query, such that the retrieved data can be used to answer the query. Background Retrieval augmented generation (RAG) systems provide a method in which relevant data can be retrieved for input into machine learning models. The performance and quality of these systems depend on the quality and accuracy of the data retrieved. Typically, data retrieval in RAG systems works by converting data into smaller pieces of data called chunks. For example, this may be documents of text that are converted into smaller chunks of text. The chunks of data are then compared to a user’s query in order to retrieve the chunks from within the data or text that corresponds to the query. The retrieved data and query are then input into a large language model (LLM). In order to retrieve accurate data i.e., chunks of data that closely match the semantic meaning of the query, smaller size chunks may be preferred. The smaller the chunk of data, the easier it is to determine whether it’s semantic meaning matches that of the user’s query. However, when inputting the retrieved data into the LLM, larger chunk sizes may be preferable. A larger chunk size of data will typically enable the LLM to better understand the context of the query and data, and draw meaning inferences, given that more retrieved data will be input into the model. Therefore, there are commonly two competing criteria when looking to implement a RAG system. Data chunk retrieval and chunk size are inversely related, and thus would benefit from smaller chunks. However, the LLM performance and chunk size are directly related and thus, would benefit from larger chunk sizes to provide more context to the LLM. Furthermore, LLM often experience what is known as hallucinations, where the LLM generates outputs in response to queries which contain false or misleading information. This reduces the accuracy and performance of the machine learning model. Insufficient data or biases in the data which may cause poor data retrieval, when input into the LLM are commonly known to cause hallucinations in the LLM outputs. The present invention sets out to alleviate these problems relating to data chunk sizes and aims to improve the precision of the data retrieval within RAG systems and in turn, the efficiency and accuracy of the generation by a machine learning model. Summary of Invention According to an aspect there is provided a computer implemented method of retrieving data to input into a machine learning model for use in a retrieval augmented generation system, the method comprising: accessing, at the data retrieval server, data from a data source server; splitting, at the data retrieval server, the data from the data source server into a plurality of master chunks, wherein each master chunk comprises a section of the data from the data source server; splitting, at the data retrieval server, each of the plurality of master chunks into a plurality of sub chunks, wherein each sub-chunk comprises a section of data from its corresponding master chunk; receiving, at a data retrieval server, data representing a query; comparing, at the data retrieval server, each of the sub chunks of data to the data representing the query; determining, at the data retrieval server, a matched sub chunk, wherein the matched sub chunk is a sub chunk from the plurality of sub chunks that matches the data representing the query; determining, at the data retrieval server, a master chunk from the plurality of master chunks that corresponds to the matched sub chunk, such that the data representing the query and the master chunk determined to correspond to the matched sub chunk are input into a machine learning model so as to generate an answer to the query using the machine learning model. This provides an improved method for retrieving data from within a data source that corresponds to the query. By splitting the data into master chunks and then splitting each master chunk into smaller sub chunks, the method allows for small sub chunks of data to be matched to the query. The smaller sub chunks provide an improved matching method, as the semantic meaning of a smaller chunk of data, compared to a larger chunk of data, can more easily and efficiently be matched to the semantic meaning of the query, providing more accurate matchings between the sub chunks of data and the query. However, the method also includes determining the master chunk in which the matched sub chunk was originally split from. The sub chunk of data that was found to match the query is mapped back to the corresponding master chunk. In this way, the larger master chunks can be used as input into the machine learning model, as larger chunks provide more data (also referred to as context) to the machine learning model, improving the output generated by said model. Therefore, in using the smaller sub chunks of data to match to the query, mapping the matched sub chunks back into their larger master chunks, and providing these matched master chunks to the machine learning model, the method provides a more accurate matching between chunks of data and the query, whilst also providing sufficient amounts of relevant data to the model. This results in a more accurate and efficient data retrieval method. The method also enhances the performance of the machine learning model by reducing any hallucinations experienced by the model, given that improved and more accurate data is input into the model. The method improves the quality of the data retrieval, and thus improves the generation of the machine learning model. This improved generation by the machine learning model results in an overall more efficient machine learning model that produces more accurate outputs with reduced hallucinations. A further advantage due to the improved data retrieval is an improved recall and reliability of the output generated by the machine learning model. The receiving, at a data retrieval server, of data representing the query may comprise receiving the query from a user. The data representing the query may be, for example, a string of text representing the query. The string of text representing the query may be received from the user. Alternatively, the data representing the query may be automatically generated in response to receiving the query from the user, or the data representing the query may have been previously stored in a memory such that the data representing the query can be obtained from the memory. Each master chunk is formed of a section of data from the data source server, and each sub chunk is formed of a section of data from its corresponding master chunk. Each master chunk may comprise a different section of the data to the other master chunks. Alternatively, one or more of the plurality of master chunks may comprise the same or overlapping sections of data from the data source. Each sub chunk split from a master chunk may comprise a different section of data to the other sub chunks split from the same master chunk, or alternatively they may comprise the same or overlapping sections of data from within the master chunk. Each master chunk is split into a plurality of sub chunks, such that the section of data in each sub-chunk is smaller than the section of data in each corresponding master chunk. The size of a sub chunk is therefore smaller than the size of its corresponding master chunk, as each sub chunk will be formed of less data than its corresponding master chunk. The method may comprise receiving data representing a plurality of queries such that the comparing, at the data retrieval server, each of the sub chunks of data to the data representing the query comprises comparing each and every sub chunk of data from the plurality of sub chunks to data representing each of the plurality of queries. A plurality of matched sub chunks may also be determined i.e., a plurality of sub chunks may be determined to match the data representing the query, or in the case of a plurality of queries, a plurality of different sub chunks may be determined to match the data representing one or more of the plurality of queries. Preferably, the method may further comprise: determining, at the data retrieval server, for each master chunk of the plurality of master chunks, whether a size of said master chunk is within a predetermined range; changing, at the data retrieval server, the size of each master chunk whose size is not within the predetermined range, such that the size of each master chunk is within the predetermined range. In this way, it can be ensured that each master chunk is of a desired size. A predetermined range can be set, such that each master chunk is verified to determine whether its size is within the predetermined range. This ensures that master chunks are split from data in the data source that have an optimal size for their intended purpose. If the size of a master chunk is too big or too small, i.e., not within the predetermined range, its size can be changed such that it is within the predetermined range. The size of a master chunk is the amount of data within a master chunk. Changing the size of a master chunk comprises changing the amount of data (i.e., the selected data) from the data source within the master chunk. Changing the size of a master chunk may comprise adding further data from the data source into the master chunk, or it may comprise removing data from the master chunk. Preferably, wherein determining, at the data retrieval server, for each master chunk of the plurality of master chunks, whether the size of said master chunk is within the predetermined range may comprise: determining, at the data retrieval server, for each master chunk of the plurality of master chunks, whether the size of said master chunk is above an upper limit of the predetermined range; and wherein changing, at the data retrieval server, the size of each master chunk whose size is not within the predetermined range, such that the size of said master chunk is within the predetermined range comprises: reducing, at the data retrieval server, the size of each master chunk whose size is above the upper limit of the predetermined range, such that the size of said master chunk is below the upper limit of the predetermined range. In this way, the size of each master chunk is reduced, if its size is above an upper limit of the predetermined range. This may help ensure that any additional unrelated data within a master chunk that is not relevant to the query of the user is not input into the machine learning model. The method allows for a maximum limit of the size of a master chunk to be set, and for each master chunk that is above this limit, to be reduced such that its size is below the limit. Any unwanted or irrelevant data can then be removed from the master chunk and prevented from being input into the machine learning model, which would decrease the accuracy and efficiency of the model in answering the query of the user. Reducing the size of a master chunk within the plurality of master chunks may comprise removing data from the master chunk such that the size of the section of data within the master chunk is below the upper limit. The data that is removed from the master chunk(s) may be disregarded, or alternatively it may be stored in a memory. Preferably, wherein determining, at the data retrieval server, for each master chunk of the plurality of master chunks, whether the size of said master chunk is within the predetermined range may comprise: determining, at the data retrieval server, for every master chunk of the plurality of master chunks, whether the size of said master chunk is below a lower limit of the predetermined range; and wherein changing, at the data retrieval server, the size of each master chunk whose size is not within the predetermined range, such that the size of said master chunk is within the predetermined range comprises: increasing, at the data retrieval server, the size of each master chunk whose size is below the lower limit of the predetermined range, such that the size of said master chunk is above the lower limit of the predetermined range. This allows for the size of each master chunk to be increased, if its size is below a lower limit of the predetermined range. The method ensures that each master chunk split from the data in the data source is large enough to be self-contained in their meaning, such that there is sufficient context of text within each master chunk for input into the machine learning model. A master chunk that is too small i.e., contains too little data, when input into the machine learning model, will not provide enough context to the model to generate an answer to the query, meaning that the model will not generate a sufficiently accurate prediction. This is prevented by determining that each master chunk is above the lower limit, and if a master chunk is not above the lower limit, that master chunk is increased in size. Increasing the size of a master chunk within the plurality of master chunks may comprise adding further data from the data source into the master chunk i.e., increasing the size of the section of data that forms the master chunk, such that the size of the section of data within the master chunk is within the predetermined range. Preferably, the method may further comprise: determining, at the data retrieval server, a plurality of semantically related segments of text from within the data from the data source server, wherein the data from the data source server is text data; and determining, at the data retrieval server, a size of each of the semantically related text segments; and setting, at the data retrieval server, the predetermined range such that the predetermined range defines a size of a section of text that encompasses the sizes of each of the semantically related text segments. In this way, segments of text within the data source that relate to each other can be determined and are used to set the predetermined range. The sizes of the segments of the text data that are semantically related, i.e., have the same semantic meaning, are used to determine the maximum and minimum size of the master chunks that are split from the data. This ensures that each master chunk comprises sufficient data or text (i.e., has a large enough size) so that that they are self-contained in their meaning, whilst also preventing master chunks being formed that comprise completely unrelated text (or text that is likely to have a different semantic meaning). Semantically related segment of texts may comprise text that is semantically associated i.e., different parts of the text have associated semantic meanings. Preferably, wherein the text data of the data source server may comprise a document, and wherein the semantically related text segments of the text data are segments of text defined by any of: headings of the document, sub-headings of the document, or paragraphs of the document. Advantageously, this allows for the structure of documents within the data source to be used to determine the desired size of each master chunks. The semantically related segments of text can be defined by headings, sub heading or paragraphs, and these segments of text may be used to set the predetermined range and therefore set the maximum and minimum size for each master chunks. This ensures that each master chunk is large enough to ensure that they are self-contained within their meaning, as the headings, subheadings and paragraphs of a document will be self-contained in their meaning, whilst also ensuring that the master chunks are not too large to decrease the efficiency of the machine learning model with unrelated context. Preferably, the method may further comprise: determining, at the data retrieval server, for each sub chunk of the plurality of sub chunks, whether a size of said sub chunk is above a predetermined threshold; reducing, at the data retrieval server, the size of each sub chunk whose size is above the predetermined threshold, such that the size of said sub chunk is below the predetermined threshold. In this way, the size of each sub chunk can be validated in order to ensure that each sub chunk is of a desired size. A predetermined threshold can be set, such that each sub chunk is tested to determine whether its size is above the predetermined threshold. This ensures that sub chunks split from master chunks are sufficiently small to accurately match their semantic meaning to the data representing the query. The smaller the sub chunk the more accurate the matching between the sub chunk and the data representing the query. The size of each sub chunk is the amount of data within each sub chunk. Reducing the size of each sub chunk comprises reducing the amount of data within each sub chunk. This may be removing data from the sub chunk such that the size of the section of data within the sub chunk is below the predetermined threshold. The data that is removed from the sub chunk(s) may be disregarded, or alternatively it may be stored in a memory. Preferably, wherein the data from the data source server is text data, wherein each master chunk is formed of a section of the text data of the data source server, and wherein each sub-chunk is formed of a section of the text data in the corresponding master chunk, such that each sub chunk is formed of a smaller amount of text data than its corresponding master chunk. By accessing text from the data source such that each master chunk and sub chunk comprises a section of the text from the data source, the data representing the query can more precisely be matched to the text in the sub chunks in order for the data retrieval to be accurate. The matched sub chunk will therefore comprise a section of text with a smaller more focused semantic meaning compared to the text within the larger master chunks. This semantic meaning is compared to the query, and due to the focused meaning, will yield more accurate matches. The master chunk corresponding to the matched sub chunk, which corresponds to the query, can then be used by a machine learning model to answer the query. The matched sub chunk of data may comprise the same or sufficiently similar data to the data representing the query. When the data representing the user’s query comprises a text string, the text of the matched sub chunk may comprise a related semantic meaning to the semantic meaning of the text within the query. For example, the query may comprise a question and the matched sub chunk may comprise all or part of an answer to the question. Preferably, the method may further comprise: transforming, at the data retrieval server, the data representing the query into a vector representation, so as to generate a query vector representation; and transforming, at the data retrieval server, each of the sub chunks into a vector representation, so as to generate a plurality of sub chunk vector representations; and wherein comparing, at the data retrieval server, each of the sub chunks of data to the data representing the query comprises: comparing, at the data retrieval server, each of the sub chunk vector representations to the query vector representation; and wherein determining, at the data retrieval server, a matched sub chunk, wherein the matched sub chunk is a sub chunk from the plurality of sub chunks that matches the data representing the query comprises: determining, at the data retrieval server, a matched sub chunk vector representation, wherein the matched sub chunk vector representation is a sub chunk vector representation from the plurality of sub chunk vector representations that matches the query vector representation; and transforming, at the data retrieval server, the matched sub chunk vector representation into its corresponding sub chunk, where said corresponding sub chunk is the matched sub chunk. In this way, small sub chunks of data are transformed into vector representations, otherwise known as embeddings, and matched to a vector representation (embedding) of the user’s query. This allows for the semantic meaning of the query to be more easily searched and matched to any sub chunks that have similar meanings. Using semantic vector representations, known as embeddings, provides a method in which data corresponding to the meaning of the user’s query can be more accurately retrieved. Further, in using the smaller sub chunks of data as embeddings to match to the user’s query embeddings, rather than the larger master chunks of data, the method provides a more accurate matching of embeddings, as smaller sections of data are easier to compare and match their semantic meanings. When converting the sub chunks into vector representations, larger sub chunks will suffer from data losses as the data in the sub chunks is compressed. During converting the sub chunks of data into vector representations, the data (i.e., text) within each sub chunk is mapped into a vector space, referred to as compressing. The loss of information happens during the mapping between larger sections of data and their corresponding vector space. Therefore, in using smaller sub chunks this loss is minimized, and therefore a more precise retrieval result may be obtained when the query and sub chunk vector representations are later matched. However, the method also provides sufficient amounts of relevant data to the model i.e., by mapping each matched sub chunk back to its original master chunk and providing this to the machine learning model, rather than the smaller matched sub chunks of data. This results in a more accurate and efficient data retrieval method. The matched sub chunk vector representation may be the same or sufficiently similar to the query vector representation. The matched sub chunk vector representation may comprise the same or sufficiently similar semantic meaning to the query vector representation. Transforming, at the data retrieval server, the data representing the query into a single vector representation, so as to generate a single query vector representation, may alternatively comprise transforming, at the data retrieval server, the data representing the query into a plurality of vector representations, so as to generate a plurality of query vector representations. Transforming, at the data retrieval server, each of the sub chunks into a vector representation, may alternatively comprise transforming at the data retrieval server, each of the sub chunks into a plurality of vector representations. Preferably, wherein the machine learning model may be a large language model. Alternatively, the machine learning model may be any type of machine learning model. Preferably, the method may further comprise: inputting into the machine learning model, at a machine learning model server, the data representing the query and the master chunk determined to correspond to the matched sub chunk; generating using the machine learning model, at the machine learning model server, an answer to the query. Advantageously, this allows for the master chunk that corresponds to the matched sub chunk and the data representing the query to be input into the machine learning model in order to generate an output of the machine learning model’s answer to the query. The data retrieval server may include the machine learning model server. Alternatively, the data retrieval server may be separate to the machine learning model server (i.e., remote from each other). The data retrieval server may include the data source server. Alternatively, the data retrieval server may be separate to the data source server (i.e., remote from each other). Preferably, the method may further comprise: providing, from the machine learning model server, the answer to an originator of the query. In this way the answer generated by the machine learning model after retrieval of the matched sub chunk, is provided to the originator of the query. The originator of the query may be a user. The answer may be provided to the user on a user device. Alternatively, it may be displayed on a display accessible by the user, for example, a screen display at the machine learning model server. The originator of the query may also be an external computer system or a separate module of the computer system of the data retrieval and machine learning model servers, in which the query had been previously stored. The user may be the user who asked the query, or the user may be another user unrelated to the query inputted into the machine learning model. Alternately, the answer to the query may not be provided to the user and instead stored on a memory in connection with the data retrieval server. According to a further aspect there is provided a data retrieval server, configured to: access, at the data retrieval server, data from a data source server; split, at the data retrieval server, the data from the data source server into a plurality of master chunks, wherein each master chunk comprises a section of the data from the data source server; split, at the data retrieval server, each of the plurality of master chunks into a plurality of sub chunks, wherein each sub-chunk comprises a section of data from its corresponding master chunk; receive, at a data retrieval server, data representing a query; compare, at the data retrieval server, each of the sub chunks of data to the data representing the query; determine, at the data retrieval server, a matched sub chunk, wherein the matched sub chunk is a sub chunk from the plurality of sub chunks that matches the data representing the query; determine, at the data retrieval server, a master chunk from the plurality of master chunks that corresponds to the matched sub chunk, such that the data representing the query and the master chunk determined to correspond to the matched sub chunk are input into a machine learning model so as to generate an answer to the query using the machine learning model. The data retrieval server may be configured to perform any of the above-mentioned method steps according to the above aspects of the invention. According to a further aspect there is provided a system configured to retrieve data to input into a machine learning model for use in a retrieval augmented generation system, the system comprising: a data retrieval server configured to: access, at the data retrieval server, data from a data source server; split, at the data retrieval server, the data from the data source server into a plurality of master chunks, wherein each master chunk comprises a section of the data from the data source server; split, at the data retrieval server, each of the plurality of master chunks into a plurality of sub chunks, wherein each sub-chunk comprises a section of data from its corresponding master chunk; receive, at a data retrieval server, data representing a query; compare, at the data retrieval server, each of the sub chunks of data to the data representing the query; determine, at the data retrieval server, a matched sub chunk, wherein the matched sub chunk is a sub chunk from the plurality of sub chunks that matches the data representing the query; determine, at the data retrieval server, a master chunk from the plurality of master chunks that corresponds to the matched sub chunk, such that the data representing the query and the master chunk determined to correspond to the matched sub chunk are input into a machine learning model so as to generate an answer to the query using the machine learning model, and a machine learning model server configured to: input into the machine learning model, at a machine learning model server, the data representing the query and the master chunk determined to correspond to the matched sub chunk; and generating using the machine learning model, at the machine learning model server, an answer to the query, and preferably provide, from the machine learning model server, the answer to an originator of the query. The system may be configured to perform any of the above-mentioned method steps according to the above aspects of the invention. According to a further aspect there is provided a non-transitory computer-readable medium comprising instructions which, when executed by a computer, cause the computer to: access, at the data retrieval server, data from a data source server; split, at the data retrieval server, the data from the data source server into a plurality of master chunks, wherein each master chunk comprises a section of the data from the data source server; split, at the data retrieval server, each of the plurality of master chunks into a plurality of sub chunks, wherein each sub-chunk comprises a section of data from its corresponding master chunk; receive, at a data retrieval server, data representing a query; compare, at the data retrieval server, each of the sub chunks of data to the data representing the query; determine, at the data retrieval server, a matched sub chunk, wherein the matched sub chunk is a sub chunk from the plurality of sub chunks that matches the data representing the query-; determine, at the data retrieval server, a master chunk from the plurality of master chunks that corresponds to the matched sub chunk, such that the data representing the query and the master chunk determined to correspond to the matched sub chunk are input into a machine learning model so as to generate an answer to the query using the machine learning model. The non-transitory computer-readable medium comprising instructions which, when executed by a computer, may be configured to perform any of the above-mentioned method steps according to the above aspects of the invention. According to a further aspect there is provided a computer program product comprising instructions which, when the program is executed by a computer, cause the computer to carry out any of the above-mentioned method steps according to the above aspects of the invention. Description of Figures Figure 1 shows a schematic block diagram of a conventionally known system configured to retrieve data to input into a machine learning model for use in a retrieval augmented generation system, showing the message flow of the process; Figure 2 shows a schematic block diagram of a system configured to retrieve data to input into a machine learning model for use in a retrieval augmented generation system, according to the present invention; Figure 3 shows a schematic block diagram of a system configured to retrieve data to input into a machine learning model for use in a retrieval augmented generation system, according to the present invention showing the message flow of the process; Figure 4 shows a first example of data used in a system configured to retrieve data to input into a machine learning model for use in a retrieval augmented generation system, according to the present invention; Figure 5 shows a second example of data used in a system configured to retrieve data to input into a machine learning model for use in a retrieval augmented generation system, according to the present invention; Figure 6 shows a flow diagram of a computer implemented method of retrieving data to input into a machine learning model for use in a retrieval augmented generation system, according to the present invention; and Figure 7 shows a data processing device, according to aspects of the present invention. Detailed Description The present disclosure relates to methods and systems configured to retrieve data to input into a machine learning model for use in a retrieval augmented generation system. The methods and systems are directed to data retrieval methods within a retrieval augmented generation (RAG) system, used to provide relevant data to machine learning models, specifically large language machine learning models (LLM). The present invention allows a data retrieval server to obtain access to data from a data source, and accurately and efficiently retrieve relevant data from within this data source data that matches a query, whilst also providing sufficient context corresponding to the matched data to the LLM. This is achieved by splitting the data from the data source server into a plurality of master chunks, splitting each of the plurality of master chunks into smaller sub chunks, and matching the smaller sub chunks to data representing the query. Sub chunks that are found to match the query are then mapped back onto their corresponding master chunks (in which they were split from), and it is the larger master chunk that is provided as relevant context to the LLM, along with the query. The LLM is then used to generate an answer to the query based on the context i.e., the master chunk(s) corresponding to the matched sub chunk(s). Conventionally known systems use a single chunk size and optimise this size depending on the desired outcome. Whereas the present invention incorporates using multiple different chunk sizes at different stages of the data retrieval process in order to improve the accuracy and efficiency of the whole process. Figure 1 shows a schematic block diagram of system 100 currently used for retrieving data to input into a machine learning model, showing the message flow between the different entities. The system 100 comprises a data retrieval server 110 and a machine learning model 140. Data 105 is processed by the data retrieval server 110 and is converted into a plurality of chunks 131-139. The chunks 131-139 are sections of the data 105. Each of the chunks 131-139 are then compared to a user’s query 120, in order to determine which of the chunks 131-139 match the user’s query 120. Chunks 133, 135 of data that are found to match the user’s query 120 are then input into the machine learning model 140, as well as the user’s query 120 itself. An answer to the user’s query 120 is then generated by the machine learning model 140. This method may be performed by any type of server and machine learning model. Figure 2 shows a schematic block diagram of a system 200 configured to retrieve data to input into a machine learning model for use in a retrieval augmented generation system, according to the present invention. The system 200 comprises a data source server 205, a data retrieval server 210 and a machine learning model server 240. The data retrieval server 210 has access to and obtains data 105 from the data source server 205. The system 200 further includes a machine learning model 140 that is maintained by the machine learning model server 240. The machine learning model 140 is the same as the machine learning model 140 in the example conventional system 100 shown in Figure 1. The data representing the query 120 and the data 105 from the data source server used in system 200 is also the same as those used in system 100 shown in Figure 1. The data retrieval server 210 is in communication with the data source server 205 and the machine learning model server 240. The data retrieval server 210, data source server 205 and machine learning model server 240 are separate to one another. The data source server 205, data retrieval server 210 and machine learning model server 240 are each held on a separate computer system to each other, with the data retrieval server 210 having access to the data 105 stored at the data source server 205 and is in communication with the machine learning model server 240. Additionally, the system 200 includes a user device 280. The user device 280 is in communication with the data retrieval server 210 and the machine learning model server 240.For example, as discussed in further detail below the user device 280 is in communication with the data retrieval server 210 as it may send a query to the data retrieval server 210. Further as an example, the user device 280 is in communication with the machine learning model server 240 as the machine learning model server 240 may send an answer to the query to the user device 280. Figure 3 shows a schematic block diagram of the system 200 configured to retrieve data to input into a machine learning model for use in a retrieval augmented generation system, according to the present invention. The system 200 of Figure 3 is the same system as that shown in Figure 2 but shows the data retrieval process in further detail. Data representing a query 120 is received at the data retrieval server 210. The data 120 represents a query made by a user and is received from the user device 280. The data representing the query is a string of text, based on a question in which the data retrieval system 200 will be used to generate an answer 285. The data 120 representing the query is received directly from the user. For example, the user may input the query into the user device 280, and the data 120 representing the query is sent from the user device 280 to the data retrieval server 210. In this example, the data retrieval server 210 receives the data 120 representing the query. However, the data retrieval server may instead receive the query and automatically determine the data 120 that represents the query. The data retrieval server 210 accesses the data 105 of the data source server 205. In the system 200, the data 105 comprises data representing text. This text data may be, for example, documents, webpages, articles, or any other electronic form of written text. Further, electronic forms of hard copies, such as, for instance, newspapers, magazines, books etc may be obtained for storing within the data 105. The data 105 is pre-processed by the data source server 205. This entails the data source server 205 storing data that has previously been collected or pulled from various different data sources. This may be public data sources such as the internet or private data sources. The data source server 205 specifically selects relevant data sources to obtain data from prior to the data retrieval server 210 accessing the data 105 from said data source server 205. This avoids the data retrieval server 210 experiencing any inefficiencies when accessing data 105 from the data source server 205, given that data sources, such as the internet, contain too large of an amount of data for the data retrieval server 210 to access in its entirety. The efficiency of the data retrieval is also increased, as the data source server 205 has processed the data 105 ahead of time, before the data retrieval server 210 accesses said data 105. All of the data 105 is then split into a plurality of master chunks 230, 250, 270. Each master chunk 230, 250, 270 therefore comprises a section of the data 105. The master chunks 230, 250, 270 each include different sections of data 105. The master chunks 230, 250, 270 may have various sizes to each other, i.e., they include any amount of data from the data 105 and are not limited to being the same size as one another. The plurality of master chunks 230, 250, 270 are determined in sequence, one after the other. For example, master chunk 230 may firstly be split from the data 105, then a second master chunk 250, then a third master chunk 270 and so on. Each subsequent master chunk 230, 250, 270 to be split from data 105 is determined based on where the previously split master chunk 230, 250, 270 ends. In this way, all of data 105 is split into one of the plurality of master chunks 230, 250, 270 and the data 105 within each master chunk 230, 250, 270 does not overlap. The section of data 105 within each master chunk 230, 250, 270 is then further split into a plurality of smaller sub chunks. As shown in Figure 3, master chunk 230 is split into sub chunks 231, 233, 235, master chunk 250 is split into sub chunks 251, 253, 255 and master chunk 270 is split into sub chunks 271, 273, 275. The data within each master chunk 230, 250, 270 is split into sub chunks 231-235, 251-255, 271-275 of data 105, and therefore the section of data 105 within each sub chunk 231-235, 251-255, 271-275 is smaller than the section of data 105 within the corresponding master chunk 230, 250, 270 from which it was split. Further, as is the case with each master chunk 230, 250, 270, each sub chunk 231-235, 251-255, 271-275 includes different sections of data 105 to the other sub chunks split from the same master chunk 230, 250, 270. Each sub chunk 231-235, 251-255, 271-275 is of any size, i.e., includes any amount of data from within the section of data 105 in its corresponding master chunk 230, 250, 270, and the sub chunks 231-235, 251-255, 271-275 are not limited to being the same size as the other sub chunks 231-235, 251-255, 271-275 split from the same master chunk 230, 250, 270. For instance, the sub chunks 251, 253, 255, which were split from the data within master chunk 250, are smaller (i.e., contain less data) than master chunk 250 itself. Sub chunk 251, sub chunk 253 and sub chunk 255 all contain different sections of data to one another. Sub chunks 251, 253, 255 have various sizes to each other, as long as they are smaller than the master chunk 250 and are not limited to being the same size as one another. An example of the query 120 may be ''How do solar panels work?". Figure 4 shows a first example 410 of data 105 that may be used for the data retrieval process in order to answer this example query 120. As shown in Figure 4, the example data 410 has been split into a plurality of master chunks 420, 440, 460. Each master chunk 420, 440, 460 have been split from the data 410. Each master chunk 420, 440, 460 is a different size to the other chunks (in this instance) and is formed of different sections of the text data 410. Each master chunk 420, 440, 460 is then split into a plurality of sub chunks. Master chunk 420 has been split into sub chunks 421, 423, 425, master chunk 440 has been split into sub chunks 441, 443 and master chunk 460 has been split into sub chunks 461, 463. Each sub chunk 421, 423, 425, 441, 443, 461, 463 is formed of a section of data 410 split from its corresponding master chunk 420, 440, 460. As can be seen in Figure 4, the sub chunks 421, 423, 425, 441, 443, 461, 463 have different sizes to each other and include different sections of the data 410 to the other sub chunks 421, 423, 425, 441, 443, 461, 463 split from the same master chunk 420, 440, 460. A further example of a query 120 received from the user may be “What is fraud!''. A second example 510 of data 105 is shown in Figure 5 that may be used for the data retrieval process in order to answer the second example query 120. The data 510 is split into a plurality of master chunks 520, 540. Each master chunk 520, 540 is then split into a plurality of sub chunks 521, 523, 525, 541, 543. Master chunk 520 is split into sub chunks 521, 523, 525, and master chunk 540 is split into sub chunks 541, 543. Each sub chunk 231-235, 251-255, 271-275 is then compared to the data representing the query 120 in a matching process. This is to determine which of the sub chunks 231-235, 251-255, 271-275 of data 105 match or correspond to the data 120 representing the query. To determine which of the sub chunks 231-235, 251-255, 271-275 match the data 120 representing the query, the semantic meaning of the text data within each sub chunk 231-235, 251-255, 271-275 is compared to the semantic meaning of the text string of data 120 representing the query. If the semantic meaning of a sub chunk within the plurality of sub chunks 231-235, 251-255, 271-275 is the same or sufficiently similar to the semantic meaning of the text string of data 120 representing the query, that sub chunk is determined to be a matched sub chunk 233, 255. As shown in the example of Figure 3, sub chunk 233 and sub chunk 255 are found to match the data representing the query 120. The matched sub chunks 233, 255 are mapped back into their corresponding master chunks 230, 250. As shown in the example of Figure 3, master chunk 230 corresponds to sub chunk 233 and master chunk 250 corresponds to sub chunk 255. The data retrieval server 210 determines which of the master chunks 230, 250, 270 the matched sub chunks 233, 255 were originally split from. This may be, for example, by metadata included into each sub chunk 231-235, 251-255, 271-275 with an indication as to which master chunk 230, 250, 270 the data within each sub chunk 231-235, 251-255, 271-275 originates from. The data retrieval server 210 proceeds to input the master chunk(s) 230, 250 that were determined to correspond to the matched sub chunks 233, 255 into the machine learning model 140, via the machine learning model server 240. The data representing the query 120 is also input into the machine learning model 140. The machine learning model server 240 uses the machine learning model 140, input with the retrieved master chunks 230, 250 and query data 120, to generate an output. The output of the machine learning model 140 is an answer 285 to the query. The answer 285 is sent to the user device 280 such that the answer 285 is provided to the user. In this way, the system 200 shown in Figures 2 and 3 provides an improved data retrieval method for use within RAG systems and machine learning models. The system 200 compares smaller sub chunks 231-235, 251-255, 271-275 of data 105 to the data 120 representing the query in order to improve the matching accuracy, whilst also mapping each of the matched sub chunks 233, 255 back to their corresponding master chunks 230, 250 in order to input larger chunks of data 105 into the machine learning model 140. This ensures that sufficient, meaningful context is provided to the machine learning model 140, whilst also increasing the accuracy and efficiency of the data matching itself. The size of each master chunks 230, 250, 270 may optionally be determined and changed, prior to the sub chunks 231-235, 251-255, 271-275 being split from the master chunks 230, 250, 270. The amount of data within each master chunk 230, 250, 270 i.e., the size of each master chunk 230, 250, 270 is determined. It is then determined whether each of these sizes are within a predetermined range. The predetermined range is set such that the master chunks 230, 250, 270 split from the data 105 are a desired size. If the size of a master chunk 230, 250, 270 is not within the predetermined range, its size is changed. The desired size of a master chunk 230, 250, 270 is determined by two factors. The first being that sufficient data is required in order to input enough context into the machine learning model 140, and the second being that unnecessary or unrelated data (i.e., too much data) is not input into the machine learning model 140. Therefore, the predetermined range is required to ensure that each master chunk 230, 250, 270 is the desired size. The changing of a master chunk’s 230, 250, 270 size may include either reducing its size if it is above an upper limit of the predetermined range, or increasing its size if it is below a lower limit of the predetermined range. The size of each master chunk 230, 250, 270 is checked against the predetermined range, and therefore one or more master chunks 230, 250, 270 may be increased in size, whilst another may be decreased in size, and one or more master chunks 230, 250, 270 may not be changed (if its size is already within the predetermined range). Reducing the size of a master chunk 230, 250, 270 includes removing data from within that master chunk 230, 250, 270. The data that is removed may be random, or it may be a section of the data at the beginning or end of the master chunk 230, 250, 270.. Increasing the size of a master chunk 230, 250, 270 includes adding more of data 105 from the data source into that master chunk 230, 250, 270. When the size of a previous master chunk 230, 250, 270 is changed, the size of the subsequent master chunk 230, 250, 270 split from data 105 is also changed. If a previous master chunk 230, 250, 270 is reduced in size, the excess data removed is added into a subsequent master chunk 230, 250, 270. Whereas, if a previous master chunk 230, 250, 270 is increased in size, the data that is added into said previous master chunk 230, 250, 270 is taken from the data 105 that would have been included in a subsequent master chunk 230, 250, 270. When a previous master chunk 230, 250, 270 is increased in size, the subsequent master chunk 230, 250, 270 is given a new starting point within data 105 i.e., the end of the previous increased master chunk 230, 250, 270. The structure of the data 105 from the data source server is also determined. In the case where the data 105 is in the form of one or more documents of text, a plurality of semantically related segments of text from said document(s) are determined. The different semantically related segments of text make up the structure of the document(s). For example, the semantically related segments of text within a document may be a segment of text defined by different titles, headings, sub-headings, paragraphs, sentences etc of the document. Each segment under a single heading, sub-heading, or paragraph, for example, will comprise text that is related to other text within the same segment. Therefore, the meaning of text under a heading of a document, for example, will relate to the meaning of text under the same heading, compared to the meaning of text under a different unrelated heading. For example, as shown in Figure 4, the example 410 of data 105 may include sections of text under different headings. Each segment of text under each heading, i.e., “Wind Turbines”, “Solar Panels” and “The National Grid” in data 410, may form the plurality of semantically related text segments. After the semantically related segments of text (that each comprise associated text) are determined, the size of these segments of text are determined. The size of a segment is the amount of text in the segment. The predetermined range for each master chunk may then be set according to the size of the semantically related text segment. The predetermined range for each master chunk may be set such that it encompasses the sizes of the determined semantically related text segments. The smallest text segment sets the lower limit of the predetermined range, and the largest text segment sets the upper limit of the predetermined range. For example, if the semantically related text segments of a document in the data 105 are the segments of text under each sub heading within said document, the size of the predetermined range will be set such that is corresponds to the sizes of sub-headings of the document. This ensures that a master chunk 230, 250, 270 split from the data 105 is the desired size to reflect the structure of the document. The system 200 also additionally splits the data 105 in the first instance such that each master chunk 230, 250, 270 corresponds to a determined segment of semantically related text i.e., each master chunk 230, 250, 270 is the segment of text below each sub-heading of the document, for example. The structure of the text is therefore used to infer the segments of text which make up each master chunk 230, 250, 270. When the topic of the text changes, e.g., a new sub heading or heading, a new segment of semantically related text is determined. Further, text data within different semantically related text segments may not be included within the same master chunk 230, 250, 270. In this way, the predetermined range for the size of a master chunk is determined based on the structure of the data (e.g., documents) in the data 105. This ensures that each master chunk 230, 250, 270 is self-contained in its meaning, and if inputted into the machine learning model 140, will provide a sufficient amount of context without unnecessary unrelated data. Whether the size of each of the sub chunks 231-235, 251-255, 271-275 is above a sub chunk predetermined threshold may also optionally be determined. The amount of data 105 in each of the sub chunks 231-235, 251-255, 271-275 may be determined, and if the size of a sub chunk 231-235, 251-255, 271-275 is above the predetermined threshold, the size of that sub chunk will be reduced. The size of the sub chunk 231-235, 251-255, 271-275 will be reduced by removing data i.e., words or sentences from said sub chunk 231-235, 251-255, 271-275, so that the size of the sub chunk 231-235, 251-255, 271-275 is no longer above the predetermined threshold size. This ensures that the size of each sub chunk 231-235, 25 1-255, 271-275 is below the sub chunk threshold, such that each sub chunk 231-235, 251-255, 271-275 is sufficiently small enough to be accurately matched to the data 120 representing the query. The system 200 shown in Figures 2 and 3 further uses embeddings to match the semantic meanings of the sub chunks 231-235, 251-255, 271-275 to the data representing the query 120. Before the sub chunks 231-235, 251-255, 271-275 are compared to the data representing the query 120, each of the sub chunks 231-235, 251-255, 271-275 and query data 120 are transformed into a vector representation, known as embeddings. The semantic meanings of each of the sub chunks 231-235, 251-255, 271-275 of text data 105 and the semantic meaning of the data representing the query 120 are compressed into an x-dimensional vector space, transforming each of the sub chunks and data 120 into vector representations. The vector representation of the query data 120 may then be compared to each of the sub chunk 231-235, 251-255, 271-275 vector representations. Embedding the sub chunks 231-235, 251-255, 271-275 and data 120 representing the query allows the semantic meaning of the text within each sub chunk of data to be more easily compared and matched to the semantic meaning of the text in the query. One or more of the sub chunk vector representations that correspond to the query vector representation are determined. When matching each sub chunk vector representation (also referred to as sub chunk embedding) to the query vector representation (also referred to as query embedding), the distance between each sub chunk embedding and the query embedding in the vector space is determined. The distance is the distance between the two vectors which can be measured in multiple ways, for example, using cosine similarity. The closer a sub chunk embedding is to the query embedding, the more similar the semantic meaning of the text within the corresponding sub chunk and query is. An embedding threshold may be set, which defines the furthest a sub chunk embedding can be to the query embedding in order for the data retrieval server 210 to determine said sub chunk embedding as matching the query embedding. If the distance between a sub chunk embedding and query embedding is too large, which for example, is above the embedding threshold, this sub chunk embedding is not determined to match the query embedding. Whereas, if the distance between a sub chunk embedding is small enough such that is below the embedding threshold, this sub chunk embedding is determined to be matching the query embedding. From the one or more matched sub chunk vector representations, the data retrieval server 210 determines the one or more sub chunks 231-235, 251-255, 271-275 of data 105 that were compressed to generate the matched vector representations. The matched sub chunks vector representations are transformed back into their corresponding sub chunks 231-235,251-255, 271-275. One or more master chunk(s) 230, 250, 270 that correspond to the one or more matched sub chunks 231-235, 251-255, 271-275 are then determined and inputted, with the data representing the query 120, into the machine learning model, in the same way as described above in relation to system 200 shown in Figures 2 and 3. Figure 6 show a flow diagram of a computer implemented method 600 of retrieving data to input into a machine learning model for use in a retrieval augmented generation system, according to an aspect of the present invention. The method starts at step 601. At step 603 the method involves, accessing, at the data retrieval server, data from a data source server. At step 605 the method involves, splitting, at the data retrieval server, the data from the data source server into a plurality of master chunks, wherein each master chunk comprises a section of the data from the data source server. At step 607 the method involves, splitting, at the data retrieval server, each of the plurality of master chunks into a plurality of sub chunks, wherein each sub-chunk comprises a section of data from its corresponding master chunk. At step 609 the method involves, receiving, at a data retrieval server, data representing a query. At step 611 the method involves, comparing, at the data retrieval server, each of the sub chunks of data to the data representing the query. At step 613 the method involves, determining, at the data retrieval server, a matched sub chunk, wherein the matched sub chunk is a sub chunk from the plurality of sub chunks that matches the data representing the query. At step 615 the method involves, determining, at the data retrieval server, a master chunk from the plurality of master chunks that corresponds to the matched sub chunk, such that the data representing the query and the master chunk determined to correspond to the matched sub chunk are input into a machine learning model so as to generate an answer to the query using the machine learning model. The method ends at step 617. However, it will be appreciated that the method may not end at step 617 and further method steps may be taken. It will also be appreciated that any of the methods described herein, and any step of the methods, can be implemented by a computer. Such implementation may take the form of a processor executing instructions stored on a non-transitory computer-readable medium or media, wherein when executed the instructions cause the processor to perform any one or more steps of any of the methods described herein. Individual steps of any method may be implemented by different processors that are all collectively acting in accordance with computer-readable instructions stored on one or more storage media. The processor(s) may be component(s) of system, for example a processor of a device. Similarly, any steps of any of the methods described herein may be performed by data processing devices. By way of example, Figure 7 shows, in schematic form, a data processing device 700 that is suitable for performing the functions of the data retrieval server, the data source server, the machine learning model server or any of the modules therein. The data processing device 700 may automatically perform any of the methods described herein. Data processing device 700 includes a processor 703 for executing instructions. Instructions may be stored in a memory? 701. Processor 703 may include one or more processing units (e.g., in a multi-core configuration) for executing instructions. The instructions may be executed within a variety of different operating systems on the data processing device 700, such as UNIX, LINUX, Microsoft Windows®, etc. More specifically, the instructions may cause various data manipulations on data stored in memory 701 (e.g., create, read, update, and delete procedures). It should also be appreciated that upon initiation of a computer-implemented method, various instructions may be executed during initialization. Some operations may be required to perform one or more methods described herein, while other operations may be more general and / or specific to a particular programming language (e.g., C, C#, C++, Java, or other suitable programming languages, etc.). Processor 703 is operatively coupled to a communication interface 705 such that data processing device 700 can communicate with a remote device, such as another data processing device of the system. For example, communication interface 705 may receive communications from another member of the system. Processor 703 may also be communicatively coupled to a storage device such as a database, depending on the function of data processing device 700 within the context of the system. The storage device is any computer-operated hardware suitable for storing and / or retrieving data, where in the case of a secure storage medium the data is stored and retrieved securely. The storage database may store the data retrieval server 210, the data source server 205 and data 105, the query 120, the machine learning model server 240 and machine learning model 140 for instance, and it can be external to data processing device 700 and located remotely. Alternatively, it can be integrated in data processing device 700. For example, data processing device 700 may include memory 701 as one or more hard disk drives acting as a storage database. Alternatively, where the storage database is external to data processing device 700, it can comprise multiple storage units such as hard disks or solid-state disks in a redundant array of inexpensive disks (RAID) configuration. The storage database may include a storage area network (SAN) and / or a network attached storage (NAS) system. In some arrangements, the system and methods may be deployed in a cloud-based environment. Processor 703 can be operatively coupled to the storage device (storage database) via a storage interface 707. Storage interface 707 is any component capable of providing processor 703 with access to the storage device. Storage interface 707 may include, for example, an Advanced Technology Attachment (ATA) adapter, a Serial ATA (SATA) adapter, a Small Computer System Interface (SCSI) adapter, a RAID controller, a SAN adapter, a network adapter, and / or any component providing processor 703 with access to the storage device. Memory 701 may include, but is not limited to, RAM such as dynamic RAM (DRAM) or static RAM (SRAM), ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), and non-volatile RAM (NVRAM). The above memory types are exemplary only and are not limiting as to the types of memory usable for storage of a computer program. As used herein, the term "non-transitory computer-readable media / medium" is intended to be representative of any tangible computer-based device implemented in any method or technology for short-term and long-term storage of information, such as, computer-readable instructions, data structures, program modules and sub-modules, or other data in any device. The methods described herein may be encoded as executable instructions embodied in a tangible, non-transitory, computer readable medium, including, without limitation, a storage device, and / or a memory device. Such instructions, when executed by a processor, cause the processor to perform at least a portion of the methods described herein. Furthermore, as used herein, the term "non-transitory computer-readable media / medium" includes all tangible, computer-readable media, including, without limitation, non-transitory computer storage devices, including, without limitation, volatile and non-volatile media, and removable and non-removable media such as a firmware, physical and virtual storage, CD-ROMs, DVDs, and any other digital source such as a network or the Internet, as well as yet to be developed digital means, with the sole exception being a transitory, propagating signal. As will be appreciated based on the specification herein, the above-described embodiments of the disclosure may be implemented using computer programming or engineering techniques including computer software, firmware, hardware or any combination or subset thereof. Any such resulting program, having computer-readable code means, may be embodied, or provided within one or more computer-readable media, thereby making a computer program product, i.e., an article of manufacture, according to the discussed embodiments of the disclosure. The article of manufacture containing the computer code may be made and / or used by executing the code directly from one medium, by copying the code from one medium to another medium, or by transmitting the code over a network. While the disclosure has been described in terms of various embodiments, the person skilled in the art will recognise that the disclosure can be practiced with modification within the spirit and scope of the claims. As described in relation to Figure 2, the data source server 205, data retrieval server 210 and machine learning model server 240 are each held on a separate computer system, provided that the data retrieval server 210 has access to the data source server 205 and the machine learning model server 240. However, alternatively the steps performed by the data retrieval server may be performed by a first module, the steps performed by the data source server may be performed by a second module, and the steps performed by the machine learning model server may be performed by a third module, where the first, second and third modules are separate parts of the same computer system. In some arrangements, the data retrieval server 210 may include the data source server 205 and machine learning model server 140. Although it is described that the data 105 is collected and stored by the data source server 205 prior to the data retrieval server 210 accessing the data 105 and receiving the data 120 representing the query 120. In other arrangements, the data retrieval server 210 may firstly receive the data 120 representing the query 120, and then access the data 105 from the data source server 205 without any pre-processing by the data source server 205 of the data 105. In this case, the data source server 205 may collect the data 105 from a data source (e.g., published articles, documents etc from the internet) at the time of the data retrieval server 210 accessing said data 105, and the data 105 will not have been pre-processed or previously collected and stored. With reference to Figures 2 and 3, the data 120 representing the query is received directly from the user, from a user device. Alternatively, the data 120 representing a query may be stored at the data retrieval server 210, data source server 205 or machine learning model server 240, and is not received directly from the user or user device 280. For example, the data representing the query 120 may be received by a separate computer system with a user interface, and stored by the data retrieval server 210, data source server 205 or machine learning model server 240. Although it is shown and described that the machine learning model 140, data 105 and the data representing the query 120 are the same between systems 100 and 200 of Figures 1 and 2 respectively, system 200 may use a different machine learning model, different data from a different data source server and different data representing a different query to those shown in the example conventional system 100. It is described in relation to Figure 3 that all of the data 105 from the data source server is split into the plurality of master chunks 230, 250, 270. However, alternatively, a portion of the data 105 may be split into a plurality of master chunks. The portion of data 105 chosen to be split into master chunks 230, 250, 270 may be chosen based on the amount of data available and / or the amount of data desired to be in each master chunk 230, 250, 270. The method may also further comprise storing all or a portion of the data 105 from the data source server at the data retrieval server 210. Although it is shown in Figure 3 that the data 105 is split into three master chunks 230, 250, 270, it is also possible for the data 105 to be split into any number of master chunks, including a singular master chunk, and is not limited to those shown in Figure 3. Similarly, although it is shown that each of master chunks 230. 250, 270 are split into three sub chunks 231-235, 251-255, 271-275, it is also possible for each master chunk to split into any number of smaller sub chunks and is not limited to those shown in Figure 3. Each master chunk 230, 250, 270 may also each be split into different numbers of sub chunks. Although it is described above that the master chunks 230, 250, 270 include / are formed of different sections of data 105, alternatively one or more of the master chunks 230, 250, 270 may comprise the same or overlapping sections of data 105. Similarly, although it is described above that the sub chunks 231-235, 251-255, 271-275 split from each master chunk 230, 250, 270 include different sections of their corresponding master chunk 230, 250, 270 to the other sub chunks split form the same master chunk, alternatively, the sub chunks 231-235, 251-255, 271-275 split from the same master chunk 230, 250, 270 may include the same or overlapping sections of their corresponding master chunk 23, 250, 270. As shown in Figure 3, two of the plurality of sub chunks 231-235, 251-255, 271-275 were matched to the data representing the query 120, sub chunk 233 and sub chunk 255. However, any number of sub chunks 231-235, 251-255, 271-275 may be determined to match the data representing the query 120, and the system 200 is not limited to the number of matched sub chunks 233, 255 shown in Figure 3. For example, 20 sub chunks may typically be found to match the data representing the query 120. Although it is shown in Figure 3, that two sub chunks 233, 255 are matched to the data representing the query 120 where each of the two sub chunks 233, 255 correspond to different master chunks 230, 250, alternatively the matched sub chunks may be derived from any one of the master chunks 230, 250, 270. For example, all of the matched sub chunks may correspond to the same master chunk 230, 250, 270, or a portion of the matched sub chunks may correspond to the same master chunk 230, 250, 270 whilst the other portion of matched sub chunks correspond to different master chunks 230, 250 270. In the case where multiple matched sub chunks are determined that all correspond to the same master chunk 230, 250, 270, that corresponding master chunk 230, 250, 270 is input into the machine learning model 140 only once. As shown in Figures 2 and 3, the output generated by the machine learning model 140 may optionally be sent to the user device. However, in other arrangements, the answer 285 may be stored at either the machine learning model server or the data retrieval server 210 for later use. The answer 285 outputted by the machine learning model 140 may also additionally, or alternatively, be displayed on a display either to the user or displayed at the machine learning model server. Although it is described that the data that is removed from each of the master chunk(s) 230, 250, 270 that are reduced is the used to form any subsequent master chunk(s) 230, 250, 270, the data that is removed from each of the master chunk(s) 230, 250, 270 may also be discarded. In other arrangements the discarded data from each of the reduced master chunks 230, 250, 270 may be stored in a memory at either the data retrieval server, data source server, or machine learning model server for future use. The data that is removed from each of the sub chunk(s) that are reduced in size is discarded. However, in other arrangements the discarded data from each of the reduced master chunks 230, 250, 270 may be stored in a memory at either the data retrieval server, data source server, or machine learning model server for future use. Although it is described that the data representing the query 120 may be transformed into a vector representation, alternatively, the data representing the query 120 may be transformed into one or more query vector representations. In the case of a plurality of query vector representations, each and every one of the sub chunk vector representations are compared to each and every query vector representation in order to find one or more sub chunk vector representations that match the one or more query vector representations. In other arrangements, the data retrieval server may receive data representing a plurality of queries such that the comparing of each of the sub chunks of data to the data representing the query comprises comparing each and every sub chunk of data from the plurality of sub chunks to data representing each of the plurality of queries. A plurality of matched sub chunks may also be determined i.e., a plurality of sub chunks may be determined to match the data representing the query, or in the case of a plurality of queries, a plurality of different sub chunks may be determined to match the data representing one or more of the plurality of queries.

Claims

1. A computer implemented method of retrieving data to input into a machine learning model for use in a retrieval augmented generation system, the method comprising:accessing, at the data retrieval server, data from a data source server;splitting, at the data retrieval server, the data from the data source server into a plurality of master chunks, wherein each master chunk comprises a section of the data from the data source server;splitting, at the data retrieval server, each of the plurality of master chunks into a plurality of sub chunks, wherein each sub-chunk comprises a section of data from its corresponding master chunk;receiving, at a data retrieval server, data representing a query;comparing, at the data retrieval server, each of the sub chunks of data to the data representing the query;determining, at the data retrieval server, a matched sub chunk, wherein the matched sub chunk is a sub chunk from the plurality of sub chunks that matches the data representing the query;determining, at the data retrieval server, a master chunk from the plurality of master chunks that corresponds to the matched sub chunk, such that the data representing the query and the master chunk determined to correspond to the matched sub chunk are input into a machine learning model so as to generate an answer to the query using the machine learning model.

2. The computer implemented method according to claim 1, the method further comprising:determining, at the data retrieval server, for each master chunk of the plurality of master chunks, whether a size of said master chunk is within a predetermined range;changing, at the data retrieval server, the size of each master chunk whose size is not within the predetermined range, such that the size of each master chunk is within the predetermined range.

3. The computer implemented method according to claim 2, wherein determining, at the data retrieval server, for each master chunk of the plurality of master chunks, whether the size of said master chunk is within the predetermined range comprises:determining, at the data retrieval server, for each master chunk of the plurality of master chunks, whether the size of said master chunk is above an upper limit of the predetermined range; andwherein changing, at the data retrieval server, the size of each master chunk whose size is not within the predetermined range, such that the size of said master chunk is within the predetermined range comprises:reducing, at the data retrieval server, the size of each master chunk whose size is above the upper limit of the predetermined range, such that the size of said master chunk is below the upper limit of the predetermined range.

4. The computer implemented method according to claim 2 or claim 3, wherein determining, at the data retrieval server, for each master chunk of the plurality of master chunks, whether the size of said master chunk is within the predetermined range comprises:determining, at the data retrieval server, for every master chunk of the plurality of master chunks, whether the size of said master chunk is below a lower limit of the predetermined range; andwherein changing, at the data retrieval server, the size of each master chunk whose size is not within the predetermined range, such that the size of said master chunk is within the predetermined range comprises:increasing, at the data retrieval server, the size of each master chunk whose size is below the lower limit of the predetermined range, such that the size of said master chunk is above the lower limit of the predetermined range.

5. The computer implemented method according to any of claims 2 to 4, the method further comprising:determining, at the data retrieval server, a plurality of semantically related segments of text from within the data from the data source server, wherein the data from the data source server is text data; anddetermining, at the data retrieval server, a size of each of the semantically related text segments; andsetting, at the data retrieval server, the predetermined range such that the predetermined range defines a size of a section of text that encompasses the sizes of each of the semantically related text segments.

6. The computer implemented method of claim 5, wherein the text data of the data source server comprises a document, and wherein the semantically related text segments of the text data are segments of text defined by any of: headings of the document, subheadings of the document, or paragraphs of the document.

7. The computer implemented method according to any preceding claim, the method further comprising:determining, at the data retrieval server, for each sub chunk of the plurality of sub chunks, whether a size of said sub chunk is above a predetermined threshold;reducing, at the data retrieval server, the size of each sub chunk whose size is above the predetermined threshold, such that the size of said sub chunk is below the predetermined threshold.

8. The computer implemented method according to any preceding claim, wherein the data from the data source server is text data, wherein each master chunk is formed of a section of the text data of the data source server, and wherein each sub-chunk is formed of a section of the text data in the corresponding master chunk, such that each sub chunk is formed of a smaller amount of text data than its corresponding master chunk.

9. The computer implemented method according to any preceding claim, the method further comprising:transforming, at the data retrieval server, the data representing the query into a vector representation, so as to generate a query vector representation; andtransforming, at the data retrieval server, each of the sub chunks into a vector representation, so as to generate a plurality of sub chunk vector representations; andwherein comparing, at the data retrieval server, each of the sub chunks of data to the data representing the query comprises:comparing, at the data retrieval server, each of the sub chunk vector representations to the query vector representation; andwherein determining, at the data retrieval server, a matched sub chunk, wherein the matched sub chunk is a sub chunk from the plurality of sub chunks that matches the data representing the query comprises:determining, at the data retrieval server, a matched sub chunk vector representation, wherein the matched sub chunk vector representation is a subchunk vector representation from the plurality of sub chunk vector representations that matches the query vector representation; andtransforming, at the data retrieval server, the matched sub chunk vector representation into its corresponding sub chunk, where said corresponding sub chunk is the matched sub chunk.

10. The computer implemented method according to any preceding claim, wherein the machine learning model is a large language model.

11. The computer implemented method according to any preceding claim, the method further comprising:inputting into the machine learning model, at a machine learning model server, the data representing the query and the master chunk determined to correspond to the matched sub chunk; andgenerating using the machine learning model, at the machine learning model server, an answer to the query.

12. The computer implemented method according to claim 11, the method further comprising:providing, from the machine learning model server, the answer to an originator of the query.

13. A data retrieval server, configured to perform the method steps of any of claims 1 to 10.

14. A system configured to retrieve data to input into a machine learning model for use in a retrieval augmented generation system, the system comprising:a data retrieval server configured to perform the method steps of any of claims 1 to 10, and a machine learning model server configured to perform the method steps of any of claims 11 to 12.

15. A non-transitory computer-readable medium comprising instructions which, when executed by a computer, cause the computer to carry out the method steps of any claim 1 to 12.