Intelligent question and answer method, device and equipment and storage medium
By performing dynamic reasoning and path pruning through multiple rounds of iteration in the tax knowledge graph, the problem of low accuracy in answering complex questions in existing intelligent question answering systems is solved, and a more efficient and accurate intelligent question answering service is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-10
AI Technical Summary
Existing knowledge graph-based intelligent question answering systems often have low accuracy when faced with complex questions, and their reasoning processes tend to be too lengthy or fail to arrive at accurate answers.
By determining the initial reasoning node in the tax knowledge graph, dynamic reasoning is carried out in multiple rounds of iteration. In the path exploration of each iteration, semantic analysis of the rule text of candidate relations is performed, combined with dynamic path pruning, to automatically adjust the reasoning path and depth, thus avoiding a lengthy reasoning process.
It improves the accuracy and efficiency of intelligent question answering, ensuring accurate answers to complex tax questions.
Smart Images

Figure CN121835905A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to an intelligent question-answering method, apparatus, device, and storage medium. Background Technology
[0002] Traditional intelligent question-answering systems mainly rely on keyword matching and simple rule engines, which cannot accurately understand and answer complex tax questions. Among related technologies, knowledge graph technology is used to build intelligent question-answering systems; however, most existing knowledge graph-based question-answering systems can only perform simple reasoning, resulting in low accuracy when faced with complex questions, and the reasoning process is often too lengthy or fails to arrive at an accurate answer. Summary of the Invention
[0003] In view of this, the purpose of this invention is to provide an intelligent question-answering method, apparatus, device, and storage medium, which can improve the accuracy and efficiency of intelligent question answering. The specific solution is as follows:
[0004] Firstly, this application discloses an intelligent question-answering method, including:
[0005] Obtain the target question, and determine the initial inference node in the tax knowledge graph based on the tax type attribute and intent category corresponding to the target question;
[0006] Starting from the initial inference node, dynamic inference is performed in multiple rounds of iteration. In the path exploration of each iteration, semantic analysis is performed on the rule text corresponding to the candidate relationship, and dynamic path pruning is performed based on the analysis results.
[0007] After each iteration, determine whether the current reasoning path meets the termination reasoning condition. If it does, generate the answer to the target question based on the final reasoning path.
[0008] Optionally, before the dynamic reasoning that starts from the initial inference node and performs multiple rounds of iterations, the method further includes:
[0009] The system detects whether the target question contains a pronoun. If it does, it queries the cache pool to determine the target node corresponding to the pronoun. The cache pool is used to store the mapping relationship between nodes that have been inferred and their corresponding pronouns.
[0010] Increase the weight of the target node in the tax knowledge graph to guide the reasoning path to converge toward the target node.
[0011] Optionally, obtaining the target problem includes:
[0012] Obtain user questions and determine the question type corresponding to the user questions;
[0013] The target element type is determined based on the question type, and the target element information is extracted from the user question; the target element information includes any one or more of the following: transaction subject, transaction type, transaction object, transaction time, transaction amount, and transaction conditions;
[0014] The user question is divided into multiple sub-questions based on the target element information, and the sub-questions are used as the target question.
[0015] Accordingly, the answer to the target question is generated based on the final reasoning path, including:
[0016] Based on the answers to all the target questions, an answer to the user question is generated.
[0017] Optionally, in each iteration of path exploration, semantic analysis is performed on the rule text corresponding to the candidate relations, and dynamic path pruning is performed based on the analysis results, including:
[0018] Obtain the candidate relation corresponding to the current inference path;
[0019] The rule text corresponding to each candidate relation is analyzed using a large language model, and the semantic type of the candidate relation is determined based on the analysis results; the semantic type includes exclusion type, inclusion type, exception type, and parallel type.
[0020] If the semantic type of a candidate relation is exclusionary, and the exclusion condition corresponding to the candidate relation has been satisfied in the current inference path, then calculate the confidence of the candidate relation.
[0021] Prune candidate relations that are not excluded, as well as candidate relations that are excluded and whose confidence is below the threshold.
[0022] Optionally, the dynamic reasoning that involves multiple iterations starting from the initial inference node includes:
[0023] After each iteration of path exploration, conflict detection is performed on reasoning paths involving different tax types, and pruning is carried out based on the conflict detection results;
[0024] During the reasoning process, the numerical values in the target problem are verified and converted based on the numerically related nodes in the reasoning path.
[0025] Optionally, the step of performing conflict detection on inference paths involving different tax types and pruning based on the conflict detection results includes:
[0026] When there are at least two reasoning paths with different tax types, calculate the probability of conflict between the paths;
[0027] If the probability of conflict is greater than the probability threshold, then the priority score of each inference path is calculated; the priority score is determined based on the rule level involved in the inference path, the release time, and the release department.
[0028] The path with the highest priority score is selected as the minimum sufficient subgraph, and other conflicting paths are removed.
[0029] Conflict explanation information is generated for the current pruning operation; the conflict explanation information includes information on pruned conflict paths, path information on retained candidate paths, conflict probability, and pruning reason.
[0030] Optionally, the dynamic reasoning that involves multiple iterations starting from the initial inference node includes:
[0031] When the reasoning path contains nodes related to numerical values, check whether the numerical units in the target question are consistent with the numerical units in the nodes.
[0032] If they are inconsistent, the numerical values in the target problem will be converted to the numerical units of the node based on the preset unit conversion rules.
[0033] Secondly, this application discloses an intelligent question-answering device, comprising:
[0034] The question acquisition module is used to acquire the target question and determine the initial reasoning node in the tax knowledge graph based on the tax type attribute and intent category corresponding to the target question.
[0035] The dynamic reasoning module is used to perform dynamic reasoning in multiple iterations starting from the initial reasoning node, and to perform dynamic path pruning based on the analysis results by performing semantic analysis on the rule text corresponding to the candidate relationship in each iteration of path exploration.
[0036] The answer generation module is used to determine whether the current reasoning path meets the termination reasoning condition after each iteration. If it does, the answer to the target question is generated based on the final reasoning path.
[0037] Thirdly, this application discloses an electronic device, including:
[0038] Memory, used to store computer programs;
[0039] A processor is used to execute the computer program to implement the aforementioned intelligent question-answering method.
[0040] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned intelligent question-answering method.
[0041] In this application, a target question is obtained, and an initial inference node is determined in the tax knowledge graph based on the tax type attribute and intent category corresponding to the target question. Starting from the initial inference node, multi-round iterative dynamic inference is performed. In each round of path exploration, semantic analysis is conducted on the rule text corresponding to the candidate relations, and dynamic path pruning is performed based on the analysis results. After each round of iteration, it is determined whether the current inference path meets the termination inference condition. If it does, an answer to the target question is generated based on the final inference path. Therefore, through multi-round iterative dynamic inference, and by performing semantic analysis on the rule text representing the candidate relations in each round of path exploration, combined with the current inference path and the semantic analysis results for dynamic path pruning, the inference path and depth are automatically adjusted, and the termination point of inference is accurately determined. This avoids the problems of lengthy inference processes and low accuracy, providing a more accurate and efficient intelligent question-answering service. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0043] Figure 1 A flowchart of an intelligent question-answering method provided in this application;
[0044] Figure 2 A flowchart of a specific intelligent question-answering method provided in this application;
[0045] Figure 3 This application provides a schematic diagram of the structure of an intelligent question-answering device;
[0046] Figure 4 This application provides a structural diagram of an electronic device. Detailed Implementation
[0047] 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 some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] In existing technologies, knowledge graph technology is used to construct intelligent question-answering systems. However, most existing knowledge graph-based question-answering systems can only perform simple reasoning, and their accuracy in answering complex questions is low. The reasoning process is often too lengthy or fails to yield an accurate answer. To overcome these technical problems, this application proposes an intelligent question-answering method that can improve the accuracy of intelligent question answering.
[0049] This application discloses an intelligent question-answering method, see [link to relevant documentation]. Figure 1 As shown, the method may include the following steps:
[0050] Step S11: Obtain the target question, and determine the initial inference node in the tax knowledge graph based on the tax type attribute and intent category corresponding to the target question.
[0051] First, the target question is obtained. The target question can be a question input by the user, or a sub-question derived from the user-input load question. In this embodiment, the form of user input is not limited; it can be text, voice, or image. The question text can then be obtained through speech recognition or text extraction.
[0052] A knowledge graph (KG) is a large-scale knowledge base that uses a structured semantic network to describe concepts, entities, and the relationships between them in the real world. Its core purpose is to integrate fragmented information into a vast, interconnected knowledge network, enabling machines to understand and reason about knowledge like humans. A knowledge graph consists of nodes and edges; nodes represent entities, and edges describe the connections or attributes between entities. In this embodiment, a knowledge graph is pre-constructed based on tax-related knowledge and policies. The graph not only contains entity relationships but also embeds semantic tags for edges (relationships) and adds numerical metadata (such as units and periods) to nodes (entities) involving numerical values, preparing for subsequent algorithm execution. For example, in a conditional nested dynamic pruning algorithm, the relationships in the graph are accompanied by semantic tags of rule text (such as exclusionary tags) to support dynamic path adjustment.
[0053] In some embodiments, determining the initial inference node in the tax knowledge graph based on the tax type attribute and intent category corresponding to the target question includes: identifying the tax type and intent of the target question, and adding corresponding tax type and intent tags based on the identification results; determining the initial inference node in the tax knowledge graph corresponding to the sub-question based on the tax type and intent tags corresponding to the target question. That is, by identifying the tax type and intent tags of the question, and combining this with the existing specific tags and intents of the graph nodes, the initial knowledge graph is filtered and selected to locate the initial graph inference node.
[0054] In some embodiments, obtaining the target question includes: obtaining a user question and determining the question type corresponding to the user question; determining a target element type based on the question type and extracting target element information from the user question; the target element information includes any one or more of the following: transaction subject, transaction type, transaction object, transaction time, transaction amount, and transaction conditions; splitting the user question into multiple sub-questions based on the target element information, and using the sub-questions as the target question; correspondingly, generating an answer to the target question based on the final reasoning path includes: generating an answer to the user question based on the answers to all the target questions. A large language model can be used to accurately extract key tax elements from user questions, providing structured input for subsequent graph reasoning. Specifically, a hierarchical identification method is adopted: the first layer identifies the question type (e.g., policy consultation / tax calculation / compliance judgment), the second layer identifies the tax type, and the third layer extracts corresponding elements for specific types and tax types.
[0055] For complex problems, based on the element extraction results, the complex tax problem is broken down into independently processable sub-problems and routed to the corresponding inference paths. Simultaneously, a dependency graph is constructed between the sub-problems to ensure the rationality of the inference order. For example, a directed acyclic graph (DAG) is used to represent the logical dependencies and execution order between the sub-problems after the complex tax problem is broken down, i.e., sequential or parallel execution. Parallel inference threads can be initiated for sub-problems without dependencies to improve inference speed. Furthermore, rules for aggregating sub-problem results are defined to handle potential result conflicts; the answer to the initial question is obtained by aggregating the answers to all sub-problems.
[0056] In some embodiments, before performing dynamic reasoning through multiple rounds of iterations starting from the initial reasoning node, the method further includes: detecting whether the target question contains a pronoun; if so, querying a cache pool to determine the target node corresponding to the pronoun; the cache pool is used to store the mapping relationship between nodes that have been reasoned and their corresponding pronouns; and increasing the weight of the target node in the tax knowledge graph to guide the reasoning path to converge toward the target node.
[0057] Understandably, the relevant technologies suffer from the following problems: when users use colloquial expressions such as "Do I need to pay this tax?", the system struggles to accurately map them to specific tax types and clauses. Semantic disambiguation capabilities are weak; for example, "tax-free" could refer to VAT exemption, corporate income tax exemption, or policy-based tax exemption, and a lack of context awareness can easily lead to ambiguity. Therefore, to eliminate ambiguity in tax entity referencing in voice / colloquial input scenarios and avoid reasoning drift caused by incorrect entity linking, this application constructs a cache pool. Specifically, it builds a table of pronouns and entities corresponding to confirmed tax entities within a multi-turn dialogue context. When a colloquial reference is detected, it prioritizes matching high-frequency entities in the table and temporarily boosts the entity's relevance score in the graph, ensuring accurate convergence of subsequent reasoning paths.
[0058] Step S12: Starting from the initial inference node, perform dynamic inference in multiple iterations. In the path exploration of each iteration, perform semantic analysis on the rule text corresponding to the candidate relationship and perform dynamic path pruning based on the analysis results.
[0059] Most existing knowledge graph question answering systems use static path templates to match policy clauses, which can easily lead to redundant paths or erroneous conclusions when dealing with nested policy rules. For example, in exclusionary scenarios, mixed sales (goods and services) are typically taxed at a single rate. However, manufacturing and construction industries have explicit exclusion clauses. For instance, for certain construction services, even with the accompanying sale of materials, the revenue from goods and services may be required to be calculated separately using different tax rates. Therefore, exclusion clauses are jump conditions rather than conditions for further reasoning, making graph reasoning prone to false associations or infinite loops. This application addresses this by using semantic tagging combined with a reverse verification mechanism to transform the rule text of each relationship (such as legal basis) into computable semantic tags. A large model then reverse-verifies whether the current path triggers an exclusion clause. If triggered, the path is immediately pruned and rolled back, achieving template-free dynamic path pruning and dynamically identifying key jump nodes in nested conditions without pre-setting paths.
[0060] In some embodiments, the step of performing semantic analysis on the rule text corresponding to candidate relations and performing dynamic path pruning based on the analysis results in each iteration of path exploration includes: obtaining candidate relations corresponding to the current inference path; analyzing the rule text corresponding to each candidate relation using a large language model and determining the semantic type of the candidate relation based on the analysis results; the semantic type includes exclusion type, inclusion type, exception type, and parallel type; if the semantic type of the candidate relation is exclusion type, and the exclusion condition corresponding to the candidate relation is satisfied in the current inference path, then calculating the confidence of the candidate relation; pruning candidate relations other than non-exclusion type candidate relations and exclusion type candidate relations with confidence below a threshold. It is understood that this application proposes a Condition-Nested Dynamic Pruning (CNDP) algorithm to solve the path explosion and infinite loop problems through dynamic pruning. Furthermore, when an exclusionary relationship is discovered and its triggering conditions are met, the branch is not immediately pruned. Instead, the process pauses and backtracks for verification. The verification includes, but is not limited to: whether the existing conditions in the current path satisfy all the prerequisites of the exclusion clause; and whether there is a higher-priority relationship that can cover or offset this exclusionary relationship. The rationality and reliability of the exclusionary relationship under the current path are then comprehensively analyzed through multiple verification results.
[0061] Specifically, the input to the conditional nested dynamic pruning algorithm is the current inference path. The corresponding candidate relation set The output is the pruned relation combination. And whether to backtrack using the backtrack flag. The specific algorithm flow is as follows:
[0062] 1. Semantic tag extraction. For each candidate relation... The corresponding rule text is analyzed using a fine-tuned BERT (Bidirectional Encoder Representations from Transformers) model to generate semantic labels:
[0063] ;
[0064] in, This represents the original legal text corresponding to this edge, and BERT is a fine-tuned BERT classification model. Label values include inclusive, exclusive, exceptional, and parallel. It's also worth noting that semantic analysis can be performed during knowledge graph construction; that is, each edge in the knowledge graph corresponds to its own semantic label. During actual path exploration, the semantic label can be directly read to determine whether it is an exclusive label, thereby further improving reasoning efficiency.
[0065] 2. Reverse verification. If and The judgment condition is in If the condition is met, then reverse verification is triggered, and the confidence score is calculated:
[0066] ;
[0067] like , Set the threshold, set backtrack (reverse verification) to true, and backtrack to the nearest non-exclusive node.
[0068] The confidence score is specifically determined by calculating the similarity between the excluded candidate relation and the current path, as follows:
[0069] For path Assuming it contains node text Then the text representation of its path is:
[0070] ;
[0071] The path text and the relationship are input into the pre-trained BERT model respectively to obtain their respective embedding vectors.
[0072] ;
[0073] ;
[0074] Calculate the similarity between the two vectors above: ;
[0075] It is understandable that the vector of the candidate relation can represent the logic of the exclusion rule, and the embedding vector of the path can represent the known actual situation. If the embedding vector of the relation is highly similar to the embedding vector of the path, it means that the current exclusionary candidate relation is very suitable for the current reasoning, and the subsequent path of the candidate relation needs to be pruned according to the exclusionary rule.
[0076] 3. Path pruning filters candidate relationships, retaining only those with non-exclusive labels or whose validation scores do not exceed a threshold. The specific pruning function is as follows:
[0077] ;
[0078] Dynamic pruning avoids the limitations of static templates, enabling template-free dynamic path pruning, which is especially suitable for nested conditions in policy clauses.
[0079] In some embodiments, the dynamic reasoning that starts from the initial reasoning node and proceeds through multiple iterations includes: after each iteration of path exploration, performing conflict detection on reasoning paths involving different tax types, and pruning based on the conflict detection results; during the reasoning process, performing unit consistency verification and conversion on the numerical values in the target problem based on the numerically related nodes in the reasoning path. It is understood that if two tax types are calculated simultaneously, reasoning along two independent paths will ultimately result in conflicting tax calculation answers; therefore, this application prunes by using conflict detection, retaining only the highest-level (Ministry of Finance > State Administration of Taxation > Local Government) and most recently published clause node among the conflicting tax types, and terminating all subsequent lower-level reasoning to ensure a single-tax-type unique exit for the answer. This improves problem understanding and answer generation. Furthermore, to avoid answer errors due to unit ambiguity, interpretable unit consistency verification is implemented through unit consistency verification and conversion; for example, when processing "small-scale taxpayers with quarterly sales ≤ 300,000 yuan are exempt from value-added tax," the existing system cannot recognize that the user input "monthly sales of 100,000 yuan" needs to be multiplied by 3 before comparison with the policy conditions, thus leading to an incorrect conclusion. This application embeds numerical condition metadata (unit, period, whether conversion is allowed, conversion rules) into the graph nodes and adds a unit consistency checker in the inference layer. When a mismatch is detected between the user's numerical value and the node condition unit, a conversion chain is automatically generated (e.g., multiplying by 3 to convert from "month" to "quarter", and multiplying by 10,000 to convert from "ten thousand yuan" to "yuan"). The converted numerical value is written back to the inference path, and the conversion process is explicitly marked in the answer to achieve interpretability of numerical reasoning.
[0080] In a preferred embodiment, the step of performing conflict detection on inference paths involving different tax types and pruning based on the conflict detection results includes: when there are at least two inference paths involving different tax types, calculating the conflict probability between the paths; if the conflict probability is greater than a probability threshold, calculating the priority score for each inference path; the priority score is determined based on the rule level, release time, and release department involved in the inference path; taking the path with the highest priority score as the minimum sufficient subgraph and pruning other conflicting paths; generating conflict explanation information for the current pruning operation; the conflict explanation information includes information on pruned conflicting paths, path information on retained candidate paths, conflict probability, and pruning reason.
[0081] This application proposes a Tax-Conflict Quantified Minimal Graph (TQMG) algorithm to solve the problem of conflicting answers across multiple tax types. The algorithm's input consists of at least two inference paths containing different tax type identifiers. Each path contains a node sequence and a tax type identifier. Specifically, it checks whether the current set of paths in the inference process contains two or more paths and determines whether these paths have different tax type identifiers; for example, one path might be a value-added tax path, and the other a corporate income tax path. TQMG executes only if both conditions are met. If there is only one path, or multiple paths belonging to the same tax type, it does not trigger, because conflicts mainly occur between cross-tax policies. The algorithm outputs a single conflict-free path P and a conflict interpretation vector. The specific process of the algorithm includes:
[0082] 1. Construct the conflict matrix. Calculate the conflict probability matrix between paths. The feedforward neural network is used to process the features of the tail node and output the conflict probability. The specific calculation formula is as follows:
[0083]
[0084] in, The function is the Sigmoid function, MLP is a two-layer feedforward network, and concat represents concatenating paths Pi and Pj.
[0085] 2. Collision Detection and Subgraph Selection. If max(C) > ,in If the threshold is reached, then minimum sufficient subgraph selection is initiated. A priority score is calculated for each path. Priority is determined based on rule hierarchy (laws > administrative regulations > departmental rules > normative documents), publication time, and departmental authority (Ministry of Finance > State Administration of Taxation > local authorities). The specific priority calculation formula is as follows:
[0086] ;
[0087] Among them, level is the rule level (law > administrative regulations > departmental rules > normative documents), day_since_publish is the publication date, and authority_score is the department level (Ministry of Finance > State Administration > Local).
[0088] 3. Generate conflicting explanatory variables : ;
[0089] Indicates the probability of conflict. Indicates the pruned path, This indicates the reason for reserving the path. A specific conflict explanation is shown below: "conflict_score": 0.87 (maximum conflict probability, 0-1); "dropped_paths" (all paths that were dropped); "pid": "PB", "reason": "level=3 < 1" (the core reason for the cut); "regulation": (Implementation Regulations of the Enterprise Income Tax Law); "retained_path": (the only path that remains); "pid": "PA", "reason": { "level": 1, "publish_date": "2016-03-24", "authority": "department x", "priority_score": 0.71.
[0090] Priority score calculation for conflict situations ensures that answers are generated based on the highest priority clause, avoiding reasoning conflicts across multiple tax types and enhancing the authority and consistency of the answers.
[0091] In a preferred embodiment, the dynamic reasoning involving multiple iterations starting from the initial inference node includes: when the inference path contains nodes related to numerical values, checking whether the numerical units in the target problem are consistent with the numerical units in the nodes; if inconsistent, converting the numerical values in the target problem to the numerical units of the nodes based on preset unit conversion rules. This embodiment proposes a Numerical Unit-Consistency Check (NUCC) algorithm to resolve unit ambiguity in colloquial input; the input is user numerical values. (including units) ), node conditions (including units) The output is the converted value. And the conversion chain. The specific process is as follows:
[0092] 1. Metadata Embedding. During graph construction, numerical metadata is pre-defined in nodes, including unit, period, whether conversion is allowed, and conversion rules.
[0093] 2. Unit consistency check. If the units do not match ( If the shortest transformation path is found, a recursive search is performed using a pre-built unit transformation graph. (Node = unit, edge = transformation function), run Dijkstra's algorithm to find the shortest path:
[0094] ;
[0095] 3. Numerical conversion and interpretation; obtained by chaining conversion functions. The conversion process should be explicitly indicated in the answer, for example: "100,000 yuan / month × 3 months = 300,000 yuan / quarter".
[0096] By converting units and generating explanatory information, erroneous conclusions caused by unit ambiguity are avoided, thereby enhancing the interpretability and user experience of numerical reasoning.
[0097] Meanwhile, to achieve deep integration with subgraph reasoning during the reasoning process, subgraph reasoning is automatically triggered when a node in the main knowledge graph contains a subgraph; the main graph reasoning state is also fully transmitted to the subgraph environment; the subgraph reasoning conclusion serves as an enhanced attribute of the main graph node; and the subgraph reasoning path and the main graph path are recorded and managed uniformly. Table 1 below shows a specific table of main graph nodes and relationships, and Table 2 below shows a specific table of subgraph nodes and relationships.
[0098] Table 1. Main Graph Nodes and Relationships
[0099] Table 2. Graph Subgraph Nodes and Relationships
[0100] The relationship codes in Table 2 correspond to detailed descriptions. For example, CoT11 indicates the judgment condition: a transaction meets the following two conditions at the same time: 1. The subject of the transaction is railway transportation services or air transportation services (provided according to national directives); 2. The transaction type is a gift, that is, the gratuitous transfer of ownership of goods or real estate, the gratuitous provision of services, the gratuitous transfer of ownership or right to use intangible assets, and no monetary, goods or other economic benefits are obtained from the buyer.
[0101] Step S13: After each iteration, determine whether the current reasoning path meets the termination reasoning condition. If it does, generate the answer to the target question based on the final reasoning path.
[0102] In this embodiment, the ReAct mechanism (Reasoning+Acting, a framework combining reasoning and action) can be employed, enabling the large language model to handle complex tasks through dynamic programming, tool calls, and result verification. Specifically, after each reasoning step, the ReAct mechanism calls the large model to evaluate whether the current path is sufficient to answer the user's question. If it is, the reasoning terminates; otherwise, it continues iterating until the maximum depth is reached. Simultaneously, the output of the algorithm engine module (such as pruned paths and conflict resolution results) serves as input to ReAct, guiding path adjustments and subgraph reasoning. For example, when CNDP identifies an exclusion clause, ReAct triggers a backtracking; when TQMG detects a conflict, ReAct prioritizes selecting the minimum sufficient subgraph.
[0103] Using the ReAct mechanism, after each iteration, a large model is invoked to evaluate the current set of paths. Sufficiency, that is, whether it is sufficient to answer the user's question x: If the large model determines that the current path is sufficient to answer the user's question, then it generates the answer: Otherwise, continue to the next iteration until the maximum search depth is reached. In addition to using the ReAct mechanism, preset relevance score thresholds, such as information entropy thresholds and confidence thresholds, can be used to determine when to stop inference; for example, inference can be stopped when the relevance of information reaches a certain level.
[0104] Finally, the reasoning results are transformed into a structured natural language answer that users can understand, ensuring ease of comprehension. Simultaneously, answer integrity is validated to ensure the output answer is complete and accurate, covering all relevant information. The answer is then fed back to the user in natural language. A feedback mechanism is also configured to allow users to evaluate and provide feedback on the system's responses, enabling the system to optimize and improve based on this feedback. Personalized services can also be supported, providing customized services based on the user's history and preferences.
[0105] As can be seen from the above, this embodiment obtains the target question, determines the initial inference node in the tax knowledge graph based on the tax type attribute and intent category corresponding to the target question, performs multi-round iterative dynamic inference starting from the initial inference node, and performs dynamic path pruning based on the analysis results of the semantic analysis of the rule text corresponding to the candidate relations during the path exploration of each round. After each round of iteration, it is determined whether the current inference path meets the termination inference condition. If it does, the answer to the target question is generated based on the final inference path. It can be seen that through multi-round iterative dynamic inference, and by performing semantic analysis of the rule text represented by the candidate relations during the path exploration of each round, and performing dynamic path pruning based on the current inference path and the semantic analysis results, the inference path and depth are automatically adjusted, and the termination point of the inference is accurately determined. This avoids the problems of lengthy inference process and low accuracy, and provides a more accurate and efficient intelligent question answering service.
[0106] Based on the above embodiments, this application also provides a specific intelligent question-answering method, see [link to relevant documentation]. Figure 2As shown, the target elements are extracted first. Taking the question "Company A is an air conditioner distributor (limited liability company, general taxpayer), employee B is a salesperson of Company A, and Company C is a customer of Company A. In 2023, employee B sold the air conditioner to real estate development company C (including installation service) for RMB 10 million (excluding tax), and issued invoices for "air conditioner" RMB 9 million (excluding tax) and "installation fee" RMB 1 million (excluding tax) respectively. Calculate the output tax payable by Company A in 2023". The final six elements extracted by the large model are as follows: (1) Transaction entities. Seller: Company A (air conditioner distributor, limited liability company, general taxpayer), buyer: Company C (real estate development company). (2) Transaction type: sales (compensated transfer of ownership of goods, compensated provision of services). (3) Transaction object. Goods: air conditioner (RMB 9 million excluding tax), service: installation service (RMB 1 million excluding tax), both occur at the same time and are provided by the same seller and signed in the same contract (implicit conditions). (4) Transaction time: 2023. (5) Transaction conditions: including additional terms of the transaction, such as price, payment method, risk assumption, etc. (6) Transaction amount: air conditioner: RMB 9 million (excluding tax), installation fee: RMB 1 million (excluding tax), total: RMB 10 million (excluding tax).
[0107] Then, based on the element extraction results, the complex tax problem is broken down into independently processable sub-problems and routed to the corresponding inference paths. By identifying the tax type and intent label of the sub-problems, the initial knowledge graph is filtered and selected to locate the initial graph inference node (the graph node already has specific labels and intents). Taking the above problem as an example, the intent label extracted by the large model is "mixed sales or concurrent business tax base and tax rate," locating the VATTB10 (mixed sales or concurrent business tax base and tax rate) node on the graph.
[0108] Furthermore, based on the collaborative execution of multiple algorithms within the dynamic inference engine, which integrates CNDP, TQMG, and NUCC modules, intelligent path exploration is achieved. Inference proceeds sequentially from the initial node identified as VATTB10 (mixed sales or concurrent business tax base and rate). The ReAct mechanism identifies whether the current node can answer the user's question. If it can, inference stops at subsequent nodes; otherwise, it continues until the maximum depth is reached or a conclusion is reached. If no conclusion is reached even after reaching the maximum depth, an answer is generated based on the native capabilities of the large model. During inference, if a subgraph exists under a node, the inference path enters the subgraph for inference, and the conclusion from the subgraph's inference is carried over to the main graph's inference (e.g., if a subgraph exists under the node "mixed sales or concurrent business tax base and rate," inference is performed under that node; if the user's question matches the description of CoT7 in the subgraph, the result from the subgraph's inference is carried over to the subsequent main graph's inference). A specific inference process is as follows:
[0109] 1. Inference Initialization. During the initialization phase, the large model identifies the tax type from the question and extracts intent labels to locate the starting point of the inference path. The initial entity set is... : .
[0110] In the d-th iteration, the system will base its decisions on the current set of paths. (That is, the set of all candidate reasoning paths formed after step d-1, where each path p is a sequence of entities and relations). New relations and entities are explored by combining a conditional nested dynamic pruning algorithm, cross-tax conflict quantification, and numerical conditional unit consistency verification algorithm.
[0111] In the relationship exploration, for each path Large models will search for paths. tail entity All relevant alternative (candidate) relationships : In other words, starting from the current tail entity, the next step is to reason along which relationships; specifically, based on the knowledge graph, all relationships connected to the tail entity can be found to obtain candidate relationships;
[0112] Then, these candidate relationships are screened and judged using a large model to obtain new relationship combinations, namely the candidate relationships mentioned above (which are the analysis objects of the dynamic pruning mentioned above). : ;
[0113] Here, x represents the question posed by the user, which guides the large model in filtering relationships. The large model utilizes its understanding of the semantics of the entire question and the reasoning context to determine which candidate relationships might point to the answer, filtering out those edges that are clearly semantically irrelevant, and selecting new relationship combinations.
[0114] At this point, the CNDP algorithm is triggered to perform semantic label classification and pruning on candidate relations. The fine-tuned BERT model is used to analyze the semantics of the rule text, perform reverse verification, identify exclusionary relations, and dynamically prune invalid paths to avoid inference explosion.
[0115] Then, entity exploration is performed for each candidate relation. The system will search for related entities. : Starting from the relationships within the new relational combination, entities connected to that relationship can be found using the knowledge graph as candidate entities. These candidate entities are then filtered and evaluated using a large-scale model to obtain the new relational combination. : .based on and Obtain the current reasoning path.
[0116] Then, TQMG monitoring is performed to calculate the probability of multi-path conflicts in real time. When the conflict exceeds the threshold, the minimum sufficient subgraph selection is initiated. The minimum sufficient subgraph is determined based on the priority of authority and timeliness.
[0117] During the reasoning process, if numerical conditions are involved, a NUCC numerical unit consistency check and conversion are triggered.
[0118] After each iteration, the ReAct mechanism is used to call the large model to evaluate the current set of paths. Is this sufficient to answer user question x? If the large model determines that the current path is sufficient to answer the user's question, then it generates the answer: Otherwise, continue to the next iteration until the maximum search depth is reached. Taking the question "Company A sells air conditioners including installation services" as an example, the process first involves pruning invalid paths using CNDP (e.g., excluding special rules for the manufacturing industry), then ensuring the priority of the VAT path using TQMG, finally verifying the unit of amount using NUCC, and ultimately generating the accurate answer under the ReAct mechanism.
[0119] Finally, the reasoning results of each sub-question are summarized to determine whether they can answer the user's initial question, and the final answer is output. Using the above question example, the final generated answer is: 1. The transaction is a mixed sale because the service is an essential component of the goods and meets the CoT7 criteria. 2. Tax should be calculated on a consolidated basis, with the tax base being the total sales amount: 10 million yuan (9 million + 1 million). 3. Applicable tax rate: 13% (corresponding to 'VATTR14', i.e., "tax rate 4"); 4. No input tax information, only output tax is calculated: Output tax = 10 million yuan × 13% = 1.3 million yuan; 5. Reasoning result: Company A's output tax payable in 2023 is 1.3 million yuan. Basis: Relevant valid rule information (such as a certain implementing rule); Transaction feature 7 (CoT7) is established, and the service is an essential component, thus the "consolidation into the goods tax base" rule applies; Applicable tax rate is 13%. Conclusion: Company A's output VAT payable in 2023 is RMB 1.3 million.
[0120] Accordingly, this application also discloses an intelligent question-answering system, which is divided into five parts: a knowledge graph construction and updating layer, a question understanding layer, a dynamic reasoning layer, an answer generation layer, and a user interaction layer.
[0121] The knowledge graph construction and update layer includes: a data crawling module, used to obtain the latest tax policy information from multiple sources such as official tax websites and regulatory databases; a data annotation module, used to automatically annotate entities and relationships using natural language processing technology to construct the knowledge graph structure; a data update module, used to monitor changes in tax policies in real time and automatically update the knowledge graph to ensure it reflects the latest policy information; and a data quality control module, used to clean and verify the acquired data to ensure its accuracy and completeness.
[0122] The question understanding layer includes: a natural language processing module, which processes user questions using natural language processing techniques, transforming them into natural language that the large model can understand; a context management module, which records the user's historical questions and contextual information, combining this with the current question for comprehensive understanding; a multi-intent recognition module, which identifies multiple intents within the user's question and processes them separately; and a question decomposition module, which breaks down the user's question based on the results of intent recognition, processes each decomposed question separately, and finally aggregates the results of all questions to generate the final output answer.
[0123] The dynamic inference layer includes: an inference engine module, used to execute dynamic inference algorithms, starting inference from the initial node; a path adjustment module, used to dynamically adjust the inference path based on the information value of the current node and the complexity of the inference path; a subgraph inference module, used to enter the subgraph for inference if a node has a corresponding subgraph, and apply the inference result of the subgraph to the next main graph node; and a ReAct mechanism, used to evaluate the information value of the current node and the complexity of the inference path to determine whether to continue inference; and an algorithm engine module, used to implement the numerical condition unit consistency check algorithm, the condition nested dynamic pruning algorithm, the cross-tax conflict quantification, and the minimum sufficient subgraph algorithm.
[0124] The answer generation layer includes: a natural language generation module, which converts the reasoning results into a structured natural language form that users can understand, ensuring ease of comprehension; and an answer integrity verification module, which ensures the completeness and accuracy of the output answer, covering all relevant information.
[0125] The user interaction layer includes: an input module to support multiple interaction methods, including text and voice input; an output module to provide answers to the user in natural language; a feedback mechanism module to allow users to evaluate and provide feedback on the system's responses, enabling the system to optimize and improve based on the feedback; and a personalized service module to provide personalized services based on the user's history and preferences.
[0126] Accordingly, this application also discloses an intelligent question-answering device, see [link to relevant documentation]. Figure 3 As shown, the device includes:
[0127] The question acquisition module 11 is used to acquire the target question and determine the initial reasoning node in the tax knowledge graph based on the tax type attribute and intent category corresponding to the target question.
[0128] The dynamic reasoning module 12 is used to perform dynamic reasoning in multiple rounds starting from the initial reasoning node, and to perform dynamic path pruning based on the analysis results by performing semantic analysis on the rule text corresponding to the candidate relationship in each round of path exploration.
[0129] The answer generation module 13 is used to determine whether the current reasoning path meets the termination reasoning condition after each iteration. If it does, the answer to the target question is generated based on the final reasoning path.
[0130] As can be seen from the above, this embodiment obtains the target question, determines the initial inference node in the tax knowledge graph based on the tax type attribute and intent category corresponding to the target question, performs multi-round iterative dynamic inference starting from the initial inference node, and performs dynamic path pruning based on the analysis results of the semantic analysis of the rule text corresponding to the candidate relations during the path exploration of each round. After each round of iteration, it is determined whether the current inference path meets the termination inference condition. If it does, the answer to the target question is generated based on the final inference path. It can be seen that through multi-round iterative dynamic inference, and by performing semantic analysis of the rule text represented by the candidate relations during the path exploration of each round, and performing dynamic path pruning based on the current inference path and the semantic analysis results, the inference path and depth are automatically adjusted, and the termination point of the inference is accurately determined. This avoids the problems of lengthy inference process and low accuracy, and provides a more accurate and efficient intelligent question answering service.
[0131] In some specific embodiments, the intelligent question-answering device may specifically include:
[0132] The query unit is used to detect whether the target question contains a pronoun before performing multiple rounds of dynamic reasoning starting from the initial reasoning node. If it does, the query unit queries the cache pool to determine the target node corresponding to the pronoun. The cache pool is used to store the mapping relationship between nodes that have been reasoned and their corresponding pronouns.
[0133] The weight configuration unit is used to increase the weight of the target node in the tax knowledge graph, so as to guide the reasoning path to converge toward the target node.
[0134] In some specific embodiments, the problem acquisition module 11 may specifically include:
[0135] A type determination unit is used to acquire user questions and determine the question type corresponding to the user questions.
[0136] The element determination unit is used to determine the target element type according to the question type and extract the target element information from the user question; the target element information includes any one or more of the following: transaction subject, transaction type, transaction object, transaction time, transaction amount, and transaction conditions;
[0137] The splitting unit is used to split the user question into multiple sub-questions based on the target element information, and to use the sub-questions as the target question;
[0138] Correspondingly, the answer generation module 13 is used to generate an answer to the user question based on the answers to all the target questions.
[0139] In some specific embodiments, the dynamic reasoning module 12 may specifically include:
[0140] The candidate relation acquisition unit is used to acquire the candidate relation corresponding to the current inference path;
[0141] The semantic type determination unit is used to analyze the rule text corresponding to each candidate relation using a large language model, and determine the semantic type corresponding to the candidate relation based on the analysis results; the semantic type includes exclusion type, inclusion type, exception type, and parallel type.
[0142] The confidence calculation unit is used to calculate the confidence of a candidate relation if the semantic type of the candidate relation is exclusionary and the exclusion condition corresponding to the candidate relation has been satisfied in the current inference path.
[0143] The pruning unit is used to prune candidate relations other than non-exclusionary candidate relations and exclusionary candidate relations with confidence levels below a threshold.
[0144] In some specific embodiments, the dynamic reasoning module 12 may specifically include:
[0145] The conflict detection unit is used to perform conflict detection on reasoning paths involving different tax types after each iteration of path exploration, and to prune based on the conflict detection results.
[0146] The unit verification unit is used to perform unit consistency verification and conversion on the numerical values in the target problem according to the numerically related nodes in the reasoning path during the reasoning process.
[0147] In some specific embodiments, the collision detection unit may specifically include:
[0148] The conflict probability calculation unit is used to calculate the conflict probability between paths when there are at least two different tax types in the reasoning path.
[0149] The priority calculation unit is used to calculate the priority score of each inference path if the conflict probability is greater than the probability threshold; the priority score is determined based on the rule level, release time and release department involved in the inference path.
[0150] The pruning unit is used to select the path with the highest priority score as the minimum sufficient subgraph and prune other conflicting paths.
[0151] The explanation information generation unit is used to generate conflict explanation information for the current pruning operation; the conflict explanation information includes information on pruned conflict paths, path information on retained candidate paths, conflict probability, and pruning reason.
[0152] In some specific embodiments, the unit verification unit may specifically include:
[0153] A consistency judgment unit is used to check whether the numerical unit in the target problem is consistent with the numerical unit in the node when the reasoning path contains nodes related to numerical values.
[0154] A conversion unit is used to convert the numerical values in the target problem to the numerical units of the node based on a preset unit conversion rule if there is a discrepancy.
[0155] Furthermore, this application also discloses an electronic device, see [link to relevant documentation]. Figure 4 As shown, the content in the figure should not be considered as any limitation on the scope of use of this application.
[0156] Figure 4 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the intelligent question-answering method disclosed in any of the foregoing embodiments.
[0157] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0158] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored on it include operating system 221, computer program 222 and data 223 including tax knowledge graph, etc. The storage method can be temporary storage or permanent storage.
[0159] The operating system 221 manages and controls the various hardware devices on the electronic device 20 and the computer program 222 to enable the processor 21 to perform calculations and processing on the massive amounts of data 223 in the memory 22. The operating system 221 can be Windows Server, Netware, Unix, Linux, etc. In addition to including computer programs capable of performing the intelligent question-answering method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0160] Furthermore, this application also discloses a computer storage medium storing computer-executable instructions. When the computer-executable instructions are loaded and executed by a processor, they implement the intelligent question-answering method steps disclosed in any of the foregoing embodiments.
[0161] Furthermore, embodiments of this application also disclose a computer program product, including a computer program that, when executed by a processor, implements the intelligent question-answering method steps disclosed in any of the foregoing embodiments.
[0162] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0163] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0164] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0165] The present invention provides a detailed description of an intelligent question-answering method, apparatus, device, and storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. An intelligent question answering method, characterized by, The method comprises the following steps: acquiring a target question, determining an initial reasoning node in a tax knowledge graph according to a tax attribute and an intention category corresponding to the target question; performing dynamic reasoning in multiple rounds of iteration starting from the initial reasoning node, and in the path exploration of each round of iteration, performing semantic analysis on rule texts corresponding to candidate relations, and performing dynamic path pruning according to the analysis result; after each round of iteration, judging whether the current reasoning path meets a termination reasoning condition, and if so, generating an answer to the target question based on the final reasoning path. 2.The intelligent question answering method of claim 1, wherein, Before the dynamic reasoning in multiple rounds of iteration starting from the initial reasoning node, the method further comprises the following steps: detecting whether the target question contains a pronoun, and if so, querying a cache pool to determine a target node corresponding to the pronoun; the cache pool is used to store a mapping relationship between a node that has been reasoned and a pronoun corresponding to the node; increasing the weight of the target node in the tax knowledge graph to guide the convergence of the reasoning path to the target node. 3.The intelligent question answering method of claim 1, wherein, The acquiring of the target question comprises the following steps: acquiring a user question, and determining a question type corresponding to the user question; determining a target element type according to the question type, and extracting target element information from the user question; the target element information includes any one or more of a transaction subject, a transaction type, a transaction object, a transaction time, a transaction amount and a transaction condition; splitting the user question into multiple sub-questions according to the target element information, and taking the sub-questions as the target questions; correspondingly, the generating of the answer to the target question based on the final reasoning path comprises the following steps: generating an answer to the user question based on the answers to all the target questions. 4.The intelligent question answering method of claim 1, wherein, In the path exploration of each round of iteration, the method comprises the following steps of: acquiring candidate relations corresponding to the current reasoning path; analyzing rule texts corresponding to each candidate relation by using a large language model, and determining a semantic type of the candidate relation according to the analysis result; the semantic type includes an exclusion type, an inclusion type, an exception type and a parallel type; if the semantic type of the candidate relation is the exclusion type, and an exclusion condition corresponding to the candidate relation has been met in the current reasoning path, calculating a confidence degree of the candidate relation; pruning candidate relations other than the candidate relations of the non-exclusion type and the exclusion type whose confidence degrees are lower than a threshold. 5.The intelligent question-answering method of any one of claims 1-4, wherein, The dynamic reasoning in multiple rounds of iteration starting from the initial reasoning node comprises the following steps: after the path exploration of each round of iteration, performing conflict detection on reasoning paths involving different tax categories, and performing pruning according to the conflict detection result; in the reasoning process, performing unit consistency checking and conversion on a value in the target question according to a node related to the value in the reasoning path. 6.The intelligent question answering method of claim 5, wherein, The conflict detection on the reasoning paths involving different tax categories and the pruning according to the conflict detection result comprise the following steps: when there are at least two reasoning paths of different tax categories, calculating a conflict probability between the paths. If the conflict probability is greater than the probability threshold, a priority score of each reasoning path is calculated; the priority score is determined based on a rule level, a publishing time and a publishing department involved in the reasoning path; The path with the highest priority score is taken as a minimal sufficient subgraph, and other conflict paths are pruned; Conflict explanation information is generated for the current pruning operation; the conflict explanation information includes conflict path information of the pruned path, path information of the retained candidate path, a conflict probability and a pruning reason. 7.The intelligent question answering method of claim 5, wherein, The dynamic reasoning with the initial reasoning node as a starting point includes: When a reasoning path contains a node related to a numerical value, check whether the numerical value unit in the target problem is consistent with the numerical value unit in the node; If not, convert the numerical value in the target problem to the numerical value unit of the node based on preset unit conversion rules.
8. An intelligent question answering apparatus, characterized by comprising: It includes: A problem acquisition module is configured to acquire a target problem, determine an initial reasoning node in a tax knowledge graph according to a tax category attribute and an intention category corresponding to the target problem; A dynamic reasoning module is configured to perform dynamic reasoning with the initial reasoning node as a starting point through multiple rounds of iteration, and in path exploration of each round of iteration, perform dynamic path pruning by performing semantic analysis on rule texts corresponding to candidate relationship pairs according to analysis results; A response generation module is configured to judge whether a current reasoning path meets a termination reasoning condition after each round of iteration, and if so, generate a response to the target problem based on a final reasoning path.
9. An electronic device, comprising: It includes: A memory is configured to save a computer program; A processor is configured to execute the computer program to implement the intelligent question answering method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer program is stored in the memory and is executed by the processor to implement the intelligent question answering method according to any one of claims 1 to 7.