Intelligent agent-based illegal behavior detection method and device, equipment and medium
Through the combination of text rewriting and fragment extraction agents, more accurate detection task prompt text is generated, which solves the problem of hallucination in violation detection in financial scenarios, and improves the accuracy and reliability of detection.
Patent Information
- Application Number
- CN202411343990.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-31
AI Technical Summary
In financial scenarios, violation detection based on large language models is prone to hallucinations, which affects the accuracy of the detection.
The original text is processed by text rewriting agents, generating text with similar semantics but different expressions, and combining fragment extraction agents to extract key fragments of the associated documents, generating detection task prompt text, and inputting them into the large language model for violations. Test.
It improves the accuracy and reliability of violation detection, reduces the illusion of large language models, and enhances the accuracy of detection in financial scenarios.
Smart Images

Figure CN119226440A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence technology and financial technology, and in particular to an intelligent agent-based violation detection method, device, equipment and medium. Background Art
[0002] Large Language Models (LLMs) are artificial intelligence models trained with large amounts of data, designed to understand and generate natural language text. These models are usually based on deep learning techniques, capable of capturing the complexity and diversity of language, and are mainly focused on areas such as natural language processing, information retrieval, and recommendation systems.
[0003] At present, in financial scenarios, customer service violations can be monitored based on large language models, and whether there are violations in the customer service chat area can be automatically detected to improve financial security and regulatory efficiency. However, in the process of customer service chatting with customers, the actual situation is that the use of LLMs to analyze whether the chat content is in violation of the rules will occasionally produce hallucinations, that is, generate content that is contrary to the facts, which makes it easy to make mistakes in violation detection and affects the accuracy of violation detection. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide an intelligent-based violation detection method, device, equipment and medium that can be applied to financial technology or other related fields, and its main purpose is to improve the accuracy and reliability of customer service behavior violation detection.
[0005] The technical solution of the present invention is as follows:
[0006] A first aspect of the present invention provides an agent-based illegal behavior detection method, comprising:
[0007] Get the original text to be detected;
[0008] Performing text rewriting processing on the original text by a text rewriting agent to obtain a corresponding rewritten text;
[0009] Perform matching retrieval in a preset knowledge base according to the rewritten text to obtain associated documents related to the rewritten text;
[0010] Extract key fragments from the associated documents through a fragment extraction agent to obtain corresponding target fragments;
[0011] Generate a detection task prompt text according to the target segment and the rewritten text, wherein the detection task prompt text is used to prompt the large language model to perform a violation detection task on the rewritten text based on the target segment;
[0012] The detection task prompt text is input into the large language model to obtain a corresponding violation detection result.
[0013] A second aspect of the present invention provides an agent-based illegal behavior detection device, comprising:
[0014] An acquisition module is used to acquire the original text to be detected;
[0015] A text rewriting module, used for performing text rewriting processing on the original text through a text rewriting agent to obtain a corresponding rewritten text;
[0016] A retrieval module, used to perform matching retrieval in a preset knowledge base according to the rewritten text, and obtain associated documents related to the rewritten text;
[0017] A fragment extraction module is used to extract key fragments from the associated documents through a fragment extraction agent to obtain corresponding target fragments;
[0018] A prompt generation module, used to generate a detection task prompt text according to the target segment and the rewritten text, wherein the detection task prompt text is used to prompt the large language model to perform a violation detection task on the rewritten text based on the target segment;
[0019] The violation detection module is used to input the detection task prompt text into the large language model to obtain a corresponding violation detection result.
[0020] A third aspect of the present invention provides a computer device, comprising at least one processor; and
[0021] a memory communicatively connected to the at least one processor; wherein,
[0022] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the above-mentioned agent-based violation detection method.
[0023] A fourth aspect of the present invention provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned agent-based violation detection method.
[0024] Beneficial effects: The present invention discloses an agent-based violation detection method, device, equipment and medium. Compared with the prior art, the embodiments of the present invention obtain an original text to be detected; perform text rewriting processing on the original text through a text rewriting agent to obtain a corresponding rewritten text; perform matching retrieval in a preset knowledge base according to the rewritten text to obtain associated documents related to the rewritten text; perform key fragment extraction on the associated documents through a fragment extraction agent to obtain a corresponding target fragment; generate a detection task prompt text according to the target fragment and the rewritten text, and the detection task prompt text is used to prompt a large language model to perform a violation detection task on the rewritten text based on the target fragment; input the detection task prompt text into the large language model to obtain a corresponding violation detection result. By rewriting the original text through a text rewriting agent, text with similar semantics but different expressions can be generated, which helps to conduct a wider range of matching retrieval in the preset knowledge base and improve retrieval accuracy. In addition, by extracting key fragments from related documents through a fragment extraction agent, it also helps to reduce the interference of irrelevant information, thereby generating more accurate detection task prompts. The text is input into the large language model to perform violation detection tasks, effectively reducing the hallucinations of the large language model and improving the accuracy of customer service violation detection in financial scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the scheme in the present invention, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0026] Figure 1 A schematic diagram of an application environment of the agent-based illegal behavior detection method provided by an embodiment of the present invention;
[0027] Figure 2 A flow chart of an agent-based illegal behavior detection method provided by an embodiment of the present invention;
[0028] Figure 3 A flow chart of step S201 in the agent-based illegal behavior detection method provided in an embodiment of the present invention;
[0029] Figure 4 A flow chart of step S202 in the agent-based illegal behavior detection method provided in an embodiment of the present invention;
[0030] Figure 5 A flow chart of step S203 in the agent-based illegal behavior detection method provided in an embodiment of the present invention;
[0031] Figure 6 A flow chart of step S204 in the agent-based illegal behavior detection method provided in an embodiment of the present invention;
[0032] Figure 7 A schematic diagram of functional modules of an agent-based illegal behavior detection device provided in an embodiment of the present invention;
[0033] Figure 8 A schematic diagram of the hardware structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. The embodiments of the present invention are described below in conjunction with the accompanying drawings.
[0035] The agent-based illegal behavior detection method provided by the embodiment of the present invention can be applied in the following aspects: Figure 1 In the application environment of FIG. 1 , it includes a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104 and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0036] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (only as examples).
[0037] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0038] The server 105 may be a server that provides various services, such as a background server that provides support for the content browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (for example only). The background server may analyze and process the received data such as the user request, and feed back the processing results (such as web pages, information, or data obtained or generated according to the user request) to the terminal device. The server 105 may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server 105 may also be a server for a distributed system, or a server combined with a blockchain.
[0039] It should be noted that the agent-based violation detection method provided in the embodiment of the present application can generally be executed by the first terminal device 101, the second terminal device 102 or the third terminal device 103. Accordingly, the agent-based violation detection device provided in the embodiment of the present invention can also be set in the first terminal device 101, the second terminal device 102 or the third terminal device 103. Alternatively, the agent-based violation detection method provided in the embodiment of the present invention can generally be executed by the server 105. Accordingly, the agent-based violation detection device provided in the embodiment of the present invention can generally be set in the server 105.
[0040] It should be understood that the numbers of the above terminal devices, networks and servers are only illustrative. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0041] like Figure 2 As shown, the agent-based illegal behavior detection method provided by the embodiment of the present invention specifically includes the following steps:
[0042] S201, obtaining the original text to be detected.
[0043] In this embodiment, in the detection of violations in financial scenarios, the original text to be detected can be the communication content between customer service and the customer, such as the conversation record of the financial customer consulting through the customer service hotline converted to the corresponding text, the text chat content of the financial customer and the customer service through the client, or the voice chat content converted to the corresponding text, etc. Since the communication content may involve sensitive information such as investment advice and account operations, the original text is obtained through multiple channels for subsequent violation detection to ensure the comprehensiveness and reliability of violation detection and improve financial security.
[0044] S202: Perform text rewriting processing on the original text through a text rewriting agent to obtain a corresponding rewritten text.
[0045] In this embodiment, on the basis of obtaining the original text, different types of LLM-based agents are flexibly added to improve the processing of the original text by the violation detection method, thereby improving the adaptability and reliability of the violation detection method in financial scenarios. An LLM-based agent refers to an artificial intelligence (AI) system that uses a large language model (LLM) to understand, interpret and generate human language. These agents are designed to perform various tasks involving natural language processing, identifying patterns and learning language structures by analyzing large text data sets, enabling them to interact with users in a context-sensitive manner.
[0046] Specifically, the original text is rewritten by a text rewriting agent. For example, the conversation record of the above-mentioned customer consultation is rewritten by synonym replacement, grammar adjustment, ambiguity elimination, structural adjustment and other rewriting operations to generate a rewritten text with similar semantics but different expressions. Because subtle differences in financial information may have significant impacts, the original text is rewritten to obtain diversified expressions, thereby ensuring a more accurate understanding of the communication needs in the original text, which will help to conduct a wider range of matching searches in the preset knowledge base and improve the retrieval accuracy. At the same time, it can also reduce the reliance on specific expressions when detecting violations and improve the accuracy and robustness of violation detection.
[0047] S203: performing a matching search in a preset knowledge base according to the rewritten text to obtain associated documents related to the rewritten text.
[0048] In this embodiment, unlike the existing method of directly inputting chat samples as original prompts into the large language model for violation detection, after rewriting the original text, this embodiment also performs matching retrieval in a preset knowledge base based on the rewritten text. The data in the preset knowledge base can be flexibly set or updated according to the needs of the application field. For example, when applied in financial scenarios, relevant documents in the financial field including financial regulations, company policies, historical cases, etc. can be uploaded to the knowledge base, thereby building a rich knowledge base, and regularly updating and maintaining the documents in the knowledge base to ensure the timeliness of relevant regulations and policies in the knowledge base.
[0049] When detecting violations in customer service behavior in financial scenarios, we rewrite the text and search in the financial knowledge base to find related documents such as financial regulations, policies, product introductions, historical cases, etc. that are related to the customer's consultation content. This allows us to introduce knowledge in specific fields when detecting violations and apply it to subsequent violation detection tasks in the large language model. This enhances the prompts of the large language model, allowing the model to obtain richer prompt information to better understand the context of the customer's consultation content, thereby improving the accuracy of violation detection.
[0050] S204: extract key fragments from the associated documents through a fragment extraction agent to obtain corresponding target fragments.
[0051] In this embodiment, after document retrieval, the content of the obtained related documents may be large, including a lot of irrelevant information, such as repeated basic laws and policies, template phrases in historical cases, etc. In order to reduce the interference of irrelevant information, this embodiment uses the added fragment extraction agent to extract key fragments from the retrieved related documents.
[0052] For example, the communication between customer service and customers mentions investment products, investment plans, yields, risks, etc. After rewriting and retrieving related documents, such as the latest policy documents and product descriptions about investment products and investment plans, the fragment extraction agent extracts all fragments related to "annualized yield" and "risk" from the retrieved documents, thereby reducing the interference of other information in the financial quality inspection process and significantly improving the effectiveness and reliability of violation detection through precise information extraction.
[0053] S205 . Generate a detection task prompt text according to the target segment and the rewritten text, wherein the detection task prompt text is used to prompt the large language model to perform a violation detection task on the rewritten text based on the target segment.
[0054] In this embodiment, the large language model is a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of language text. They can handle a variety of natural language tasks, such as text classification, question and answer, dialogue, etc. When implementing violation detection in a financial scenario, the corresponding detection task prompt text is generated based on the rewritten text obtained by the text rewriting agent and the target fragment obtained by the fragment extraction agent. The detection task prompt text is used to prompt the large language model to perform a violation detection task on the rewritten text based on the target fragment. The type of specific violation detected can be, for example, leaking customer information, improper sales behavior, using improper language, failing to comply with financial regulations, etc. That is, by constructing a detection task prompt text to guide the large language model to understand the specific needs of the current task, the large language model is prompted to detect whether the rewritten text has the above-mentioned type of violation in combination with the context prompt of the target fragment, thereby adapting to the violation detection task in the financial scenario.
[0055] S206: Input the detection task prompt text into the large language model to obtain a corresponding violation detection result.
[0056] In this embodiment, the detection task prompt text is input into the large language model for text analysis, and a violation detection result is obtained based on the prompt of the target segment to determine whether there is any violation in the rewritten text. By utilizing the powerful analysis capability of the large language model, an in-depth understanding of complex text data can be achieved, thereby making a more accurate violation judgment.
[0057] For example, an exemplary detection task prompt text can be: Please combine the extracted target segment and the rewritten text to determine whether the customer service statement violates the above financial industry regulations. If there is a violation, please indicate which regulations are violated and provide the basis for the judgment.
[0058] Extracted target fragment: [fragment content]
[0059] Rewrite text: [text content]
[0060] Output format requirements:
[0061] - Target fragment to be extracted: [fragment content]
[0062] -Violation detection result: [Violation or not]
[0063] - Description of violation: [Specific content of violation and basis for judgment]
[0064] The above detection task prompt text is input into the large language model to guide the large language model to detect violations of the rewritten text in combination with the extracted target segment. Specifically, the large language model can compare the extracted target segment with the rewritten text. For example, the customer service communication content contains descriptions of the yield, risk, etc. of a certain product, such as "We have an investment plan with an annualized yield of at least 10%, and the risk is extremely low", and the target segment is the segment related to "annualized yield" and "risk" in the retrieved product description, such as "The expected annualized yield of the investment plan is 5%-7%, and the risk level is medium". After constructing the above detection task prompt text based on the target segment and the rewritten text, the large language model is used to analyze and find that the annualized yield promised in the customer service description is inconsistent with the information in the target segment. At the same time, the expression "extremely low risk" used by the customer service is inconsistent with the description of "medium risk level" in the document. The following output can be generated to achieve accurate violation detection:
[0065] Extracted target fragment: The expected annualized rate of return of the investment plan is 5%-7%, and the risk level is medium.
[0066] Violation detection result: Yes
[0067] Description of violation: The annualized rate of return of at least 10% promised by the customer service staff was inconsistent with the expected rate of return in the policy document. At the same time, the use of the expression "extremely low risk" may mislead customers, violating regulations 1 and 2.
[0068] In the above embodiment, the present invention discloses an agent-based violation detection method, which comprises the following steps: obtaining an original text to be detected; performing text rewriting processing on the original text through a text rewriting agent to obtain a corresponding rewritten text; performing matching retrieval in a preset knowledge base based on the rewritten text to obtain associated documents related to the rewritten text; performing key fragment extraction on the associated documents through a fragment extraction agent to obtain a corresponding target fragment; generating a detection task prompt text based on the target fragment and the rewritten text, the detection task prompt text being used to prompt a large language model to perform a violation detection task on the rewritten text based on the target fragment; and inputting the detection task prompt text into the large language model to obtain a corresponding violation detection result. By rewriting the original text through a text rewriting agent, text with similar semantics but different expressions can be generated, which helps to conduct a wider range of matching retrieval in the preset knowledge base and improve retrieval accuracy. In addition, by extracting key fragments from related documents through a fragment extraction agent, it also helps to reduce the interference of irrelevant information, thereby generating more accurate detection task prompts. The text is input into the large language model to perform violation detection tasks, effectively reducing the hallucinations of the large language model and improving the accuracy of customer service violation detection in financial scenarios.
[0069] In one embodiment, Figure 3 As shown, step S201 includes:
[0070] S301, collecting original chat content of customer service;
[0071] S302, cleaning the original chat content, removing the non-text part of the original chat content, and obtaining pure text chat content;
[0072] S303: converting the plain text chat content according to a preset format standard to obtain an original text to be detected in a standard format.
[0073] In this embodiment, the original chat content can be the real-time communication record between the customer and the customer service in the chat area of the client, including various forms such as text, emoticons, and pictures, or it can be a voice communication record. If it is a voice communication record, it will be processed by voice-to-text conversion to obtain the original chat content in text form, providing a basis for violation detection.
[0074] After collecting the original chat content, it is cleaned and processed to remove non-text parts, such as special characters, emoticons, HTML tags, URL links and other non-text content, and only the plain text part is retained, ensuring the data quality of subsequent processing, eliminating the interference of irrelevant information, and making the detection more focused on the text content. At the same time, the plain text chat content is converted according to the preset format standard. The conversion process includes unifying texts of different formats into a standard format, such as date, timestamp, identification of both parties in the conversation, unification of uppercase and lowercase, and unification of traditional and simplified Chinese, etc., to obtain the original text to be detected in a standard format. Through the standardized format, the detection system can more easily parse and process data, improving the efficiency and accuracy of detection.
[0075] In one embodiment, Figure 4 As shown, step S202 includes:
[0076] S401, obtaining a text rewriting strategy, generating a rewriting task prompt text according to the text rewriting strategy and the original text, wherein the rewriting task prompt text is used to prompt the large language model to perform a text rewriting task on the original text based on the text rewriting strategy;
[0077] S402: Input the rewriting task prompt text into the large language model to obtain a rewriting text corresponding to the rewriting task prompt text.
[0078] In this embodiment, the text rewriting agent uses the same large language model as the one for performing the violation detection task as the base model, and sets the role through different prompts, i.e., prompt texts, so as to realize the corresponding functions of the text rewriting agent. When rewriting and optimizing the original text, the text rewriting strategy is first obtained. The text rewriting strategy may include, for example, retaining the evidence of violation in the original text, making the text more standardized and clear, highlighting keywords and important information, eliminating ambiguity, not changing the original meaning of the text, etc., so as to retain the potential violation descriptions that may exist, and generate semantically similar diversified expressions.
[0079] Based on the text rewriting strategy and the original text, a rewriting task prompt text is generated. The rewriting task prompt text is used to prompt the large language model to perform the text rewriting task on the original text based on the text rewriting strategy. The rewriting task prompt text is input into the large language model to obtain a rewritten text corresponding to the rewriting task prompt text. That is, by constructing the rewriting task prompt text to guide the large language model to understand the specific requirements of the current task, the large language model is prompted to perform the corresponding rewriting operation on the original text under the context prompt of the text rewriting strategy, thereby obtaining a variety of expressions, thereby ensuring a more accurate understanding of the communication needs in the original text.
[0080] For example, in an exemplary rewriting task prompt, the prompt could be: You are a text rewriting agent in the financial field. Your task is to receive financial customer service conversation text and rewrite it to facilitate accurate violation detection in the knowledge base. When rewriting, please pay attention to the following points:
[0081] 1. Preserve evidence of violations in the original text.
[0082] 2. Make the text more standardized and clear.
[0083] 3. Highlight keywords and important information.
[0084] 4. Eliminate ambiguity.
[0085] 5. Do not change the original meaning of the text.
[0086] Please rewrite the following dialogue based on the above example:
[0087] Original text:
[0088] User: I am interested in your investment products, but I am worried that the risks are too high.
[0089] Customer Service: Don’t worry, our products have a bottom-line guarantee to ensure that you will not incur losses.
[0090] The above rewriting task prompt text is input into the large language model to guide the large language model to rewrite the original text according to the text rewriting strategy and output the following rewritten text:
[0091] User: I am considering investing but would like to reduce potential financial risk.
[0092] Customer Service: The investment products we provide claim to have risk control measures to protect investors’ principal.
[0093] Through text rewriting, the rewritten text retains the violations in the original conversation (i.e., the bottom line promise). At the same time, by using words such as "claim", it provides clear clues for subsequent violation detection, so that the text rewriting not only retains the evidence of violations, but also improves the overall standardization and clarity, which helps the violation detection system to more accurately identify and deal with potential problems.
[0094] In one embodiment, Figure 5 As shown, step S203 includes:
[0095] S501, performing vectorization processing on the rewritten text to generate a query vector;
[0096] S502: Calculate similarity between the query vector and vector data in a pre-constructed index structure, where the index structure is constructed by vectorizing documents in the preset knowledge base;
[0097] S503, sorting the documents in the preset knowledge base according to the relevance to the query vector according to the similarity calculation result;
[0098] S504: Obtain associated documents related to the rewritten text from the preset knowledge base according to the sorting result and in a preset ratio.
[0099] In this embodiment, relevant documents in the financial field are uploaded to the knowledge base in advance, including financial regulations, company policies, historical cases, etc., the documents in the knowledge base are analyzed and processed, the key information of the documents is extracted and converted into vectors, and then the vector data of the documents is stored in the index structure, that is, the documents are converted into vectors in advance and stored in the index structure. These vectors represent the content and semantic information of the documents to facilitate subsequent rapid retrieval.
[0100] When performing a match detection in a preset knowledge base based on the rewritten text, the rewritten text is vectorized through Word2Vec, BERT or other pre-trained language models to generate a corresponding query vector, and the similarity between the query vector and each vector in the index structure is calculated in the vector space through a similarity measurement method (such as cosine similarity, Euclidean distance, Jaccard similarity, etc.), so that the document most similar to the query vector can be quickly found, which helps to narrow the search scope and improve retrieval efficiency.
[0101] According to the similarity calculation results, the documents in the knowledge base are sorted according to their relevance to the query vector, so as to accurately obtain the associated text with high relevance to the query vector. For example, the higher the similarity, the higher the ranking, and the documents most relevant to the query vector are displayed first. When obtaining related documents, a preset ratio can be used, such as obtaining the top 10% or top 20 most relevant documents in the sorting results from the preset knowledge base as related documents related to the rewritten text. Effectively retrieving information related to customer service communication content from a large number of documents in a specific field improves the efficiency and accuracy of information retrieval, and also provides contextual information for subsequent violation detection.
[0102] In one embodiment, Figure 6 As shown, step S204 includes:
[0103] S601, extracting key objects from the rewritten text;
[0104] S602: Generate an extraction task prompt text according to the key object and the associated document, wherein the extraction task prompt text is used to prompt the large language model to perform a segment extraction task on the associated document according to the key object;
[0105] S603: Input the extraction task prompt text into the large language model to obtain a target segment corresponding to the extraction task prompt text.
[0106] In this embodiment, the fragment extraction agent uses the same large language model as the base model, and sets roles through different prompts, i.e., prompt texts, so as to realize the corresponding functions of the fragment extraction agent. When extracting fragments from associated documents, key objects are first extracted from the rewritten text. The key objects may be terms in financial transactions, customer information, product names, etc. For example, in a conversation about bank loans, key objects may include "loan amount", "interest rate", "repayment period", etc. By extracting key objects, the core content in the text can be quickly identified, providing key information for subsequent fragment extraction and violation detection.
[0107] Generate extraction task prompt text based on the extracted key objects and associated documents. The extraction task prompt text includes the description of the key objects and the extraction requirements. For example: "Please extract all paragraphs related to 'loan amount' and 'interest rate' from the following documents, and pay attention to any contextual information that mentions these terms." This extraction task prompt text is used to prompt the large language model to perform a fragment extraction task on the associated documents based on the key objects. The extraction task prompt text is input into the large language model to obtain the target fragment corresponding to the extraction task prompt text. For example, the above extraction task prompt text is input into the large language model, and the model analyzes and returns the document paragraph containing "loan amount" and "interest rate" based on the prompt text.
[0108] That is, by constructing extraction task prompt text to guide the large language model to understand the specific requirements of the current task, the large language model is prompted to extract the most relevant fragments of customer service communication content from related documents under the context prompts of key objects, and the target fragments with the strongest relevant information, reducing the interference of other irrelevant information, so that the context prompts provided to the large language model for violation detection are more accurate, thereby improving the accuracy of detection.
[0109] In one embodiment, after step S206, the method further includes:
[0110] Performing error verification on the violation detection result by a fact-checking agent to confirm whether there is a factual error in the violation detection result;
[0111] If there is a factual error, the detection task prompt text is corrected according to the verification result and re-input into the large language model to obtain an updated violation detection result.
[0112] In this embodiment, after the large language model outputs the violation detection result, in order to ensure the reliability of the output result, the violation detection result is also verified by the additional fact-checking agent, that is, the factual errors in the answers generated by the model are verified, and whether there are factual errors in the violation detection result is confirmed, so as to immediately verify the content generated by the model and verify the illusion phenomenon that may exist in the large language model. If the fact-checking agent finds that there is an error in the violation detection result, such as misjudging a legitimate loan discount as a violation, the detection task prompt text will be corrected. The correction process can be, for example, updating keywords, adjusting the detection logic, or providing more contextual information such as the latest regulations to reduce misjudgment. The corrected detection task prompt text is re-input into the large language model, so that the model re-detects violations based on the updated detection task prompt text and then outputs the updated violation detection result. It can be understood that the updated violation detection result can still be verified by the fact-checking agent until the verification result is correct. It ensures that the violation detection result can reflect the latest information and corrections, and improves the reliability and effectiveness of the detection result.
[0113] In one embodiment, the fact-checking agent uses the large language model as a base model, and the fact-checking agent performs error verification on the violation detection result to confirm whether there is a factual error in the violation detection result, including:
[0114] Parsing the violation detection result to obtain the violation type and violation text excerpt in the violation detection result;
[0115] Query the corresponding violation evidence according to the violation type and the violation text excerpt;
[0116] Generate a verification task prompt text according to the violation basis and the violation detection result, wherein the verification task prompt text is used to prompt the large language model to perform a fact verification task on the violation detection result according to the violation basis;
[0117] The verification task prompt text is input into the large language model to obtain a factual error verification result corresponding to the verification task prompt text.
[0118] In this embodiment, the fact-checking agent also uses the same large language model as the base model, and sets the role through different prompts, that is, prompt texts, so as to realize the corresponding functions of the fact-checking agent. When the violation detection result output by the large language model is verified for error, the violation detection result is first parsed to obtain the violation type and the violation text excerpt in the violation detection result. For example, if the violation type is parsed as "misleading propaganda", the violation text excerpt can be "our investment product guarantees an annualized rate of return of more than 15%" related to the propaganda index, providing an accurate target for verification. Based on the violation type and the violation text excerpt, access external data sources, such as financial regulations database, historical conversation records, company policies, etc., query and obtain the latest violation basis, so as to provide the latest and most reliable verification basis. For example, based on the above parsed content, the latest actual annualized rate of return of the financial product is queried from the official website of the product. For example, the latest annualized rate of return is 10%, which may be different from the violation detection task performed by the large language model, that is, the violation detection result previously output by the large language model may be wrong.
[0119] A verification task prompt text is generated based on the latest violation evidence and violation detection results queried. The verification task prompt text includes instructions, which clearly tell the model the specific task to be performed, such as "Please verify whether the following violation detection results are accurate"; input data, which is the specific information that the model needs to process, such as the violation detection results generated by the large language model; background information, which provides environmental information or additional details required to perform the task, such as the latest violation evidence queried; output instructions, which define the expected type or format of the model output, such as "For each violation detection result, please provide a judgment of 'correct' or 'wrong' and give an explanation." The verification task prompt text is used to prompt the large language model to perform a fact-checking task on the violation detection results based on the violation evidence. The verification task prompt text is input into the large language model to obtain a factual error verification result corresponding to the verification task prompt text.
[0120] That is, by constructing verification task prompt text to guide the large language model to understand the specific requirements of the current task, the large language model is prompted to verify the original violation detection results under the context prompts of the latest violation evidence, confirm whether the violation detection results are accurate, and ensure that the model can comprehensively and accurately verify the violation detection results, and perform self-correction according to the latest regulations and historical cases, so as to reliably and accurately realize violation detection of customer service behavior in the financial field.
[0121] It should be noted that there is not necessarily a certain order between the above-mentioned steps. A person skilled in the art can understand, based on the description of the embodiments of the present invention, that in different embodiments, the above-mentioned steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.
[0122] Further references Figure 7 , as a response to the above Figure 2 The present invention provides an embodiment of an agent-based illegal behavior detection device, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0123] like Figure 7 As shown, the agent-based illegal behavior detection device 70 described in this embodiment includes:
[0124] An acquisition module 701 is used to acquire the original text to be detected;
[0125] A text rewriting module 702 is used to perform text rewriting processing on the original text through a text rewriting agent to obtain a corresponding rewritten text;
[0126] A retrieval module 703 is used to perform a matching search in a preset knowledge base according to the rewritten text to obtain associated documents related to the rewritten text;
[0127] The segment extraction module 704 is used to extract key segments from the associated documents through a segment extraction agent to obtain corresponding target segments;
[0128] A prompt generating module 705 is used to generate a detection task prompt text according to the target segment and the rewritten text, wherein the detection task prompt text is used to prompt the large language model to perform a violation detection task on the rewritten text based on the target segment;
[0129] The violation detection module 706 is used to input the detection task prompt text into the large language model to obtain a corresponding violation detection result.
[0130] The module referred to in the present invention refers to a series of computer program instruction segments that can perform specific functions, which are more suitable for describing the execution process of agent-based violation detection than programs. For the specific implementation methods of each module, please refer to the corresponding method embodiments above, which will not be repeated here.
[0131] In one embodiment, the apparatus 70 further comprises:
[0132] A fact checking module, configured to perform error verification on the violation detection result through a fact checking agent to confirm whether there is a factual error in the violation detection result;
[0133] The correction module is used to correct the detection task prompt text according to the verification result if there is a factual error and then re-input it into the large language model to obtain an updated violation detection result.
[0134] In one embodiment, the text rewriting module 702 includes:
[0135] A strategy acquisition unit, used to acquire a text rewriting strategy, and generate a rewriting task prompt text according to the text rewriting strategy and the original text, wherein the rewriting task prompt text is used to prompt the large language model to perform a text rewriting task on the original text based on the text rewriting strategy;
[0136] The text rewriting unit is used to input the rewriting task prompt text into the large language model to obtain a rewritten text corresponding to the rewriting task prompt text.
[0137] In one embodiment, the retrieval module 703 includes:
[0138] A vectorization unit, used for performing vectorization processing on the rewritten text to generate a query vector;
[0139] A similarity calculation unit, used to calculate the similarity between the query vector and the vector data in a pre-constructed index structure, wherein the index structure is constructed by vectorizing the documents in the preset knowledge base;
[0140] A sorting unit, used to sort the documents in the preset knowledge base according to the relevance to the query vector based on the similarity calculation result;
[0141] A result acquisition unit is used to obtain associated documents related to the rewritten text from the preset knowledge base according to the sorting result and in a preset proportion.
[0142] In one embodiment, the fragment extraction module 704 includes:
[0143] An object extraction unit, used for extracting key objects from the rewritten text;
[0144] A first prompt generating unit, configured to generate an extraction task prompt text according to the key object and the associated document, wherein the extraction task prompt text is used to prompt the large language model to perform a segment extraction task on the associated document according to the key object;
[0145] The segment extraction unit is used to input the extraction task prompt text into the large language model to obtain a target segment corresponding to the extraction task prompt text.
[0146] In one embodiment, the fact-checking module includes:
[0147] A parsing unit, used to parse the violation detection result to obtain the violation type and violation text excerpt in the violation detection result;
[0148] A query unit, used to query corresponding violation evidence according to the violation type and the violation text excerpt;
[0149] A second prompt generating unit is used to generate a verification task prompt text according to the violation basis and the violation detection result, wherein the verification task prompt text is used to prompt the large language model to perform a fact verification task on the violation detection result according to the violation basis;
[0150] The verification unit is used to input the verification task prompt text into the large language model to obtain a factual error verification result corresponding to the verification task prompt text.
[0151] In one embodiment, the acquisition module 701 includes:
[0152] A collection unit, used to collect the original chat content of customer service;
[0153] A cleaning unit, used for cleaning the original chat content, removing the non-text part of the original chat content, and obtaining pure text chat content;
[0154] The conversion unit is used to convert the plain text chat content according to a preset format standard to obtain the original text to be detected in a standard format.
[0155] In the above embodiment, the present invention discloses an agent-based violation detection device, which obtains an original text to be detected; performs text rewriting processing on the original text through a text rewriting agent to obtain a corresponding rewritten text; performs matching retrieval in a preset knowledge base based on the rewritten text to obtain associated documents related to the rewritten text; performs key fragment extraction on the associated documents through a fragment extraction agent to obtain a corresponding target fragment; generates a detection task prompt text based on the target fragment and the rewritten text, and the detection task prompt text is used to prompt a large language model to perform a violation detection task on the rewritten text based on the target fragment; and inputs the detection task prompt text into the large language model to obtain a corresponding violation detection result. By rewriting the original text through a text rewriting agent, text with similar semantics but different expressions can be generated, which helps to conduct a wider range of matching retrieval in the preset knowledge base and improve retrieval accuracy. In addition, by extracting key fragments from related documents through a fragment extraction agent, it also helps to reduce the interference of irrelevant information, thereby generating more accurate detection task prompts. The text is input into the large language model to perform violation detection tasks, effectively reducing the hallucinations of the large language model and improving the accuracy of customer service violation detection in financial scenarios.
[0156] Another embodiment of the present invention provides a computer device, such as Figure 8As shown, the computer device 80 includes:
[0157] One or more processors 801 and memory 802, Figure 8 A processor 801 is used as an example for the description. The processor 801 and the memory 802 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.
[0158] Processor 801 is used to complete various control logics of computer device 80, and it can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component or any combination of these components. In addition, processor 801 can also be any traditional processor, microprocessor or state machine. Processor 801 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a DSP and / or any other such configuration.
[0159] The memory 802 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions corresponding to the agent-based violation detection method in the embodiment of the present invention. The processor 801 executes various functional applications and data processing of the computer device 80 by running the non-volatile software programs, instructions and units stored in the memory 802, that is, implementing the agent-based violation detection method in the above method embodiment.
[0160] The memory 802 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device 80, etc. In addition, the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 802 may optionally include a memory remotely arranged relative to the processor 801, and these remote memories may be connected to the computer device 80 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. One or more units are stored in the memory 802, and when executed by one or more processors 801, the steps of the agent-based violation detection method in any of the above-mentioned method embodiments are executed.
[0161] In the above embodiment, the present invention discloses a computer device, which obtains the original text to be detected; performs text rewriting processing on the original text through a text rewriting agent to obtain the corresponding rewritten text; performs matching retrieval in a preset knowledge base according to the rewritten text to obtain the associated document related to the rewritten text; extracts the key fragments of the associated document through a fragment extraction agent to obtain the corresponding target fragment; generates a detection task prompt text according to the target fragment and the rewritten text, and the detection task prompt text is used to prompt the large language model to perform the violation detection task on the rewritten text based on the target fragment; inputs the detection task prompt text into the large language model to obtain the corresponding violation detection result. The text rewriting agent rewrites the original text to generate text with similar semantics but different expressions, which helps to perform a wider range of matching retrieval in the preset knowledge base and improve the retrieval accuracy, and the fragment extraction agent extracts the key fragments of the associated documents, which also helps to reduce the interference of irrelevant information, thereby generating a more accurate detection task prompt text input into the large language model to perform the violation detection task, effectively reducing the illusion of the large language model and improving the accuracy of customer service violation detection in financial scenarios.
[0162] An embodiment of the present invention provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the steps of the agent-based violation detection method in any of the above method embodiments are executed.
[0163] In the above embodiment, the present invention discloses a non-volatile computer-readable storage medium, which obtains an original text to be detected; performs text rewriting processing on the original text through a text rewriting agent to obtain a corresponding rewritten text; performs matching retrieval in a preset knowledge base based on the rewritten text to obtain associated documents related to the rewritten text; performs key fragment extraction on the associated documents through a fragment extraction agent to obtain a corresponding target fragment; generates a detection task prompt text based on the target fragment and the rewritten text, and the detection task prompt text is used to prompt a large language model to perform a violation detection task on the rewritten text based on the target fragment; and inputs the detection task prompt text into the large language model to obtain a corresponding violation detection result. By rewriting the original text through a text rewriting agent, text with similar semantics but different expressions can be generated, which helps to conduct a wider range of matching retrieval in the preset knowledge base and improve retrieval accuracy. In addition, by extracting key fragments from related documents through a fragment extraction agent, it also helps to reduce the interference of irrelevant information, thereby generating more accurate detection task prompts. The text is input into the large language model to perform violation detection tasks, effectively reducing the hallucinations of the large language model and improving the accuracy of customer service violation detection in financial scenarios.
[0164] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0165] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0166] In summary, in the agent-based violation detection method, device, equipment and medium disclosed in the present invention, the method includes: obtaining the original text to be detected; performing text rewriting processing on the original text through a text rewriting agent to obtain a corresponding rewritten text; performing matching retrieval in a preset knowledge base based on the rewritten text to obtain associated documents related to the rewritten text; performing key fragment extraction on the associated documents through a fragment extraction agent to obtain a corresponding target fragment; generating a detection task prompt text based on the target fragment and the rewritten text, the detection task prompt text is used to prompt the large language model to perform a violation detection task on the rewritten text based on the target fragment; inputting the detection task prompt text into the large language model to obtain a corresponding violation detection result. By rewriting the original text through a text rewriting agent, text with similar semantics but different expressions can be generated, which helps to conduct a wider range of matching retrieval in the preset knowledge base and improve retrieval accuracy. In addition, by extracting key fragments from related documents through a fragment extraction agent, it also helps to reduce the interference of irrelevant information, thereby generating more accurate detection task prompts. The text is input into the large language model to perform violation detection tasks, effectively reducing the hallucinations of the large language model and improving the accuracy of customer service violation detection in financial scenarios.
[0167] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium, and the computer program can include the processes of the above-mentioned method embodiments when executed. The storage medium can be a memory, a disk, a floppy disk, a flash memory, an optical storage device, etc.
[0168] It should be noted that if any software tools or components other than those of the Company appear in the embodiments of the present application, they are merely used for illustration and do not represent actual use. It should be understood that the application of the present invention is not limited to the above examples, and that those skilled in the art can make improvements or changes based on the above description, and all such improvements and changes shall fall within the scope of protection of the claims attached to the present invention.
Claims
1. A method for detecting illegal behaviors based on an intelligent agent, characterized in that: include: Get the original text to be detected; Performing text rewriting processing on the original text by a text rewriting agent to obtain a corresponding rewritten text; Perform matching retrieval in a preset knowledge base according to the rewritten text to obtain associated documents related to the rewritten text; Extract key fragments from the associated documents through a fragment extraction agent to obtain corresponding target fragments; Generate a detection task prompt text according to the target segment and the rewritten text, wherein the detection task prompt text is used to prompt the large language model to perform a violation detection task on the rewritten text based on the target segment; The detection task prompt text is input into the large language model to obtain a corresponding violation detection result.
2. The agent-based violation detection method according to claim 1, characterized in that: After inputting the detection task prompt text into the large language model to obtain the corresponding violation detection result, the method further includes: Performing error verification on the violation detection result by a fact-checking agent to confirm whether there is a factual error in the violation detection result; If there is a factual error, the detection task prompt text is corrected according to the verification result and re-input into the large language model to obtain an updated violation detection result.
3. The agent-based violation detection method according to claim 1, characterized in that: The text rewriting agent uses the large language model as a base model, and the text rewriting agent performs text rewriting processing on the original text to obtain the corresponding rewritten text, including: Acquire a text rewriting strategy, and generate a rewriting task prompt text according to the text rewriting strategy and the original text, wherein the rewriting task prompt text is used to prompt the large language model to perform a text rewriting task on the original text based on the text rewriting strategy; The rewriting task prompt text is input into the large language model to obtain a rewriting text corresponding to the rewriting task prompt text.
4. The agent-based violation detection method according to claim 1, characterized in that: The step of performing a matching search in a preset knowledge base according to the rewritten text to obtain associated documents related to the rewritten text includes: Performing vectorization processing on the rewritten text to generate a query vector; Calculate similarity between the query vector and vector data in a pre-constructed index structure, where the index structure is constructed by vectorizing documents in the preset knowledge base; According to the similarity calculation result, the documents in the preset knowledge base are sorted according to the relevance to the query vector; According to the sorting result, associated documents related to the rewritten text are obtained from the preset knowledge base in a preset ratio.
5. The agent-based violation detection method according to claim 1, characterized in that: The segment extraction agent uses the large language model as a base model, and extracts key segments from the associated documents through the segment extraction agent to obtain corresponding target segments, including: extracting key objects from the rewritten text; Generate an extraction task prompt text according to the key object and the associated document, wherein the extraction task prompt text is used to prompt the large language model to perform a segment extraction task on the associated document according to the key object; The extraction task prompt text is input into the large language model to obtain a target segment corresponding to the extraction task prompt text.
6. The agent-based violation detection method according to claim 2, characterized in that: The fact-checking agent uses the large language model as a base model, and the fact-checking agent performs error verification on the violation detection result to confirm whether there is a factual error in the violation detection result, including: Parsing the violation detection result to obtain the violation type and violation text excerpt in the violation detection result; Query the corresponding violation evidence according to the violation type and the violation text excerpt; Generate a verification task prompt text according to the violation basis and the violation detection result, wherein the verification task prompt text is used to prompt the large language model to perform a fact verification task on the violation detection result according to the violation basis; The verification task prompt text is input into the large language model to obtain a factual error verification result corresponding to the verification task prompt text.
7. The agent-based violation detection method according to any one of claims 1 to 6, characterized in that: The step of obtaining the original text to be detected includes: Collect the original chat content of customer service; Cleaning the original chat content to remove non-text parts of the original chat content to obtain pure text chat content; The plain text chat content is converted according to a preset format standard to obtain the original text to be detected in a standard format.
8. An agent-based violation detection device, characterized in that: include: An acquisition module is used to acquire the original text to be detected; A text rewriting module, used for performing text rewriting processing on the original text through a text rewriting agent to obtain a corresponding rewritten text; A retrieval module, used to perform matching retrieval in a preset knowledge base according to the rewritten text, and obtain associated documents related to the rewritten text; A fragment extraction module is used to extract key fragments from the associated documents through a fragment extraction agent to obtain corresponding target fragments; A prompt generation module, used to generate a detection task prompt text according to the target segment and the rewritten text, wherein the detection task prompt text is used to prompt the large language model to perform a violation detection task on the rewritten text based on the target segment; The violation detection module is used to input the detection task prompt text into the large language model to obtain a corresponding violation detection result.
9. A computer device, characterized in that: comprising at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the agent-based violation detection method described in any one of claims 1-7.
10. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, enable the one or more processors to execute the agent-based violation detection method described in any one of claims 1-7.
Citation Information
Cited By
Speech recognition result processing method and device, computer equipment and storage medium
CN116976311A
Multi-agent collaborative false news evidence chain automatic checking method and system
CN122818124A
