Hierarchical retrieval device and method for LLM-driven big data retrieval, equipment and medium
By using an LLM-driven hierarchical retrieval device, the big data retrieval process is optimized through an input module, a strategy planning module, and a scheduler. This solves the problems of system process redundancy and inaccurate retrieval results, and achieves efficient and accurate cross-domain data retrieval, which is suitable for complex business systems of large enterprises.
Patent Information
- Application Number
- CN202511464794.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-14
- Publication Date
- 2026-01-09
AI Technical Summary
Existing big data retrieval technologies suffer from problems such as redundant system processes, extremely high LLM context token consumption, and inaccurate retrieval results. In particular, they are unable to meet the needs of efficient retrieval when dealing with complex and multi-dimensional queries, leading to resource waste and performance bottlenecks.
The hierarchical retrieval device driven by LLM preprocesses user query requirements through the input module, generates a structured execution plan through the strategy planning module, generates API execution instructions through the executable strategy generation module, and integrates the retrieval results by the scheduler. It also classifies documents by combining lightweight natural language processing and data capabilities, and dynamically adjusts the context content to optimize resource allocation.
It significantly reduces the occupancy of LLM context tokens, improves the retrieval efficiency and accuracy of complex cross-domain queries, is suitable for complex business systems of large enterprises, can handle query requirements from multiple business domains, while maintaining high token utilization and query response speed.
Smart Images

Figure CN121301626A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of artificial intelligence and big data retrieval technology, in particular to a hierarchical retrieval device for LLM-driven big data retrieval and a method, equipment and medium thereof. BACKGROUND
[0002] In the field of big data retrieval, the core data of an enterprise is often scattered in different scenarios, and most of the data is not directly open to the original storage, but provides access capability to the outside through API interface. Therefore, the enterprise usually relies on a large number of API interfaces and database structure documents to realize the query and analysis of multi-source heterogeneous data. However, with the expansion of the scale of the enterprise, the number of APIs increases significantly, and traditional methods such as fixed rule query, sql expression query, and manual strategy query face many challenges in handling complex query requirements. For example, the existing technology usually directly loads the full amount of OpenAPI document for processing, which occupies a high context Token of the large language model (LLM), limiting its application range in actual scenarios. For an enterprise with hundreds or even thousands of APIs, the traditional method not only cannot meet the demand of efficient retrieval, but also may cause waste of system resources and performance bottleneck.
[0003] In addition, the existing rag (retrieval augmentation generation) retrieval method relies on a single retrieval method, either based on keyword matching or based on vector semantic retrieval (such as cosine similarity calculation). Keyword matching has weak processing ability for synonyms and professional term variants, while vector retrieval can capture semantic similarity, but is prone to misjudgment of semantics in professional fields or ambiguous queries, and has lower accuracy for complex multi-dimensional query results. The retrieval results cannot balance the relationship between multiple keywords, resulting in biased retrieval results in one dimension and information bias.
[0004] Therefore, the present application is proposed. SUMMARY
[0005] The present application aims to provide a hierarchical retrieval device for LLM-driven big data retrieval and a method, equipment and medium thereof, to solve the defects of system process redundancy, high context Token occupation of LLM, and inaccurate retrieval results in the existing big data retrieval technology.
[0006] To solve the above technical problems, the present application realizes the following technical scheme: A hierarchical retrieval device for LLM-driven big data retrieval is used to filter out target data query information to reduce the occupation of LLM context Token and improve the efficiency of LLM in cross-domain complex query retrieval, comprising: an input module, a strategy planning module, an executable strategy generation module and a scheduler. The input module is configured to acquire and preprocess a user query requirement of a user input LLM. The policy planning module is configured to generate a structured execution plan by combining the user query requirement with a pre-constructed data capability classification document. The executable policy generation module is configured to generate API execution instructions that are compliant and directly schedulable based on the structured execution plan. The scheduler is configured to perform retrieval and integrate execution retrieval results to obtain hierarchical retrieval results according to the API execution instructions.
[0007] Preferably, the preprocessing includes: performing preliminary analysis on the user query requirement using a lightweight natural language processing model to identify business domains involved in the query; assigning an importance weight to each identified business domain based on the prominence of the business domain in the user query requirement.
[0008] Preferably, the data capability classification document takes an OpenAPI specification document as the core input source and a data object document existing in the enterprise as a supplement, and is generated through code automation integration; the APIs covered by the data capability classification document include database APIs and data warehouse APIs to accurately interface different types of big data resources.
[0009] Preferably, the division rules of general business object domains are adopted to ensure that the classification of the data capability classification document is logically compatible with the data object document existing in the enterprise; wherein: if the data object document existing in the enterprise has been grouped according to general business object domains, the classification is directly reused as the general business object domain chapter of the data capability classification document; if the data object document existing in the enterprise has not been grouped according to general business object domains, the division of the general business object domains of the data object document existing in the enterprise is automatically completed by parsing the API names and function descriptions of the data object document, and manual fine-tuning is supported.
[0010] Preferably, when the data capability classification document is parsed and generated, general parameters embedded in the general parameter template are adaptively matched based on a predefined general parameter template to improve the consistency and completeness of API descriptions in the data capability classification document and reduce redundancy; the types of the general parameters include time class parameters, classification class parameters, and paging class parameters.
[0011] Preferably, in the strategy planning module, based on the pre-built data capability classification document and combined with custom API analysis prompts, the user query requirements are decomposed through LLM, key information of APIs in relevant business areas is selectively loaded, and the proportion and order of key information of APIs in each business area in the context are dynamically adjusted according to the importance weight of each business area. At the same time, combined with custom API analysis prompts, the user query requirements are decomposed through LLM to obtain a structured execution plan.
[0012] Preferably, in the executable strategy generation module, First, the structured execution plan is initially cleaned and its parameter information is checked for compliance based on the OpenAPI specification document. Next, inference is performed using LLM to identify the query rules and dependencies of all entities in the structured execution plan, and an execution strategy is generated. The execution strategy is then subjected to secondary cleaning and compliance verification based on user-defined rules to obtain API execution instructions.
[0013] Preferably, in the scheduler, the execution retrieval results of each API are obtained according to the API execution instructions, and the execution retrieval results of each API are subjected to field filtering, format unification and compliance processing to obtain the final hierarchical retrieval results.
[0014] This invention also provides a hierarchical retrieval method for a hierarchical retrieval device driven by LLM for big data retrieval, comprising: Obtain and preprocess user query requirements for LLM input; A structured execution plan is generated by combining pre-built data capability classification documents with the user query requirements; Generate compliant and directly schedulable API execution instructions based on the structured execution plan; The search is performed according to the API execution instructions, and the search results are integrated to obtain hierarchical search results.
[0015] The present invention also provides a hierarchical retrieval device for LLM-driven big data retrieval, including a processor and a memory, wherein the memory stores a computer program that can be executed by the processor to implement the hierarchical retrieval method described above.
[0016] The present invention also provides a computer-readable storage medium storing computer-readable instructions, which, when executed by a processor of the device on which the computer-readable storage medium resides, implement the hierarchical retrieval method described above.
[0017] In summary, compared with the prior art, the present invention has the following beneficial effects: This invention achieves dynamic filtering of target data query information based on LLM by preprocessing user query requirements through an input module, generating a structured execution plan through a strategy planning module, generating API execution instructions through an executable strategy generation module, and integrating hierarchical search results through a scheduler. This effectively reduces the occupation of LLM context tokens and improves the retrieval efficiency of complex cross-domain queries, while also improving the accuracy of search results.
[0018] This invention employs a dynamic context management approach to effectively address the efficiency issues of complex cross-domain queries. By adjusting the context content in real time, the system can process more relevant API information within a limited token range, improving the accuracy of LLM understanding and response speed. Simultaneously, the phased query execution method allows the system to continuously optimize and focus during processing, ensuring the quality and relevance of the final results. This approach is particularly suitable for complex business systems in large enterprises, effectively handling complex queries involving multiple business domains while maintaining high token utilization and query response speed.
[0019] This invention optimizes the big data retrieval process through a two-level processing module, significantly reducing the occupancy of LLM context tokens and improving the efficiency of policy generation and the automation level of API calls. The automated generation of data capability classification documents and the establishment of parameter compliance benchmarks ensure the efficient operation of the system and its adaptation to specific enterprise needs. Attached Figure Description
[0020] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.
[0021] Figure 1 This is a schematic diagram of a hierarchical retrieval device for LLM-driven big data retrieval provided in Embodiment 1.
[0022] Figure 2 This is a flowchart illustrating a hierarchical retrieval device for LLM-driven big data retrieval provided in Embodiment 1.
[0023] Figure 3 This is a flowchart of a hierarchical retrieval method for LLM-driven big data retrieval provided in Example 2.
[0024] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0026] Example 1 In this embodiment, a hierarchical retrieval device for LLM-driven big data retrieval can be an electronic device equipped with a processor. The processor carries a computer program for the hierarchical retrieval method for LLM-driven big data retrieval, and the computer program can be executed. Examples include computers, smartphones, smart tablets, workstations, etc., which are not limited here.
[0027] In existing technologies, when enterprises handle complex data query needs, they usually load the entire API documentation directly for processing, resulting in excessive consumption of large language model context tokens, making it difficult to cope with cross-domain retrieval scenarios.
[0028] To address the aforementioned issues, the inventors observed domain-specific characteristics in API calls and attempted to optimize resource allocation through a tiered processing mechanism. Initially, they considered domain identification and weight allocation for user queries, but found that simple classification could not resolve the priority issues of complex queries. Subsequently, they explored methods for generating structured execution plans, discovering the need to establish a mapping relationship between API metadata and business domains. Ultimately, a phased processing mechanism was developed, using a modular architecture to progressively parse and execute query requirements.
[0029] This embodiment can extract target data query information and dependent relationships without passing in full data query information (such as full API documentation and database structure information). It can do so by using only a structured data capability classification document (data_info.txt, which is small in size) automatically generated by the code, combined with the user's input natural language requirements. This reduces the occupation of massive data query information on LLM context tokens and improves LLM processing efficiency by reorganizing API and database structure documents.
[0030] like Figures 1-2As shown, the overall architecture of a hierarchical retrieval device for LLM-driven big data retrieval includes: an input module, a strategy planning module (first level), an executable strategy generation module (second level), and a scheduler module. These modules work together with automation tools and LLM to achieve efficient big data retrieval. The specific operating principles and processes of each module will be explained below with reference to the accompanying drawings.
[0031] First, the input module acquires and preprocesses the user's query requirements for the LLM. This step transforms the user's natural language query (which may be ambiguous or redundant) into a "clear query intent" that the LLM can accurately understand, laying the foundation for subsequent plan generation.
[0032] Specifically, a lightweight natural language processing model is used to perform preliminary analysis of user queries to identify the business domains involved. For example, keyword extraction and semantic analysis are used to determine multiple business domains involved in the query. Then, each identified business domain is assigned an importance weight based on its prominence in the query.
[0033] This preprocessing mechanism significantly reduces the amount of redundant information in the LLM context, while avoiding the computational delay caused by the traditional full-processing method, thereby improving the overall retrieval efficiency.
[0034] Next, the first-level strategy planning is performed. The core task of the first-level strategy planning module is to generate a structured execution plan, transforming the abstract plan into an executable instruction converter. The LLM breaks down the "query intent" into a "hierarchical, executable" structured plan, ensuring a clear and controllable retrieval path.
[0035] Specifically, firstly, the system needs to prepare a data capability classification document (data_info.txt) in advance. This document uses the OpenAPI specification document (a commonly used enterprise API interface definition standard, such as Swagger / OpenAPI 3.0+ format) as the core input source. It does not require manual writing and can also integrate existing enterprise database table structure documents or data model definition documents. It is automatically generated through code scripts. First, based on the OpenAPI specification document, or in conjunction with other data object documents, classify the data according to common business object domains. This ensures that the classification in the data_info.txt document is logically compatible with the enterprise's existing API documents, reducing the cost of secondary adjustments. The classification principles are as follows: Category reuse principle: If the enterprise's existing OpenAPI specification documents have already been grouped into "general business object domains" (such as "customer entity, order entity, inventory entity") (such as the OpenAPI's tags field being marked as "customer related API" and "order related API"), then this category can be directly reused as the "general business object domain" of data_info.txt without the need for additional re-division; Category completion rules: If the OpenAPI documentation does not explicitly categorize, the code can parse keywords in the API name and function description (e.g., those containing "customer" or "client" are classified as "customer domain", and those containing "order" or "transaction" are classified as "order domain") to automatically complete the division of general business object domains, and support subsequent manual fine-tuning. Next, the JSON / YAML structure of the OpenAPI specification document can be automatically parsed using a script (such as a Python script) and the key information of the API can be extracted as the basic content of the "General Business Object Domain → API / Data Query Entity" level in data_info.txt. The key information of the API includes the data query entity name, function description, key parameters and unique short code identifier (such as auto-incrementing from 1 in sequence, or generating an 8-digit hexadecimal short code based on the API path hash value).
[0036] Of course, other methods can also be used to automatically parse the OpenAPI specification document, such as the existing document parsing model, which is not limited here.
[0037] The extraction rules are shown in Table 1 below: Table 1. Extraction Rules
[0038] Then, the extracted key information from the API is integrated according to the hierarchical structure of one-to-one correspondence between general business object domains and data query entity names to obtain a structured document, namely the data capability classification document.
[0039] Furthermore, to avoid redefining the same parameters across different APIs, the system defines a set of general parameter templates. Based on these predefined templates, the system adaptively matches general parameters embedded within them to improve the consistency and completeness of API descriptions in the data capability classification documents and reduce redundancy. The types of these general parameters include time-related parameters, category-related parameters, pagination-related parameters, etc. These types are specific to user order categories; however, in other cases, the types of general parameters may differ. These approaches are all within the scope of this invention and will not be elaborated upon here.
[0040] For example, time-related parameters such as `date_range` and category-related parameters such as `category_id` are automatically embedded into the common parameter fields of the data capability classification document `data_info.txt` through code. The final generated data capability classification document `data_info.txt` supports YAML / JSON formats, ensuring its small size and ease of loading and processing by LLM.
[0041] Adaptive matching and embedding rules, such as: 1) Traverse API native parameters, and reuse them directly if they have the same name and type as template parameters; 2) Automatically embed and fill default values for template parameters that are not covered; 3) In case of conflict, API native parameters take precedence.
[0042] The specific steps for generating the data capability classification document are as follows: Input reading: Reads the OpenAPI specification document (supports JSON / YAML format), and if there is supplementary data object document, reads and parses it synchronously; Classification and Extraction: Divide the general business object domain according to the classification principle, extract the key API information according to the extraction rules, and embed the general parameters according to the general parameter template; Structure assembly: The code automatically assembles the extracted information into a hierarchical structure of "general business object domain → API / data query entity" (keeping consistent with the initialization definition of data_info.txt); Output: Generates a structured data_info.txt document, which is a data capability classification document.
[0043] In practical applications, such as e-commerce platform API documentation, APIs are typically categorized into customer, order, and logistics domains based on business object domains. If a clear classification already exists, the system directly reuses it; otherwise, it categorizes the API by parsing keywords from its name and function description. For example, APIs containing "customer" or "client" are classified as "customer domain," while those containing "order" or "transaction" are classified as "order domain." The system then extracts key information and embeds it into a generic parameter template. This template can include a summary of the API's functions, detailed function descriptions, important parameters, and their definitions. For instance, for the "Customer Basic Information Query" API, the system extracts its function summary "Supports filtering basic information by customer ID and region" and records important parameters such as "Customer Unique Identifier ID."
[0044] This application achieves precise narrowing of the data retrieval scope through business domain classification, and reduces manual intervention by combining automated parsing. The resulting structured document provides standardized data input for the subsequent strategy planning module, enabling LLM to quickly locate the relevant API set when processing cross-domain queries.
[0045] By pre-building a data capability classification document, data_info.txt, the problem of "massive APIs occupying LLM context" can be solved. For example, data_info.txt for 72 APIs only occupies 9851 tokens, far below the 128k token limit supported by mainstream LLMs. This ensures that the LLM can load and efficiently filter target data query information at once. At the same time, combined with "general business object domain classification", the processing scope of the LLM is further narrowed (e.g., loading only API information from the customer domain and order domain can further reduce the usage).
[0046] After generating the data capability classification document data_info.txt, the strategy planning module combines the user's query requirements input in natural language with the data_info.txt document, selectively loads key information of APIs in relevant business domains, and dynamically adjusts the proportion and order of key information of APIs in each business domain in the context according to the importance weight of each business domain. At the same time, combined with custom API analysis prompts, the module decomposes the user query requirements through LLM to obtain a structured execution plan.
[0047] Suppose the user inputs "Query the orders and corresponding logistics status of newly added customers in the last 30 days". The system first identifies the entity relationship chain, namely "customer → order → logistics order", and loads the key information of the API in the corresponding business domain. For example, the customer ID (customer_id) output by the customer task (T1) needs to be used as the input of the order task (T2), and the order ID (order_no) output by the order task (T2) needs to be used as the input of the logistics task (T3). Finally, the system generates a structured execution plan that includes query conditions, output fields, and dependencies.
[0048] For example, the task definition for T1 is: query condition: create_date in last 30 days, output field: customer_id; The task definition for T2 is: Query condition: customer_id from T1.output, Output field: order_no; The task definition for T3 is: query condition: order_no from T2.output, output field: logistics_status.
[0049] Then, after entering the second-level executable strategy generation module, the system generates compliant and directly schedulable API execution instructions based on the structured execution plan generated by the first-level module through a three-level process: preliminary cleaning, dependency generation, and special adaptation. Preliminary cleaning solves "basic compliance issues," dependency generation solves "complex parameter completion," and special adaptation solves "enterprise-customized scenarios."
[0050] In the initial cleaning phase, the system first establishes parameter compliance benchmarks through the OpenAPI documentation, filtering out parameters in the execution strategy that clearly do not conform to the specifications. For example, for task T1, the system checks whether its parameters conform to the specifications, such as page_size needing to be an integer and start_date needing to be in YYYY-MM-DD format. If it finds that the initially extracted parameter values do not match the types defined in the API, the system automatically corrects them through type conversion logic.
[0051] Then, for each query task in the structured execution plan, the "parameter compliance baseline" of the API is extracted by precisely associating it with the OpenAPI documentation through identifiers, clarifying the following key information: Distinguish parameter attributes: mark which are "required parameters" (missing them will cause API calls to fail) and which are "optional parameters" (which can be filled in by default or added later); Locking down basic specifications: Record the "data type definition" (e.g., order_id must be a string, page_size must be a positive integer), "format requirements" (e.g., date must be YYYY-MM-DD, phone must be an 11-digit number), and "value boundaries" (e.g., status only allows active / inactive, amount must be ≥0) for each parameter; Associating entity mapping: Clarify the correspondence between parameters and business entities (e.g., category_id must match the ID format of "product category entity", user_id must conform to the encoding rules of enterprise user ID). The dependency generation phase is used when the initial cleaning phase cannot fully resolve the issue. It employs LLM reasoning to identify and supplement the query rules and dependencies of all entities in the structured execution plan, thereby generating an execution strategy.
[0052] In this step, during LLM inference, the structured execution plan can be converted into JSON input, combined with preset prompts, such as, "Please analyze the following task chain and output the entity dependency graph: If the input field of task T2 ∈ the output field set of task T1, then add the edge T1→T2." Inference is performed through fine-tuned LLM, and if circular dependencies are found, the rule engine is triggered to correct them.
[0053] In this step, a compliance check can be performed on the implicit parameter information in the execution strategy (such as entity values in target_entity and preliminary parameters extracted from the dialogue history) through preset lightweight logic, and issues that can be automatically corrected can be directly optimized. For example, field type compliance verification and correction: If the parameter value initially extracted in the execution strategy does not match the type defined by the API (e.g., the API requires page_size to be an integer, but the initially extracted value is the string "20"), it will be automatically corrected through type conversion logic; if it cannot be converted (e.g., the string "abc" is converted to an integer), then "parameter type incompatible, valid value needs to be added later" will be marked in the issue log. For example, time / date format unification optimization: For time format requirements explicitly stated in the API documentation (e.g., start_date must be YYYY-MM-DD), automatically identify different formats of time descriptions in the execution strategy (e.g., preliminary inferences of "2025.09.05", "2025-9-5", "last 7 days"), and unify them into the standard format required by the API through format conversion logic; if the time range exceeds the backtracking period allowed by the API (e.g., the API only supports data from the last 90 days, while the preliminary inference value is "2025-01-01"), it will be automatically adjusted to the maximum range allowed by the API, and a note will be added to the log stating "Time range exceeded, API limit has been adapted". For example, the initial judgment of missing required parameters: the core is to check whether there is available information in the execution strategy (such as the entity ID in target_entity, the description in the dialogue history) by referring to the "list of required parameters" in the API technical specification document, and process it according to the logic of "keep if it exists, fill in / mark if it is missing": First, check the existing information: see if target_entity contains the entity value associated with the parameter (e.g., product_id corresponds to the entity ID), and if the dialogue history contains parameter-related descriptions (e.g., region corresponds to "East China region"). If so, associate directly. Then, add the basic value: if there is no existing information, first check the default value in the API documentation (e.g., page_size defaults to 10). If there is no default value, add it according to business common sense (e.g., add "today" for the date, "this month" for the month, and "this year" for the year). Finally, mark it as to be added: if the default value and common sense added value are not available, mark it as "to be added" in the execution strategy.
[0054] During the special adaptation phase, the execution strategy undergoes secondary cleaning and compliance verification based on user-defined rules. This secondary cleaning addresses parameter issues that the initial cleaning and LLM inference cannot handle. For example, for task T2, the system filters out a list of APIs with "missing / non-compliant parameters" and matches each one with its corresponding complete and detailed documentation. The LLM is provided with detailed API documentation, all historical dialogue fragments, and business-related information, such as category ID=1024 and East China region code=310000, to generate parameters in batches. Subsequently, the system ensures parameter compliance through secondary cleaning, including field type validation, format consistency, and business compliance verification. For example, the system checks whether `fans_count_max` is an integer, whether `date_range` is in YYYY-MM-DD format, and whether `category_id` is within the document whitelist.
[0055] During the special adaptation phase, the system ensures it covers non-general, highly customized data retrieval scenarios for enterprises, guaranteeing the implementation of specific enterprise needs. For example, for certain enterprise-specific business rules, the system generates special parameters through custom logic and embeds API execution instructions. Ultimately, the system generates executable API instructions, each containing complete query conditions, output fields, and dependencies.
[0056] Finally, the scheduler calls the APIs according to the generated executable API instructions in dependency order, executes the retrieval tasks, and integrates and returns the results. The system automatically generates the execution order according to the rule of "tasks without dependencies are executed first, and dependent tasks are executed later." For example, task T1 is executed first, and its output `customer_id` is written to the result cache in real time for use by task T2. Similarly, after task T2 is completed, its output `order_no` is written to the cache for use by task T3. In the result validation stage, the system slims down the original return results of each API according to the whitelist of result fields in the API documentation.
[0057] For example, the original product API return includes unnecessary fields such as create_time, update_time, and operator_id, but the system only retains valid fields such as product_id, sales_num, and category_id. Furthermore, the system standardizes the format of valid parameters; for example, it converts the string "1000" in sales_num to the integer 1000, and filters invalid data in the results, such as removing outliers like sales_num=-1. Finally, the system automatically correlates the results of each stage and returns a structured, end-to-end result. For example, the system matches "Customer C001 → Order O001 → Logistics Order L001" into a single complete data entry.
[0058] Through the above steps, this invention achieves one-time triggering and fully automated retrieval of multiple related entities. Compared to traditional step-by-step retrieval methods, this invention significantly reduces the consumption of LLM context tokens and improves the efficiency of strategy generation and the automation level of API calls. Furthermore, the automated generation of data capability classification documents and the establishment of parameter compliance benchmarks ensure the efficient operation of the system and its adaptation to specific enterprise needs.
[0059] These technical features work together to enable LLM to process large amounts of API information within a limited token context, significantly improving data retrieval efficiency while expanding the range of APIs that can be processed.
[0060] Using "72 Data Analysis APIs" as a test sample, we compared the effects of fully loading the OpenAPI documentation versus using the data capability categorization documentation: The full loading of OpenAPI documentation method can only support a maximum of 40-45 APIs within a 128k Token context. This method is only suitable for micro-enterprises (small merchants with fewer than 50 APIs).
[0061] Using data-driven document categorization, approximately 935 APIs can be supported within a 128k Token context, covering over 95% of enterprise scenarios. Small and medium-sized enterprises (100-500 APIs): Full coverage.
[0062] Large enterprises (600-800 core business domain APIs): can cover core scenarios.
[0063] For very large enterprises: data_info.txt can be split according to business lines, and a single round of loading of APIs for a single business line (usually <600) can still meet the needs.
[0064] This embodiment clearly demonstrates that the core technical solution of the present invention can effectively solve the problem of large-scale API information processing, enabling LLM to process more API information in a limited token context, thereby meeting the needs of enterprises of various sizes.
[0065] In summary, compared with the prior art, the present invention has the following beneficial effects: Traditional methods require loading all potentially related API documentation simultaneously when handling complex queries, resulting in the context window being filled with low-relevance information. This solution, however, uses a tiered processing mechanism to load only the necessary API metadata during the strategy planning phase and call specific interfaces as needed during execution, effectively reducing the model's processing burden. For example, in cross-domain query scenarios, the system can prioritize API calls from high-priority domains, preventing low-priority interfaces from consuming computational resources.
[0066] Through the above technical solutions, this application achieves progressive processing of complex query requests, significantly reducing the context burden on large language models processing API documents. The system can dynamically adjust resource allocation based on the domain distribution of the query content, improving the response speed of cross-domain data retrieval. Simultaneously, through a structured execution plan generation mechanism, it ensures the compliance and execution efficiency of API calls, avoiding resource waste caused by invalid interface calls.
[0067] Meanwhile, the phased query execution approach allows the system to continuously optimize and focus during processing, ensuring the quality and relevance of the final results. This method is particularly suitable for complex business systems in large enterprises, effectively handling complex queries involving multiple business domains while maintaining high token utilization and query response speed.
[0068] Example 2 like Figure 3 As shown, the second embodiment of the present invention also provides a hierarchical retrieval method for LLM-driven big data retrieval, including: Obtain and preprocess user query requirements for LLM input; A structured execution plan is generated by combining pre-built data capability classification documents with the user query requirements; Generate compliant and directly schedulable API execution instructions based on the structured execution plan; The search is performed according to the API execution instructions, and the search results are integrated to obtain hierarchical search results.
[0069] Example 3 The third embodiment of the present invention also provides a hierarchical retrieval device for LLM-driven big data retrieval, which includes a memory and a processor. The memory stores a computer program, which can be executed by the processor to realize the hierarchical retrieval method for LLM-driven big data retrieval as described above.
[0070] Example 4 The fourth embodiment of the present invention also provides a computer-readable storage medium storing computer-readable instructions. When the computer-readable instructions are executed by the processor of the device where the computer-readable storage medium is located, they implement the hierarchical retrieval method for LLM-driven big data retrieval as described above.
[0071] In the several embodiments provided in this invention, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus and method embodiments described above are merely illustrative. For example, the flowcharts in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the invention. In this regard, each block in the flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0072] In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0073] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, electronic device, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks. It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. In the absence of further restrictions, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0074] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0075] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0076] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0077] The use of "first" and "second" in the embodiments is merely to distinguish similar objects and does not represent a specific ordering of objects. It is understood that "first" and "second" can be interchanged in a specific order or sequence where permitted. It should be understood that the objects distinguished by "first" and "second" can be interchanged where appropriate so that the embodiments described herein can be implemented in an order other than those illustrated or described herein.
[0078] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A hierarchical retrieval device for LLM-driven big data retrieval, used to filter target data query information to reduce the occupation of LLM context tokens and improve the efficiency of LLM in retrieving complex cross-domain queries, characterized in that, include: Input module, strategy planning module, executable strategy generation module, and scheduler; The input module is used to acquire and preprocess user query requirements for LLM input; The strategy planning module is used to generate a structured execution plan by combining pre-built data capability classification documents with the user query requirements; The executable strategy generation module is used to generate compliant and directly schedulable API execution instructions based on the structured execution plan; The scheduler is used to execute retrieval according to the API execution instructions and integrate the retrieval results to obtain hierarchical retrieval results.
2. The hierarchical retrieval device for LLM-driven big data retrieval according to claim 1, characterized in that... The preprocessing includes: A lightweight natural language processing model is used to perform a preliminary analysis of the user's query request and identify the business areas involved in the query. Based on the prominence of the business domain in the user's query request, an importance weight is assigned to each identified business domain.
3. The hierarchical retrieval device for LLM-driven big data retrieval according to claim 1, characterized in that... The data capability classification document uses the OpenAPI specification document as the core input source and is supplemented by the enterprise's existing data object documents, and is generated through automated code integration. The APIs compiled in the data capability classification document cover calling database APIs and data warehouse APIs to accurately connect with different types of big data resources.
4. The hierarchical retrieval device for LLM-driven big data retrieval according to claim 3, characterized in that... The use of general business object domain partitioning rules ensures that the classification of data capability documents is logically compatible with the existing data object documents within the enterprise; among which: If the enterprise's existing data object documents have been grouped according to the common business object domain, then the classification can be directly reused as the common business object domain chapter of the data capability classification document; If an enterprise's existing data object documents are not grouped according to common business object domains, the code will automatically complete the division of common business object domains for the enterprise's existing data object documents by parsing the keywords in the API names and function descriptions, and will support manual fine-tuning.
5. A hierarchical retrieval device for LLM-driven big data retrieval according to claim 4, characterized in that... When parsing and generating the data capability classification document, based on a predefined general parameter template, the general parameters embedded in the general parameter template are adaptively matched to improve the consistency and completeness of the API description in the data capability classification document and reduce redundancy; the types of general parameters include time-related parameters, category-related parameters and pagination-related parameters.
6. The hierarchical retrieval device for LLM-driven big data retrieval according to claim 4, characterized in that... In the strategy planning module, based on the pre-built data capability classification document, key information of APIs in relevant business areas is selectively loaded. According to the importance weight of each business area, the proportion and order of key information of APIs in each business area in the context are dynamically adjusted. At the same time, combined with custom API analysis prompts, the user query requirements are decomposed through LLM to obtain a structured execution plan.
7. A hierarchical retrieval device for LLM-driven big data retrieval according to claim 1, characterized in that... In the executable strategy generation module, First, the structured execution plan is initially cleaned and its parameter information is checked for compliance based on the OpenAPI specification document. Next, LLM is used for reasoning to find the query rules and dependencies of all entities in the structured execution plan and generate an execution strategy; The execution strategy is then cleaned and validated for compliance based on user-defined rules to obtain API execution instructions. In the scheduler, the execution results of each API are obtained by retrieving the execution instructions of the API, and the execution results of each API are filtered by fields, formatted and processed for compliance, to obtain the final hierarchical search results.
8. A hierarchical retrieval method based on the hierarchical retrieval device for LLM-driven big data retrieval according to any one of claims 1-7, characterized in that... ,include: Obtain and preprocess user query requirements for LLM input; A structured execution plan is generated by combining pre-built data capability classification documents with the user query requirements; Generate compliant and directly schedulable API execution instructions based on the structured execution plan; The search is performed according to the API execution instructions, and the search results are integrated to obtain hierarchical search results.
9. A hierarchical retrieval device for LLM-driven big data retrieval, characterized in that, It includes a processor and a memory, wherein the memory stores a computer program that can be executed by the processor to implement the hierarchical retrieval method as described in claim 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by the processor of the device on which the computer-readable storage medium resides, implement the hierarchical retrieval method as described in claim 8.
