Model training method, rule generation method, device, medium and program product
By generating a rule generation model using training data and existing risk prediction models, the problem of low efficiency and poor accuracy in rule generation in existing technologies is solved. This enables automated rule generation and flexible updates, improving the responsiveness and transparency of risk strategies.
Patent Information
- Application Number
- CN202511652936.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-12
- Publication Date
- 2026-02-13
AI Technical Summary
In existing technologies, the rule generation process relies on manual labor, which is inefficient, has low accuracy, lacks flexibility, and makes it difficult to respond quickly to changes in risk strategies.
By using training data and existing risk prediction models, a rule generation model is generated that can automatically output rule codes and rule texts described in natural language. The model can be fine-tuned by combining generation objectives, constraints, and rule examples to achieve automatic rule generation.
It improves the efficiency and accuracy of rule generation, enhances the interpretability of rules, and improves the agility of risk strategy updates by eliminating the need to retrain the model when risk strategies change.
Smart Images

Figure CN121525898A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a model training method, rule generation method, device, medium, and program product. Background Technology
[0002] Currently, artificial intelligence (AI) technology has demonstrated powerful capabilities in various fields such as text generation, summarization, translation, question answering, and code writing, deeply penetrating all aspects of life and work. In the fintech sector, AI technology can be used for risk management.
[0003] In related technologies, model-driven risk management decision-making can be achieved by training a machine learning model using historical transaction data and using the model's predictions (such as risk scores) as the basis for decision-making. However, the conversion between the machine learning model's predictions and the final deployable and interpretable business rules still requires manual intervention. This involves manually extracting rules based on the predictions and writing code to convert these rules into rule code.
[0004] However, in the above process, rule extraction and code writing are highly dependent on manual processes and easily influenced by subjective human factors, resulting in low efficiency and accuracy in rule generation. Furthermore, when risk strategies change, it is necessary to retrain the machine learning model and manually extract and recode the rules, leading to delayed risk strategy updates and poor flexibility. Summary of the Invention
[0005] This invention provides a model training method, a rule generation method, a device, a medium, and a program product to solve the technical problems of low efficiency, low accuracy, and poor flexibility in rule generation methods in related technologies.
[0006] According to one aspect of the present invention, a model training method is provided, the method comprising:
[0007] Based on the training data and the prediction results of existing risk prediction models on the training data, the initial model is trained to obtain the first risk prediction model; wherein, the training data includes historical transaction data.
[0008] The first risk prediction model is trained based on the training data and the risk labels of the training data to obtain the second risk prediction model;
[0009] Based on the generation target, constraints, rule examples, descriptions of the rule examples, and data summaries of the training data, the second risk prediction model is fine-tuned to obtain a rule generation model; wherein, the rule generation model is used to output rule code, rule generation basis, and rule text described in natural language, the constraints include business constraints and compliance requirements, and the rules include rule logical structure and rule control parameters.
[0010] According to another aspect of the present invention, a rule generation method is provided, the method comprising:
[0011] Obtain a rule generation model; wherein the rule generation model is a model generated according to the model training method described in any of the above embodiments;
[0012] The current data, current generation target, current constraints, current rule example, description of the current rule example, and data summary of the current data are input into the rule generation model to obtain the rule code, the basis for rule generation, and the rule text described in natural language output by the rule generation model; wherein, the rule includes the rule logical structure and rule control parameters, and the current data includes the current transaction data.
[0013] According to another aspect of the present invention, a model training apparatus is provided, the apparatus comprising:
[0014] The first training module is used to train the initial model based on the training data and the prediction results of the existing risk prediction model on the training data to obtain the first risk prediction model; wherein, the training data includes historical transaction data.
[0015] The second training module is used to train the first risk prediction model based on the training data and the risk labels of the training data to obtain the second risk prediction model.
[0016] The fine-tuning module is used to fine-tune the second risk prediction model based on the generation target, constraints, rule examples, descriptions of the rule examples, and data summaries of the training data to obtain a rule generation model. The rule generation model is used to output rule codes, the basis for rule generation, and rule text described in natural language. The constraints include business constraints and compliance requirements, and the rules include rule logic structures and rule control parameters.
[0017] According to another aspect of the present invention, a rule generation apparatus is provided, the apparatus comprising:
[0018] An acquisition module is used to acquire a rule generation model; wherein the rule generation model is a model generated according to the model training method described in any of the above embodiments;
[0019] The determination module is used to input the current data, current generation target, current constraints, current rule example, description of the current rule example, and data summary of the current data into the rule generation model to obtain the rule code, the basis for rule generation, and rule text described in natural language output by the rule generation model; wherein, the rule includes rule logical structure and rule control parameters, and the current data includes current transaction data.
[0020] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0021] At least one processor; and
[0022] A memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the model training method according to any embodiment of the present invention, or to perform the rule generation method according to any embodiment of the present invention.
[0024] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, the computer program being configured to cause a processor to execute the model training method described in any embodiment of the present invention, or to execute the rule generation method described in any embodiment of the present invention.
[0025] According to another aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the model training method described in any embodiment of the present invention, or executes the rule generation method described in any embodiment of the present invention.
[0026] The technical solution of this invention includes: training an initial model based on training data and the prediction results of an existing risk prediction model on the training data to obtain a first risk prediction model, wherein the training data includes historical transaction data; training the first risk prediction model based on the training data and the risk labels of the training data to obtain a second risk prediction model; and fine-tuning the second risk prediction model based on the generation target, constraints, rule examples, descriptions of the rule examples, and a data summary of the training data to obtain a rule generation model, wherein the rule generation model is used to output rule code, the basis for rule generation, and rule text described in natural language, the constraints include business constraints and compliance requirements, and the rules include rule logical structure and rule control parameters. Its technical advantages include: Firstly, the trained rule generation model can directly generate executable rule code, avoiding manual intervention in the rule code generation process, thus improving rule generation efficiency and accuracy. Furthermore, the model can output the basis for rule generation and rule text described in natural language, enhancing rule interpretability. Secondly, when risk strategies change, there is no need to retrain the model. Simply inputting the modified generation objective, constraints, rule examples, and descriptions of the rule examples into the rule generation model yields new rule code, improving the agility and flexibility of risk strategy updates. Thirdly, based on training data and the prediction results of existing risk prediction models on the training data, the initial model is trained to obtain the first risk prediction model. This allows the performance of the first risk prediction model to approach that of existing risk prediction models, avoiding the risk of overfitting and thus improving the accuracy of the rule generation model.
[0027] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a flowchart of a model training method provided in an embodiment of the present invention;
[0030] Figure 2 This is a schematic diagram of the training process of a model training method provided in an embodiment of the present invention;
[0031] Figure 3 This is a flowchart of another model training method provided in an embodiment of the present invention;
[0032] Figure 4 This is a flowchart of another model training method provided in an embodiment of the present invention;
[0033] Figure 5 This is a flowchart of a rule generation method provided in an embodiment of the present invention;
[0034] Figure 6 This is a schematic diagram of the structure of a model training device provided in an embodiment of the present invention;
[0035] Figure 7 This is a schematic diagram of the structure of a rule generation device provided in an embodiment of the present invention;
[0036] Figure 8 This is a schematic diagram of the structure of an electronic device that implements the model training method or rule generation method of the embodiments of the present invention. Detailed Implementation
[0037] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0038] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the term "comprising" and any variations thereof are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or units is not necessarily limited to those explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices. The acquisition, storage, use, and processing of data in the embodiments of this invention comply with relevant national laws and regulations. The information collected in the embodiments of this invention is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure, and application of related data all comply with relevant national and regional laws, regulations, and standards, necessary confidentiality measures have been taken, public order and good morals have not been violated, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0039] To facilitate a better understanding of the solution provided in this embodiment, the terms involved in this embodiment are explained below.
[0040] Decision support: Based on historical information (such as transaction data, user profiles, market environment, etc.), intelligently assess the risk of a transaction (such as loan application, payment transaction, investment operation, etc.) and generate assessment results and corresponding suggestions (such as approval, rejection, increase vigilance, manual review required, etc.) for use by subsequent decision-making systems or human decision-makers.
[0041] Large models: These refer to deep learning models with a huge number of parameters (usually in the billions or hundreds of billions), pre-trained on massive amounts of text and / or multimodal data, and possessing powerful natural language understanding, generation, reasoning, and context learning capabilities.
[0042] Rule control parameters: In a rule-based decision-making system, these are specific numerical values or conditional thresholds used to define and adjust the decision logic. For example, in the rule "reject loan if user's credit score is below 600," the "600 score" is a rule control parameter.
[0043] Automatic rule generation: refers to the process of automatically deriving, writing and optimizing decision rules and their control parameters using artificial intelligence technology (especially the large model in this invention) based on training data, optimization objectives and constraints, without the need for manual rule writing or configuration files.
[0044] In related technologies, the following methods are used for risk management.
[0045] Rule-based systems rely on expert experience to manually write a large number of "if-then-other" rules or decision trees. Control parameters (such as thresholds) are embedded in the rules.
[0046] Based on statistical / machine learning models: Classification or regression models are trained using algorithms such as logistic regression, random forest, gradient boosting tree, and neural networks to predict trading risk. The model output is usually a risk score or probability.
[0047] Model-driven decision-making: This approach uses predictions from machine learning models (such as risk scores) as the basis for decisions, or maps scores to simple rules (e.g., "reject if score > 0.8"). The transformation from model parameters or predictions to final deployable and interpretable business rules typically still requires manual intervention. For example: data scientists train a high-precision risk prediction model; risk managers need to understand the importance of the model's features or analyze the model's behavior on specific samples to manually extract interpretable business rules (e.g., ">=2 consecutive late payments in 3 months" is a high-risk signal); engineers need to manually write code to implement these extracted rule logics into the production decision engine and set corresponding control parameters. When business strategies or data distribution change, the model may need to be retrained, and the rules will again require manual refinement and updates.
[0048] The above-mentioned risk management methods have the following drawbacks.
[0049] Rule extraction and writing are highly dependent on manual labor: Transforming the predictive logic or data insights of complex models (especially "black box" models) into clear, executable, and compliant business rules requires experienced experts to invest a significant amount of time in interpretation, analysis, and manual writing. This is inefficient and easily influenced by subjective factors.
[0050] Lag and High Costs: Market environments, customer behavior, and risk patterns change rapidly. When existing rules become less effective or new rules need to be introduced, the entire process—from requirement submission, manual analysis, rule writing to testing and deployment—is time-consuming and costly, leading to delays in updating risk strategies.
[0051] Explainability challenges: While the final rules themselves may be explainable, the process of generating the rules (especially the process of extracting rules from complex models) often lacks transparency and traceability, which is detrimental to auditing and regulatory compliance.
[0052] Rules and models are disconnected: rule-based systems and model-based systems are often separate. Rule-based systems struggle to fully utilize the complex nonlinear relationships captured by models; insights generated by model-based systems are difficult to quickly and accurately translate into actionable rules.
[0053] Maintenance difficulties: The maintenance cost of a large rule base is high, potential conflicts between rules are not easy to discover, and rule version management is complicated.
[0054] This embodiment provides a model training method that can train a rule generation model capable of generating rule code, the basis for rule generation, and rule text described in natural language, thus solving the problems caused by the aforementioned shortcomings. The model training method provided in this embodiment will be described in detail below.
[0055] Figure 1 This is a flowchart of a model training method provided in an embodiment of the present invention. This embodiment is applicable to scenarios where a pre-trained model is trained to obtain a rule generation model. The method can be executed by a model training device, which can be implemented in hardware and / or software. This model training device can be configured in an electronic device, such as a computer or a server. Figure 1 As shown, the method includes the following steps 101 to 103.
[0056] Step 101: Based on the training data and the prediction results of the existing risk prediction model on the training data, train the initial model to obtain the first risk prediction model.
[0057] The training data includes historical transaction data.
[0058] In this embodiment, historical transaction data refers to historical loan applications, historical payment transactions, or historical investment operations, etc. The existing risk prediction model in this embodiment refers to an AI model that has already been deployed and is used to output risk assessment information. The initial model in this embodiment refers to a pre-trained AI model, such as a large pre-trained model.
[0059] In step 101, the prediction results of the existing risk prediction model on the training data can be used as calibration data to perform supervised training on the initial model, thereby obtaining the first risk prediction model. The training process is similar to that of existing technologies and will not be described in detail in this embodiment.
[0060] The reason for using the prediction results of the existing risk prediction model on the training data to train the initial model in step 101 is mainly to avoid the risk of overfitting of the first risk prediction model. At the same time, it can also make the performance of the first risk prediction model close to that of the existing risk prediction model, so as to smoothly replace the existing risk prediction model with the rule-generated model in the future, and avoid the model replacement process causing large fluctuations in risk management.
[0061] The first risk prediction model in this embodiment is used to output risk prediction results. These risk prediction results can be credit risk predictions, market risk predictions, abnormal transaction risk predictions, etc.
[0062] Optionally, the historical transaction data is anonymized transaction data. In this embodiment, anonymized transaction data refers to data that retains the overall distribution, pattern, and statistical characteristics of the transaction data for effective model learning, while permanently removing or replacing sensitive information that can directly or indirectly identify an individual. For example, historical transaction data anonymization can be achieved through at least one of the following methods: deletion and masking, generalization and grading, perturbation, and data synthesis.
[0063] The anonymized transaction data ensured data security during the training process and protected information security.
[0064] Optionally, step 101 can be implemented as follows: Based on the training data, feature importance analysis information, and the prediction results of existing risk prediction models on the training data, an initial model is trained to obtain a first risk prediction model. Feature importance analysis information refers to the degree of contribution of each feature in the data to the prediction made by the artificial intelligence model. In this implementation, the accuracy of the first risk prediction model is improved by incorporating the feature importance analysis results during the training process.
[0065] Step 102: Train the first risk prediction model based on the training data and the risk labels of the training data to obtain the second risk prediction model.
[0066] In this embodiment, the first risk prediction model is retrained in step 102 to improve the accuracy of the second risk prediction model.
[0067] In this embodiment, the risk labels on the training data refer to the risk labels assigned to the training data by experts. For example, the risk labels in this embodiment can be normal, abnormal, approved, or rejected, etc. These risk labels serve as calibration data for supervised training of the first risk prediction model, resulting in the second risk prediction model. The training process is similar to existing technologies and will not be described in detail here.
[0068] Optionally, step 102 can be implemented by training the first risk prediction model based on the training data, feature importance analysis information, and risk labels of the training data to obtain the second risk prediction model. In this implementation, the feature importance analysis results are incorporated during the training of the second risk prediction model, thus improving the accuracy of the second risk prediction model.
[0069] Furthermore, the training data in this embodiment also includes user profiles. The user profile in this embodiment includes at least one of the following: the user's basic attributes and the user's behavioral data. Based on this implementation, since the training data also includes user profiles, the accuracy of the trained first risk prediction model and second risk prediction model is improved.
[0070] The difference between the second risk prediction model and the first risk prediction model is that the second risk prediction model has higher accuracy.
[0071] Step 103: Based on the generation objective, constraints, rule examples, descriptions of the rule examples, and data summaries of the training data, fine-tune the second risk prediction model to obtain the rule generation model.
[0072] The rule generation model outputs rule code, the basis for rule generation, and rule text described in natural language. Constraints include business constraints and compliance requirements. Rules include the rule's logical structure and control parameters.
[0073] In step 103, the second risk prediction model is fine-tuned to obtain a rule generation model. Leveraging the powerful natural language understanding, reasoning, generation, and instruction following capabilities of the rule generation model, it outputs rule code, the basis for rule generation, and rule text described in natural language. In this embodiment, the rule code refers to code that conforms to the decision engine's syntax and can be directly parsed and executed by the decision engine. Compared to risk management methods in related technologies, the rule generation model in this embodiment can achieve automatic rule generation.
[0074] In this embodiment, the generation objective clearly defines the specific goal of this rule generation. For example, the generation objective could be: "Generate rules to identify abnormal credit card transactions" or "Generate access rules for loan approval of micro and small enterprises," etc.
[0075] In this embodiment, the constraints include business constraints and compliance requirements. For example, a compliance requirement in this embodiment could be "must comply with Article X of XXX regulations." Further, the constraints also include risk preference. For example, a risk preference could be "maximum tolerable delinquency rate not exceeding 5%" or "considering the experience of high-net-worth clients." By further including risk preference in the constraints, the matching degree between the rule generation model and the business is further improved.
[0076] The rule examples in this embodiment can be manually written rule examples, used by the second risk prediction model to learn the rule's structure, language style, and logic. The description of the rule examples is used to describe necessary information related to the rule, such as the rule's output format. For example, the rule's output format can be a certain syntax template.
[0077] In this embodiment, the data summary of the training data refers to the statistical information or key feature description of the training data.
[0078] To improve interpretability, the rule generation model can also output the basis for rule generation. In this embodiment, the basis for rule generation refers to the reason for rule generation. For example, this rule is generated based on the high correlation between the feature "abnormally high recent transaction frequency" and the abnormal transaction label. The rule generation model can also output rule text described in natural language to facilitate understanding of the rules by business personnel.
[0079] In this embodiment, the rule generation model generates rules including a rule logical structure and rule control parameters, realizing the generation of the rule logical structure while automatically deriving the optimal or feasible control parameter values. The rule control parameters in this embodiment include the specific values of all thresholds, weights, and other control parameters involved in the rule. For example, when the rule generation model generates a rule, such as "age greater than X, transaction quantity greater than Y", it can not only generate the rule logical structure but also automatically derive the optimal or feasible control parameter values X and Y. The rule generation model can optimize the rule control parameters based on the data feature distribution of the input training data, the objective function of the training data (such as maximizing precision while satisfying the lower bound of recall), and constraints.
[0080] Figure 2 This is a schematic diagram illustrating the training process of a model training method provided in an embodiment of the present invention. For example... Figure 2 As shown, the process from the initial model to the rule generation model involves a first risk prediction model and a second risk prediction model. The input parameters for each model during training are as follows: Figure 2 As shown in the image.
[0081] It should be noted that the generation target, constraints, rule examples, descriptions of rule examples, and data summaries of training data in this embodiment can be input in natural language or in the form of structured templates into the second risk prediction model.
[0082] In this embodiment, during the fine-tuning process, the fine-tuned second risk prediction model can also automatically check whether the rule code conforms to the target engine's syntax requirements.
[0083] The model training method provided in this embodiment enables the application of artificial intelligence models to the novel downstream task of rule generation.
[0084] In existing technologies, rules are learned from data using techniques such as decision tree induction, association rule mining, and inductive logic programming. These methods typically have the following drawbacks: difficulty in handling high-dimensional, complex, and unstructured data; the generated rules may be very verbose or difficult to understand; difficulty in flexibly incorporating business constraints and risk preferences described in natural language; and low levels of automation and expressive power in the generated rules. Pure machine learning model scoring-driven decision-making: directly using model scores to make decisions. The advantage is end-to-end, but the disadvantage is that interpretability is usually lower than rules, and policy adjustments require retraining the model or adjusting the mapping rules (the latter still requires manual intervention). The rule generation model in this embodiment typically generates rules with better interpretability and more flexible policy adjustments (new rules can be generated simply by modifying the rule description). Other large model applications: using large models for risk prediction (classification / scoring) instead of generating rules. This is a common use of large models, but its output still needs to be manually or by another system to be converted into executable decisions, failing to solve the core problem of automatic rule generation required in this embodiment.
[0085] Compared to existing technologies, the model training method provided in this embodiment has the following improvements: **AI Model as Rule Generator:** The AI model is positioned as an automated generation engine for business rules and their control parameters, rather than merely a text generator or predictor. **End-to-End Automation:** An end-to-end automated process is achieved from input of "risk strategy objectives / data / constraints" to output of "deployable rule code + parameters," eliminating the need for manual intervention in the core steps of writing rule logic and parameters. **Collaborative Rule and Parameter Generation:** While generating the rule logic structure, key control parameter values are automatically derived and filled into the rules using data and optimization objectives. **Constraint-Guided Generation:** Business constraints, compliance requirements, and risk preferences are directly integrated into the rule generation model's generation process, ensuring that the generated rules are inherently compliant and aligned with business objectives. **Enhanced Interpretability:** Requiring the rule generation model to provide the basis for rule generation or natural language explanations assists in human understanding and auditing.
[0086] The rule generation model obtained based on the model training method provided in this embodiment has the following advantages: Overcoming the bottleneck of rules relying on manual extraction and writing: It solves the problem in existing technologies where the predictive power and insights of artificial intelligence models (especially large models) are highly dependent on manual operation when transforming them into deployable business rules and their control parameters, achieving automated generation of rules and their parameters. Improving the speed and efficiency of risk decision-making response: It significantly shortens the cycle from risk strategy conception and model training / tuning to rule deployment, enabling rapid iteration of risk strategies. Enhancing the transparency and interpretability of decision-making: It provides records and evidence of the automatic rule generation process, making the generated rules themselves and their sources more interpretable. Achieving direct conversion from model capabilities to business rules: It seamlessly bridges the advanced predictive capabilities of large models with the execution capabilities of the bank's core business decision engine.
[0087] In summary, this embodiment utilizes the powerful generation, understanding, and instruction-following capabilities of artificial intelligence models to automate the generation of end-to-end business rules and their parameters driven by natural language and guided by constraints. This is a unique technical solution of this embodiment. This embodiment has significant advantages in terms of efficiency, flexibility, ability to integrate with business constraints, and the ability to express complex rule logic.
[0088] The model training method provided in this embodiment has several advantages. First, the trained rule generation model can directly generate executable rule code, avoiding manual intervention in the rule code generation process, thus improving rule generation efficiency and accuracy. Furthermore, the rule generation model can output the basis for rule generation and rule text described in natural language, enhancing rule interpretability. Second, when the risk strategy changes, there is no need to retrain the model. Simply inputting the modified generation objective, constraints, rule examples, and descriptions of the rule examples into the rule generation model yields new rule code, improving the agility and flexibility of risk strategy updates. Third, based on the training data and the prediction results of existing risk prediction models on the training data, the initial model is trained to obtain a first risk prediction model. This allows the performance of the first risk prediction model to be close to that of existing risk prediction models, avoiding the risk of overfitting and thus improving the accuracy of the rule generation model.
[0089] Figure 3 This is a flowchart of another model training method provided in an embodiment of the present invention. This model training method... Figure 1 Based on the illustrated embodiments and various optional implementations, a detailed explanation is provided of how to fine-tune the second risk prediction model. For example... Figure 3 As shown, the model training method provided in this embodiment includes the following steps 301 to 304.
[0090] Step 301: Based on the training data and the prediction results of the existing risk prediction model on the training data, train the initial model to obtain the first risk prediction model.
[0091] The training data includes historical transaction data.
[0092] Step 302: Train the first risk prediction model based on the training data and the risk labels of the training data to obtain the second risk prediction model.
[0093] The implementation process and technical principles of steps 301 and 101, and steps 302 and 102 are similar, and will not be repeated here.
[0094] Step 303: Based on the generated objectives, constraints, rule examples, and descriptions of the rule examples, fine-tune the second risk prediction model to obtain the fine-tuned risk prediction model.
[0095] The fine-tuned risk prediction model is used to output the rule logic structure.
[0096] In this embodiment, rule examples are used as calibration data. Based on the generated objectives, constraints, and the description of the rule examples, the second risk prediction model is subjected to supervised fine-tuning to obtain the fine-tuned risk prediction model. The fine-tuned risk prediction model in this embodiment is used to output the rule logic structure. It should be noted that the rule logic structure does not include rule control parameters. That is, the fine-tuned risk prediction model first aims to align with the rule logic.
[0097] Step 304: Based on the data summary of the training data, fine-tune the fine-tuned risk prediction model to obtain the rule generation model.
[0098] In step 304, the fine-tuned risk prediction model is fine-tuned based on the data summary of the training data, so that the fine-tuned risk prediction model can learn the rule control parameters, thereby obtaining the rule generation model.
[0099] The model training method provided in this embodiment is divided into two stages when fine-tuning the second risk prediction model: first, the second risk prediction model is fine-tuned based on the generation target, constraints, rule examples, and descriptions of the rule examples to obtain the fine-tuned risk prediction model with the output rule logic structure; then, the fine-tuned risk prediction model is fine-tuned again based on the data summary of the training data to obtain the rule generation model, which improves the model training efficiency and reduces the model training complexity.
[0100] Figure 4 This is a flowchart of another model training method provided in an embodiment of the present invention. This model training method... Figure 1 Based on the illustrated embodiments and various optional implementations, a detailed explanation is provided of how to fine-tune the second risk prediction model. For example... Figure 4 As shown, the model training method provided in this embodiment includes the following steps 401 to 404.
[0101] Step 401: Based on the training data and the prediction results of the existing risk prediction model on the training data, train the initial model to obtain the first risk prediction model.
[0102] The training data includes historical transaction data.
[0103] Step 402: Train the first risk prediction model based on the training data and the risk labels of the training data to obtain the second risk prediction model.
[0104] The implementation process and technical principles of steps 401 and 101, and steps 402 and 102 are similar, and will not be repeated here.
[0105] Step 403: Combine the generated target, constraints, rule examples, descriptions of the rule examples, and data summaries of the training data to obtain model prompt words.
[0106] Step 404: Fine-tune the second risk prediction model based on the model prompts to obtain the rule generation model.
[0107] In steps 403 and 404, based on the context learning capability of the second risk prediction model itself, the second risk model is fine-tuned using the approach of cue engineering.
[0108] Optionally, in step 403, the generation target, constraints, rule examples, descriptions of rule examples, and data summaries of training data can be combined based on a pre-designed prompt template to ensure that the model prompts are clear, complete, and structured.
[0109] Optionally, the model prompt should explicitly require the model to output structured, executable rule code or rule language supported by a specific decision engine. The model prompt must include constraints, such as "The generated rules must ensure [compliance requirement description]". The model prompt may require the model to provide a brief natural language explanation and / or justification for the generated rules.
[0110] The model training method provided in this embodiment fine-tunes the second risk prediction model through prompt word engineering to obtain a rule generation model. This reduces the number of training samples required during the fine-tuning process, lowers the training threshold, and improves training efficiency and effectiveness.
[0111] Furthermore, in the above Figure 1 , Figure 3 and Figure 4 In the model training methods and various optional implementations shown, during the fine-tuning process, the fine-tuned second risk prediction model is also used to periodically perform logical consistency and conflict detection on the output rules, obtaining rule detection results. These rule detection results are used as input data for the fine-tuned second risk prediction model in the next iteration. By self-detecting the output rules during the fine-tuning process, the logical consistency and non-conflict among the rules output by the rule-based generation model are ensured.
[0112] Furthermore, during model fine-tuning, developers can further refine the rules output by the second risk prediction model. These refined rules can then be used as input data for the next iteration, accelerating model convergence.
[0113] Furthermore, after obtaining the rule generation model, it can be validated. The validation process is divided into logical validation and conflict detection. Logical validation: Using a reserved test dataset or simulated data, the generated rule set is run to evaluate whether its key metrics (such as accuracy, recall, false positive rate, and pass rate) meet the preset goals (defined in the input stage) and constraints (such as delinquency rate constraints). Conflict detection: Check whether there are logical conflicts or redundancies between the newly generated rules and the existing rule base.
[0114] The core idea of the above model training method is to leverage the powerful natural language understanding, reasoning, generation, and instruction-following capabilities of artificial intelligence models, combined with specific training methods, prompting engineering, and constraint mechanisms. It automatically generates structured business decision rules and their control parameters directly from inputs such as training data, generation objectives, constraints, rule examples, descriptions of the rule examples, and data summaries of the training data. The generated rules can be directly parsed and executed by the decision engine.
[0115] Figure 5 This is a flowchart of a rule generation method provided in an embodiment of the present invention. The rule generation method provided in this embodiment is applied to scenarios where rule code, rule text, and the basis for rule generation are generated based on a pre-trained rule generation model. This method can be executed by a rule generation device, which can be implemented in hardware and / or software. This rule generation device can be configured in an electronic device, such as a computer or server. Figure 5 As shown, the method includes the following steps 501 and 502.
[0116] Step 501: Obtain the rule generation model.
[0117] The rule generation model is a model generated according to the model training method provided in the above embodiments.
[0118] Step 502: Input the current data, current generation target, current constraints, current rule example, description of the current rule example, and data summary of the current data into the rule generation model to obtain the rule code, the basis for rule generation, and the rule text described in natural language output by the rule generation model.
[0119] The rules include the rule logic structure and rule control parameters. Current data includes current transaction data.
[0120] Furthermore, after obtaining the rule code and rule text, the rule code can be verified based on the existing rule base. If there are no logical consistency or conflict issues, the verified rule set and its parameters will be directly imported into the decision engine for deployment and execution.
[0121] Optionally, in this embodiment, during the model training process or the rule generation process, information about the rule generation process, such as input, prompts, output, and verification results, can be recorded to provide audit trails.
[0122] Optionally, in this embodiment, a feedback loop can also be established: the actual effect data after the rule goes online (such as real risk performance and business indicators) can be used to determine whether to trigger the regeneration or optimization and fine-tuning process of the rule.
[0123] Furthermore, the rule generation method also includes the following steps: deploying the rule code to the decision engine so that the decision engine runs the rule code.
[0124] The rule generation method provided in this embodiment has the following advantages: 1. Significantly improved efficiency: It reduces the time for rule writing and parameter setting from days / weeks to minutes / hours, significantly reducing labor costs and accelerating risk strategy iteration. 2. Reduced reliance on manual labor and errors: It eliminates the risks of typos, logical loopholes, and subjective biases introduced by manual rule writing. 3. Enhanced decision-making agility: It can quickly respond to new risk patterns and changes in business needs, and deploy updated rule strategies in a timely manner. 4. Enhanced transparency and auditability: The rule generation process is recordable and traceable, and the generated rules come with explanations, making them easy to understand, audit, and meet regulatory requirements. 5. Unleashing model potential: It enables advanced artificial intelligence model capabilities to be directly transformed into implementable business rules, improving the intelligence level and adaptability of the rule system. 6. Optimized parameter configuration: Automatically generated parameters are optimized based on data and objectives, and may be more scientific and effective than parameters set by human experience.
[0125] Figure 6 This is a schematic diagram of a model training device provided in an embodiment of the present invention. The device is installed in an electronic device. Figure 6 As shown, the model training device provided in this embodiment includes the following modules: a first training module 61, a second training module 62, and a fine-tuning module 63.
[0126] The first training module 61 is used to train the initial model based on the training data and the prediction results of the existing risk prediction model on the training data to obtain the first risk prediction model.
[0127] The training data includes historical transaction data.
[0128] The second training module 62 is used to train the first risk prediction model based on the training data and the risk labels of the training data to obtain a second risk prediction model.
[0129] The fine-tuning module 63 is used to fine-tune the second risk prediction model based on the generation target, constraints, rule examples, descriptions of the rule examples, and data summaries of the training data to obtain a rule generation model.
[0130] The rule generation model outputs rule code, the basis for rule generation, and rule text described in natural language. The constraints include business constraints and compliance requirements. The rules include a rule logic structure and rule control parameters.
[0131] In one embodiment, the training data further includes user profiles. The historical transaction data is anonymized transaction data. The constraints also include risk preference.
[0132] In one embodiment, the first training module 61 is specifically used to: train an initial model based on training data, feature importance analysis information, and the prediction results of an existing risk prediction model on the training data, to obtain a first risk prediction model.
[0133] In one embodiment, the second training module 62 is specifically used to: train the first risk prediction model based on the training data, feature importance analysis information, and risk labels of the training data to obtain a second risk prediction model.
[0134] In one embodiment, the fine-tuning module 63 is specifically used to: fine-tune the second risk prediction model according to the generation target, constraints, rule examples, and descriptions of the rule examples to obtain a fine-tuned risk prediction model, wherein the fine-tuned risk prediction model is used to output the rule logic structure; and fine-tune the fine-tuned risk prediction model according to the data digest of the training data to obtain the rule generation model.
[0135] In one embodiment, the fine-tuning module 63 is specifically used to: combine the generation target, constraints, rule examples, descriptions of the rule examples, and data summaries of the training data to obtain model prompt words; and fine-tune the second risk prediction model according to the model prompt words to obtain the rule generation model.
[0136] In one embodiment, during the fine-tuning process, the fine-tuned second risk prediction model is further used to periodically perform logical consistency and conflict detection on the output rules to obtain rule detection results. These rule detection results are used as input data for the fine-tuned second risk prediction model in the next iteration.
[0137] The model training apparatus provided in this embodiment of the invention can execute the model training method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0138] Figure 7 This is a schematic diagram of a rule generation device provided in an embodiment of the present invention. The device is installed in an electronic device. Figure 7 As shown, the rule generation device provided in this embodiment includes the following modules: an acquisition module 71 and a determination module 72.
[0139] Module 71 is used to obtain the rule generation model.
[0140] The rule generation model is a model generated according to the model training method described in any of the above embodiments.
[0141] The determination module 72 is used to input the current data, the current generation target, the current constraints, the current rule example, the description of the current rule example, and the data summary of the current data into the rule generation model to obtain the rule code, the basis for rule generation, and the rule text described in natural language output by the rule generation model.
[0142] The rules include a rule logic structure and rule control parameters, and the current data includes current transaction data.
[0143] The rule generation apparatus provided in the embodiments of the present invention can execute the rule generation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0144] Figure 8 This is a schematic diagram of the structure of an electronic device that implements the model training method or rule generation method of the embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0145] like Figure 8As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory 12 or a random access memory 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the read-only memory 12 or loaded from storage unit 18 into the random access memory 13. The random access memory 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, read-only memory 12, and random access memory 13 are interconnected via a bus 14. An input / output interface 15 is also connected to the bus 14.
[0146] Multiple components in electronic device 10 are connected to input / output interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of monitors, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0147] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, central processing units, graphics processing units, various special-purpose artificial intelligence computing chips, various processors running machine learning model algorithms, digital signal processors, and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as model training methods or rule generation methods.
[0148] In some embodiments, the model training method or rule generation method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via read-only memory 12 and / or communication unit 19. When the computer program is loaded into random access memory 13 and executed by processor 11, one or more steps of the model training method or rule generation method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the model training method or rule generation method by any other suitable means (e.g., by means of firmware).
[0149] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays, application-specific integrated circuits (ASICs), application-specific standard products (ASICs), systems-on-a-chip (SoCs), payload programmable logic devices, computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0150] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0151] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory (flash memory), optical fibers, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0152] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a cathode ray tube or liquid crystal display monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0153] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0154] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product within the cloud computing service system to address the shortcomings of traditional physical hosts and virtual private servers, such as high management difficulty and weak business scalability.
[0155] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the model training method or rule generation method provided in any embodiment of this invention.
[0156] In the implementation of a computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages as well as conventional procedural programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including local area networks (LANs) or wide area networks (WANs), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0157] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0158] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A model training method, characterized in that, The method comprises: training an initial model according to training data and a prediction result of the training data by an existing risk prediction model to obtain a first risk prediction model; wherein the training data comprises historical transaction data; training the first risk prediction model according to the training data and a risk label of the training data to obtain a second risk prediction model; fine-tuning the second risk prediction model according to a generation target, a constraint condition, a rule example, a description of the rule example and a data summary of the training data to obtain a rule generation model; wherein the rule generation model is used to output a rule code, a generation basis of a rule and a rule text described in natural language, the constraint condition comprises a business constraint and a compliance requirement, and the rule comprises a rule logic structure and a rule control parameter.
2. The method of claim 1, wherein, The training data further comprises a user portrait. The historical transaction data is desensitized transaction data. The constraint condition further comprises a risk preference.
3. The method of claim 1, wherein, The training of the initial model according to the training data and the prediction result of the training data by the existing risk prediction model to obtain the first risk prediction model comprises: training the initial model according to the training data, feature importance analysis information and the prediction result of the training data by the existing risk prediction model to obtain the first risk prediction model. The training of the first risk prediction model according to the training data and the risk label of the training data to obtain the second risk prediction model comprises: training the first risk prediction model according to the training data, feature importance analysis information and the risk label of the training data to obtain the second risk prediction model.
4. The method of claim 1, wherein, The fine-tuning of the second risk prediction model according to the generation target, the constraint condition, the rule example, the description of the rule example and the data summary of the training data to obtain the rule generation model comprises: fine-tuning the second risk prediction model according to the generation target, the constraint condition, the rule example and the description of the rule example to obtain a fine-tuned risk prediction model; wherein the fine-tuned risk prediction model is used to output a rule logic structure; fine-tuning the fine-tuned risk prediction model according to the data summary of the training data to obtain the rule generation model.
5. The method of claim 1, wherein, The fine-tuning of the second risk prediction model according to the generation target, the constraint condition, the rule example, the description of the rule example and the data summary of the training data to obtain the rule generation model comprises: combining the generation target, the constraint condition, the rule example, the description of the rule example and the data summary of the training data to obtain a model prompt word; fine-tuning the second risk prediction model according to the model prompt word to obtain the rule generation model.
6. The method according to any one of claims 1 to 5, characterized in that, In the fine-tuning process, the fine-tuned second risk prediction model is further used for logically consistent and conflict detection of the output rule in stages to obtain a rule detection result; The rule detection result is used as input data of the fine-tuned second risk prediction model in the next iteration process.
7. A rule generation method characterized by, The method comprises: obtaining a rule generation model; wherein the rule generation model is a model generated by the model training method according to any one of claims 1 to 6; inputting the current data, the current generation target, the current constraint condition, the current rule example, the description of the current rule example, and the data summary of the current data into the rule generation model to obtain rule code, rule generation basis, and rule text described in natural language output by the rule generation model; wherein the rule comprises a rule logic structure and a rule control parameter, and the current data comprises current transaction data.
8. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the model training method of any one of claims 1 to 6 or the rule generation method of claim 7.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program for enabling a processor to execute the model training method of any one of claims 1 to 6 or the rule generation method of claim 7 when executed by the processor.
10. A computer program product comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the model training method of any one of claims 1 to 6 or the rule generation method of claim 7.