Method for financial text generation error correction based on MRAG and ACD

By constructing a multimodal compliance knowledge base using MRAG and ACD technologies, and constraining the output of large language models in real time, the problem of compliance illusion in the financial field of large language models is solved. This achieves deterministic compliance control and smooth content generation, reduces maintenance costs, and provides personalized compliance strategies.

CN122242781BActive Publication Date: 2026-07-31XIDIAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
XIDIAN UNIV
Filing Date
2026-05-22
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing large language models exhibit a compliance illusion in the financial field, failing to strike a balance between ensuring compliance and certainty. This results in generated content that may violate financial regulations, and current technological methods cannot effectively address this issue.

Method used

By employing MRAG and ACD technologies, a multimodal compliance knowledge base is constructed. Through semantic mapping and cross-modal anchor alignment, a compliance tensor is generated to constrain the output of a large language model in real time, enabling violation detection and semantic smooth replacement. Furthermore, the compliance of the generated content is ensured through logical anomaly detection and state backtracking mechanisms.

Benefits of technology

It achieves deterministic compliance control of large language models in financial scenarios, ensuring the fluency and usability of generated content, while reducing maintenance costs, providing personalized compliance constraint strategies, and avoiding the drawbacks of one-size-fits-all risk control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122242781B_ABST
    Figure CN122242781B_ABST
Patent Text Reader

Abstract

This application relates to the fields of artificial intelligence and financial technology, and in particular to a financial text generation and error correction method based on MRAG and ACD. The method includes: performing semantic mapping processing and cross-modal anchor alignment on financial regulatory data, financial product data, and target user data to construct a multimodal compliance knowledge base; generating a compliance tensor with the same vocabulary dimension as the output of a large language model based on the current session context, the target financial products involved, and the multimodal compliance knowledge base; performing violation detection and semantic smoothing replacement on the output of the large language model under the constraints of the compliance tensor to generate a compliance-corrected response text; performing perplexity-based logical anomaly detection on the compliance-corrected response text; generating a logical anomaly prompt and backtracking the state of the large language model when a logical anomaly is detected, until no logical anomaly is detected, and obtaining the optimal response text to reply to the target customer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this application relate to the fields of artificial intelligence and financial technology, and in particular to a financial text generation and error correction method based on MRAG and ACD. Background Technology

[0002] In recent years, large language models have made groundbreaking progress in natural language understanding and generation tasks, and have been rapidly and widely applied in the financial sector, covering multiple core business scenarios such as robo-advisors, automated research report generation, customer service Q&A, and compliance review. These large language models, relying on massive amounts of pre-trained data, have demonstrated powerful semantic understanding and multi-turn dialogue capabilities, greatly improving the efficiency and reach of financial services.

[0003] However, large language models are essentially probabilistic predictive models, whose core mechanism is to predict the next most probable word based on context. This "probabilistic generation" characteristic inherently contradicts the extreme requirements of compliance, rigor, and certainty in the financial industry. In practical applications, especially in scenarios involving strict regulations, existing large language models or industry models with initial fine-tuning often exhibit a "compliance illusion." This "compliance illusion" refers to the phenomenon where the content generated by the model appears fluent and logically consistent, but in reality violates mandatory financial regulations. For example, the model might recommend high-risk stocks or futures products to clients with a conservative risk tolerance, or use absolute promises such as "risk-free" or "guaranteed profit" in financial product descriptions, or even omit risk disclosure statements mandated by regulations. This not only exposes financial institutions to significant regulatory penalties but may also mislead investors about their assets.

[0004] In response to the "compliance illusion" phenomenon, existing technologies have mainly adopted three mainstream technical approaches.

[0005] The first approach is supervised fine-tuning. This method constructs a large amount of high-quality compliance question-and-answer pairs and performs full or efficient parameter fine-tuning on the basic model, attempting to internalize regulatory rules into the model's weights. However, this method has limitations: First, financial regulatory policies are frequently updated, and compliance requirements vary in timeliness and type across different regions and financial products. Frequent retraining of the model is not only computationally expensive but also prone to "catastrophic forgetting," meaning the model loses its original ability to learn new rules. Second, fine-tuning can only reduce the probability of violations; it cannot fundamentally eliminate the possibility that the model will output illegal content under specific prompts.

[0006] The second approach is based on retrieval-enhanced generation. This method retrieves relevant regulatory fragments or product documents from an external knowledge base when a user asks a question, and then feeds the retrieved content as contextual input to the model. While retrieval-enhanced generation can alleviate information lag to some extent, it is essentially an extension of prompt word engineering. Because the attention mechanism of large language models may experience "attention loss" when processing long texts, or because the weights of erroneous knowledge accumulated during pre-training are too high, the model may still ignore some constraints and output non-compliant suggestions that do not match the retrieval results, even if it sees compliant documents. Furthermore, simple text retrieval struggles to handle the logical mapping between structured user data and unstructured regulatory regulations.

[0007] The third approach is based on post-event detection and filtering. This method involves scanning for compliance using keyword matching or a review model after the model generates a complete response, and intercepting or replacing any content that violates regulations. This strategy also has limitations: First, reviewing the complete text after generation introduces significant reasoning delays, failing to meet the needs of real-time interaction; second, simplistic keyword blocking often results in the output being forcibly truncated, left blank, or replaced with rigid, generic responses, severely disrupting the flow of the conversation and the user experience; finally, many compliance risks are hidden within complex logical reasoning, making these implicit violations difficult to identify effectively using simple keywords.

[0008] It is evident that existing technologies, when dealing with the compliance issues of financial language models, either cannot guarantee that the generated content is compliant, or they sacrifice the real-time performance of the model and the fluency of the text, thus failing to meet user needs. Summary of the Invention

[0009] To address the aforementioned technical issues, embodiments of this application propose a financial text generation and error correction method based on MRAG and ACD. This method aims to utilize two core technologies, MRAG (Multimodal Retrieval Augmented Generation) and ACD (Adaptive Constraint Decoding), combined with multimodal user states and regulatory rules, to perform real-time, adaptive constraints and logical corrections on the generation probability distribution. This ensures financial compliance while maintaining high-quality text generation capabilities.

[0010] To achieve the above objectives, embodiments of this application propose a financial text generation and error correction method based on MRAG and ACD, comprising: performing semantic mapping processing and cross-modal anchor alignment on financial regulatory data, financial product data, and user data of the target user to construct a multimodal compliance knowledge base; upon receiving a question from the target user, a large language model performs reasoning to obtain a large language model output vocabulary, and simultaneously generates a compliance tensor with the same dimension as the large language model output vocabulary based on the current conversation context, the target financial products involved, and the multimodal compliance knowledge base; under the constraint of the compliance tensor, referring to the multimodal compliance knowledge base, performing violation detection and semantic smoothing replacement on the lexical units in the large language model output vocabulary to generate a compliance-corrected response text; performing perplexity-based logical anomaly detection on the compliance-corrected response text, generating a logical anomaly prompt when a logical anomaly is detected, performing large language model state backtracking, and regenerating the compliance-corrected response text under the dual constraints of the dynamic compliance tensor and the logical anomaly prompt, referring to the multimodal compliance knowledge base, until no logical anomalies are detected, obtaining the optimal response text and replying to the target customer.

[0011] To achieve the above objectives, embodiments of this application also propose a financial text generation and error correction system based on MRAG and ACD, comprising: a multimodal compliance knowledge base construction module, a compliance tensor generation module, a compliance correction module, and a logic correction module; the multimodal compliance knowledge base construction module is used to perform semantic mapping processing and cross-modal anchor point alignment on financial regulatory data, financial product data, and user data of target users to construct a multimodal compliance knowledge base; the compliance tensor generation module is used to, after receiving a question from a target user, use a large language model for reasoning to obtain the output vocabulary of the large language model, and simultaneously generate a vocabulary that matches the large language model output vocabulary based on the current conversation context, the target financial products involved, and the multimodal compliance knowledge base. The model outputs a compliance tensor with the same vocabulary dimension. The compliance correction module, under the constraints of the compliance tensor and referencing a multimodal compliance knowledge base, performs violation detection and semantic smoothing replacement on the lexical units in the large language model's output vocabulary, generating a compliance-corrected response text. The logic correction module performs perplexity-based logic anomaly detection on the compliance-corrected response text. If a logic anomaly is detected, a logic anomaly prompt is generated, and the large language model's state is backtracked. Under the dual constraints of the dynamic compliance tensor and the logic anomaly prompt, and referencing the multimodal compliance knowledge base, the compliance-corrected response text is regenerated until no logic anomalies are detected. Finally, the optimal response text is obtained and sent to the target customer.

[0012] To achieve the above objectives, embodiments of this application also propose an electronic device comprising a processor and a memory, wherein the memory stores instructions executable by the processor, and the processor is configured to execute the instructions such that the electronic device can implement a financial text generation and error correction method based on MRAG and ACD as described above.

[0013] To achieve the above objectives, embodiments of this application also propose a computer-readable storage medium storing a computer program that, when executed by a processor, enables a financial text generation and error correction method based on MRAG and ACD as described above.

[0014] Optionally, financial regulatory data, financial product data, and target user data include two modalities: unstructured text data and structured data. Unstructured text data includes financial regulatory rules, financial business specifications, service manuals for financial products, risk disclosure texts for financial products, and historical dialogue texts of target users. Structured data includes product risk ratings, product categories, return attributes, suitability rules for financial products, as well as user profiles, risk tolerance levels, asset information, and investment preferences of target users. For unstructured text data, natural language processing methods including sentence segmentation, word segmentation, entity recognition, relation extraction, and rule induction are used to extract constraint objects, prohibited behaviors, applicable conditions, and exception conditions. For structured data, core fields are extracted through database interfaces, configuration interfaces, and business middleware interfaces; By semantically mapping the constraint objects, prohibited behaviors, applicable conditions, and exception conditions with the core fields and aligning them with cross-modal anchors, a semantic anchoring relationship is established, thereby constructing a multimodal compliance knowledge base; The multimodal compliance knowledge base is implemented in the form of a knowledge graph. Its nodes include at least regulatory nodes, product nodes, user nodes, behavior nodes, prohibited words nodes, and alternative suggestion nodes. The edge relationships between nodes include at least permission, prohibition, adaptation, substitution, and explanation.

[0015] Optionally, generating a compliance tensor with the same vocabulary dimension as the output of the large language model, based on the current session context, the target financial products involved, and the multimodal compliance knowledge base, includes: Based on the current conversation context, the target financial products involved, and the multimodal compliance knowledge base, the prohibited word set, restricted expression set, and compliant alternative expression set are identified at the current moment. Among them, the prohibited word set and the restricted expression set together constitute the taboo domain. The prohibited word set includes at least the names of financial products that are not allowed to be recommended, illegal profit promises, and illegal transaction guidance words. The restricted expression set includes at least vague profit statements, absolute recommendation statements, statements that downplay risks, instructions for trading, and marketing inducement statements. The compliant alternative expression set includes at least risk explanation statements, suitability explanation statements, and the names of alternative financial products with matching risk levels. Based on the current set of prohibited words, restricted expressions, and compliant alternative expressions, a compliance tensor is generated for the current moment; the dimension of the compliance tensor is the same as the dimension of the vocabulary output by the large language model.

[0016] Optionally, the compliance tensor for the current moment is generated based on the current set of prohibited words, restricted expressions, and compliant alternative expressions, using the following formula: ; ; ; , ; in, For scope functions, Output a vocabulary for the large language model. Output the first word of the vocabulary for the large language model Each word element, , , These are, respectively, the set of prohibited words, the set of restricted expressions, and the set of compliant alternative expressions at the current moment. To suppress weight for prohibited words, To limit expression suppression weights, To increase weight for compliance alternatives For the generated compliance tensor at the current moment, for The first in One element, Output the total number of lexical units in the vocabulary for the large language model.

[0017] Optionally, under the constraints of the compliance tensor, and with reference to a multimodal compliance knowledge base, violation detection and semantic smoothing replacement are performed on the lexical units in the output vocabulary of the large language model to generate a compliance-corrected response text, including: Extracting large language models for word-by-word decoding, used to generate... The original output Logits vector ; Will As a constraint, it is embedded in In the process, the compliance-corrected Logits vector is obtained. and based on Calculate the probability distribution of compliance constraints ; The calculation formula is: ; ; in, For the Softmax function, The preset temperature coefficient, This is a preset compliance constraint coefficient; exist Based on this, select the top probability rankings The candidate words constitute the candidate word set. ; like At least one candidate word did not fall into the category of and The forbidden domain formed Then the candidate word with the highest probability ranking will be selected as the first... A compliant and corrected terminology ; like All candidate words fell into Then for Conduct violation intent identification and determine the violation intent. And based on the current session context and Generate query vectors ; This can be expressed by the formula: ; ; in, This is a mapping function for illegal intents, pointing to multiple preset illegal intents. This indicates that encoding is being performed; based on Semantic queries are performed in the multimodal compliance knowledge base, and the results with the highest semantic similarity that do not fall into the same category are selected. The word as the first A compliant and corrected terminology ; Based on all the compliant and corrected terms, generate the compliant and corrected response text.

[0018] Optionally, the step of performing perplexity-based logical anomaly detection on the compliant and corrected response text includes: Based on length The sliding detection window performs local perplexity calculation on the compliant and corrected response text. The compliant and corrected response text has a length of [missing information]. Compliance-corrected lexical sequence Therefore, it is necessary to conduct The calculation of local perplexity; where... ; Let the first The local perplexity of each sliding detection window is , The calculation process is expressed by the formula: ; in, Indicates to The conditional probability; like Greater than the preset perplexity tolerance threshold Then directly determine the first If a sliding detection window has a logical anomaly, then... Based on semantic consistency and rule consistency, a comprehensive anomaly score is calculated. ; The calculation process is expressed by the formula: ; in, The semantic consistency score, i.e., the first... A sliding detection window and Cosine similarity in semantic vector space The rule consistency score represents the first... The sliding detection window checks the integrity of the subject-verb-object structure and the presence of redundant expressions. , , They are respectively , , The corresponding weighting coefficients, ; like If it is greater than 1, then determine the first... If the sliding detection window has a logical anomaly, then the first sliding window is determined to be normal; otherwise, the second sliding window is determined to be normal. There are no logical anomalies in the sliding detection window; If it is determined that there are no logical anomalies in all sliding detection windows, the compliant and corrected response text will be used as the optimal response text and sent to the target customer.

[0019] Optionally, upon detecting a logical anomaly, a logical anomaly prompt is generated, and a large language model state backtracking is performed. Under the dual constraints of the dynamic compliance tensor and the logical anomaly prompt, and with reference to the multimodal compliance knowledge base, a compliance-corrected response text is regenerated, including: Assume the judgment of the first If the sliding detection window has a logical anomaly, then for the first... A logic exception message is generated in the sliding detection window. Simultaneously, backtracking the large language model state back to the generation state is performed. Before; Will As a constraint, with Embed together In the process, the Logits vector after compliance logic correction is obtained. and based on Calculate the probability distribution of compliance logic constraints ; The calculation formula is: ; ; in, These are the preset logical constraint coefficients; exist Based on this, select the top probability rankings The candidate words constitute the candidate word set. ; like At least one candidate word did not fall into the category. Then, the candidate word with the highest probability ranking will be used as the new lexical unit after compliance correction. ; like All candidate words fell into Then for Conduct violation intent identification and determine the violation intent. And based on the current session context and Generate query vectors ; This can be expressed by the formula: ; ; based on Semantic queries are performed in the multimodal compliance knowledge base, and the results with the highest semantic similarity that do not fall into the same category are selected. The lexical units as new compliant revised lexical units ; Generate a new compliance-corrected response text based on all the new compliance-corrected terms.

[0020] This application proposes a financial text generation and error correction method based on MRAG and ACD, which has the following improvements compared with traditional financial big language model compliance illusion elimination methods.

[0021] First, deterministic compliance control is achieved. Based on the current session context, the target financial products involved, and a multimodal compliance knowledge base, this application dynamically generates a compliance tensor. Under the constraints of the compliance tensor and with reference to the multimodal compliance knowledge base, violation detection and semantic smoothing replacement are performed on the lexical units in the output vocabulary of the large language model. This directly shields the possibility of generating high-risk violation words from the decoding layer, eliminating the influence of compliance illusion.

[0022] Secondly, it ensures the fluency and usability of the generated content. Unlike traditional methods that cause dialogue truncation due to keyword filtering, this application, through semantic substitution and state backtracking mechanisms, endows the large language model with the ability to self-correct, ensuring the logical coherence of the generated content.

[0023] Third, maintenance costs are low. This application decouples financial regulatory data, financial product data, and target user data from the reasoning logic of the large language model. Changes only require updating the multimodal compliance knowledge base, without needing to retrain the large language model, effectively reducing cost investment.

[0024] Fourth, it achieves personalized and precise control. By integrating users' multimodal data, this application generates differentiated compliance constraint strategies for users with different risk levels, avoiding the drawbacks of a one-size-fits-all risk control approach. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies of this application will be briefly introduced below. The following drawings are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. The drawings described herein are only used to explain this application and are not intended to limit this application.

[0026] Figure 1 This is a flowchart of a financial text generation and error correction method based on MRAG and ACD provided in one embodiment of this application; Figure 2This is a schematic diagram illustrating the construction of a multimodal compliance knowledge base provided in one embodiment of this application; Figure 3 This is a schematic diagram of generating compliant tensors provided in one embodiment of this application; Figure 4 This is a schematic diagram illustrating the generation of a compliance-corrected response text provided in one embodiment of this application; Figure 5 This is a schematic diagram of logic anomaly detection provided in one embodiment of this application; Figure 6 This is a comparison chart of the compliance accuracy and overall error correction effect of the method provided in one embodiment of this application with other methods (supervised fine-tuning, retrieval enhancement generation, and post-detection). Figure 7 This is a schematic diagram of the structure of a financial text generation and error correction system based on MRAG and ACD provided in another embodiment of this application; Figure 8 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation

[0027] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the various embodiments of this application will be described in detail below with reference to the accompanying drawings. Those skilled in the art will understand that many technical details have been presented in the embodiments of this application to facilitate better understanding. However, the technical solutions claimed in this application can be implemented even without these technical details and various variations and modifications based on the following embodiments. The division of the following embodiments is for ease of description and should not constitute any limitation on the specific implementation of this application. The following embodiments can be combined with and referenced by each other without contradiction.

[0028] One embodiment of this application proposes a financial text generation and error correction method based on MRAG and ACD. The implementation details of the financial text generation and error correction method based on MRAG and ACD proposed in this embodiment are described in detail below. The following implementation details are provided for ease of understanding only and are not necessary for implementing this solution.

[0029] The specific process of the financial text generation and error correction method based on MRAG and ACD proposed in this embodiment can be described as follows: Figure 1 As shown, it includes: Step 101 involves semantic mapping and cross-modal anchor alignment of financial regulatory data, financial product data, and target user data to construct a multimodal compliance knowledge base.

[0030] Specifically, the multimodal compliance knowledge base is the underlying data support for financial text generation and error correction. Therefore, we need to perform semantic mapping processing and cross-modal anchor alignment on financial regulatory data, financial product data, and user data of target users to build a multimodal compliance knowledge base, so as to solve the technical problem that traditional retrieval enhancement methods rely solely on text similarity and cannot handle structured logical constraints.

[0031] In one example, financial regulatory data, financial product data, and target user data include two modalities: unstructured text data and structured data. Unstructured text data includes financial regulatory rules, financial business specifications, service manuals for financial products, risk disclosure texts for financial products, and historical dialogue texts of target users. Structured data includes product risk ratings, product categories, return attributes, and suitability rules for financial products, as well as user profiles, risk tolerance levels, asset information, and investment preferences of target users.

[0032] In one example, the construction process of a multimodal compliance knowledge base can be as follows: Figure 2 As shown, it is mainly divided into three parts: unstructured text data processing, structured data processing, and semantic mapping processing and cross-modal anchor alignment.

[0033] For unstructured text data, natural language processing methods, including sentence segmentation, word segmentation, entity recognition, relation extraction, and rule induction, are used to extract constraints, prohibited behaviors, applicable conditions, and exceptions. For structured data, core fields are extracted through database interfaces, configuration interfaces, and business platform interfaces.

[0034] After extraction, the constraint objects, prohibited behaviors, applicable conditions, and exception conditions are semantically mapped to the core fields and aligned with cross-modal anchors (using similarity calculation logic and rule-based matching logic) to establish semantic anchoring relationships, thereby constructing a multimodal compliance knowledge base. Specifically, the multimodal compliance knowledge base is implemented in the form of a knowledge graph, whose nodes include at least regulatory nodes, product nodes, user nodes, behavior nodes, prohibited language nodes, and alternative suggestion nodes. The edge relationships between nodes include at least allow, prohibit, adapt, substitute, and require explanation.

[0035] In one example, to enable textual constraints to directly participate in calculations, this embodiment establishes a unified mapping relationship between user risk levels and product risk levels. For instance, user levels C1 to C5 and product levels R1 to R5 can be mapped to the same ordered numerical space. If a user's risk tolerance (user level) is lower than the risk of the target product (product level), it constitutes a scenario where recommendations are prohibited, inducements to trade are prohibited, or additional explanations are required.

[0036] By constructing a multimodal compliance knowledge base, this embodiment successfully transforms institutional and rule-based descriptions, such as "high-risk products should not be recommended to conservative clients," into a searchable, computable, and callable rule structure, providing a foundation for the subsequent generation of constraints (compliance tensors).

[0037] Step 102: After receiving a question from the target user, the large language model performs reasoning to obtain the output vocabulary of the large language model. At the same time, based on the current conversation context, the target financial products involved, and the multimodal compliance knowledge base, a compliance tensor with the same dimensions as the output vocabulary of the large language model is generated.

[0038] Specifically, after receiving a question from the target user, the large language model immediately performs inference, and we obtain the output vocabulary of the large language model. At the same time, based on the current conversation context, the target financial products involved, and the multimodal compliance knowledge base, we generate a compliance tensor with the same dimensions as the output vocabulary of the large language model to determine the scope of compliance constraints corresponding to this round of dialogue.

[0039] It is important to note that after receiving a question from the target user, the large language model begins to infer and output. Its output includes the original output Logits vector and the large language model output vocabulary. According to the traditional method, the response text should be generated based on the large language model output vocabulary at this time. However, this embodiment does not do so. The large language model output vocabulary is only one of the references for generating the compliance tensor, and is not the basis for the final generation of the response text.

[0040] In one example, the process of generating a compliant tensor can be as follows: Figure 3 As shown.

[0041] First, based on the current session context, the target financial products involved, and the multimodal compliance knowledge base, the prohibited word set, restricted expression set, and compliant alternative expression set are identified at the current moment. The prohibited word set and restricted expression set together constitute the taboo domain. The prohibited word set includes the names of financial products that are not allowed to be recommended, illegal profit promises, and illegal transaction guidance words. The restricted expression set includes vague profit statements, absolute recommendation statements, statements that downplay risks, directive transaction guidance statements, and marketing inducement statements. The compliant alternative expression set includes at least risk explanation statements, suitability description statements, and names of alternative financial products with matching risk levels.

[0042] Subsequently, a compliance tensor can be generated based on the current set of prohibited words, restricted expressions, and compliant alternative expressions. The dimensionality of this compliance tensor is the same as that of the vocabulary output by the large language model.

[0043] In one example, the compliance tensor for the current time step is generated based on the current set of prohibited words, restricted expressions, and compliant alternative expressions. This can be achieved using the following formula: ; ; ; , ; in, For scope functions, Output a vocabulary for the large language model. Output the first word of the vocabulary for the large language model Each word element, , , These are, respectively, the set of prohibited words, the set of restricted expressions, and the set of compliant alternative expressions at the current moment. To suppress weight for prohibited words, To limit expression suppression weights, To increase weight for compliance alternatives For the generated compliance tensor at the current moment, for The first in One element, Output the total number of lexical units in the vocabulary for the large language model.

[0044] Understandably, in the compliance tensor, the index positions corresponding to prohibited words are assigned extremely negative values, while the positions of compliant words remain zero or positive. The compliance tensor is dynamically refreshed as the dialogue progresses to adapt to contextual changes in multi-turn conversations, mathematically blocking the sampling probability of prohibited words. Through compliance negotiation, we can transform the rule information originally existing in the knowledge base into real-time constraint vectors that directly affect the model's vocabulary space. In other words, this embodiment does not perform post-processing review after the model is generated, but rather pre-corrects the candidate output space before each step of the large language model's generation, thereby achieving proactive risk control.

[0045] In practical applications, if a violating entity consists of multiple sub-words, constraints need to be applied to all sub-word units corresponding to that entity simultaneously to prevent large language models from bypassing restrictions through word segmentation paths. Synonyms, abbreviations, synonyms, and highly similar expressions can also be synchronously suppressed through word list mapping relationships.

[0046] Step 103: Under the constraints of the compliance tensor, referencing the multimodal compliance knowledge base, perform violation detection and semantic smoothing replacement on the lexical units in the output vocabulary of the large language model to generate the compliance-corrected response text.

[0047] Specifically, after generating the compliance tensor, under the constraints of the compliance tensor, and with reference to the multimodal compliance knowledge base, violation detection and semantic smoothing replacement can be performed on the lexical units in the output vocabulary of the large language model to generate a compliance-corrected response text. This preserves the naturalness of the generated text and improves the business usability of the output results.

[0048] In one example, the process of generating the compliance-corrected response text can be as follows: Figure 4 As shown, after the large language model enters the word-by-word decoding stage, the basic output of the large language model can be fused with the compliance tensor to form a constrained generation distribution. If the high-probability candidate words in the basic output of the large language model contain prohibited recommended products, exaggerated benefits, or suggestive action words, then the dynamic compliance tensor is used to suppress their probability, and a moderate boost is applied to compliant alternative expressions, guiding the large language model to complete semantic correction without interrupting the generation flow.

[0049] First, extract the language model used for word-by-word decoding to generate... The original output Logits vector .

[0050] Then, As a constraint, it is embedded in In the process, the compliance-corrected Logits vector is obtained. and based on Calculate the probability distribution of compliance constraints .

[0051] The calculation formula is: ; ; in, For the Softmax function, The preset temperature coefficient, This is the preset compliance constraint coefficient.

[0052] Next, in Based on this, select the top probability rankings The candidate words constitute the candidate word set. and judge Do all candidate words fall into the range of words provided by the system? and The forbidden domain formed .

[0053] like At least one candidate word did not fall into the category of and The forbidden domain formed Then the candidate word with the highest probability ranking will be selected as the first... A compliant and corrected terminology .

[0054] like All candidate words fell into Then for Conduct violation intent identification and determine the violation intent. And based on the current session context and Generate query vectors .

[0055] This can be expressed by the formula: ; ; in, This is a mapping function for illegal intents, pointing to multiple preset illegal intents. This indicates that encoding is being performed.

[0056] After that, based on Semantic queries are performed in the multimodal compliance knowledge base, and the results with the highest semantic similarity that do not fall into the same category are selected. The word as the first A compliant and corrected terminology .

[0057] Finally, based on all the compliantly corrected terms, a compliantly corrected response text is generated.

[0058] In one example, when a user's level is insufficient to purchase a high-risk product, this embodiment does not simply block the product name and force the model to passively replace the words. Instead, it actively guides the model to generate expressions that are more in line with the financial service process, such as "this product has a high risk level," "it does not match your risk tolerance at the moment," and "you can give priority to alternative products with lower risk levels." This preserves the naturalness of the generated text and improves the business usability of the output results.

[0059] Step 104: Perform perplexity-based logic anomaly detection on the compliance-corrected response text. If a logic anomaly is detected, generate a logic anomaly prompt and perform state backtracking of the large language model. Under the dual constraints of the dynamic compliance tensor and the logic anomaly prompt, refer to the multimodal compliance knowledge base to regenerate the compliance-corrected response text until no logic anomalies are detected. Then, obtain the optimal response text and reply to the target customer.

[0060] Specifically, in financial scenarios, even if the large language model is already constrained by the compliance tensor, another type of problem may still arise: the generated text may no longer appear to be directly non-compliant, but the internal logic may be inconsistent. For example, after replacing the name of a high-risk, high-return product with a low-risk product, if subsequent text continues with incompatible semantic fragments such as "20% return" and "rapid doubling," significant business logic conflicts will occur. To address this, this embodiment selects to perform perplexity-based logic anomaly detection on the compliance-corrected response text. If a logic anomaly is detected, a logic anomaly prompt is generated, and the large language model state is backtracked. Under the dual constraints of the dynamic compliance tensor and the logic anomaly prompt, and with reference to the multimodal compliance knowledge base, the compliance-corrected response text is regenerated until no logic anomalies are detected. The optimal response text is then obtained and sent to the target customer, thereby improving the logical integrity and compliance stability of the response text.

[0061] In one example, a concrete implementation of perplexity-based logical anomaly detection can be found in [reference needed]. Figure 5 .

[0062] First, a sliding detection window is used to calculate the local perplexity of the revised response text after compliance. It's understandable that the logical consistency of the revised response text cannot be judged by a single word; it must be comprehensively evaluated in conjunction with the preceding and following words. Therefore, based on a length of... The sliding detection window performs local perplexity calculation on the compliant and corrected response text. The compliant and corrected response text has a length of [missing information]. Compliance-corrected lexical sequence Therefore, it is necessary to conduct Secondary local perplexity calculation. Among them, .

[0063] Assumption Take 4. Taking 20 means that the local perplexity is calculated based on 4 tokens each time. For a compliant and corrected response text with a length of 20 tokens, a total of 17 calculations are required.

[0064] Let the first The local perplexity of each sliding detection window is , The calculation process is expressed by the formula: ; in, Indicates to The conditional probability.

[0065] In the calculation Then, it is necessary to judge Is it greater than the preset perplexity tolerance threshold? ,if Greater than the preset perplexity tolerance threshold Then directly determine the first If a sliding detection window has a logical anomaly, then... Based on semantic consistency and rule consistency, a comprehensive anomaly score is calculated. .

[0066] The calculation process is expressed by the formula: ; in, The semantic consistency score, i.e., the first... A sliding detection window and Cosine similarity in semantic vector space The rule consistency score represents the first... The sliding detection window checks the integrity of the subject-verb-object structure and the presence of redundant expressions. , , They are respectively , , The corresponding weighting coefficients, .

[0067] In the calculation Then, it is necessary to judge Is it greater than 1? If it is greater than 1, then determine the first... If the sliding detection window has a logical anomaly, then the first sliding window is determined to be normal; otherwise, the second sliding window is determined to be normal. There are no logical anomalies in the sliding detection window.

[0068] As the logic anomaly detection proceeds, if it is determined that there are no logic anomalies in all sliding detection windows, the compliant and corrected response text will be used as the optimal response text and sent to the target customer.

[0069] In one example, for cases with logical anomalies, we will trigger a state rollback mechanism, reverting the key-value cache state of the large language model to the reference position before the conflict occurred, and clearing the impact of the anomaly generation segment on subsequent predictions. After the rollback, a logical anomaly warning is implicitly injected into the context to clearly inform the large language model of the generation principles it should follow in the current scenario. This warning is preferably expressed in Chinese and includes the user's risk level, the target product's risk level, prohibited behaviors, and alternative generation directions. For example, the following warning message could be injected: "The current user's risk level is lower than the target product's risk level. This product should not be directly recommended. Please explain the reasons for the risk compatibility first, and then recommend an alternative product with a risk level no higher than the user's level. Avoid using expressions such as 'guaranteed principal,' 'sure profit,' or 'buy with all your funds.'"

[0070] In one example, suppose the decision is made on the first... If the sliding detection window has a logical anomaly, then for the first... A logic exception message is generated in the sliding detection window. Simultaneously, backtracking the large language model state back to the generation state is performed. Before.

[0071] Then, As a constraint, with Embed together In the process, the Logits vector after compliance logic correction is obtained. and based on Calculate the probability distribution of compliance logic constraints .

[0072] The calculation formula is: ; ; in, These are the preset logical constraint coefficients.

[0073] Next, in Based on this, select the top probability rankings The candidate words constitute the candidate word set. .

[0074] like At least one candidate word did not fall into the category. Then, the candidate word with the highest probability ranking will be used as the new lexical unit after compliance correction. .

[0075] like All candidate words fell into Then for Conduct violation intent identification and determine the violation intent. And based on the current session context and Generate query vectors .

[0076] This can be expressed by the formula: ; .

[0077] based on Semantic queries are performed in the multimodal compliance knowledge base, and the results with the highest semantic similarity that do not fall into the same category are selected. The lexical units as new compliant revised lexical units .

[0078] Finally, based on all the new compliance-corrected terms, a new compliance-corrected response text is generated, and the new compliance-corrected response text is subjected to logic anomaly detection based on perplexity. This process is repeated until it is determined that there are no logic anomalies in all sliding detection windows, and then the result is taken as the optimal response text and sent to the target customer.

[0079] Through the state rollback mechanism, the large language model no longer follows the original erroneous benefit-oriented path when generating subsequent texts. Instead, it reorganizes the language according to the new compliance path, thereby significantly improving the logical integrity and compliance stability of the text.

[0080] This embodiment proposes a financial text generation and error correction method based on MRAG and ACD, which has the following improvements compared with the traditional financial big language model compliance illusion elimination method.

[0081] First, deterministic compliance control is achieved. This embodiment dynamically generates a compliance tensor based on the current session context, the target financial products involved, and a multimodal compliance knowledge base. Under the constraints of the compliance tensor, and with reference to the multimodal compliance knowledge base, violation detection and semantic smoothing replacement are performed on the lexical units in the output vocabulary of the large language model. This directly shields the possibility of generating high-risk violation words from the decoding layer, eliminating the influence of compliance illusion.

[0082] Secondly, it ensures the fluency and usability of the generated content. Unlike traditional methods that cause dialogue interruption due to keyword filtering, this embodiment, through semantic substitution and state backtracking mechanisms, endows the large language model with the ability to self-correct, ensuring the logical coherence of the generated content.

[0083] Third, maintenance costs are low. This embodiment decouples financial regulatory data, financial product data, and target user data from the reasoning logic of the large language model. Changes only require updating the multimodal compliance knowledge base, without needing to retrain the large language model, effectively reducing cost investment.

[0084] Fourth, it achieves personalized and precise control. This embodiment integrates users' multimodal data to generate differentiated compliance constraint strategies for users with different risk levels, avoiding the drawbacks of a one-size-fits-all risk control approach.

[0085] The steps described above are merely for clarity in describing the technical solution. In actual implementation, they can be combined into one step, or certain steps can be broken down into multiple steps, as long as they involve the same logical relationship, they are all within the scope of protection of this application. Any insignificant modifications or designs added to the algorithm or process, as long as they do not change the core of the algorithm or process, are also within the scope of protection of this application.

[0086] In one embodiment, we will describe the operation process of a financial text generation and error correction method based on MRAG and ACD (hereinafter referred to as OURS or this method) proposed in this application in conjunction with a specific business scenario.

[0087] Suppose a user's risk tolerance level is C2 in the user profile, corresponding to a conservative customer, and a certain financial product, KB No. 1, has a risk level of R5 in the product attribute table, corresponding to a high-risk product. When the user enters "Help me buy KB No. 1 with a 20% return" in the client, OURS first identifies highly sensitive expressions such as "buy with all funds," "20% return," and "KB No. 1" from the user's input text. At the same time, it reads the user's KYC information and the risk attributes of the product from the structured database.

[0088] Subsequently, OURS queried its constructed multimodal compliance knowledge base and determined that the scenario simultaneously contained the following risk characteristics: First, the user's risk level was lower than the target product's risk level, constituting a risk mismatch scenario. Second, the input contained obvious expressions of inducement to gain benefits. Third, the input showed a strong tendency towards transactional actions. Therefore, OURS identified this round of dialogue as a high-risk generation scenario requiring focused constraint.

[0089] Upon entering the decoding phase, if the large language model tends to generate content such as "We can purchase KB No. 1 for you," "This product has high returns," or "We recommend buying it as soon as possible," then the compliance tensor will significantly suppress candidate words such as "KB No. 1," "buy," and "high-yield promise," while moderately boosting candidate words such as "high risk," "not suitable for the current rating," and "We recommend considering stable products." In the first round of correction generation, the large language model may generate text that seems to have avoided direct violations, but the expression is still incomplete or the logic is still flawed. At this time, OURS continues to judge the local perplexity and semantic consistency of the generated text. If logical anomalies such as "stable products correspond to extremely high returns" or "low-risk recommendations are paired with aggressive action words" are detected, a state rollback is immediately triggered.

[0090] After the rollback and prompt re-injection are completed, the large language model regenerates the data. At this point, it is more likely to output text in the following format: "Based on your C2 conservative risk rating, the KB No. 1 product you selected is a high-risk product and does not currently match your risk tolerance. It is not advisable to purchase it directly at this stage. If you are more concerned about asset stability and liquidity, you can prioritize lower-risk financial or bond products." Therefore, this application not only blocks the generation of obviously illegal content but also promptly corrects the generation path when semantic breaks occur, ensuring that the final output is compliant, interpretable, and linguistically fluent.

[0091] In one embodiment, to demonstrate the superiority of the proposed financial text generation and error correction method based on MRAG and ACD, we conducted relevant simulation experiments. We compared this method with methods based on supervised fine-tuning, retrieval-enhanced generation, and post-detection and filtering in terms of both comprehensive error correction effectiveness and compliance accuracy. The comparison results are as follows: Figure 6 As shown, from Figure 6 As can be seen, this method achieved the highest compliance progress and the best overall error correction effect.

[0092] Another embodiment of this application proposes a financial text generation and error correction system based on MRAG and ACD. The details of the financial text generation and error correction system based on MRAG and ACD proposed in this embodiment are described in detail below. The following implementation details are provided for ease of understanding only and are not necessary for implementing this solution.

[0093] Figure 7 This is a schematic diagram of the structure of a financial text generation and error correction system based on MRAG and ACD proposed in this embodiment, including: a multimodal compliance knowledge base construction module 201, a compliance tensor generation module 202, a compliance correction module 203, and a logic correction module 204.

[0094] The multimodal compliance knowledge base construction module 201 is used to perform semantic mapping processing and cross-modal anchor alignment on financial regulatory data, financial product data, and target user data to build a multimodal compliance knowledge base.

[0095] The compliance tensor generation module 202 is used to perform reasoning using a large language model after receiving a question from a target user, obtain the output vocabulary of the large language model, and generate a compliance tensor with the same dimension as the output vocabulary of the large language model based on the current conversation context, the target financial products involved, and the multimodal compliance knowledge base.

[0096] The compliance correction module 203 is used to perform violation detection and semantic smoothing replacement on the lexical units in the output vocabulary of the large language model under the constraints of the compliance tensor and with reference to the multimodal compliance knowledge base, so as to generate a compliance-corrected response text.

[0097] The logic correction module 204 is used to perform logic anomaly detection based on perplexity on the compliance-corrected response text. If a logic anomaly is detected, a logic anomaly prompt is generated, and the state of the large language model is backtracked. Under the dual constraints of the dynamic compliance tensor and the logic anomaly prompt, the compliance-corrected response text is regenerated with reference to the multimodal compliance knowledge base until no logic anomaly is detected. Then, the optimal response text is obtained and sent to the target customer.

[0098] It is worth noting that all modules involved in this embodiment are logical modules. In practical applications, a logical module can be a physical module, a part of a physical module, or an organic combination of multiple physical modules. Furthermore, to highlight the innovative aspects of this application, this embodiment does not introduce modules that are not closely related to solving the technical problems proposed in this application. However, this does not mean that other modules are absent from this embodiment.

[0099] It is not difficult to see that this embodiment is a system embodiment corresponding to the above method embodiments, and this embodiment can be implemented in conjunction with the above method embodiments. The relevant technical details and technical effects mentioned in the above method embodiments are still valid in this embodiment, and will not be repeated here to reduce repetition. Accordingly, the relevant technical details mentioned in this embodiment can also be applied to the above method embodiments.

[0100] Another embodiment of this application provides an electronic device, such as Figure 8 As shown, it consists of a processor 301 and a memory 302. The memory 302 stores instructions that the processor 301 can execute. When the processor 301 is configured to execute the instructions, the electronic device can implement a financial text generation and error correction method based on MRAG and ACD as described in the above method embodiment.

[0101] The memory and processor are connected via a bus, which includes any number of interconnecting buses and bridges. The bus connects various circuits of one or more processors and the memory. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and will not be described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor is transmitted over the wireless medium via an antenna, which also receives and transmits data back to the processor. The processor manages the bus and general processing, and can also provide various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. The memory can be used to store data used by the processor during operation.

[0102] Another embodiment of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, can implement a financial text generation and error correction method based on MRAG and ACD as described in the above method embodiments.

[0103] That is, those skilled in the art will understand that all or part of the steps in the above method embodiments can be implemented by a program instructing related hardware. The program is stored in a storage medium and includes several instructions to cause a device (such as a microcontroller, chip, etc.) or processor to execute all or part of the steps of the method described in the method embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.

[0104] It will be understood by those skilled in the art that the above embodiments are specific implementations of this application, and in practical applications, various changes can be made in form, detail, and description without departing from the spirit and scope of this application. For those skilled in the art, several improvements and modifications can be made without departing from the principles of this application, and these improvements and modifications are also considered to be within the scope of protection of this application.

Claims

1. A method for financial text generation error correction based on MRAG and ACD, characterized in that, include: Semantic mapping and cross-modal anchor alignment are performed on financial regulatory data, financial product data, and user data of target users to build a multimodal compliance knowledge base; After receiving a question from the target user, the large language model performs reasoning to obtain the output vocabulary of the large language model. At the same time, based on the current conversation context, the target financial products involved, and the multimodal compliance knowledge base, a compliance tensor with the same dimensions as the output vocabulary of the large language model is generated. Under the constraints of the compliance tensor, and with reference to the multimodal compliance knowledge base, violation detection and semantic smoothing replacement are performed on the lexical units in the output vocabulary of the large language model to generate a compliance-corrected response text; The system performs perplexity-based logic anomaly detection on the compliance-corrected response text. If a logic anomaly is detected, a logic anomaly prompt is generated, and the state of the large language model is backtracked. Under the dual constraints of the dynamic compliance tensor and the logic anomaly prompt, and with reference to the multimodal compliance knowledge base, the compliance-corrected response text is regenerated until no logic anomalies are detected. Finally, the optimal response text is obtained and sent to the target customer.

2. The MRAG and ACD based financial text generation correction method according to claim 1, wherein, Financial regulatory data, financial product data, and target user data include two modalities: unstructured text data and structured data. Unstructured text data includes financial regulatory rules, financial business specifications, service manuals for financial products, risk disclosure texts for financial products, and historical dialogue texts of target users. Structured data includes product risk ratings, product categories, return attributes, suitability rules for financial products, as well as user profiles, risk tolerance levels, asset information, and investment preferences of target users. For unstructured text data, natural language processing methods including sentence segmentation, word segmentation, entity recognition, relation extraction, and rule induction are used to extract constraint objects, prohibited behaviors, applicable conditions, and exception conditions. For structured data, core fields are extracted through database interfaces, configuration interfaces, and business middleware interfaces; By semantically mapping the constraint objects, prohibited behaviors, applicable conditions, and exception conditions with the core fields and aligning them with cross-modal anchors, a semantic anchoring relationship is established, thereby constructing a multimodal compliance knowledge base; The multimodal compliance knowledge base is implemented in the form of a knowledge graph. Its nodes include at least regulatory nodes, product nodes, user nodes, behavior nodes, prohibited words nodes, and alternative suggestion nodes. The edge relationships between nodes include at least permission, prohibition, adaptation, substitution, and explanation.

3. The MRAG and ACD based financial text generation correction method of claim 1, wherein, The process of generating a compliance tensor with the same vocabulary dimension as the output of a large language model, based on the current session context, the target financial products involved, and a multimodal compliance knowledge base, includes: Based on the current conversation context, the target financial products involved, and the multimodal compliance knowledge base, the prohibited word set, restricted expression set, and compliant alternative expression set are identified at the current moment. Among them, the prohibited word set and the restricted expression set together constitute the taboo domain. The prohibited word set includes at least the names of financial products that are not allowed to be recommended, illegal profit promises, and illegal transaction guidance words. The restricted expression set includes at least vague profit statements, absolute recommendation statements, statements that downplay risks, instructions for trading, and marketing inducements. The compliant alternative expression set includes at least risk explanation statements, suitability explanation statements, and the names of alternative financial products with matching risk levels. Based on the current set of prohibited words, restricted expressions, and compliant alternative expressions, a compliance tensor is generated for the current moment; the dimension of the compliance tensor is the same as the dimension of the vocabulary output by the large language model.

4. The MRAG and ACD based financial text generation correction method of claim 3, wherein, The compliance tensor for the current moment is generated based on the set of prohibited words, the set of restricted expressions, and the set of compliant alternative expressions, using the following formula: ; ; ; , ; in, For scope functions, Output a vocabulary for the large language model. Output the first word of the vocabulary for the large language model Each word element, , , These are, respectively, the set of prohibited words, the set of restricted expressions, and the set of compliant alternative expressions at the current moment. To suppress weight for prohibited words, To limit expression suppression weights, To increase weight for compliance alternatives For the generated compliance tensor at the current moment, for The first in One element, Output the total number of lexical units in the vocabulary for the large language model.

5. The MRAG and ACD based financial text generation correction method of claim 4, wherein, Under the constraints of the compliance tensor, and with reference to a multimodal compliance knowledge base, violation detection and semantic smoothing replacement are performed on the lexical units in the output vocabulary of the large language model to generate a compliance-corrected response text, including: The original output Logits vector used by a large language model to generate when performing word-by-word decoding Will As a constraint, it is embedded in In the process, the compliance-corrected Logits vector is obtained. and based on Calculate the probability distribution of compliance constraints ; The calculation formula is: ; ; wherein, is a Softmax function, is a preset temperature coefficient, is a preset compliance constraint coefficient; In addition, the candidate words with the top probabilities are selected to form a candidate word set . like At least one candidate word did not fall into the category of and The forbidden domain formed Then the candidate word with the highest probability ranking will be selected as the first... A compliant and corrected terminology ; like All candidate words fell into Then for Conduct violation intent identification and determine the violation intent. And based on the current session context and Generate query vectors ; By formula: ; ; in, This is a mapping function for illegal intents, pointing to multiple preset illegal intents. This indicates that encoding is being performed; based on Semantic queries are performed in the multimodal compliance knowledge base, and the results with the highest semantic similarity that do not fall into the same category are selected. The lexical as the first A compliant and corrected terminology ; Based on all the compliant and corrected terms, generate the compliant and corrected response text.

6. The MRAG and ACD based financial text generation correction method of claim 5, wherein, The process of performing perplexity-based logical anomaly detection on the compliant and corrected response text includes: Based on length The sliding detection window performs local perplexity calculation on the compliant and corrected response text. The compliant and corrected response text has a length of [missing information]. Compliance-corrected lexical sequence Therefore, it is necessary to conduct The calculation of local perplexity; where... ; Let the local perplexity of the th sliding detection window be , The calculation process is represented by the formula: ; wherein denotes the conditional probability of ; like Greater than the preset perplexity tolerance threshold Then directly determine the first If a sliding detection window has a logical anomaly, then... Based on semantic consistency and rule consistency, a comprehensive anomaly score is calculated. ; The calculation process is expressed by the formula: ; in, The semantic consistency score, i.e., the first... A sliding detection window and Cosine similarity in semantic vector space The rule consistency score represents the first... The sliding detection window checks the integrity of the subject-verb-object structure and the presence of redundant expressions. , , They are respectively , , The corresponding weighting coefficients, ; like If it is greater than 1, then determine the first... If the sliding detection window has a logical anomaly, then the first sliding window is determined to be normal; otherwise, the second sliding window is determined to be normal. There are no logical anomalies in the sliding detection window; If it is determined that there are no logical anomalies in all sliding detection windows, the compliant and corrected response text will be used as the optimal response text and sent to the target customer.

7. The MRAG and ACD based financial text generation correction method of claim 6, wherein, Upon detecting a logical anomaly, a logical anomaly prompt is generated, and the state of the large language model is backtracked. Under the dual constraints of the dynamic compliance tensor and the logical anomaly prompt, and with reference to the multimodal compliance knowledge base, a compliance-corrected response text is regenerated, including: Assuming the judgment is the first If the sliding detection window has a logical anomaly, then for the first... A logic exception message is generated in the sliding detection window. Simultaneously, backtracking the state of the large language model is performed, reverting to the generation state. Before; Will As a constraint term, with Embedding into , get the Logits vector after the compliance logic is revised , and based on Calculate the compliance logic constraint probability distribution ; The calculation formula is: ; ; wherein, is a preset logical constraint coefficient; exist Based on this, select the top probability rankings The candidate words constitute the candidate word set. ; like At least one candidate word did not fall into the category. Then, the candidate word with the highest probability ranking will be used as the new lexical unit after compliance correction. ; like All candidate words fell into Then for Conduct violation intent identification and determine the violation intent. And based on the current session context and Generate query vectors ; By formula: ; ; based on Semantic queries are performed in the multimodal compliance knowledge base, and the results with the highest semantic similarity that do not fall into the same category are selected. The lexical units as new compliant revised lexical units ; Generate a new compliance-corrected response text based on all the new compliance-corrected terms.

8. A MRAG and ACD based financial text generation correction system, characterized in that, include: The multimodal compliance knowledge base construction module is used to perform semantic mapping processing and cross-modal anchor alignment on financial regulatory data, financial product data, and target user data to build a multimodal compliance knowledge base. The compliance tensor generation module is used to perform reasoning using a large language model after receiving a question from a target user, obtain the output vocabulary of the large language model, and generate a compliance tensor with the same dimensions as the output vocabulary of the large language model based on the current conversation context, the target financial products involved, and the multimodal compliance knowledge base. The compliance correction module is used to perform violation detection and semantic smoothing replacement on the lexical units in the output vocabulary of the large language model under the constraints of the compliance tensor and with reference to the multimodal compliance knowledge base, so as to generate a compliance-corrected response text. The logic correction module is used to perform perplexity-based logic anomaly detection on the compliance-corrected response text. If a logic anomaly is detected, a logic anomaly prompt is generated, and the state of the large language model is backtracked. Under the dual constraints of the dynamic compliance tensor and the logic anomaly prompt, the compliance-corrected response text is regenerated with reference to the multimodal compliance knowledge base until no logic anomalies are detected. Finally, the optimal response text is obtained and sent to the target customer.

9. An electronic device, comprising a processor and a memory, wherein the memory stores instructions that, when executed by the processor, cause the processor to perform operations comprising: The memory stores instructions that can be executed by the processor, and when the processor is configured to execute the instructions, the electronic device is able to implement a financial text generation and error correction method based on MRAG and ACD as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it can implement a financial text generation and error correction method based on MRAG and ACD as described in any one of claims 1 to 7.