Academic publishing in Europe and N. America

Archive Publication ethics Submission Payment Contacts
In the original languageTranslation into English

Composite key as a new Data Extraction Primitive in Retrieval-Augmented Generation systems

Authors

Mykola Khoroshevskyi

Rubric:Information technology
1
0
Quote
1
0

Annotation

The article discusses the use of a composite key as an additional tool for data extraction in Retrieval-Augmented Generation systems. This research is relevant because lexical and vector searches do not always allow us to differentiate between documents that have similar content but relate to different sources, objects, time periods, or versions. A composite key is an ordered set of attributes that includes metadata about a document and helps to pre-define the search scope. An architecture is proposed that integrates document preparation, metadata creation, filtering, lexical and vector searching, ranking, and transmission of relevant language model fragments. The sequence of creating and applying a composite key is described, including field checking, condition combining, and re-filtering. It has been established that this approach is suitable for structured collections of documents, but its effectiveness depends on the completeness and accuracy of the metadata and needs to be verified through experimentation.

Keywords

Retrieval-Augmented Generation
RAG system
composite key
data extraction
metadata
ranking
language model.

Authors

Mykola Khoroshevskyi

Relevance of the study

Large language models are able to generate meaningful responses, but their knowledge is limited by training data and may be irrelevant or not always consistent with specific sources. To overcome these limitations, Retrieval-Augmented Generation (RAG) systems have been developed that combine language models with information retrieval in extensive external knowledge bases.

The efficiency of RAG systems directly depends on the accuracy of data extraction. Vector search takes into account the semantic proximity of a query and a document, but it is not always able to distinguish information related to different objects, periods, versions, or sources. As a result, formally similar but irrelevant fragments may fall into the context of the model.

The relevance of the research lies in creating a composite key that will include several characteristics of the information object, such as the source, document type, date, subject area, and entity name. Using such a key will improve the accuracy of the search, reduce the number of unreliable results, and improve the quality of responses in RAG systems. To evaluate the effectiveness of the proposed approach, it must be compared with vector, full-text, and hybrid search methods.

The scientific novelty of this study lies in the development of a composite key, which is not used as a unique identifier for a record, but rather as a dynamically generated mechanism to pre-limit the search space in a RAG system. The proposed model divides the key components into mandatory and optional, allowing for controlled relaxation of conditions when results are not found.

Analysis of recent research

Modern research on RAG systems is focused on improving the extraction, filtering, and ranking of external information. Techniques such as hybrid search, re-ranking, and limiting multiple documents based on metadata are considered promising approaches [10].

In the Multi-Meta-RAG model, metadata is used to filter documents during the processing of complex queries, thereby improving the accuracy of information extraction [4]. This is achieved by enriching documents with relevant metadata, removing irrelevant content, and conducting a multi-agent assessment of the results [11-12].

However, existing studies have not proposed a formal model for a composite key that divides conditions into mandatory and optional. Addressing this gap is the focus of this study.

The purpose of the study

The aim of this study is to theoretically justify the composite key model as a supplementary tool for data extraction in RAG systems. This model provides a preliminary selection of documents based on a set of structural features, followed by the application of lexical, vector, or hybrid search methods.

The research hypothesis

It is assumed that using a composite key based on metadata will help narrow the search area, reduce the number of unnecessary fragments, and improve the accuracy of data extraction in RAG systems.

Research objectives

  1. To study the basic methods of data extraction in RAG systems and identify their limitations.
  2. To clarify the definition and structure of the composite key.
  3. To develop the architecture and sequence of its application.
  4. To determine the conditions, limitations, and directions of experimental verification of the proposed approach.

Materials and research methods

The research materials consisted of scientific publications and technical documentation on the architecture of RAG systems, including lexical, vector, and hybrid search methods, filtering by metadata, re-ranking, and composite keys.

The methods used were analysis and generalization of sources, comparison of data extraction methods, formalization of the composite key structure, and structural and functional modeling of the search architecture. In addition, algorithmic modeling was used to determine the sequence of query function selection, create filtering, search, and ranking conditions, and, if necessary, weaken the conditions in the absence of results.

The proposed approach was evaluated for its logical consistency and technical feasibility. Quantitative experimental verification is defined as the direction of further research.

The results of the study

Retrieval-Augmented Generation systems combine a generative language model with an external knowledge base to create answers. Before creating a response, the system searches the knowledge base for documents or fragments corresponding to the user's query. These documents are then provided as additional context for the language model [10].

The extraction process typically involves several steps. The documents are first divided into smaller fragments and indexed. The user's query is then processed to create a searchable query. The search module then retrieves the relevant documents and ranks them based on their relevance. The selected documents are passed to the generative model for further processing.

Lexical, vector, and hybrid search types are used in RAG systems (Table 1). Lexical search is based on matching query words with words in a document. Vector search compares numerical representations of queries and text fragments, allowing for the identification of materials that are similar in meaning. Hybrid search combines the results of both lexical and vector searches.

Table 1

The main ways to extract data in RAG systems

The search method

The basis of the comparison

Main purpose

Lexical search

Matching words and phrases

Search for documents containing precise terms

Vector search

Semantic proximity of queries and documents

Search for texts with similar content

Hybrid Search

Sharing lexical and vector search

Improving the completeness and accuracy of the results

Re-ranking

Additional evaluation of the found documents

Clarifying the order of results

A source: compiled based on research materials [7]

 

The quality of the response from the RAG system depends not only on the capabilities of the language model, but also on the accuracy of the selected documents. If the search module cannot find the necessary information or provides unsuitable fragments to the model, the final answer may be incomplete or even incorrect [8].

Each data extraction method has its own limitations. Lexical search is performs well when the terms match exactly, but it may not find the document if the query and the text use similar but different words. In addition, this type of search does not fully take into account the general meaning and context of the document [2, p. 43].

Vector search allows you to find fragments that are similar in content. However, semantic proximity does not always guarantee that they match the query exactly. The results may include documents related to other objects, periods, versions, or subject areas. The quality of the search also depends on the text representation model used and the characteristics of the source data.

Repeated ranking increases the accuracy of the location of the found documents, but requires additional computing resources. In addition, it applies only to already selected materials and does not allow you to correct the situation when the required document is missing from the initial sample.

Metadata filters can restrict searches by date, document type, source, category, or other attributes, but they do not determine the semantic relevance of the text. A record identifier can provide an accurate reference to a known object, but it is not suitable for searching for documents that are not defined in advance.

In relational databases, a composite key includes several fields whose combined value is used to uniquely identify a record. The individual parts of a composite key may be repeated, but the combination must be unique.

A composite key in the RAG system can be understood as an ordered set of functions that are used to limit the search area and select relevant documents. This set may include the information source, document type, object name, date, version, section, thematic category, and other available metadata [3, p. 127].

To formally describe the proposed approach, we will consider a set of documents or text fragments, D = {d1, d2, ..., dn}, which will be used as the information base for the RAG system.

Each document corresponds to text content and metadata set M(d) = {(a₁,v₁), (a₂,v₂), ..., (aₘ,vₘ)}, where ai is the attribute metadata, and vi is the value. Information source, document type, object name, publication date, version, thematic category, and other structural characteristics can be used as attributes.

Let q be a user query.

Based on the analysis of the query is formed by a composite key CK(q) = {c₁, c₂, ..., cₖ}, where each component is defined as cᵢ = (aᵢ, oᵢ, vᵢ, pᵢ).

Here:

  • ai – metadata attribute;
  • oi – comparison operation;
  • vi – the desired value;
  • pi – indicates whether the component is required.

The mandatory attribute takes one of two values pᵢ {mandatory, optional}.

The required components define the essential criteria that must be met for the document to be considered relevant to a user's search query. Optional components can be used to further narrow the search results and can be omitted if no relevant documents are found.

After forming the composite key, the set of candidate documents DCK(q) = { d D | d satisfies the required components CK(q) } is determined.

If, after applying all the restrictions, the set of documents is empty, the search conditions are relaxed one by one until a non-empty set of candidates is found.

After forming a set of candidate documents, they are ranked R(q) = rank(q, DCK(q)), where the rank() function can be implemented using lexical, vector, or hybrid search.

Thus, the overall process of handling a user request in a RAG system using a composite key can be described as a series of steps, as shown in Figure 1.

Fig. 1. General scheme of processing a user request in a RAG system using a composite key

 

The proposed composite key is not intended to uniquely identify a record, as is the case with a composite key in a relational database. Instead, its purpose is to dynamically define the structural constraints for a user's query, allowing for a reduction in the search space through lexical, vector, or hybrid search methods.

This means that a document can be searched based not only on the text of a query but also on a set of attributes, such as the name of an organization, type of document, year of adoption, and section number. Once documents matching these specified features have been selected, a lexical, vector, or hybrid search method can be applied to the resulting set.

A composite key does not replace existing search methods. Instead, its purpose is to pre-filter a set of documents based on the established criteria in a query. Once the materials have been found, they can then be ranked based on lexical or semantic similarity.

Table 2 outlines the steps involved in creating the criteria for a composite key.

Table 2

Operations used in forming the conditions of a composite key

Group of Operations

Appointment

Supported values in Pinecone

Equality and inequality

Checking whether values match or differ

Number, string, Boolean value

More, less, no less, no more

Checking the numeric range

Number

Entry and non-entry

Checking for the presence of a value in a given set

String, number

Verification of existence

Establishing the presence of a metadata field

Number, string, Boolean value

Logical "AND" and "OR"

Combining multiple conditions

Logical expressions

A source: author's development based on [9]

 

The architecture includes a data preparation and a query processing component (Figure 2). In the preparation phase, the source documents are split into smaller units. Each unit is assigned a unique identifier, and a vector representation of the content is calculated. Additionally, metadata is added to each unit. Vector storage allows us to save the metadata along with the identifier and the vector, which helps us limit the search results to records that match given filtering criteria.

Fig. 2. Architecture of data extraction based on a composite key (author's development)

 

When processing a request, the specified structural features are highlighted. They are converted into keywords and checked against the metadata schema. The search engine then restricts the search to the relevant entries and calculates their relevance based on their textual representation. This process corresponds to a combination of metadata filtering and semantic search in vector repositories [1, p. 107].

For example, Pinecone allows users to simultaneously set a text or vector query, the number of results, and conditions for metadata fields. The architecture can use separate lexical and vector search modules, the results of which are combined after the search is performed. Elasticsearch combines full-text and vector extraction in a hybrid search and creates a single result from multiple lists. This requires at least two search modules [5].

Table 3 shows the architecture components.

Table 3

Architecture components

Component

Input data

Result

Data preparation

Source documents

Text fragments

module Metadata

Information about the source and the document

Normalized fields

module Vector representation model

The text of the fragment

Numeric vector

The Composite Key Generator

User's request

A set of conditions

Filtering module

Composite key and metadata

Acceptable set of records

The search module

Request and acceptable entries

The ranked list

The generative model

The request and the fragments found

Final response

A source: author's development

 

The process of using a composite key involves several interrelated steps. Firstly, the explicitly specified attributes are selected from the user's query. Then, the names of the fields and the types of their values are verified. Based on this information, a logical expression for the composite key is created, and filtering by metadata is applied. If suitable entries are found, the system moves on to search and rank them, selecting the most relevant fragments and transferring the context to the language model. If no results are found, optional conditions can be checked and relaxed before the filtering process is repeated. Figure 3 shows the general sequence of these steps.

Fig. 3. The sequence of using the composite key (author's development)

 

The effectiveness of a composite key depends on the completeness and accuracy of the metadata. Incorrect or missing values can exclude relevant documents even before the semantic search stage begins. Therefore, metadata fields must be generated according to a unified schema, standardized, and validated before indexing. The results of using the Multi-Meta-RAG model demonstrate that pre-filtering based on source, date, and other metadata enhances the accuracy of identifying relevant documents [4].

Combining all attributes with the "and" operator may unduly restrict the search. It is, therefore, necessary to distinguish between mandatory and optional components beforehand. Conditions can only be relaxed for optional attributes.

Using a composite key also increases the cost of preparing data, creating indexes, and maintaining a consistent field format. This approach is most suitable for systems in which documents have a stable structure and vary in type, source, time period, object, or version [6].

In buildings without markings and with extensive research requests, a composite key can be used as an additional method. The primary extraction technique in these cases remains lexical, vector-based, or hybrid searching.

Conclusions

Thus, a composite key can be used in RAG systems as an additional mechanism for pre-limiting the search area. It does not replace lexical, vector, or hybrid extraction, but it allows you to apply them to documents that match the specified attributes of the source, such as type, date, version, or object. This approach is most reasonable when working with structured and regularly updated datasets. However, its use depends on the quality of metadata: incomplete or erroneous values can lead to the exclusion of relevant documents. Excessively strict conditions can also reduce the completeness of the search, so it is important to divide the key components into mandatory and optional ones.

To determine the effectiveness of a composite key, an experimental comparison with existing data extraction methods should be conducted.

References:

  1. Basipov A.A., Demich O.V. Semantic Search: Problems and Technologies // Bulletin of Astrakhan State Technical University. Series: Control, Computing, and Informatics. – 2012. – No. 1. – pp. 104-111.
  2. Bryukhov D.O., Stupnikov S.A., Kovalev D.Yu., Shanin I.A. Neurophysiology as a Subject Area for Solving Data-Intensive Problems // Computer Science and Its Applications. – 2020. – Vol. 14, No. 1. – pp. 40-47. – DOI 10.14357/19922264200106.
  3. Goncharov M.V., Kolosov K.A. Relevance Issues in Processing Search Queries to Bibliographic and Full-Text Databases in Modern Models of Providing Scientific Research with Open Archives // Scientific and Technical Libraries. – 2022. – No. 11. – pp. 120-134. – DOI 10.33186/1027-3689-2022-11-120-134.
  4. Poliakov M., Shvai N. Multi-Meta-RAG: Improving RAG for Multi-Hop Queries Using Database Filtering with LLM-Extracted Metadata [Electronic resource] // arXiv. – 2024. – DOI: 10.48550/arXiv.2406.13213. – URL: https://arxiv.org/abs/2406.13213.
  5. Elastic. Hybrid search [Electronic resource] // Elastic Docs. – URL: https://www.elastic.co/docs/solutions/search/hybrid-search.
  6. Elastic. Mapping [Electronic resource] // Elasticsearch Guide. Version 8.19. – URL: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/mapping.html.
  7. Karpukhin V., Oğuz B., Min S. [et al.]. Dense Passage Retrieval for Open-Domain Question Answering // Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP). – 2020. – pp. 6769-6781. – DOI: 10.18653/v1/2020.emnlp-main.550. – URL: https://arxiv.org/abs/2004.04906.
  8. Lewis P., Perez E., Piktus A. [et al.]. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks // Advances in Neural Information Processing Systems. – 2020. – Vol. 33. – URL: https://arxiv.org/abs/2005.11401.
  9. Pinecone. Filter by metadata [Electronic resource] // Pinecone Docs. – URL: https://docs.pinecone.io/guides/search/filter-by-metadata.
  10. Zhao P., Zhang H., Yu Q. [et al.]. Retrieval-Augmented Generation for AI-Generated Content: A Survey [Electronic resource]. – 2024. – 22 p. – DOI: 10.48550/arXiv.2402.19473. – URL: https://arxiv.org/abs/2402.19473.
  11. Mombaerts L., Ding T., Banerjee A. [et al.]. Meta Knowledge for Retrieval Augmented Large Language Models [Electronic resource] // arXiv. – 2024. – arXiv:2408.09017. – DOI: 10.48550/arXiv.2408.09017.
  12. Zhu K., Feng X., Du X. [et al.]. An Information Bottleneck Perspective for Effective Noise Filtering on Retrieval-Augmented Generation // Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics. – 2024. – pp. 1044-1069. – DOI: 10.18653/v1/2024.acl-long.59.

Other articles of the issue

Alimova Sarbinaz Reproductive significance and survival of different cohorts in the muskrat (Ondatra Zibethicus L.) population in the South Aral region
Download article in PDF2249 views
cc-license
About us Journals Books
Publication ethics Terms of use of services Privacy policy
Copyright 2013-2025 Premier Publishing s.r.o.
Praha 8 - Karlín, Lyčkovo nám. 508/7, PSČ 18600, Czech Republic pub@ppublishing.org