Question and answer method and device, electronic equipment, storage medium and program product

CN123012136APending Publication Date: 2026-10-30GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611521185.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-29
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]本申请实施例提供了一种问答方法、装置、电子设备、存储介质及程序产品,以至少解决相关技术在搜索时将知识进行了筛选和压缩来达到降低检索资源消耗,导致面对复杂问题时容易答案失真的技术问题

Benefits of technology

[0018]在本申请实施例中,采用语义复杂度感知与弹性预算调度相结合的方式,通过量化表征查询任务难度的复杂度特征向量动态分配计算资源上限,并基于知识库元数据索引评估知识复杂度以优选预测消耗在预算内的目标查询路径,并依据路径执行结果生成最终答案,达到了在严格控制资源消耗的同时完整保留知识库证据链的目的,从而实现了复杂查询仍能获得完整答案及提升多跳推理准确率的技术效果,进而解决了相关技术在搜索时将知识进行了筛选和压缩来达到降低检索资源消耗,导致面对复杂问题时容易答案失真的技术问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123012136A_ABST
    Figure CN123012136A_ABST
Patent Text Reader

Abstract

The application discloses a question and answer method and device, electronic equipment, storage medium and program product. The method comprises the following steps: obtaining a complexity feature vector corresponding to a natural language query; determining an inference budget according to the complexity feature vector; determining the knowledge complexity of a knowledge unit corresponding to the natural language query, and determining a target query path according to the knowledge complexity; and determining a natural language answer corresponding to the natural language query according to the execution result of the target query path. The application solves the technical problem that related technologies filter and compress knowledge to reduce the consumption of retrieval resources when searching, which leads to the distortion of answers to complex problems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and more specifically, to a question-answering method, apparatus, electronic device, storage medium, and program product. Background Technology

[0002] Related technologies filter and compress knowledge during the search process to reduce retrieval resource consumption. However, the compression process actively discards low-weight or long-tail feature vectors, which permanently filters out the non-high-frequency but critical semantic associations required for multi-hop reasoning, making the answers prone to distortion when faced with complex problems.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This application provides a question-answering method, apparatus, electronic device, storage medium, and program product to at least solve the technical problem that related technologies filter and compress knowledge during searching to reduce retrieval resource consumption, which can easily lead to distorted answers when faced with complex questions.

[0005] According to one aspect of the embodiments of this application, a question-answering method is provided, comprising: obtaining a complexity feature vector corresponding to a natural language query, wherein the complexity feature vector is used to characterize the task difficulty of solving the natural language query from multiple dimensions; determining an inference budget based on the complexity feature vector, wherein the inference budget is used to quantify the upper limit of computing resources allocated to the natural language query; determining the knowledge complexity of the knowledge unit corresponding to the natural language query, and determining a target query path based on the knowledge complexity, wherein the knowledge complexity is determined based on the metadata index of the knowledge base where the knowledge unit is located, and the prediction consumption budget of the target query path is not greater than the inference budget; and determining a natural language answer corresponding to the natural language query based on the execution result of the target query path.

[0006] In some embodiments of this application, determining the knowledge complexity of a knowledge unit associated with a natural language query includes: obtaining the metadata index of the knowledge base where the knowledge unit is located, wherein the metadata index is used to store summary information of the knowledge base; determining the knowledge unit associated with the natural language query based on the metadata index, wherein the knowledge unit includes at least one of the following: a data source, a subgraph; determining the topological features corresponding to the knowledge unit, wherein the topological features are used to characterize the inference load and semantic processing difficulty when using the knowledge unit to process the natural language query; and determining the knowledge complexity based on the topological features.

[0007] In some embodiments of this application, determining the topological features corresponding to a knowledge unit includes: determining a data size index for the knowledge unit, wherein the data size index includes the number of data entries or documents corresponding to the knowledge unit; determining an association density index for the knowledge unit, wherein the association density index includes the number of connection edges or association relationships between elements within the knowledge unit; determining a heterogeneity index for the knowledge unit, wherein the heterogeneity index includes the types of data structures within the knowledge unit; and using at least one of the data size index, association density index, and heterogeneity index as a topological feature.

[0008] In some embodiments of this application, determining the target query path based on knowledge complexity includes: obtaining a set of logical constraints in a natural language query, and determining multiple candidate query paths based on the set of logical constraints and knowledge complexity; determining the predicted consumption budget corresponding to each of the multiple candidate query paths, wherein the predicted consumption budget is determined based on the total knowledge complexity of the candidate query paths; and determining the candidate query paths whose predicted consumption budget is less than or equal to the inference budget as the target query path.

[0009] In some embodiments of this application, the method further includes: determining path value scores corresponding to the target query paths, wherein the path value scores are used to quantify the expected semantic contribution of the target query paths to natural language queries and the reliability of retrieval execution; determining the estimated cost-effectiveness ratio based on the path value scores and the predicted cost-effectiveness ratio; and selecting updated target query paths from the target query paths based on the estimated cost-effectiveness ratio.

[0010] In some embodiments of this application, determining the inference budget amount based on the complexity feature vector includes: determining a budget sensitivity factor corresponding to the complexity feature vector, wherein the budget sensitivity factor is used to quantify the query complexity of a natural language query; obtaining a preset base budget, a budget elasticity coefficient, and a maximum budget threshold, wherein the budget elasticity coefficient is used to determine the response sensitivity of the base budget to query complexity; and determining the inference budget amount based on the budget sensitivity factor, the base budget, the budget elasticity coefficient, and the maximum budget threshold.

[0011] In some embodiments of this application, determining the natural language answer corresponding to the natural language query based on the execution result of the target query path includes: obtaining the execution result of the target query path; generating a natural language answer based on the execution result if the execution result completely covers the logical constraint set corresponding to the natural language query; and determining the missing constraint set not covered by the execution result from the logical constraint set if the execution result does not completely cover the logical constraint set, determining the updated execution result based on the missing constraint set, and generating a natural language answer based on the updated execution result, wherein the updated execution result completely covers the missing constraint set.

[0012] In some embodiments of this application, the method further includes: stopping execution when the execution result does not completely cover the logical constraint set and the remaining inference budget is less than the minimum execution unit cost; or, when determining the updated execution result based on the missing constraint set, stopping execution when the coverage increment of the updated execution result in consecutive multi-step iterations is less than a preset increment; or, stopping execution when the execution result or the updated execution result contains content that contradicts the natural language query.

[0013] In some embodiments of this application, obtaining a complexity feature vector corresponding to a natural language query includes: extracting an entity set, a set of relational predicates reflecting the logical relationships between entities, and a set of logical constraints reflecting limiting conditions from the natural language query; determining structural complexity based on the set of relational predicates and the set of logical constraints, wherein structural complexity is used to quantify the logical nesting depth of the natural language query; determining semantic ambiguity based on the entity set, wherein semantic ambiguity is used to quantify the degree of ambiguity of entities; determining domain span based on the entity set and the set of relational predicates, wherein domain span is used to quantify the degree of dispersion of the distribution of entities or relations in a predefined domain vector space; and determining a complexity feature vector based on structural complexity, semantic ambiguity, and domain span.

[0014] According to another aspect of the embodiments of this application, a question-answering device is also provided, comprising: an acquisition module, configured to acquire a complexity feature vector corresponding to a natural language query, wherein the complexity feature vector is used to characterize the task difficulty of solving the natural language query from multiple dimensions; a first determination module, configured to determine an inference budget amount based on the complexity feature vector, wherein the inference budget amount is used to quantitatively represent the upper limit of computing resources allocated to the natural language query; a second determination module, configured to determine the knowledge complexity of the knowledge unit corresponding to the natural language query, and determine a target query path based on the knowledge complexity, wherein the knowledge complexity is determined based on the metadata index of the knowledge base where the knowledge unit is located, and the prediction consumption budget of the target query path is not greater than the inference budget amount; and an execution module, configured to determine the natural language answer corresponding to the natural language query based on the execution result of the target query path.

[0015] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory and a processor, wherein the memory is used to store program instructions; and the processor is connected to the memory and used to execute the above-described question-and-answer method.

[0016] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned question-and-answer method by running the computer program.

[0017] According to another aspect of the embodiments of this application, a computer program product is also provided, including computer instructions that, when executed by a processor, implement the above-described question-and-answer method.

[0018] In this embodiment, a combination of semantic complexity awareness and elastic budget scheduling is adopted. The upper limit of computing resources is dynamically allocated by quantifying the complexity feature vector that represents the difficulty of the query task. The knowledge complexity is evaluated based on the knowledge base metadata index to optimize the target query path that consumes within the budget. The final answer is generated based on the path execution result. This achieves the goal of strictly controlling resource consumption while completely preserving the evidence chain of the knowledge base. This enables the technical effect of obtaining complete answers for complex queries and improving the accuracy of multi-hop reasoning. In turn, it solves the technical problem that related technologies filter and compress knowledge during the search to reduce retrieval resource consumption, which can easily lead to distorted answers when facing complex problems. Attached Figure Description

[0019] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0020] Figure 1 This is a hardware structure block diagram of a computer terminal according to an embodiment of the question-and-answer method of this application;

[0021] Figure 2 This is a flowchart of a question-and-answer method according to an embodiment of this application;

[0022] Figure 3 This is a system architecture diagram of a question-and-answer method according to an embodiment of this application;

[0023] Figure 4 This is a schematic diagram of the structure of a question-and-answer device according to an embodiment of this application. Detailed Implementation

[0024] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0026] To better understand the embodiments of this application, the technical terms involved in the embodiments of this application are explained below:

[0027] Budget Sensitivity Factor (δ): A normalized value in the (0,1) interval that maps multidimensional complexity feature vectors to a sigmoid activation function. It is used to characterize the difficulty of solving a task. In this embodiment, the budget sensitivity factor serves as a bridge between query difficulty and system resources. It is used to dynamically adjust the basic budget to ensure that complex queries receive more computing power support, while preventing a single query from exhausting system resources.

[0028] Action-Cost Table (ACT): A mapping table that pre-registers the computational resource consumption and external call economic cost of each available tool or API. In this embodiment, the Action-Cost Table is used to define the resource cost of different inference actions (such as Lookup, KBQuery, WebSearch), providing benchmark data for the estimated consumption calculation of path planning, and realizing precise quantitative control of resource consumption.

[0029] Knowledge Topology Scanning: A lightweight access process to the metadata index of an internal knowledge base to obtain summary information about the data source (such as data size, association density, and heterogeneity). In this embodiment, knowledge topology scanning is used to quickly evaluate the knowledge base before consuming computing power, determine the complexity κ of knowledge units, avoid unnecessary deep searches of high-complexity subgraphs, and thus preserve the complete chain of evidence while reducing resource consumption.

[0030] Knowledge Complexity (κ): An indicator that comprehensively evaluates the complexity of a data source or subgraph based on factors such as data scale, association density, and heterogeneity. In this embodiment, knowledge complexity is used to quantitatively evaluate the processing difficulty of different knowledge units, serving as a key basis for estimating consumption budget and path value scoring in path planning, and helping the system to prioritize high-value and low-complexity paths.

[0031] When handling multi-hop question-answering reasoning tasks, intelligent question-answering technologies typically employ a "compression-then-retrieval" paradigm. This involves using knowledge compression algorithms to filter and compress knowledge vectors to reduce storage and retrieval overhead. However, this compression process often actively discards low-weight or long-tail feature vectors, permanently filtering out the non-high-frequency but crucial semantic connections required for multi-hop reasoning. Consequently, when faced with complex problems, these technologies struggle to retain a complete chain of evidence, easily leading to distorted answers and failing to provide accurate and complete reasoning results.

[0032] Furthermore, the relevant technologies primarily focus on entity extraction and analysis of the problem. For example, they generate standardized questions through placeholder replacement to isolate specific entities, focus on core semantics, and narrow the search scope. However, because placeholder replacement disrupts the sequential relationships and structural information between entities, the system struggles to capture implicit relationships between entities. Therefore, when faced with complex problems involving multi-condition joint filtering or inference of implicit relationships between entities, these technologies tend to overlook the deep logical relationships and constraints of the problem, resulting in low inference accuracy and failing to meet the requirements for precise matching.

[0033] To address the aforementioned technical problems, this application provides corresponding solutions, which are detailed below.

[0034] The question-and-answer method embodiments provided in this application can be executed on mobile terminals, computer terminals, or similar computing devices. Figure 1 A hardware block diagram of a computer terminal for implementing a question-and-answer method is shown. Figure 1 As shown, the computer terminal 10 may include a processor 102, a memory 104 for storing data, and a transmission module 106 for communication functions. The processor 102 may include one or more processors. For ease of explanation, Figure 1The illustration uses multiple processors, including a first processor 102a, a second processor 102b, ..., an nth processor 102n. Processor 102 may include, but is not limited to, processing devices such as microcontroller units (MCUs) or field-programmable gate arrays (FPGAs). In addition, it may include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0035] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10. As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0036] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the question-and-answer method in this embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the aforementioned question-and-answer method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0037] The transmission module 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission module 106 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission module 106 may be a radio frequency (RF) module, used for data interaction with external networks or devices via wired and / or wireless network connections.

[0038] The display can be, for example, a touchscreen liquid crystal display (LCD), which allows the user to interact with the user interface of the computer terminal 10. Furthermore, the computer terminal 10 can be connected to a cursor control device and a keyboard via an input / output interface. The cursor control device (e.g., a mouse, trackball, or touchpad) is primarily used to transmit directional information and command selections to the terminal and control the movement of the cursor on the display; the keyboard is primarily used to receive letters, numbers, and other control commands input by the user, thereby enabling interaction between the user and the computer terminal 10.

[0039] It should be noted here that, in some optional embodiments, the above... Figure 1 The computer terminal shown may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that... Figure 1 This is only one instance of a specific particular instance, and is intended to illustrate the types of components that may exist in the aforementioned computer terminal.

[0040] In the above operating environment, this application provides a question-and-answer method embodiment. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than that shown here.

[0041] Figure 2 This is a flowchart of a question-and-answer method according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:

[0042] Step S202: Obtain the complexity feature vector corresponding to the natural language query, wherein the complexity feature vector is used to characterize the difficulty of solving the natural language query task from multiple dimensions.

[0043] In step S202 above, a natural language query refers to text information entered by the user in natural language form that contains specific intentions or factual needs.

[0044] The complexity feature vector is a multidimensional array composed of multiple quantitative indicators. For example, it can comprehensively characterize the difficulty of solving natural language queries from multiple dimensions such as structural complexity, semantic ambiguity, and domain span. Among them, structural complexity is used to measure the depth of logical nesting in the query, which can be calculated by counting the number of independent conditions and the number of hops in the relation predicate graph, reflecting the complexity of the query logic; semantic ambiguity is used to assess the uncertainty of the mapping of core entities in the knowledge base, which can be quantified by counting the average number of candidate entity mappings, reflecting the difficulty of entity linking; domain span is used to characterize the breadth of knowledge domains involved in the query, which can be established by calculating the average Euclidean distance between the entity and relation embedding vectors and the centroid of the predefined domain, reflecting the difficulty of cross-domain reasoning.

[0045] In some embodiments of this application, the complexity feature vector corresponding to a natural language query can be obtained in the following ways: extracting an entity set, a set of relational predicates reflecting the logical relationships between entities, and a set of logical constraints reflecting the limiting conditions from the natural language query; determining structural complexity based on the set of relational predicates and the set of logical constraints, wherein structural complexity is used to quantify the logical nesting depth of the natural language query; determining semantic ambiguity based on the entity set, wherein semantic ambiguity is used to quantify the degree of ambiguity of entities; determining domain span based on the entity set and the set of relational predicates, wherein domain span is used to quantify the degree of dispersion of the distribution of entities or relations in a predefined domain vector space; and determining the complexity feature vector based on structural complexity, semantic ambiguity, and domain span.

[0046] Specifically, the system loads a pre-trained large language model to perform deep dependency parsing and semantic role labeling on the natural language queries input by the user. During this process, the system identifies and extracts three key elements: a core entity set (named entities identified through named entity recognition); a relational predicate set (logical verbs or implicit relationships between entities); and a set of logical constraints (extracting limiting conditions, including explicit constraints such as time windows and numerical comparisons, as well as implicit constraints such as geographical location and state attributes).

[0047] Furthermore, based on the extracted elements, the system constructs a three-dimensional feature vector. For structural complexity, the system calculates the number of independent conditions in the logical constraint set and the depth of the graph structure formed by the relation predicate set. A weighted formula is used to derive a structural complexity index to quantify the depth of logical nesting. For semantic ambiguity, the system maps core entities to knowledge base nodes and calculates the average number of candidate mappings for each entity in the knowledge base, thus deriving a semantic ambiguity index to quantify the uncertainty of entity links. For domain cross-domain complexity, the system uses a predefined set of domains and their corresponding domain centroid vectors to calculate the minimum Euclidean distance from the embedding vector of each entity or relation in the query to its nearest domain centroid. The arithmetic mean of all minimum distances is then taken to quantify the difficulty of cross-domain queries.

[0048] Furthermore, the system can input the feature vector composed of the above-mentioned structural complexity, semantic ambiguity and domain span into the Sigmoid activation function, and after linear weighted combination, map it to the interval between 0 and 1 to generate a normalized budget sensitivity factor. This factor serves as a quantitative representation of query difficulty and directly reflects the overall difficulty of solving the task. The larger the value, the higher the difficulty of solving the task.

[0049] To facilitate understanding of the process of determining the complexity feature vectors described above, the following explanation will be provided in conjunction with some specific examples.

[0050] The system receives natural language queries input by the user. Next, load the pre-trained large language model and... Deep dependency parsing and semantic role labeling are performed. During this process, the system identifies and extracts three key elements:

[0051] Core Entity Set ( ): Extract named entities involved in the query by using named entity recognition.

[0052] Relational predicate set ( ): Extract logical linking verbs or implicit relationships between entities.

[0053] Logical constraint set ( Extracting constraints, including explicit constraints (time window) Numerical comparison (and implicit constraints such as geographic location, state attributes, etc.)

[0054] Furthermore, multi-dimensional complexity feature calculations are performed. Based on the above factors, the system constructs a three-dimensional feature vector. :

[0055] Structural complexity ( This metric measures the logical nesting depth of a query. It also represents the system's statistical set of logical constraints. Number of independent conditions And calculate the relational predicate set. The depth of the graph structure ( (Number). The calculation formula can be expressed as: ,in It is a depth regulation factor.

[0056] Semantic ambiguity ( ): The system's core entity set Each entity in the database is linked to another entity and mapped to a node in the knowledge base. The average number of candidate mappings for each mapping in the knowledge base is calculated.

[0057] Field span ( The entropy of a query across a predefined domain vector space is calculated using the semantic embedding vectors of entities and relationships. If the query involves multiple domains such as finance, law, and technology, a higher entropy value indicates greater difficulty in cross-domain reasoning.

[0058] Specifically, the predefined set of domains Each of these fields It has a corresponding domain centroid vector For each entity or relation embedding vector in query Q. (Source: Collection) or ), calculate its Euclidean distance to each centroid.

[0059] Select each vector Minimum distance to its nearest centroid :

[0060]

[0061] in, This represents the L2 Euclidean distance between vectors. (Neighborhood span) Defined as the arithmetic mean of all minimum distances:

[0062]

[0063] Where n is the total number of entity and relation vectors.

[0064] Furthermore, the budget sensitivity factor is generated. The system inputs the above feature vectors into the Sigmoid activation function to generate a normalized budget sensitivity factor. This factor serves as a bridge connecting query difficulty and system resources.

[0065]

[0066] in, , , The regression coefficients, obtained through offline training using historical data, can be optimized using gradient descent. The range of the value is (0,1), and the larger the value, the higher the difficulty of solving the task.

[0067] The above steps transform unstructured queries into multidimensional quantitative indicators through deep semantic parsing and generate budget-sensitive factors, achieving a precise mapping between query difficulty and system resource requirements. This ensures that the system can dynamically allocate computing resources based on the complexity of the query, avoiding resource waste in simple queries or insufficient resources in complex queries.

[0068] Step S204: Determine the inference budget amount based on the complexity feature vector, wherein the inference budget amount is used to quantitatively represent the upper limit of computing resources allocated for natural language queries.

[0069] In step S204 above, the inference budget refers to the upper limit of computing resources allocated to a specific natural language query session. For example, it is expressed in numerical form and is used to quantify and limit the total amount of resources that the query can consume during the inference process, so as to ensure that the inference engine does not exceed the system's carrying capacity when performing each action.

[0070] In some embodiments of this application, the inference budget can be determined in the following ways: determining a budget sensitivity factor corresponding to the complexity feature vector, wherein the budget sensitivity factor is used to quantify the query complexity of a natural language query; obtaining a preset base budget, a budget elasticity coefficient, and a maximum budget threshold, wherein the budget elasticity coefficient is used to determine the sensitivity of the base budget to the query complexity; and determining the inference budget based on the budget sensitivity factor, the base budget, the budget elasticity coefficient, and the maximum budget threshold.

[0071] Specifically, the system receives a feature vector from the semantic complexity awareness module, containing structural complexity, semantic ambiguity, and domain span. This vector is then weighted and summed with regression coefficients obtained offline from historical data. The sum is then input into the Sigmoid activation function, which maps this linear combination value to an open interval of 0 to 1, generating a normalized budget sensitivity factor. It should be noted that this process utilizes the saturation property of the Sigmoid function, allowing queries of moderate difficulty to show significant score differences, while queries of extremely high or low difficulty tend towards the saturation value, thus smoothly quantifying query complexity.

[0072] Furthermore, the system reads pre-set system parameters from the global configuration center or persistent storage. The base budget is set to a fixed value based on business needs (such as the base computing power quota for simple question answering); the budget flexibility coefficient is set as an adjustment coefficient based on the system's tolerance for resource utilization; and the maximum budget threshold is set based on strategies such as dividing the total system resource capacity by the maximum number of concurrent queries, serving as an insurmountable safety boundary.

[0073] Furthermore, the system first multiplies the base budget by the budget sensitivity factor, then multiplies it by the budget elasticity coefficient to calculate the dynamically increasing budget portion, and adds it to the base budget to obtain the theoretical total budget. Subsequently, the system compares the calculated theoretical total budget with the maximum budget threshold, and takes the smaller value as the final inference budget amount, ensuring that the budget grows dynamically with complexity while being strictly limited within the maximum resource range allowed by the system.

[0074] In some embodiments of this application, the system maintains an action cost table, pre-registering corresponding action cost values ​​for each available inference tool or API interface. These cost values ​​include not only computational resource consumption such as processor time, but also the economic cost of external API calls. For example, simple knowledge retrieval actions are assigned lower cost values, while complex external network search actions are assigned higher cost values. This mechanism provides a standardized unit of measurement for the resource consumption of each action in the subsequent inference process, making budget deductions precise and operable.

[0075] The system establishes a session-level budget account and sets the calculated total inference budget (i.e., inference budget limit) as the account's initial remaining budget. The system enforces a "deduct before execution" strategy, meaning that before initiating any inference action, it must check whether the current remaining budget is greater than or equal to the cost of the action. Only when the remaining budget is sufficient is the corresponding inference action allowed to be executed; if the remaining budget is insufficient, execution is prohibited or a termination mechanism is triggered.

[0076] To facilitate understanding of the calculation process for the above-mentioned reasoning budget, the following explanation will be provided in conjunction with some specific examples.

[0077] The system reads the base budget of the global configuration. (Default quota for simple fact-based queries) and maximum budget threshold (System security red lines), and based on the sensitivity factors generated in Phase One. The system dynamically calculates the total inference budget for this session. The calculation formula is:

[0078]

[0079] in, This is the budget flexibility coefficient.

[0080] Furthermore, the system maintains an Action Cost Table (ACT). Each available tool or API has a pre-registered Action Cost (tool). It should be noted that this cost includes not only the computational resource consumption (CPU / GPU time) but also the economic cost of external API calls. For example, the cost of a simple lookup is 1, the cost of a knowledge base query (KBQuery) is 5, and the cost of an external WebSearch API is 10.

[0081] Furthermore, establish a session-level budget account and set the remaining budget. The policy of "deducting fees first and then executing" is enforced, and any reasoning action must be checked before it is initiated. Is it greater than or equal to the cost of the action?

[0082] The above steps directly convert the semantic and logical complexity of the query into a measurable resource quota, which avoids wasting computing resources on simple queries, ensures that complex queries have sufficient reasoning ability, and prevents resource runaway through the maximum budget threshold, thereby optimizing the system resource utilization at the source.

[0083] Step S206: Determine the knowledge complexity of the knowledge unit corresponding to the natural language query, and determine the target query path based on the knowledge complexity. The knowledge complexity is determined based on the metadata index of the knowledge base where the knowledge unit is located, and the prediction cost budget of the target query path is not greater than the inference budget.

[0084] In step S206 above, a knowledge unit refers to a basic data entity or information fragment stored in a knowledge base. It can be a structured data table record, an unstructured document fragment, or a node or edge in a knowledge graph.

[0085] Knowledge complexity refers to a comprehensive indicator that reflects the processing difficulty of a knowledge unit, based on the metadata index of the knowledge base where the knowledge unit is located. For example, it can be determined by factors such as data scale, association density, and heterogeneity, and is used to predict the computing resources required to retrieve a specific knowledge unit (i.e., predict the consumption budget).

[0086] Metadata indexes refer to lightweight index structures stored in the knowledge base that describe the attributes of data units (such as the number of rows, field types, number of connections, etc.) but do not contain specific business data. They are used to support fast knowledge topology scanning. The system can obtain the approximate size and network structure information of knowledge units by querying the metadata index without accessing the massive actual data storage, thereby completing the initial assessment of knowledge complexity with extremely low overhead.

[0087] The target query path refers to the specific retrieval sequence or action set generated based on the logical constraints of natural language queries and the results of knowledge complexity assessment, which satisfies the prediction consumption budget not exceeding the inference budget. It is the actual execution plan of the inference execution engine, which specifies the order in which the system will retrieve which knowledge units and which tools will be called.

[0088] Predicted resource consumption budget refers to the total amount of resources required to complete a path, estimated in advance during the path planning phase based on the complexity of knowledge units and the cost of actions involved in the target query path.

[0089] In some embodiments of this application, the metadata index of the knowledge base can be queried based on the core entity set and relation predicate set in the natural language query. For each possible data source or subgraph, the system evaluates its knowledge complexity and generates multiple candidate query paths based on the parsed logical constraint set and the evaluated knowledge complexity. Finally, the target query path is selected from the candidate query paths based on the predicted consumption budget and / or the path value score.

[0090] To accurately predict the processing difficulty of knowledge units without actually loading large amounts of data, the knowledge complexity of knowledge units associated with natural language queries can be determined through the following steps: obtaining the metadata index of the knowledge base where the knowledge unit resides, where the metadata index stores summary information of the knowledge base; determining the knowledge unit associated with the natural language query based on the metadata index, where the knowledge unit includes at least one of the following: data source, subgraph; determining the topological features corresponding to the knowledge unit, where the topological features characterize the inference load and semantic processing difficulty when using the knowledge unit to process natural language queries; and determining the knowledge complexity based on the topological features.

[0091] It should be noted that the data source can be a structured database table or an unstructured collection of documents, while the subgraph is a collection of interconnected nodes and edges in the knowledge graph.

[0092] Topological features refer to quantitative indicators extracted from metadata indexes to characterize the inference load and semantic processing difficulty when using knowledge units to process natural language queries. For example, they may include data size, association density, and heterogeneity. Data size reflects the amount of data retrieved; association density reflects the tightness of the connections between entities, affecting the depth and breadth of graph traversal; and heterogeneity reflects the complexity of the data structure, affecting the difficulty of data parsing.

[0093] In some embodiments of this application, the topological features corresponding to a knowledge unit can be determined in the following ways: determining the data size index of the knowledge unit, wherein the data size index includes the number of data entries or documents corresponding to the knowledge unit; determining the association density index of the knowledge unit, wherein the association density index includes the number of connection edges or association relationships between elements within the knowledge unit; determining the heterogeneity index of the knowledge unit, wherein the heterogeneity index includes the types of data structures within the knowledge unit; and using at least one of the data size index, association density index, and heterogeneity index as the topological feature.

[0094] Specifically, before consuming computing power for retrieval, the system first performs a lightweight scan of its internal knowledge base, based on the parsed core entity set. and relational predicate set The system queries the metadata index of the knowledge base, which stores summary information about the knowledge base rather than the specific content, so access is extremely fast.

[0095] For each potential data source or subgraph involved, the system evaluates its knowledge complexity κ, which is determined by the following factors:

[0096] Data scale ( ): The number of rows in the data table or the number of documents involved.

[0097] Correlation density ( ): The number of connecting edges between entities, i.e., the average degree of the graph.

[0098] Heterogeneity : The types of data structures involved (purely structured tables vs. unstructured long text).

[0099] The comprehensive evaluation function can be defined, for example, as: .

[0100] In some embodiments of this application, the system confirms the currently available budget amount. ,like If the available budget is insufficient to support the lowest possible complexity of the exploration, the process terminates directly. That is, the system compares the current available budget with the preset "lowest execution unit cost" (i.e., the cost of the lowest possible complexity of the exploration). If the current available budget is less than this minimum cost, it means that even executing the cheapest retrieval action is insufficient, and continuing to plan a path would only waste computing power. Therefore, the system skips the subsequent expensive path planning and evaluation steps and directly sends an interrupt signal to the hybrid termination decision module, ending the inference process.

[0101] To achieve path feasibility under hard budget constraints, the target query path can be determined as follows: obtain the set of logical constraints in the natural language query, and determine multiple candidate query paths based on the set of logical constraints and knowledge complexity; determine the predicted consumption budget corresponding to each of the multiple candidate query paths, wherein the predicted consumption budget is determined based on the total knowledge complexity of the candidate query paths; and determine the candidate query paths whose predicted consumption budget is less than or equal to the inference budget as the target query paths.

[0102] It should be noted that candidate query paths refer to multiple possible retrieval or reasoning sequences generated based on the set of logical constraints and the knowledge base structure. Each path represents a potential strategy for the system to obtain the answer and consists of a series of actions (such as retrieval, filtering, and aggregation) executed sequentially or in parallel.

[0103] Specifically, the system first extracts key conditions from the parsed set of logical constraints, and then expands the search space on the knowledge graph or database index in combination with the knowledge complexity of the relevant knowledge units in the knowledge base. Each generated path is associated with the knowledge complexity of the nodes involved, thus forming multiple candidate query paths with different complexity characteristics.

[0104] Furthermore, for each candidate query path, the system traverses all nodes (knowledge units) on the path, accumulates the knowledge complexity of these nodes, and converts the accumulated total knowledge complexity into a specific budget value based on the action cost table.

[0105] Furthermore, the system obtains the current remaining inference budget and then compares the predicted consumption budget of all candidate query paths with the remaining budget one by one. The system eliminates those paths whose predicted consumption budget is higher than the remaining budget because they cannot be executed under the current resource conditions. The remaining paths whose predicted consumption budget is less than or equal to the remaining budget are marked as target query paths.

[0106] In some embodiments of this application, the following steps may also be performed: determining the path value score corresponding to each target query path, wherein the path value score is used to quantify the expected semantic contribution of the target query path to the natural language query and the reliability of retrieval execution; determining the estimated cost-effectiveness ratio based on the path value score and the predicted cost-effectiveness ratio; and filtering the updated target query paths from the target query paths based on the estimated cost-effectiveness ratio.

[0107] It should be noted that the path value score can be composed of two sub-dimensions: coreness, which measures the degree to which the path directly hits the core conditions of the query logic constraint set; paths that directly hit the core conditions have a high score; and determinism, which judges the probability of the path returning a result based on metadata. For example, if the nodes traversed by the path are closely connected in the knowledge base and have high data quality, then the determinism score is high.

[0108] The estimated cost-effectiveness ratio is the ratio of the path value score to the predicted consumption budget, used to quantify the semantic contribution obtained per unit of resource consumption.

[0109] Specifically, the system analyzes each target query path, calculating its coreity and determinism. Coreness is determined by evaluating the proportion of core conditions in the logical constraint set covered by the path; paths closer to core constraints score higher. Determinism is evaluated based on the connection density and node attribute stability in the knowledge base metadata; paths composed of nodes with tighter connections and more stable attributes receive higher determinism scores. The system then weights and merges these two dimensions to derive a path value score for each path.

[0110] Furthermore, the system obtains the path value score and predicted cost budget calculated for each path to determine the estimated cost-effectiveness ratio.

[0111] Furthermore, the system sorts all selected target query paths in descending order according to their estimated cost-effectiveness. Based on a preset strategy (such as the number of paths to be executed in parallel, K), the system selects the top K paths as the updated target query paths. Alternatively, if the remaining budget allows, all paths with a cost-effectiveness higher than a certain threshold can be selected.

[0112] The above steps overcome the shortcomings of traditional greedy search, which only focuses on local optima or a single dimension. By quantifying the semantic contribution and resource consumption of paths, the system is guided to prioritize the execution of cost-effective paths, ensuring that the maximum amount of key evidence is obtained with limited resources, thereby improving the accuracy of multi-hop question answering.

[0113] To facilitate understanding of the process of determining the target query path described above, the following explanation will be provided in conjunction with some specific examples.

[0114] The system is based on the parsed set of logical constraints. Combining knowledge complexity Generate multiple candidate query paths For each path The system performs preliminary calculations without actually using expensive resources:

[0115] (1) Estimated consumption budget ( ), that is, the predicted consumption budget:

[0116] Calculation based on path The complexity of the knowledge involved If the path involves highly complex subgraphs (such as a full scan of unstructured annual reports), then High; if only simple structured queries are involved (such as looking up a dictionary table), then Low.

[0117]

[0118] in, Let p be the estimated total cost of path p, where p is a candidate query path. Let be a node on the path; let i be the i-th node in the path. The standard base cost of the tool or API that needs to be called to execute the i-th node.

[0119] (2) Path value score ):

[0120] Centrality: Measures whether the path resolves the main query constraint or the edge validation; a direct hit... The core path scored highly.

[0121] Certainty: The probability of a path returning a result is determined based on metadata. For example, if the nodes traversed by the path are closely connected in the knowledge base, the certainty is high.

[0122]

[0123] in, These are the weights corresponding to coreness and certainty, respectively.

[0124] Furthermore, the system calculates the estimated cost-effectiveness ratio for each path:

[0125]

[0126] in, To prevent the minimum value from being divided by zero.

[0127] ① Filtering: The system only retains The path is to eliminate options that cannot be supported by the budget.

[0128] ② Sort and select: by Sort in descending order and select The top K highest paths.

[0129] ③ Batch execution: The system executes these K paths in parallel or serially, calling the actual tools (API / retrieval).

[0130] ④ Settlement and Update: Settle expenses based on actual consumption. The results returned by the path are written into the evidence pool. In other words, the system first calculates the sum of the actual costs of all target query paths in the current execution batch. From the current remaining budget balance Subtract this sum from the middle and reassign the result to the value. .

[0131] Step S208: Determine the natural language answer corresponding to the natural language query based on the execution result of the target query path.

[0132] In step S208 above, the execution result of the target query path refers to the original factual data, intermediate evidence, or structural resolution obtained by the inference execution engine from the knowledge base or external data source after completing the actual retrieval and processing of the selected target query path.

[0133] In some embodiments of this application, after the inference execution engine completes the execution of all target query paths, it can check whether the fact set in the evidence pool (used to store the execution results of each iteration) has covered all the logical constraint sets defined in the natural language query. Only when the information in the evidence pool is sufficient to logically deduce all the conditions of the query is it determined to be "evidence closure," that is, the successful termination condition is met. Once successful termination is determined, the structured or semi-structured fact data in the evidence pool, as well as the original natural language query, are used as context to generate natural language text as the final answer.

[0134] To address the issues of broken evidence chains and distorted reasoning caused by single retrieval or knowledge compression, the natural language answer corresponding to the natural language query can be determined through the following steps: obtaining the execution result of the target query path; generating a natural language answer based on the execution result if it completely covers the logical constraint set corresponding to the natural language query; and generating a natural language answer based on the updated execution result if it does not completely cover the logical constraint set, identifying the missing constraint set not covered by the execution result from the logical constraint set, determining the updated execution result based on the missing constraint set, and generating a natural language answer based on the updated execution result, wherein the updated execution result completely covers the missing constraint set.

[0135] Specifically, after completing the actual call to the target query path (such as a database query or API request), the inference execution engine writes the returned data results into the evidence pool maintained by the system. The evidence pool is a dynamic storage structure that accumulates fact fragments generated by all executed paths.

[0136] Furthermore, the system invokes the coverage function to compare the set of facts in the evidence pool with the set of logical constraints of the natural language query. If the coverage function value is 1 (meaning all constraints are supported by evidence), the system determines that the reasoning is successful. If the coverage function value is not 1, the system identifies those constraints that are not supported by evidence and defines their set as the missing constraint set. Using the missing constraint set as the new query target, and combining the remaining budget, the system re-enters the knowledge topology scanning and path planning stage to generate a new target query path specifically to obtain the missing evidence.

[0137] Furthermore, after executing these new paths, the new evidence obtained is merged with the original evidence pool to form an updated execution result. The system then performs coverage verification again until all constraints are covered or the budget is exhausted: if the budget is exhausted but coverage is still not achieved, a partial answer or prompt message is output; if coverage is successful, the final answer is generated.

[0138] To facilitate understanding of the above process for generating natural language answers, the following explanation will be provided with reference to some specific examples.

[0139] After execution is complete, the system enters a decision loop:

[0140] ① Integrity verification: Check the evidence pool Has it been covered? All constraints within, for example, can be defined using a covering function. ,like If so, then it is considered a successful termination.

[0141] ② Missing constraint identification: If not covered, identify the set of missing constraints. .

[0142] ③ Budget review: Review If the cost exceeds the minimum execution unit cost, and if it is insufficient, the program terminates due to budget exhaustion; if there is a balance, then... Based on the remaining budget, a new round of (more refined) path planning will be carried out, and this closed loop will continue until the termination condition is met.

[0143] In some embodiments of this application, a multi-dimensional termination determination mechanism may also be set, including but not limited to stopping execution when the execution result does not completely cover the logical constraint set and the remaining inference budget is less than the minimum execution unit cost; or stopping execution when the coverage increment of the updated execution result is less than a preset increment in consecutive iterations when the updated execution result is determined based on the missing constraint set; or stopping execution when there is content in the execution result or the updated execution result that contradicts the natural language query.

[0144] It should be noted that the minimum execution unit cost can be the computational resources or economic cost required to perform a single, minimal-granularity action (such as a single record query or simple field matching) during knowledge base retrieval or reasoning. Coverage increment refers to the increase in the coverage of the evidence pool over the natural language query logic constraint set relative to the previous iteration during a single iteration.

[0145] Specifically, after each iteration, the system synchronously monitors the termination conditions in the following four dimensions to ensure the finiteness and correctness of the reasoning process.

[0146] Condition 1: Successful termination (evidence closure).

[0147] When the evidence pool The set of facts in the data can be logically deduced to generate a query. All constraints (i.e.) If the condition is deemed successful, the system calls the generation module, based on... Generate natural language answers.

[0148] Condition 2: Failure to terminate (budget exhausted).

[0149] when and The system determined that there were insufficient resources and output "Unable to retrieve exact information".

[0150] Condition 3: Failure to terminate (utility stagnation).

[0151] During N consecutive iterations, the coverage increment of the evidence pool If the threshold is too low, the system is determined to be trapped in a local optimum or has no solution, and the system outputs "The current information is insufficient to answer the question".

[0152] Condition 4: Failure to terminate (logical falsification).

[0153] If, during the search process, axiomatic evidence that directly contradicts the premise of query Q is found (e.g., querying "subsidiary B of company A", but the search reveals that B has been divested), it is determined that the premise is incorrect, and the system outputs "the premise is not true".

[0154] Through steps S202 to S208, a combination of semantic complexity awareness and elastic budget scheduling is adopted. The upper limit of computing resources is dynamically allocated by quantifying the complexity feature vector that represents the difficulty of the query task. The knowledge complexity is evaluated based on the knowledge base metadata index to optimize the target query path that consumes within the budget. The final answer is generated based on the path execution result. This achieves the goal of strictly controlling resource consumption while completely preserving the evidence chain of the knowledge base. Thus, it achieves the technical effect of obtaining complete answers for complex queries and improving the accuracy of multi-hop reasoning. This solves the technical problem that related technologies filter and compress knowledge during the search to reduce retrieval resource consumption, which can easily lead to distorted answers when facing complex problems.

[0155] Figure 3 This is an architecture diagram of a question-answering system according to an embodiment of this application, such as... Figure 3 As shown, the system includes a query parsing and complex quantification layer 302, an elastic budget scheduling layer 304, a KTP inference execution engine layer 306, and a hybrid termination decision layer 308.

[0156] Among them, the query parsing and complexity quantification layer (302) serves as the front-end entry point of the system and is mainly responsible for performing deep semantic parsing on the unstructured natural language queries input by users. Unlike traditional simple word segmentation, this layer uses a pre-trained language model to extract the core entities, relational predicates, and logical constraints in the query and transforms them into quantified multi-dimensional complexity feature vectors.

[0157] The function of the elastic budget scheduling layer (304) is to dynamically calculate the total inference budget for this session based on the complexity feature vector output by the query parsing and complexity quantification layer, according to the preset resource strategy. At the same time, this layer maintains a real-time ledger, records the actual consumption of each inference action, and distributes the current available budget to the KTP inference execution engine layer, strictly enforcing the "deduct before execution" budget hard constraint mechanism to ensure the reasonable allocation and use of system resources throughout the session lifecycle.

[0158] The KTP inference execution engine layer (306) is the core computing hub of the system. It abandons the traditional chain execution mechanism and adopts a closed-loop inference model of "planning-execution-feedback". After receiving the budget, the engine first performs a lightweight scan of the knowledge base to assess the topological complexity of the knowledge. Then, based on the estimated value model, it selects the target query path with the best cost-effectiveness and executes it. During the execution process, the engine strictly controls the cost of each action and writes the returned results into the evidence pool to achieve feedback updates, thereby completing the multi-hop question answering inference task under budget constraints.

[0159] The hybrid termination decision layer (308) is connected in parallel to the KTP inference execution engine layer, and monitors the key states of the entire inference lifecycle in real time, including the coverage status of the evidence pool on the logical constraint set, the remaining balance of the budget account, and the changing trend of inference utility. Once a preset termination condition is detected (such as evidence closure, budget exhaustion, utility stagnation, or logical falsification), this layer immediately sends an interrupt signal to the execution engine and controls the output of the final natural language answer or the generation of error prompts to ensure the finiteness and correctness of the inference process.

[0160] In some embodiments of this application, the query parsing and complexity quantification layer 302 is used to implement semantic role labeling, constraint extraction and feature vector calculation, including: semantic role labeling 3021, constraint extraction 3022, structural complexity calculation 3023, semantic ambiguity calculation 3024, domain span calculation 3025, budget sensitivity factor generation 3026.

[0161] It should be noted that Semantic Role Labeling (3021) is used to perform deep dependency parsing and entity recognition on natural language queries using a pre-trained language model to extract the core entity set and relational predicate set. Constraint Extraction (3022) is used to parse and separate explicit constraints such as time windows and numerical comparisons, as well as implicit logical constraints such as geographical location and state attributes, from the query statement. Structural Complexity Calculation (3023) is used to quantify the complexity of query logic nesting and reasoning paths based on the number of logical constraints and the depth of the graph structure formed by relational predicates. Semantic Ambiguity Calculation (3024) is used to evaluate the semantic uncertainty in the entity linking process by statistically analyzing the average number of candidate mapping nodes of core entities in the knowledge base. Domain Span Calculation (3025) is used to calculate the average Euclidean distance from the query entity and relation vector to the centroids of each predefined domain to quantify the difficulty of multi-domain cross-reasoning involved in the query. Budget Sensitivity Factor Generation (3026) is used to weight the structural complexity, semantic ambiguity, and domain span into the Sigmoid activation function to generate a normalized budget sensitivity factor to characterize the difficulty of solving the task.

[0162] In some embodiments of this application, the flexible budget scheduling layer 304 is used to implement budget accounting, cost registration and account management, including: budget accounting module 3041, action cost registry 3042, real-time ledger management 3043, budget account initialization 3044, and deduct payment before execution strategy 3045.

[0163] It should be noted that the budget calculation module 3041 dynamically calculates the total inference resource quota allowed for the current session based on the baseline budget, maximum budget threshold, and budget sensitivity factors. The action cost registry 3042 predefines and stores the standardized resource consumption costs of various retrieval tools or API calls, serving as the basis for subsequent billing. The real-time ledger management 3043 dynamically records the actual resource consumption of each action during inference, ensuring the real-time nature and accuracy of the budget status. The budget account initialization 3044 sets the remaining budget amount as the total inference budget at session startup, establishing an initial resource container for subsequent execution. The pre-payment execution strategy 3045 forcibly verifies whether the remaining budget is sufficient to cover the action cost before initiating any inference action, preventing resource overspending through a mechanism.

[0164] In some embodiments of this application, the KTP inference execution engine layer 306 is used to implement a closed-loop mechanism of "planning, execution and feedback", including: knowledge topology scanning 3061, path planning module 3062, candidate path generation 3063, estimated value calculation 3064, path optimization algorithm 3065, batch execution scheduling 3066, evidence pool management 3067, integrity verification 3068, and missing constraint identification 3069.

[0165] It should be noted that the knowledge topology scanning 3061 is used to query the knowledge base metadata index based on the query parsing results, quickly assessing the data size, association density, and heterogeneity of potential data sources or subgraphs. The path planning module 3062 combines the set of logical constraints with knowledge complexity to generate multiple possible retrieval or inference sequences as candidate solutions within the search space. The candidate path generation 3063 constructs a set of multiple candidate query paths containing specific retrieval action sequences based on the parsed logical constraint combinations. The estimated value calculation 3064 estimates the resource consumption of each path based on the knowledge complexity and action cost table of the nodes involved, without actually invoking expensive resources. The path optimization algorithm 3065 calculates the value score and estimated cost ratio of each path, selecting the top K paths with the highest budget and cost-effectiveness as execution targets. The batch execution scheduling 3066 schedules the selected target query paths in parallel or serially, calls the actual tools to perform retrieval operations, and collects the returned results. The evidence pool management 3067 centrally stores and manages the factual fragments and intermediate evidence returned by all execution paths, forming a structured evidence set for subsequent verification. Integrity check 3068 compares the facts covered by the evidence pool with the query logic constraint set to determine whether the current evidence is sufficient to fully answer the query. Missing constraint identification 3069 is used to accurately locate specific logical conditions not supported by evidence when the integrity check fails, and generates a missing constraint set to guide the next round of iteration planning.

[0166] In some embodiments of this application, the hybrid termination determination layer 308 is used to realize multi-dimensional monitoring, condition determination and result output, including: evidence closure monitoring 3081, budget balance monitoring 3082, utility trend analysis 3083, logical falsification detection 3084, termination signal transmission 3085, and result generation module 3086.

[0167] It should be noted that the evidence closure monitoring 3081 is used to monitor in real time whether the evidence pool has completely covered all logical constraints of the query to determine whether a successful termination state has been reached. The budget balance monitoring 3082 is used to continuously track the remaining inference budget to determine whether a failure termination condition has been triggered due to resource exhaustion. The utility trend analysis 3083 is used to analyze the changing trend of evidence coverage increments in continuous iterations to determine whether utility stagnation has been triggered due to getting stuck in a local optimum or having no solution. The logical falsification detection 3084 is used to retrieve and compare whether there is factual evidence that directly contradicts the query premises to determine whether logical falsification has been triggered due to incorrect premises. The termination signal sending 3085 is used to immediately send an interrupt command to the inference engine when any termination condition is triggered, forcibly stopping the execution of subsequent inference actions. The result generation module 3086 is used to call the generation model upon successful termination, integrating the facts in the evidence pool and transforming them into a final answer output that conforms to natural language usage.

[0168] It is understandable that one or more of the modules configured in the above layers can be selected as needed, and no restrictions are imposed here.

[0169] It should be noted that, Figure 3 The question-and-answer system shown is used to perform Figure 2 The question-and-answer method shown, therefore Figure 2 The relevant explanations in the question-and-answer method also apply to Figure 3 The question-and-answer system shown will not be described in detail here.

[0170] This application's embodiments generate budget-sensitive factors by constructing a three-dimensional complexity feature vector, establishing an action cost table and budget account, and implementing a pre-deduction-before-execution strategy. Simultaneously, it utilizes lightweight knowledge topology scanning to assess the knowledge complexity of the data source, and then employs KTP path planning and cost-effectiveness ranking to prioritize high-value paths. Based on the "compression before retrieval" paradigm, it proposes a knowledge complexity-aware elastic retrieval mechanism, combining budget factors and topological complexity for path optimization. Furthermore, through defect detection and iterative closed-loop dynamic supplementation of missing evidence, it achieves the technical effect of reducing resource consumption while fully preserving the knowledge base evidence chain and improving the accuracy of multi-hop reasoning. This effectively avoids the filtering out of key long-tail semantics, ensuring that complex queries still obtain complete answers.

[0171] This application's embodiments extract explicit and implicit constraints, incorporating the constraint set into structural complexity and path coreness indicators. It stipulates that candidate paths must explicitly cover the constraint set, and identifies missing constraints through integrity verification after execution to initiate iterative planning. This overcomes the limitations of entity extraction or placeholder replacement, achieving full-process tracking of logical constraints for the first time. It proposes a constraint-driven iterative closed-loop retrieval mechanism and quantifies the degree of constraint coverage as path coreness, achieving the technical effect of improving the accuracy of multi-condition filtering and implicit reasoning queries. It effectively avoids constraint loss and ensures that the complete answer is gradually approached within budget rather than outputting partial or incorrect results.

[0172] Figure 4 This is a structural diagram of a question-and-answer device according to an embodiment of this application, such as... Figure 4 As shown, the device includes:

[0173] The acquisition module 402 is used to acquire the complexity feature vector corresponding to the natural language query, wherein the complexity feature vector is used to characterize the difficulty of solving the natural language query task from multiple dimensions;

[0174] The first determining module 404 is used to determine the inference budget based on the complexity feature vector, wherein the inference budget is used to quantitatively represent the upper limit of computing resources allocated to natural language queries;

[0175] The second determining module 406 is used to determine the knowledge complexity of the knowledge unit corresponding to the natural language query, and to determine the target query path based on the knowledge complexity. The knowledge complexity is determined based on the metadata index of the knowledge base where the knowledge unit is located, and the prediction consumption budget of the target query path is not greater than the inference budget.

[0176] Execution module 408 is used to determine the natural language answer corresponding to the natural language query based on the execution result of the target query path.

[0177] It should be noted that, Figure 4 The question-and-answer device shown is used to perform Figure 2 The question-and-answer method shown, therefore Figure 2 The relevant explanations in the question-and-answer method also apply to Figure 4 The question-and-answer device shown will not be described in detail here.

[0178] This application also provides an electronic device, which includes a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute steps that implement the question-and-answer methods in various embodiments of this application.

[0179] This application also provides a non-volatile storage medium including a stored computer program, wherein the device containing the non-volatile storage medium executes the steps of the question-and-answer method in various embodiments of this application by running the computer program.

[0180] This application also provides a computer program product, including computer instructions that, when executed by a processor, implement the steps of the question-and-answer method in various embodiments of this application.

[0181] This application also provides a computer program that, when executed by a processor, implements the steps of the question-and-answer method in various embodiments of this application.

[0182] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0183] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0184] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0185] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0186] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0187] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or 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, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0188] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A question-and-answer method, characterized in that, include: Obtain the complexity feature vector corresponding to the natural language query, wherein the complexity feature vector is used to characterize the task difficulty of solving the natural language query from multiple dimensions; The inference budget is determined based on the complexity feature vector, wherein the inference budget is used to quantitatively represent the upper limit of computing resources allocated to the natural language query; The knowledge complexity of the knowledge unit corresponding to the natural language query is determined, and the target query path is determined based on the knowledge complexity. The knowledge complexity is determined based on the metadata index of the knowledge base where the knowledge unit is located, and the prediction cost budget of the target query path is not greater than the inference budget. The natural language answer corresponding to the natural language query is determined based on the execution result of the target query path.

2. The method according to claim 1, characterized in that, Determining the knowledge complexity of the knowledge unit associated with the natural language query includes: Obtain the metadata index of the knowledge base where the knowledge unit is located, wherein the metadata index is used to store summary information of the knowledge base; Based on the metadata index, a knowledge unit associated with the natural language query is determined, wherein the knowledge unit includes at least one of the following: a data source, a subgraph; Determine the topological features corresponding to the knowledge unit, wherein the topological features are used to characterize the reasoning load and semantic processing difficulty when processing the natural language query using the knowledge unit; The knowledge complexity is determined based on the topological features.

3. The method according to claim 2, characterized in that, Determining the topological features corresponding to the knowledge unit includes: Determine the data scale index of the knowledge unit, wherein the data scale index includes the number of data entries or documents corresponding to the knowledge unit; Determine the association density index of the knowledge unit, wherein the association density index includes the number of connection edges or the number of association relationships between elements within the knowledge unit; Determine the heterogeneity index of the knowledge unit, wherein the heterogeneity index includes the types of data structures within the knowledge unit; The data size index, the association density index, and the heterogeneity index are used as the topological features.

4. The method according to claim 1, characterized in that, Determining the target query path based on the aforementioned knowledge complexity includes: Obtain the set of logical constraints in the natural language query, and determine multiple candidate query paths based on the set of logical constraints and the knowledge complexity; Determine the predicted consumption budget corresponding to each of the plurality of candidate query paths, wherein the predicted consumption budget is determined based on the total knowledge complexity of the candidate query paths; Candidate query paths whose predicted consumption budget is less than or equal to the inference budget amount are identified as the target query paths.

5. The method according to claim 4, characterized in that, The method further includes: Determine the path value score corresponding to each of the target query paths, wherein the path value score is used to quantitatively represent the expected semantic contribution of the target query path to the natural language query and the reliability of retrieval execution; The estimated cost-effectiveness ratio is determined based on the path value score and the predicted consumption budget; The updated target query path is selected from the target query path based on the estimated cost-effectiveness ratio.

6. The method according to claim 1, characterized in that, Determining the inference budget based on the complexity feature vector includes: Determine the budget sensitivity factor corresponding to the complexity feature vector, wherein the budget sensitivity factor is used to quantify the query complexity of the natural language query; Obtain a preset base budget, a budget flexibility coefficient, and a maximum budget threshold, wherein the budget flexibility coefficient is used to determine the response sensitivity of the base budget to the query complexity; The inference budget amount is determined based on the budget sensitivity factor, the base budget, the budget flexibility coefficient, and the maximum budget threshold.

7. The method according to claim 1, characterized in that, Determining the natural language answer corresponding to the natural language query based on the execution result of the target query path includes: Obtain the execution result of the target query path; If the execution result completely covers the logical constraint set corresponding to the natural language query, the natural language answer is generated based on the execution result. If the execution result does not completely cover the logical constraint set, the missing constraint set not covered by the execution result is determined from the logical constraint set, and the updated execution result is determined based on the missing constraint set. The natural language answer is generated based on the updated execution result, wherein the updated execution result completely covers the missing constraint set.

8. The method according to claim 7, characterized in that, The method further includes: If the execution result does not completely cover the set of logical constraints and the remaining inference budget is less than the minimum execution unit cost, then execution is stopped; or, When determining the updated execution result based on the missing constraint set, if the coverage increment of the updated execution result is less than a preset increment in multiple consecutive iterations, execution is stopped; or... If the execution result or the updated execution result contains content that contradicts the natural language query, execution shall be stopped.

9. The method according to claim 1, characterized in that, Obtain the complexity feature vector corresponding to the natural language query, including: Extract the entity set, the relational predicate set reflecting the logical relationships between entities, and the logical constraint set reflecting the limiting conditions from the natural language query; The structural complexity is determined based on the set of relational predicates and the set of logical constraints, wherein the structural complexity is used to quantify the logical nesting depth of the natural language query; The semantic ambiguity degree is determined based on the entity set, wherein the semantic ambiguity degree is used to quantify the degree of ambiguity in representing entities; The domain span is determined based on the entity set and the relation predicate set, wherein the domain span is used to quantify the degree of dispersion of the distribution of entities or relations in a predefined domain vector space; The complexity feature vector is determined based on the structural complexity, semantic ambiguity, and domain span.

10. A question-and-answer device, characterized in that, include: The acquisition module is used to acquire the complexity feature vector corresponding to the natural language query, wherein the complexity feature vector is used to characterize the task difficulty of solving the natural language query from multiple dimensions; The first determining module is used to determine the inference budget based on the complexity feature vector, wherein the inference budget is used to quantitatively represent the upper limit of computing resources allocated to the natural language query; The second determining module is used to determine the knowledge complexity of the knowledge unit corresponding to the natural language query, and to determine the target query path based on the knowledge complexity. The knowledge complexity is determined based on the metadata index of the knowledge base where the knowledge unit is located, and the prediction consumption budget of the target query path is not greater than the inference budget. The execution module is used to determine the natural language answer corresponding to the natural language query based on the execution result of the target query path.

11. An electronic device, characterized in that, include: A memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the question-and-answer method according to any one of claims 1 to 9.

12. A non-volatile storage medium, characterized in that, The non-volatile storage medium includes a stored computer program, wherein the device containing the non-volatile storage medium executes the question-and-answer method according to any one of claims 1 to 9 by running the computer program.

13. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the question-and-answer method according to any one of claims 1 to 9.