Financial domain knowledge question-answering method, device and equipment based on large language model and storage medium

By constructing a financial knowledge graph and training and optimizing a large language model, the problems of insufficient data and low efficiency of large language models in the illusion detection of the financial field are solved, and efficient and reliable knowledge question answering results are achieved.

CN121581218APending Publication Date: 2026-02-27SHANDONG INSPUR SCI RES INST CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511761061.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-27
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Existing large-scale language models face challenges in hallucination detection in fields such as finance, medicine, and law, including small data volume, limited coverage, low generation efficiency, and high costs. They are unable to meet the demands of rapid iteration and new knowledge, and manual annotation is time-consuming and labor-intensive. Furthermore, LLM-based screening may introduce new biases.

Method used

By constructing a financial knowledge graph, identifying the target financial knowledge graph, processing the facts according to a preset obfuscation strategy, generating obfuscated data, and training and optimizing the initial large-scale financial domain model to generate an optimized large-scale financial domain model, the optimized model is then used for knowledge question answering.

Benefits of technology

It improves the factuality and reliability of data generated by large models in the financial field, ensures the traceability and accuracy of obfuscated data, enhances the effectiveness of knowledge-based question answering, and reduces labor costs and time consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121581218A_ABST
    Figure CN121581218A_ABST
Patent Text Reader

Abstract

The invention discloses a financial field knowledge question-answering method, device and equipment based on a large language model, and a storage medium, and relates to the technical field of artificial intelligence, and the method comprises the steps: determining a target financial knowledge graph corresponding to financial data; confusing the target fact and other atomic facts according to a preset confusion strategy to obtain confused data; performing training optimization on the initial financial field large model based on a model output result which is generated by the initial financial field large model and corresponds to the confused data; and when a to-be-processed financial field problem is obtained, using the optimized financial field large model to generate problem reply content corresponding to the to-be-processed financial field problem. Therefore, the traceability and the accuracy of the confused data can be ensured in combination with the structured facts provided by the financial knowledge graph; and the large model in the financial field can be trained and optimized based on the model output result, so that the factuality and reliability of data generation of the large model in the financial field can be improved, and the knowledge question and answer effect is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and in particular to a financial field knowledge question answering method and device based on a large language model, equipment and a storage medium. BACKGROUND

[0002] To improve the reliability of large language models (LLMs), hallucination detection has become a crucial research task. Hallucination problems seriously affect the reliability and credibility of LLMs in application scenarios such as medicine, finance, law, and scientific research, which have very high requirements for information accuracy. Effective hallucination detection requires a large amount of high-quality and diverse data to train and evaluate the detection model. However, previous methods of obtaining hallucination detection data generally face challenges. Currently, it mainly relies on manual screening, manual writing, or using existing large language models to preliminarily screen conventional public data sets, and then supplemented by manual review to identify and collect errors or hallucinations in model answers. These traditional methods can obtain a certain amount of hallucination samples, but generally have problems such as small data volume, limited coverage, low generation efficiency, and high cost. Manual annotation is time-consuming and labor-intensive, and it is difficult to meet the demand for rapid iteration of LLMs and the continuous emergence of new knowledge; while LLM-based screening may introduce new biases, and it is difficult to systematically explore various potential hallucination patterns and knowledge boundaries.

[0003] Therefore, how to effectively generate high-quality and diverse hallucination detection data and optimize large language models based on hallucination detection data for financial data interaction is a problem to be solved in the field. SUMMARY

[0004] Therefore, the purpose of the present application is to provide a financial field knowledge question answering method and device based on a large language model, which can ensure the traceability and accuracy of the mixed data in combination with the structured facts provided by the financial knowledge graph; and based on the model output result, the financial field large model can be trained and optimized, which can improve the factuality and reliability of the data generated by the financial field large model, and further improve the knowledge question answering effect. The specific scheme is as follows:

[0005] In a first aspect, the present application provides a financial field knowledge question answering method based on a large language model, comprising:

[0006] determining a target financial knowledge graph corresponding to the financial data; the target financial knowledge graph is a financial knowledge graph constructed based on atomic facts and corresponding path indexes of the financial data;

[0007] obfuscate the target fact and other atomic facts according to a preset obfuscation strategy to obtain corresponding obfuscated data; the target fact is a fact obtained by sampling each path index;

[0008] based on a model output result corresponding to the obfuscated data generated by an initial financial domain large model, training and optimizing the initial financial domain large model to obtain an optimized financial domain large model;

[0009] when a financial domain problem to be processed is obtained, generating a problem reply content corresponding to the financial domain problem to be processed by using the optimized financial domain large model.

[0010] Optionally, the target financial knowledge graph corresponding to the financial data comprises:

[0011] converting the financial data into a lightweight markup language file;

[0012] parsing the lightweight markup language file to obtain corresponding atomic facts;

[0013] adding a path index to each atomic fact, and mapping each atomic fact and the corresponding path index to a node and an edge in a financial knowledge graph to obtain a target financial knowledge graph corresponding to the financial data.

[0014] Optionally, the obfuscating the target fact and other atomic facts according to a preset obfuscation strategy to obtain corresponding obfuscated data comprises:

[0015] sampling each path index according to a preset sampling manner to obtain a target fact;

[0016] determining a target obfuscation strategy having an association relationship with the target fact from the preset obfuscation strategy;

[0017] obfuscating the target fact and other facts except the target fact according to the target obfuscation strategy to obtain corresponding obfuscated data.

[0018] Optionally, the sampling each path index according to a preset sampling manner to obtain a target fact comprises:

[0019] randomly sampling each path index to obtain a target path index;

[0020] based on the atomic fact corresponding to the target path index, recalling a corresponding text block from the financial data to obtain a target fact.

[0021] Optionally, the obfuscating the target fact and other facts except the target fact according to the target obfuscation strategy comprises:

[0022] According to the target confusion strategy, a target search method is used to recall text blocks associated with the target fact from the financial data, to obtain a fact to be confused; the target search method is a keyword search method or a text vector search method;

[0023] The target fact and the fact to be confused are processed to obtain corresponding confused data.

[0024] Optionally, the model output result corresponding to the confused data generated based on the initial financial domain large model is used to train and optimize the initial financial domain large model, including:

[0025] Generate an illusion question for knowledge question and answer of the initial financial domain large model based on the confused data;

[0026] Obtain the model output result corresponding to the illusion question output by the initial financial domain large model;

[0027] Perform illusion evaluation on the model output result, and train and optimize the initial financial domain large model based on the corresponding illusion evaluation result.

[0028] Optionally, the illusion evaluation on the model output result and the training and optimization of the initial financial domain large model based on the corresponding illusion evaluation result include:

[0029] Perform illusion evaluation on the model output result by a preset illusion evaluation model to obtain a corresponding illusion evaluation result;

[0030] If the illusion evaluation result indicates that the model output result has an illusion, collect all data of the knowledge question and answer operation corresponding to the model output result;

[0031] Train and optimize the initial financial domain large model based on the all data.

[0032] In a second aspect, the present application provides a financial domain knowledge question and answer device based on a large language model, including:

[0033] A financial knowledge graph determination module is configured to determine a target financial knowledge graph corresponding to financial data; the target financial knowledge graph is a financial knowledge graph constructed based on atomic facts and corresponding path indexes of the financial data;

[0034] A data confusion module is configured to perform confusion processing on a target fact and other atomic facts according to a preset confusion strategy, to obtain corresponding confused data; the target fact is a fact obtained by randomly sampling each path index;

[0035] The model optimization module is used to train and optimize the initial financial domain model based on the model output results generated by the initial financial domain model corresponding to the obfuscated data, so as to obtain the optimized financial domain model.

[0036] The knowledge-based question-and-answer module is used to generate corresponding question-and-answer content based on the optimized financial domain big data model when a question in the financial domain is obtained.

[0037] Thirdly, this application provides an electronic device, comprising:

[0038] Memory, used to store computer programs;

[0039] A processor is used to execute the computer program to implement the financial domain knowledge question answering method based on a large language model as described above.

[0040] Fourthly, this application provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the above-described financial domain knowledge question-answering method based on a large language model.

[0041] Therefore, this application first determines the target financial knowledge graph corresponding to the financial data; the target financial knowledge graph is a financial knowledge graph constructed based on the atomic facts and corresponding path indexes of the financial data; then, according to a preset obfuscation strategy, the target facts and other atomic facts are obfuscated to obtain the corresponding obfuscated data; the target facts are facts obtained by sampling each of the path indexes; then, based on the model output results corresponding to the obfuscated data generated by the initial financial domain large model, the initial financial domain large model is trained and optimized to obtain an optimized financial domain large model; when a financial domain question to be processed is obtained, the optimized financial domain large model is used to generate question answer content corresponding to the financial domain question to be processed. Thus, this application can combine the structured facts provided by the financial knowledge graph to ensure the traceability and accuracy of the generated obfuscated data, avoiding the low-quality problems caused by random generation; and, based on the model output results generated by the financial domain large model for the obfuscated data, the financial domain large model can be trained and optimized, which can improve the factuality and reliability of the question answer data generated by the financial domain large model, further improving the knowledge question answering effect of the large language model on financial data. Attached Figure Description

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of the provided drawings.

[0043] Figure 1 A financial field knowledge question answering method based on a large language model disclosed in the present application;

[0044] Figure 2 A specific financial field knowledge question answering method based on a large language model disclosed in the present application;

[0045] Figure 3 A financial field knowledge question answering device structure schematic diagram disclosed in the present application;

[0046] Figure 4 A structure diagram of an electronic device disclosed in the present application. DETAILED DESCRIPTION

[0047] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0048] Referring to Figure 1 The embodiments of the present application disclose a financial field knowledge question answering method based on a large language model, which comprises:

[0049] Step S11, determining a target financial knowledge graph corresponding to the financial data; the target financial knowledge graph is a financial knowledge graph constructed based on atomic facts and corresponding path indexes of the financial data.

[0050] In the present embodiment, in order to ensure the traceability and accuracy of the corresponding facts of the financial data, a financial knowledge graph corresponding to the financial data can be constructed, and a clear and accurate knowledge base is provided for knowledge question answering through a structured fact base. It can be understood that the nodes in the financial knowledge graph represent entities (such as a specific place name) corresponding to atomic facts of the financial data, and the edges represent relationships (such as issuance, limit, etc.); and the atomic facts correspond to a plurality of nodes and edges, such as a triple of the form "subject-relation-object"; and each atomic fact corresponds to a unique path index, which corresponds a specific path on the knowledge graph to the atomic fact, so as to sample facts and recall text blocks subsequently.

[0051] In specific embodiments, determining the target financial knowledge graph corresponding to the financial data can include: converting the financial data into a lightweight markup language file; parsing the lightweight markup language file to obtain a plurality of atomic facts; adding a path index to each atomic fact, and mapping each atomic fact and the corresponding path index to a node and an edge in the financial knowledge graph to obtain the target financial knowledge graph corresponding to the financial data. Specifically, the financial data can be converted first, and the lightweight markup language file format can be used to ensure clear text structure; then the lightweight markup language file can be parsed to extract atomic facts. At the same time, a path index is added to each atomic fact, and is mapped to a node and an edge in the knowledge graph. The path index is stored for subsequent sampling of facts and recall of text blocks. Here, the text block refers to a text block corresponding to the financial data, and each block corresponds to one or more atomic facts. For example, a text block contains “3.8 trillion yuan of new special debt limit in the whole region per year”. The atomic fact index is associated with the text block to ensure traceability of the text block. Further, the lightweight markup language file can be divided into text blocks by imitating the RAG (Relevance-Aware Generation, retrieval-enhanced generation) task.

[0052] In step S12, the target fact and other atomic facts are processed according to a preset confusion strategy to obtain corresponding confused data; the target fact is a fact obtained by sampling each path index.

[0053] In the embodiment, the target knowledge graph corresponding to the financial data is determined in the above steps, and then a target fact can be obtained by sampling each path index; then the target fact and other atomic facts are processed according to a preset confusion strategy, and different facts can be incorrectly associated by data confusion to fabricate a fact hypothesis, i.e., to obtain confused data. For example, the target fact (431 billion yuan of new special debt issued in A province) is incorrectly associated with the whole region limit (3.8 trillion yuan) in other atomic facts, and a hypothesis (i.e., confused data) that “A province has issued 90% of the whole year limit of new special debt in the fourth quarter” is fabricated.

[0054] In specific embodiments, the target fact and other atomic facts are processed according to a preset obfuscation strategy to obtain corresponding obfuscated data, which can include: sampling each path index according to a preset sampling method to obtain a target fact; determining a target obfuscation strategy from the preset obfuscation strategy that has an association relationship with the target fact; and processing the target fact and other facts except the target fact according to the target obfuscation strategy to obtain corresponding obfuscated data. Specifically, when sampling each path index, random sampling can be directly performed to obtain a target path index, and then the corresponding atomic fact of the target path index is recalled from the text block corresponding to the financial data to obtain the target fact; that is, the index obtains the corresponding target fact. Of course, in addition to random sampling, the connection dense area of the knowledge graph can also be sampled, or sampling can be performed based on historical hotspot data area. Further, based on the target fact, a target obfuscation strategy that has an association relationship with the target fact can be determined; for example, a strategy for obfuscating the region or value corresponding to the target fact, or a strategy for obfuscating similar terms, or a strategy for obfuscating the cause and effect relationship. Based on the target obfuscation strategy, the target fact and other atomic facts can be obfuscated.

[0055] Further, processing the target fact and other facts except the target fact according to the target obfuscation strategy can include: recalling text blocks having an association relationship with the target fact from the financial data using a target search method according to the target obfuscation strategy to obtain facts to be obfuscated; the target search method is a keyword search method or a text vector search method; and the target fact and the facts to be obfuscated are processed to obtain corresponding obfuscated data. Specifically, different obfuscation strategies need to recall different text blocks from the text blocks corresponding to the financial data. For example, if the obfuscation strategy is regional obfuscation, other atomic facts corresponding to the text blocks with regional names can be recalled; if the obfuscation strategy is numerical obfuscation, other atomic fact text blocks with numerical values can be recalled. It can be understood that keyword search or text vector search can be used in the process of recalling text blocks; here, the facts to be obfuscated obtained by searching are facts that are similar to the target fact but have deviations, i.e., the contents of the relevant text blocks are similar but have deviations. By processing the target fact and the facts to be obfuscated, an obfuscated data that is easy to induce hallucination of a large language model can be obtained. Based on the obfuscated data, a question can be generated, which is easy to induce model hallucination, and the initial financial domain large model is further subjected to knowledge question and answer.

[0056] In step S13, the initial financial domain large model is trained and optimized based on the model output result corresponding to the obfuscated data generated by the initial financial domain large model to obtain an optimized financial domain large model.

[0057] In this embodiment, the mixed data of the confused target facts and other facts can be obtained based on the target knowledge graph of the financial data through the above steps. It can be understood that the mixed data is easy to induce hallucinations of the large language model. Then, the hallucination question for knowledge question and answer of the initial large model in the financial field can be generated based on the mixed data. The hallucination question generated in this way can imply the authenticity of the mixed data and enhance the confusion. Then, the model output result corresponding to the hallucination question output by the initial large model in the financial field is obtained. The model output result can reflect whether the large model is misled to produce hallucinations. Specifically, the hallucination of the model output result can be evaluated, and then the initial large model in the financial field is trained and optimized based on the corresponding hallucination evaluation result. In this way, the knowledge boundary and reasoning ability of the large model can be tested and trained, and the reliability and authenticity of the large model in the financial field knowledge question and answer can be optimized.

[0058] In specific embodiments, hallucination evaluation of the model output result and training and optimization of the initial large model in the financial field based on the corresponding hallucination evaluation result can include: hallucination evaluation of the model output result by a preset hallucination evaluation model to obtain the corresponding hallucination evaluation result; if the hallucination evaluation result indicates that the model output result has hallucinations, collecting all data of the knowledge question and answer operation corresponding to the model output result; training and optimizing the initial large model in the financial field based on the all data. Specifically, the process of hallucination evaluation can use an adjusted large model to evaluate whether the model output result has hallucinations. When the corresponding hallucination evaluation result indicates that there are hallucinations, it means that the previous confusion strategy has played a role. The initial large model in the financial field can be trained and optimized by using all data of the knowledge question and answer operation corresponding to the model output result. Correspondingly, if the hallucination evaluation result indicates that there are no hallucinations, the next hallucination question can be generated for knowledge question and answer, and whether the corresponding model output result has hallucinations can be evaluated.

[0059] Step S14, when the to-be-processed financial field question is obtained, the optimized large model in the financial field is used to generate the question and reply content corresponding to the to-be-processed financial field question.

[0060] It can be understood that the initial large model in the financial field can be trained and optimized through the above steps to obtain the corresponding optimized large model in the financial field. The training and optimization end condition involved in this process can be that the model output result does not have hallucinations for a plurality of times in succession, or the training and optimization is performed for a fixed number of model output results with hallucinations. In this way, the optimized large model in the financial field is obtained. Further, when the to-be-processed financial field question is obtained, the optimized large model in the financial field can be used to generate the question and reply content corresponding to the to-be-processed financial field question. It can be understood that the large model after training and optimization has higher reliability, and the information involved in the generated question and reply content is more accurate and reliable.

[0061] Therefore, the application can provide structured facts combined with the financial knowledge graph to ensure the traceability and accuracy of the generated confused data, avoiding the low-quality problems caused by random generation. Based on the model output results generated by the financial domain large model for the confused data, the financial domain large model can be trained and optimized, which can improve the factuality and reliability of the problem reply data generated by the financial domain large model, and further improve the knowledge question and answer effect of the large language model on financial data.

[0062] The following embodiments will specifically describe the process of how to process financial data and generate illusion questions; as shown in Figure 2 The embodiment discloses a financial domain knowledge question and answer method based on a large language model, which involves a knowledge base analysis module, a knowledge graph tool, an illusion induction strategy pool tool, a knowledge graph sampling tool, a search tool, an illusion evaluation module, and a strategy verification queue pool module. Specifically, it includes:

[0063] It should be pointed out that the related steps of generating illusion questions and illusion evaluation involved in the technical solution of the application can be realized by a core intelligent agent, which is an attacker model driven by reinforcement learning. The attacked model is an initial financial domain large model. Moreover, the attacker model can dynamically maintain the illusion induction strategy pool, and verify the newly generated confusion strategies through the strategy verification queue pool module. Specifically, under the reinforcement learning module, the attacker model driven by reinforcement learning can adopt a phased training mechanism: in the strategy mining mode, the attacker model generates a new strategy string and performs three-level verification through the strategy verification queue pool: preliminary test (5-10 questions), multiple verification (30 questions cross-path test), and periodic cleaning. Only when the illusion induction rate exceeds the specified threshold and the stability meets the standard, the new strategy is stored in the illusion induction strategy pool. In the data synthesis mode, the model calls the strategy pool to generate diversified questions and optimize the illusion induction rate. Moreover, the embodiment can also include a training scheduler module, which is specifically used for dynamically switching between the strategy mining mode and the data synthesis mode. In the initial stage, the data synthesis training is started with artificial strategies, and after the attacker model masters the tool calling ability, it is switched to strategy mining. Further, combined with the illusion induction strategy update module, the effectiveness of the confusion strategy can be periodically evaluated, and the inefficient strategies that are below the specified threshold for a long time are removed to ensure the continuous improvement of the quality of the strategy library.

[0064] In this embodiment, first, the unstructured corpus (financial data PDF) is disassembled into atomic facts and constructed into a knowledge graph by the knowledge base analysis module, and text slicing and indexing are performed to provide accurate and traceable knowledge base for subsequent fact sampling. Second, the graph sampling method (sampling target facts) is intelligently selected, the illusion inducing strategy is selected or generated, and the search tool is called to recall the false text blocks (data to be confused) for confusion. The attacker model then synthesizes the diversified illusion inducing questions by integrating these data (target facts and data to be confused) and asks the attacked model. Then the illusion evaluation model evaluates the answers output by the attacked model, and if there is illusion, the related data can be stored, and if there is no illusion, the related data can be discarded directly. Specifically, the knowledge base analysis module first receives the corpus in PDF format and converts it into Markdown (a lightweight markup language) format to ensure clear text structure. Then, the module parses the Markdown file; automatically identifies and splits into atomic facts in the form of “subject-relation-object” triples. For example, extract atomic facts from the corpus: “A province-fourth quarter new special debt issuance-431 billion yuan” and “all regions-new special debt annual limit-380 billion yuan”. At the same time, the system adds a unique index to each atomic fact and maps it to the nodes and edges in the knowledge graph. Then build the knowledge graph, you can use Neo4j database to store these atomic facts and build the knowledge graph. The nodes in the graph represent entities (such as “A province” and “all regions”), and the edges represent relationships (such as “issuance” and “limit”). Path indexes are saved for subsequent sampling and recall. Finally, the text block is divided, and the module divides the Markdown file into multiple text blocks, each corresponding to one or more atomic facts, following the RAG task. For example, one text block contains “A province-fourth quarter new special debt issuance-431 billion yuan”, and another text block contains “all regions-new special debt annual limit-380 billion yuan”. The atomic fact index is associated with the text block to ensure traceability of the true value text block. Further, the attacker model acts as a pre-trained agent and operates in data synthesis mode. The attacker model first accesses the current state, including the knowledge graph structure, the illusion inducing strategy pool list (such as the initial strategy “confuse regional scope” and “fabricate numerical relationship”), and the historical interaction data (such as the success rate of past strategies). First, graph sampling is performed, and the attacker model calls the graph sampling tool to randomly select a path from the knowledge graph, such as the path “A province-fourth quarter new special debt issuance-431 billion yuan”. This path corresponds to the simple fact “A province-fourth quarter new special debt issuance-431 billion yuan”. Then the strategy selection, the model calls the illusion inducing strategy pool tool to view the available strategy list. Based on the current simple fact, the “confuse regional scope” strategy can be selected, which encourages the confusion of data for a certain region with all region data to enhance the question confusion.According to the sampling path and the selected strategy, the attacker model can call the tool to recall the relevant text block. First, through the index of the simple fact "431 billion yuan of special debt was issued in A province in the fourth quarter", the corresponding true value text block, that is, the original text segment containing the fact, is automatically recalled. And according to the "confusion of regional scope" strategy, the search tool (preferably using keyword search) is called to recall the text block containing "3.8 trillion yuan of special debt limit for the whole year". The text block is semantically related to the true value text block but has a different regional scope, which is easy to induce confusion. After that, the attacker model can incorrectly associate the simple fact (431 billion yuan of special debt issued in A province) with the whole region limit (3.8 trillion yuan) in the false text block, and fabricate the assumption that "A province has issued 90% of the whole year limit in the fourth quarter". Then, the question is generated: "If A province has issued 90% of the whole year limit in the fourth quarter, what is the whole year limit?" Since the attacker model is trained by reinforcement learning method, the way of asking questions is in the form of established facts, suggesting that A province has a separate whole year limit, while in fact the whole year limit in the original text is only for the whole region, which enhances the confusion. Then, the synthesized question is input into the attacked model (a large language model fine-tuned in the financial field), and the attacked model may answer "the whole year limit is about 478.9 billion yuan" based on the incorrect association calculation or fabricated data, while the correct answer should be "the whole region limit is 3.8 trillion yuan, and A province has no separate whole year limit". Finally, the illusion evaluation and data collection are performed, the attacker model can analyze the consistency of the answer with the corpus, and identify that the answer of the attacked model incorrectly applies the whole region data to A province, so it outputs false (representing illusion); in this case, the data when the illusion answer is collected, such as the hidden state, the answer content, etc., is stored in the database for subsequent training and optimization of the attacked model.

[0065] It can be understood that the action space of the attacker model covers the selection of the knowledge graph sampling method, the generation / calling of the strategy, the calling of the search tool, and the synthesis of the question; the state space integrates the knowledge graph path, the true / false text block, the strategy pool list, and the stored historical interaction success rate data (i.e. data related to the answers with illusion).

[0066] Further, in specific embodiments, the state space S includes: the sampling path of the current knowledge graph , the recalled true text block and false text block , the current strategy of the illusion inducing strategy pool, the historical interaction data (such as the success rate of the past confusion strategy, the usage frequency of the sampling method, etc.), the system prompt word (is it in the strategy mining mode or the data synthesis mode). Correspondingly, the action space A includes: selecting the graph sampling method Random sampling, hotspot area sampling, connection dense area sampling , select or generate hallucination inducing strategy (In the strategy mining mode, the model is encouraged to explore new strategy strings; in the data synthesis mode, the model selects strategies from the strategy pool), call search tool Keyword search, embedding search Recall fake text blocks, synthesize questions .

[0067] To encourage the attacker model to generate questions that can effectively induce hallucinations while being novel and diverse, and to avoid invalid actions, a reward function r can be designed, which consists of the following:

[0068] ;

[0069] Where the basic reward directly reflects the success rate of hallucination induction, as follows:

[0070] ;

[0071] Here represents the probability of the hallucination evaluation model outputting false (i.e., the model answering with hallucination), directly encouraging the attacker model to induce hallucinations in the attacked model.

[0072] Strategy novelty reward Only activated in the strategy mining mode, as follows:

[0073] ;

[0074] Where, is the new strategy string generated by the attacker model, is the set of all existing strategies in the strategy pool, represents the maximum embedding cosine similarity between the new strategy and the strategies in the strategy pool, is a pre-set similarity threshold. When the similarity between the new strategy and the existing strategy is lower than this threshold, it means that it has higher novelty and is given a positive reward.

[0075] Diversity reward is to prevent the attacker model from generating repeated or overly similar questions, as follows:

[0076] ;

[0077] where B is the number of synthesis problems in a batch, is the vector representation of the ith synthesis problem , compute the variance of cosine similarity of the embedding of the problems, normalize the variance value to the range [0, 1]. High variance indicates large difference between problems, thus giving positive reward.

[0078] penalty term give a fixed negative reward for invalid actions, e.g. the sampled path cannot recall the text block, the synthesized problem does not conform to the grammar specification or semantic logic, etc. Hyperparameters are used to balance the contribution of the base reward, strategy novelty reward and diversity reward in the total reward, respectively.

[0079] In another specific embodiment, to ensure the effectiveness of the new confusion strategy, the steps of new strategy verification and illusion induction strategy pool warehousing are as follows:

[0080] 1. New strategy generation: in the strategy mining mode, the attacker model outputs a new strategy string (for example, "confuse time sequence") according to the current state. The system automatically checks whether the strategy is repeated in the strategy pool (based on string similarity and embedding similarity). If it is repeated or the similarity is higher than the threshold , it is considered as an invalid strategy and does not enter the subsequent verification.

[0081] 2. Preliminary test: the system automatically synthesizes N1 (for example, 5-10) problems using the new strategy (using the data synthesis mode, but not calling the illusion induction strategy pool), and asks the attacked model. Calculate the average probability of inducing illusion If is not less than the threshold , the strategy enters the multiple verification stage; otherwise, the strategy is discarded.

[0082] 3. Multiple verification: the system uses the new strategy to synthesize more problems (for example, N2 (30)), and tests on multiple knowledge graph paths, calculates the average illusion induction rate If is not less than the threshold (usually is not less than ), and the strategy performs consistently on different paths (i.e. the variance of the induction rate is lower than a preset threshold ), the strategy is considered effective.

[0083] 4. Add strategy to pool: Verify that the valid strategy is added to the illusion inducing strategy pool, and record its metadata (e.g. generation time, average success rate). After the strategy pool is updated, all subsequent interactions can use the strategy. At the same time, the model obtains the reward will be confirmed and counted into the history experience to reinforce similar behaviors of the attacker model.

[0084] 5. Periodic cleaning: The training scheduler module periodically evaluates the effectiveness of strategies in the strategy pool, removes long-term inefficient (e.g. average induction rate drops to below) or excessively repetitive strategies to maintain the quality and refinement of the strategy pool.

[0085] In another specific embodiment, the training-related steps of the attacker model are as follows:

[0086] 1. Initialization: The attacker model is initialized using pre-trained language model weights. The illusion inducing strategy pool contains a set of artificial initial strategies (e.g. "confuse similar terms", "numerical calculation"). The illusion evaluation model uses a model fine-tuned on the illusion detection task.

[0087] 2. Interaction loop: For each training round, first, the training scheduler module sets the system mode (strategy mining or data synthesis) according to the current training phase and target. The initial stage usually opens the data synthesis mode, uses artificial initial strategies to train the attacker model, and makes it learn tool invocation and problem synthesis; the attacker model selects an action according to the current state; executes the selected action, including invoking the graph sampling tool, searching tool, illusion inducing strategy pool tool, and synthesizing the question; the attacked model answers the question; the illusion evaluation module evaluates the answer of the attacked model and outputs the illusion probability ; according to the illusion evaluation result and the verification state of the new strategy, calculate the reward r; store the experience (state, action, reward, next state) to the replay buffer; every K steps, use the experience stored in the replay buffer to update the parameters of the attacker model through the PPO (Proximal Policy Optimization) algorithm, maximize the expected cumulative reward , where is the discount factor.

[0088] 3. Strategy update: In the strategy mining mode, when the attacker model generates a new strategy and passes the above verification process, it is added to the illusion inducing strategy pool, and the embedding index of the strategy pool is updated for subsequent similarity calculation.

[0089] 4. Regularization and exploration: Add a strategy entropy regularization term to the PPO loss function, where is the coefficient. H(s) is the entropy of the strategy at state s, encouraging the attacker model to explore new actions and strategies. Meanwhile, a greedy strategy can be used in the initial stage of training to further promote exploration.

[0090] Therefore, the technical scheme of the present application provides a structured fact basis through a knowledge graph, ensuring the traceability and accuracy of generating illusion questions, and avoiding low-quality problems caused by random generation. Moreover, the attacker model driven by reinforcement learning realizes the automation and intelligentization of illusion question generation, reducing labor costs and time consumption. Further, the dynamic illusion induction strategy pool and its iterative updating mechanism can continuously learn and discover new and more effective illusion induction strategies, improving the diversity of the generated confused data and the coverage ability for unknown illusion types. Furthermore, based on the accurate feedback of the illusion evaluation model, the attacker model can continuously optimize the generation process of illusion questions, ensuring high-quality data and stable illusion induction rate. In this way, the technical scheme of the present application can efficiently provide large-scale and high-quality training and testing data for illusion detection, evaluation, and fine-tuning of financial field large models, thereby accelerating the optimization of the factuality and reliability of large models.

[0091] As shown in Figure 3 The present embodiment discloses a financial field knowledge question answering device based on a large language model, which comprises:

[0092] A financial knowledge graph determination module 11 is configured to determine a target financial knowledge graph corresponding to financial data; the target financial knowledge graph is a financial knowledge graph constructed based on atomic facts and corresponding path indexes of the financial data;

[0093] A data confusion module 12 is configured to confuse the target fact and other atomic facts according to a preset confusion strategy, to obtain corresponding confused data; the target fact is a fact obtained by randomly sampling each path index;

[0094] A model optimization module 13 is configured to train and optimize an initial financial field large model based on a model output result corresponding to the confused data generated by the initial financial field large model, to obtain an optimized financial field large model;

[0095] A knowledge question answering module 14 is configured to, when a to-be-processed financial field question is obtained, generate a question reply content corresponding to the to-be-processed financial field question by using the optimized financial field large model.

[0096] ​Therefore, the application can provide structured facts based on the financial knowledge graph, ensure the traceability and accuracy of the generated confused data, and avoid the low-quality problems caused by random generation. In addition, the model output result generated based on the financial domain large model for the confused data can be used to train and optimize the financial domain large model, thereby improving the factuality and reliability of the problem reply data generated by the financial domain large model, and further improving the knowledge question and answer effect of the large language model on financial data.

[0097] In a specific embodiment, the financial knowledge graph determination module 11 can include:

[0098] a conversion unit configured to convert the financial data into a lightweight markup language file;

[0099] a parsing unit configured to parse the lightweight markup language file to obtain a plurality of atomic facts corresponding thereto;

[0100] a mapping unit configured to add a path index to each of the atomic facts, and map each of the atomic facts and the corresponding path index to a node and an edge in the financial knowledge graph to obtain a target financial knowledge graph corresponding to the financial data.

[0101] In a specific embodiment, the data confusion module 12 can include:

[0102] a sampling sub-module configured to sample each of the path indexes according to a preset sampling manner to obtain a target fact;

[0103] a strategy determination unit configured to determine a target confusion strategy associated with the target fact from a plurality of preset confusion strategies;

[0104] a data confusion sub-module configured to confuse the target fact and other facts except the target fact according to the target confusion strategy to obtain corresponding confused data.

[0105] In another specific embodiment, the sampling sub-module can include:

[0106] a sampling unit configured to randomly sample each of the path indexes to obtain a target path index;

[0107] a first text block recall unit configured to recall a corresponding text block from the financial data based on an atomic fact corresponding to the target path index to obtain a target fact.

[0108] In yet another specific embodiment, the data confusion sub-module can include:

[0109] The second text block recall unit is configured to recall, according to the target confusion strategy, a text block associated with the target fact from the financial data by using a target search method, to obtain a to-be-confused fact, wherein the target search method is a keyword search method or a text vector search method.

[0110] The data confusion unit is configured to confuse the target fact and the to-be-confused fact to obtain corresponding confused data.

[0111] In a specific embodiment, the model optimization module 13 can include:

[0112] The question generation unit is configured to generate an illusion question for knowledge question and answer of the initial financial field large model based on the confused data.

[0113] The result acquisition unit is configured to acquire a model output result corresponding to the illusion question output by the initial financial field large model.

[0114] The model optimization sub-module is configured to perform illusion evaluation on the model output result, and perform training and optimization on the initial financial field large model based on a corresponding illusion evaluation result.

[0115] In another specific embodiment, the model optimization sub-module can include:

[0116] The illusion evaluation unit is configured to perform illusion evaluation on the model output result by using a preset illusion evaluation model, to obtain a corresponding illusion evaluation result.

[0117] The data collection unit is configured to collect all data of a knowledge question and answer operation corresponding to the model output result when the illusion evaluation result indicates that the model output result has an illusion.

[0118] The model optimization unit is configured to perform training and optimization on the initial financial field large model based on the all data.

[0119] Further, the embodiments of the present application also disclose an electronic device, Figure 4 is a structure diagram of an electronic device 20 according to an exemplary embodiment, and the content in the figure cannot be considered as any limitation on the use range of the present application.

[0120] Figure 4A structural schematic diagram of an electronic device 20 is provided in the embodiments of the present application. The electronic device 20 can 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 is configured to store a computer program, and the processor 21 is configured to load and execute the computer program to implement the related steps in the method for answering questions in the financial field based on a large language model disclosed in any of the preceding embodiments. In addition, the electronic device 20 in the embodiments of the present application can be an electronic computer.

[0121] In the embodiments of the present application, the power supply 23 is configured to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 is capable of creating a data transmission channel between the electronic device 20 and external devices, and the communication protocol followed by the communication interface 24 can be any communication protocol applicable to the technical solution of the present application, which is not limited specifically herein; the input / output interface 25 is configured to obtain external input data or output data to the outside, and the specific interface type can be selected according to the specific application needs, which is not limited specifically herein.

[0122] In addition, the memory 22 as a carrier for resource storage can be a read-only memory, a random access memory, a magnetic disk, or an optical disk, etc., and the resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage mode can be temporary storage or permanent storage.

[0123] The operating system 221 is configured to manage and control each hardware device on the electronic device 20 and the computer program 222, and can be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program capable of completing the method for answering questions in the financial field based on a large language model executed by the electronic device 20 disclosed in any of the preceding embodiments, the computer program 222 can further include computer programs capable of completing other specific work.

[0124] Further, the present application also discloses a computer readable storage medium for storing a computer program; wherein the computer program is executed by a processor to implement the method for answering questions in the financial field based on a large language model disclosed in the preceding embodiments. The specific steps of the method can refer to the corresponding contents disclosed in the preceding embodiments, which will not be repeated here.

[0125] The embodiments in the present specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts of each embodiment can be referred to each other. For the device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant parts can refer to the method part.

[0126] Those skilled in the art will further appreciate that the units and algorithm steps of the examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or any combination thereof. To clearly illustrate the interchangeability of hardware and software, various components have been described above generally in terms of their functionality, without referring to the details of their implementation. Whether such functionality is implemented in hardware or software depends on the particular application and design constraints imposed on the overall system. Skilled persons can implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.

[0127] The steps of a method or algorithm described in connection with the embodiments disclosed herein can be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module can reside in random access memory (RAM), flash memory, read-only memory (ROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0128] Finally, it should be noted that the terms "first", "second", and the like, herein do not denote any order, quantity, combination, or importance, but are used to distinguish one entity or action from another, and do not imply any such actual relationship or order. Also, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by "comprises a" does not, without more constraints, foreclose additional identical elements.

[0129] The above has introduced the technical solutions provided by the present application in detail, and the principles and implementation manners of the present application have been described by applying specific examples. The above description of the examples is only applicable to help understand the method and core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range can be changed, and the above description of the present application should not be understood as a limitation.

Claims

1. A method for answering questions in the financial field based on a large language model, characterized in that, The method comprises the following steps: determining a target financial knowledge graph corresponding to the financial data; the target financial knowledge graph is a financial knowledge graph constructed based on atomic facts and corresponding path indexes of the financial data; according to a preset confusion strategy, the target fact and other atomic facts are confused to obtain corresponding confused data; the target fact is a fact obtained by sampling each path index; based on the model output result corresponding to the confused data generated by the initial financial domain large model, the initial financial domain large model is trained and optimized to obtain an optimized financial domain large model; when a to-be-processed financial domain question is obtained, the optimized financial domain large model is used to generate a question reply content corresponding to the to-be-processed financial domain question.

2. The large language model-based financial field knowledge question answering method according to claim 1, characterized in that, The method comprises the following steps: convert the financial data into a lightweight markup language file; parsing the lightweight markup language file to obtain a plurality of atomic facts; add a path index to each atomic fact, and map each atomic fact and the corresponding path index to a node and an edge in the financial knowledge graph to obtain the target financial knowledge graph corresponding to the financial data.

3. The large language model-based financial field knowledge question answering method according to claim 1, characterized in that, The method comprises the following steps: according to a preset sampling method, a target fact is obtained by sampling each path index; determine a target confusion strategy that has an association relationship with the target fact from the preset confusion strategy; according to the target confusion strategy, the target fact and other facts except the target fact are confused to obtain corresponding confused data.

4. The method according to claim 3, wherein, The method comprises the following steps: randomly sampling each path index to obtain a target path index; based on the atomic fact corresponding to the target path index, the corresponding text block is recalled from the financial data to obtain the target fact.

5. The large language model-based financial field knowledge question answering method according to claim 3, characterized in that, The method comprises the following steps: according to the target confusion strategy, a target search method is used to recall a text block having an association relationship with the target fact from the financial data to obtain a to-be-confused fact; the target search method is a keyword search method or a text vector search method; the target fact and the to-be-confused fact are confused to obtain corresponding confused data.

6. The large language model-based financial field knowledge question answering method according to any one of claims 1 to 5, characterized in that, The method comprises the following steps: based on the confused data, an illusion question for knowledge question and answer of the initial financial domain large model is generated; obtain the model output result corresponding to the illusion question output by the initial financial domain large model; perform illusion evaluation on the model output result, and train and optimize the initial financial domain large model based on the corresponding illusion evaluation result.

7. The method according to claim 6, wherein, The model output result is hallucination evaluated, and the initial financial field large model is trained and optimized based on the corresponding hallucination evaluation result, including: The hallucination evaluation model is used to evaluate the model output result, and the corresponding hallucination evaluation result is obtained; If the hallucination evaluation result represents that the model output result has hallucination, collect all data of the knowledge question and answer operation corresponding to the model output result; Based on the all data, the initial financial field large model is trained and optimized.

8. A large language model-based financial field knowledge question answering device, characterized by, Including: A financial knowledge graph determination module is configured to determine a target financial knowledge graph corresponding to financial data; The target financial knowledge graph is a financial knowledge graph constructed based on atomic facts and corresponding path indexes of the financial data; A data confusion module is configured to confuse target facts and other atomic facts according to a preset confusion strategy to obtain corresponding confused data; The target fact is a fact obtained by randomly sampling each path index; A model optimization module is configured to train and optimize the initial financial field large model based on model output results corresponding to the confused data generated by the initial financial field large model, to obtain an optimized financial field large model; A knowledge question and answer module is configured to generate a question and answer reply content corresponding to a to-be-processed financial field question using the optimized financial field large model when the to-be-processed financial field question is obtained.

9. An electronic device, comprising: Including: A memory is configured to save a computer program; A processor is configured to execute the computer program to implement the financial field knowledge question and answer method based on a large language model according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, A memory is configured to save a computer program, and the computer program is executed by a processor to implement the financial field knowledge question and answer method based on a large language model according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Sample data construction method and question and answer model training method

    CN118227731A

  • Illusion detection method and device based on semantic embedding and structural entropy detection

    CN119446427A

  • Inintegrity knowledge graph question answering method and device based on triple retrieval enhancement

    CN120994764A