System and method for enhancing generative artificial intelligence (AI) model-based matching of queries and contents
A method, computer program product, and computing system for generating a plurality of chunks for a plurality of text portions of a document. A plurality of chunk embeddings are generated from the plurality of chunks. A query is processed using a generative artificial intelligence (AI) model. A query embedding is generated from the query. A plurality of candidate chunk embeddings are identified from the plurality of chunk embeddings based upon, at least in part, a chunk size and a chunk similarity score associated with each chunk and a performance metric associated with the query. A prompt is generated using the query embedding and the plurality of candidate chunk embeddings. The prompt is provided to the generative AI model.
1 . A computer-implemented method, executed on a computing device, comprising:
generating a plurality of chunks for a plurality of text portions of a document;
generating a plurality of chunk embeddings from the plurality of chunks;
processing a query using a generative artificial intelligence (AI) model;
generating a query embedding from the query;
identifying a plurality of candidate chunk embeddings from the plurality of chunk embeddings based upon, at least in part, a chunk size, a chunk similarity score associated with each chunk, and a performance metric associated with the query, wherein the performance metric associated with the query is a user-defined prompt size limitation associated with the query that is different than a maximum number of tokens for a prompt, wherein identifying the plurality of candidate chunk embeddings includes:
determining the chunk size and the chunk similarity score associated with each chunk, and
determining a candidate chunk performance value for each chunk by dividing the chunk similarity score by the chunk size for each chunk;
generating the prompt using the query embedding and the plurality of candidate chunk embeddings; and
providing the prompt to the generative AI model.
2 . The computer-implemented method of claim 1 , further comprising:
processing the query during Retrieval Augmented Generation (RAG) using the generative AI model.
3 . The computer-implemented method of claim 1 , wherein identifying the plurality of candidate chunk embeddings includes ranking the plurality of chunk embeddings based upon, at least in part, the candidate chunk value for each chunk.
4 . The computer-implemented method of claim 3 , wherein identifying the plurality of candidate chunk embeddings includes adding chunk embeddings to the plurality of chunk embeddings with the highest candidate chunk values using the ranking of the plurality of chunk embeddings.
5 . The computer-implemented method of claim 4 , wherein adding chunk embeddings to the plurality of chunk embeddings includes adding further candidate chunk embeddings to the plurality of chunk embeddings until one of: the performance metric associated with the query is reached and a total candidate chunk performance value is not increased with additional chunk embeddings.
6 . A computer program product residing on a non-transitory computer readable medium having a plurality of instructions stored thereon which, when executed by a processor, cause the processor to perform operations comprising:
generating a plurality of chunks for a plurality of text portions of a document;
generating a plurality of chunk embeddings from the plurality of chunks;
processing a query using a generative artificial intelligence (AI) model;
generating a query embedding from the query;
identifying a plurality of candidate chunk embeddings from the plurality of chunk embeddings based upon, at least in part, a chunk size, a chunk similarity score associated with each chunk, and a performance metric associated with the query, wherein the performance metric associated with the query is a user-defined prompt size limitation associated with the query that is different than a maximum number of tokens for a prompt, wherein identifying the plurality of candidate chunk embeddings includes:
determining the chunk size and the chunk similarity score associated with each chunk, and
determining a candidate chunk performance value for each chunk by dividing the chunk similarity score by the chunk size for each chunk;
generating the prompt using the query embedding and the plurality of candidate chunk embeddings; and
providing the prompt to the generative AI model.
7 . The computer program product of claim 6 , wherein the operations further comprise:
processing the query during Retrieval Augmented Generation (RAG) using the generative AI model.
8 . The computer program product of claim 6 , wherein identifying the plurality of candidate chunk embeddings includes ranking the plurality of chunk embeddings based upon, at least in part, the candidate chunk value for each chunk.
9 . The computer program product of claim 8 , wherein identifying the plurality of candidate chunk embeddings includes adding chunk embeddings to the plurality of chunk embeddings with the highest candidate chunk values using the ranking of the plurality of chunk embeddings.
10 . The computer program product of claim 9 , wherein adding chunk embeddings to the plurality of chunk embeddings includes adding further candidate chunk embeddings to the plurality of chunk embeddings until one of: the performance metric associated with the query is reached and a total candidate chunk performance value is not increased with additional chunk embeddings.
11 . A computing system comprising:
a memory; and
a processor configured to:
generate a plurality of chunks for a plurality of text portions of a document,
generate a plurality of chunk embeddings from the plurality of chunks, to process a query using a generative artificial intelligence (AI) model,
generate a query embedding from the query,
identify a plurality of candidate chunk embeddings from the plurality of chunk embeddings based upon, at least in part, a chunk size, a chunk similarity score associated with each chunk, and a performance metric associated with the query, wherein the performance metric associated with the query is a user-defined prompt size limitation associated with the query that is different than a maximum number of tokens for a prompt, wherein identifying the plurality of candidate chunk embeddings includes:
determining the chunk size and the chunk similarity score associated with each chunk, and
determining a candidate chunk performance value for each chunk by dividing the chunk similarity score by the chunk size for each chunk,
generate the prompt using the query embedding and the plurality of candidate chunk embeddings, and
provide the prompt to the generative AI model.
12 . The computing system of claim 11 , wherein the processor is further configured to:
process the query during Retrieval Augmented Generation (RAG) using the generative AI model.
13 . The computing system of claim 11 , wherein identifying the plurality of candidate chunk embeddings includes ranking the plurality of chunk embeddings based upon, at least in part, the candidate chunk value for each chunk.
14 . The computing system of claim 13 , wherein identifying the plurality of candidate chunk embeddings includes adding chunk embeddings to the plurality of chunk embeddings with the highest candidate chunk values using the ranking of the plurality of chunk embeddings.