Credit risk control method, device and storage medium
Patent Information
- Application Number
- CN202611262370.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-10-27
AI Technical Summary
[0004]本申请的主要目的在于提供一种信贷风控方法、设备和存储介质,旨在解决模型训练方向与业务优化方向无法实现对齐,难以确保模型在实际金融风控业务中的预测准确性的技术问题
本申请预设风控模型是基于信贷样本数据,以预设损失函数为优化目标对预训练模型训练得到的,由于信贷样本数据包括正样本数据和负样本数据,该预设损失函数用于衡量所述预训练模型对所述正样本数据和所述负样本数据在预测违约概率上的群体平均区分能力,在模型训练过程中,不再是以模型对个体样本的概率误差为优化目标,而是以模型对正样本数据和负样本数据的群体平均区分能力为优化目标;使得在金融风控场景下,当预设损失函数在训练过程中持续优化时,预设损失函数的优化方向能够与传统KS统计量的评估方向具有内在的一致性,基于信贷样本数据以该预设损失函数为优化目标训练得到的预设风控模型也能够准确对信贷用户的当前信贷数据进行预测,得到准确的信贷用户的当前违约概率。即,能够确保模型在实际金融风控业务中的预测准确性。
Smart Images

Figure CN122989290A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial risk control technology, and in particular to a credit risk control method, device and storage medium. Background Technology
[0002] Currently, in financial risk control scenarios, the KS (Kolmogorov-Smirnov statistic) is commonly used to measure the performance of risk control models. Specifically, the KS statistic evaluates the model's ability to rank and distinguish between good and bad customers by calculating the maximum vertical distance between the cumulative distribution functions of positive and negative samples.
[0003] However, when training risk control models, the cross-entropy loss function is typically used as the optimization objective. The cross-entropy loss function minimizes the probability error between the model's predicted probability and the true label of the sample, enabling the model to fit a conditional probability distribution. In other words, during model training, the optimization objective of the cross-entropy loss is to minimize the prediction probability error for each sample, while during model evaluation, the optimization objective of the KS statistic is to separate the positive and negative sample groups. This inconsistency between the optimization objectives of the cross-entropy loss function and the KS statistic leads to a misalignment between the model training direction and the business optimization direction, making it difficult to ensure the model's predictive accuracy in actual financial risk control operations. Summary of the Invention
[0004] The main purpose of this application is to provide a credit risk control method, device and storage medium, which aims to solve the technical problem that the model training direction and the business optimization direction cannot be aligned, making it difficult to ensure the predictive accuracy of the model in actual financial risk control business.
[0005] To achieve the above objectives, this application proposes a credit risk control method, which includes: Obtain the current credit data of credit users; The current credit data is input into a preset risk control model, and the preset risk control model outputs a risk control result. The risk control result includes the current default probability of the credit user. The preset risk control model is trained on a pre-trained model based on credit sample data and with a preset loss function as the optimization objective. The credit sample data includes positive sample data and negative sample data. The preset loss function is used to measure the group average discrimination ability of the pre-trained model in predicting the default probability of the positive sample data and the negative sample data.
[0006] In one embodiment, prior to the step of obtaining the credit data of the credit user, the method further includes: Obtain credit sample data, which includes training sample data and corresponding first risk control result labels. The training sample data is divided into positive sample data and negative sample data based on the first risk control result labels. The positive sample data and the negative sample data are input into a pre-trained model, and the pre-trained model outputs the predicted default probability. The loss value of the preset loss function is calculated based on the predicted default probability corresponding to the positive sample data and the predicted default probability corresponding to the negative sample data. Based on the loss value, update the model parameters of the pre-trained model, and return to the step of inputting the positive sample data and the negative sample data into the pre-trained model until the preset accuracy condition is met, and obtain the preset risk control model.
[0007] In one embodiment, the step of calculating the loss value of the preset loss function based on the predicted default probability corresponding to the positive sample data and the predicted default probability corresponding to the negative sample data includes: Calculate the mean of the first predicted probability corresponding to the positive sample data based on the predicted default probability corresponding to all positive sample data in the current training batch and the number of all positive sample data in the current training batch. The mean of the second predicted probability corresponding to the negative sample data is calculated based on the predicted default probability corresponding to all negative sample data in the current training batch and the number of all negative sample data in the current training batch. Calculate the difference between the mean of the first predicted probability and the mean of the second predicted probability, and use the difference as the loss value of the preset loss function.
[0008] In one embodiment, the expression for the preset loss function is:
[0009] in, , ; in, This is the label for the first risk control result. This represents positive sample data. Represents negative sample data. To predict the probability of default, This indicates the number of all positive samples in the current training batch. This indicates the number of all negative samples in the current training batch. This represents the predicted default probability corresponding to positive sample data. This represents the predicted default probability corresponding to negative sample data. This represents the loss value of the preset loss function.
[0010] In one embodiment, the step of updating the model parameters of the pre-trained model based on the loss value includes: The gradient values of the preset loss function with respect to the model parameters in the pre-trained model are calculated using the backpropagation algorithm. With maximizing the loss value as the update direction, the model parameters are updated according to the gradient value and the preset learning rate, following the gradient ascent strategy.
[0011] In one embodiment, the credit sample data further includes verification sample data and corresponding second risk control result labels, the second risk control result labels including default and non-default, and before the step of updating the model parameters of the pre-trained model according to the loss value, the method further includes: At the end of the current training cycle, multiple verification samples from the verification sample data are input into the pre-trained model, and the corresponding verification default probability is output through the pre-trained model; Calculate the first KS statistic corresponding to the pre-trained model based on the verification default probability corresponding to each verification sample; If the first KS statistic for multiple consecutive training periods prior to the current training period does not show a positive increase, it is determined that the pre-trained model meets the preset accuracy condition, and the model parameters of the pre-trained model are stopped from being updated.
[0012] In one embodiment, the step of calculating the first KS statistic corresponding to the pre-trained model based on the validation default probability corresponding to each of the validation samples includes: The verification default probabilities are sorted by size. For each sorted verification default probability, the first cumulative percentage of the number of verification samples with the second risk control result label of default in all verification samples before each sorting position is calculated, and the second cumulative percentage of the number of verification samples with the second risk control result label of negative in the verification sample data is calculated, which is also calculated as the total number of negative samples in the verification sample data. Calculate the absolute value of the difference between the first cumulative percentage and the second cumulative percentage corresponding to each of the sorting positions, and take the maximum value among all the absolute values corresponding to the sorting positions as the first KS statistic corresponding to the pre-trained model.
[0013] In one embodiment, after the step of training the preset risk control model, the method further includes: Obtain out-of-sample data and corresponding third-party risk control result labels; The out-of-sample data is input into multiple candidate risk control models saved during the training of the pre-trained model, and each candidate risk control model outputs the corresponding out-of-sample default probability. Based on the out-of-sample default probability and the corresponding third risk control result label, calculate the second KS statistic for each candidate risk control model; The candidate risk control model with the highest second KS statistic is selected as the preset risk control model.
[0014] In addition, to achieve the above objectives, this application also proposes a credit risk control device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the credit risk control method described above.
[0015] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the credit risk control method described above.
[0016] One or more technical solutions proposed in this application have at least the following technical effects: This application's pre-set risk control model is trained on a pre-trained model based on credit sample data, with a pre-set loss function as the optimization objective. Since the credit sample data includes both positive and negative samples, the pre-set loss function measures the pre-trained model's ability to distinguish between the positive and negative samples in terms of their group-average probability of default. During model training, the optimization objective is no longer the probability error of the model on individual samples, but rather the model's ability to distinguish between the positive and negative samples in a group-average manner. This ensures that, in financial risk control scenarios, as the pre-set loss function is continuously optimized during training, its optimization direction is inherently consistent with the evaluation direction of traditional KS statistics. The pre-set risk control model trained on credit sample data with this pre-set loss function as the optimization objective can accurately predict the current credit data of credit users, obtaining an accurate current default probability. In other words, it ensures the predictive accuracy of the model in actual financial risk control operations. Attached Figure Description
[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating the first embodiment of the credit risk control method in this application. Figure 2 A schematic diagram of the logical architecture of the credit risk control method provided in Embodiment 1 of this application; Figure 3 This is a flowchart illustrating the second embodiment of the credit risk control method in this application. Figure 4 This is a schematic diagram of the equipment structure of the hardware operating environment involved in the credit risk control method in the embodiments of this application.
[0020] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0021] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0022] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0023] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or credit risk control device capable of performing the above functions. The following description uses a credit risk control device as an example to illustrate this embodiment and the subsequent embodiments.
[0024] Based on this, the embodiments of this application provide a credit risk control method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the credit risk control method of this application.
[0025] In this embodiment, the credit risk control method includes steps S10 to S20: Step S10: Obtain the current credit data of the credit user; Step S20: Input the current credit data into the preset risk control model, and output the risk control result through the preset risk control model. The risk control result includes the current default probability of the credit user. The preset risk control model is trained on a pre-trained model based on credit sample data and with a preset loss function as the optimization objective. The credit sample data includes positive sample data and negative sample data. The preset loss function is used to measure the group average discrimination ability of the pre-trained model in predicting the default probability of the positive sample data and the negative sample data.
[0026] It should be noted that the credit risk control method described in this embodiment can be applied to financial risk control scenarios. Specifically, in financial risk control scenarios, there is a need to accurately assess the credit risk of credit users in order to assist financial institutions in making decisions.
[0027] In financial risk control scenarios, the KS statistic is typically used to measure a model's ability to distinguish between good and bad customers (i.e., customers with credit risk and those without). The KS statistic calculates the maximum vertical distance between the cumulative distribution functions of positive and negative samples. However, during the training phase of risk control models, the cross-entropy loss function is usually used as the optimization objective. This function aims to minimize the probability error between the model's predicted probability and the true label of the sample, allowing the model to fit the conditional probability distribution. This leads to a discrepancy between the optimization objective during model training and the optimization objective during model evaluation. Furthermore, the cross-entropy loss function is sensitive to the prediction error of individual samples, making it difficult to consistently improve the model's overall ranking ability.
[0028] This embodiment aims to train a pre-trained model using a preset loss function that aligns the training objective with the business evaluation objective, so that the trained preset risk control model can accurately output risk control results.
[0029] Specifically, before assessing the credit risk of a credit user, their current credit data can be obtained. The credit user can be an individual borrower applying for credit, a micro-enterprise owner, or other types of credit applicants. Credit data may include at least one of the following: the credit user's identity information, historical borrowing records, repayment behavior data, credit report text, income verification data, asset and liability information, and third-party credit data. Current credit data refers to the real-time data provided by the credit user at the time of this credit application; this embodiment uses current credit data as an example for illustration.
[0030] In one feasible implementation, the credit risk control device can respond to a credit user's credit application instruction, extract the credit user's unique identifier from the business system, and send data query requests to data sources such as the credit reporting system, user information database, and historical loan record database based on the unique identifier; receive the raw data returned by the above data sources, perform format verification and content cleaning on the raw data, and filter out incomplete or abnormally formatted fields to achieve the cleaning of the raw data; and encapsulate the cleaned data into structured current credit data according to a preset data structure.
[0031] The current credit data is input into a preset risk control model, and the preset risk control model outputs a risk control result, wherein the risk control result includes the current default probability of the credit user; specifically, refer to Figure 2In the case that the current credit data is credit text, the preset risk control model may include an encoder and a classification head. The current credit data is input into the preset risk control model, the encoder of the preset risk control model extracts the semantic features of the current credit data, and the classification head of the preset risk control model maps the semantic features into default probabilities, and outputs the risk control result corresponding to the credit user, that is, outputs the current default probability of the credit user.
[0032] The credit sample data can be derived from historical credit business records accumulated by financial institutions. Each sample data entry contains application information of historical credit users and the corresponding actual risk control results for those users. Samples in the credit sample data with the risk control result label indicating default or default risk are considered positive samples, while samples with the risk control result label indicating no default or no default risk are considered negative samples.
[0033] Pre-trained models can be pre-trained large language models or pre-trained multimodal models. Pre-trained large language models are language models that have been pre-trained on large-scale general corpora or related domain corpora.
[0034] The probability of default is used to quantify the likelihood of a credit user defaulting in the future. The current probability of default can be converted into a risk score according to a preset scoring mapping rule and output to the business end for enterprises or business personnel to use as a reference for risk assessment.
[0035] Since the pre-defined risk control model is trained with a pre-defined loss function as the optimization objective, and this pre-defined loss function measures the average group-wide discrimination ability between positive and negative sample data in predicting default probabilities, this average group-wide discrimination ability quantifies the overall distributional difference between positive and negative sample groups in predicting default probabilities. This average group-wide discrimination ability reflects the model's overall ability to distinguish between customers with and without credit risk, rather than the degree of fit to the prediction accuracy of individual samples. Therefore, the objective during model training is essentially to optimize the separation of the positive and negative sample group distributions, rather than to fit the accuracy of individual sample probabilities.
[0036] Furthermore, if the KS statistic is required to measure model performance during the evaluation phase, this embodiment trains a preset risk control model with the optimization objective of measuring the average group discrimination ability of positive and negative sample data in predicting default probability. When the current credit data is analyzed through the preset risk control model, the default probability output by the model can accurately reflect the relative position of the credit user in the distribution of positive and negative sample groups, thereby ensuring that the risk control results are aligned with the actual business evaluation objectives and improving prediction accuracy.
[0037] In this embodiment, the model training process no longer optimizes the probability error of the model on individual samples, but rather optimizes the model's ability to distinguish between positive and negative sample data as a group average. This ensures that, in financial risk control scenarios, as the preset loss function is continuously optimized during training, its optimization direction is inherently consistent with the evaluation direction of traditional KS statistics. The preset risk control model trained based on credit sample data using this preset loss function as the optimization objective can accurately predict the current credit data of credit users, thus obtaining an accurate probability of default. In other words, it ensures the predictive accuracy of the model in actual financial risk control operations.
[0038] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 Before step S10, the credit risk control method further includes steps S01 to S04: Step S01: Obtain credit sample data, which includes training sample data and corresponding first risk control result labels. The training sample data is divided into positive sample data and negative sample data based on the first risk control result labels. Step S02: Input the positive sample data and the negative sample data into the pre-trained model, and output the predicted default probability through the pre-trained model; Step S03: Calculate the loss value of the preset loss function based on the predicted default probability corresponding to the positive sample data and the predicted default probability corresponding to the negative sample data. Specifically, a certain proportion of samples can be extracted from the credit sample data as training sample data. The training sample data includes the historical credit data of historical credit users, and this training sample data participates in the forward calculation and backpropagation process of the model.
[0039] The first risk control result label of the training sample data is used to mark whether the historical credit user has defaulted or whether there is a risk of default. Based on the first risk control result label corresponding to each sample data in the training sample data, all training sample data can be divided into two sets: positive sample data and negative sample data.
[0040] For example, if the label value of the first risk control result label is a first identifier (e.g., "1", "default" or "risk exists"), then the corresponding sample data is assigned to the positive sample data set; if the label value of the first risk control result label is a second identifier (e.g., "0", "no default" or "no risk exists"), then the sample data is assigned to the negative sample data set.
[0041] Furthermore, positive and negative sample data are used as inputs and fed into the pre-trained model for forward computation; the pre-trained model performs feature extraction and probability mapping on each input sample data and outputs the predicted default probability for the corresponding historical credit user.
[0042] For example, when the credit sample data is credit text, the encoder of the pre-trained model can convert the training sample data into a semantic feature vector; the classification head of the pre-trained model can perform a linear mapping on the semantic feature vector to obtain a logical score; the activation function (e.g., sigmoid) of the pre-trained model can map the logical score to the predicted default probability of the historical credit user: specifically, the predicted default probability can be expressed as:
[0043] in, To predict the probability of default, For logical scoring, This is the probability mapping result of the activation function Sigmoid on the logical score.
[0044] Specifically, the predicted default probability can be a value between 0 and 1, representing the likelihood that the model predicts the historical credit user will default in the future.
[0045] In one feasible implementation, the method for calculating the loss value of the preset loss function based on the predicted default probability corresponding to the positive sample data and the predicted default probability corresponding to the negative sample data can be: Based on the predicted default probabilities corresponding to all positive sample data in the current training batch and the number of all positive sample data in the current training batch, calculate the first predicted probability mean corresponding to the positive sample data; based on the predicted default probabilities corresponding to all negative sample data in the current training batch and the number of all negative sample data in the current training batch, calculate the second predicted probability mean corresponding to the negative sample data; calculate the difference between the first predicted probability mean and the second predicted probability mean, and use the difference as the loss value of the preset loss function.
[0046] Since the total amount of credit sample data is usually large, it is impossible to input all of it into the model for forward calculation and backpropagation at once. Therefore, all training samples are divided into multiple mini-batches, each of which is a training batch. The loss value is calculated and the model parameters are updated independently for each training batch.
[0047] Therefore, in this embodiment, the predicted default probabilities corresponding to all positive sample data in the current training batch can be summed and divided by the number of all positive sample data in the current training batch to obtain the arithmetic mean, which is the first predicted probability mean corresponding to the positive sample data. This first predicted probability mean reflects the average level of the predicted default probability of the model for the positive sample group (i.e., the credit users corresponding to samples that have actually defaulted or have default risk) under the current model parameters.
[0048] The arithmetic mean is calculated by summing the predicted default probabilities corresponding to all negative sample data in the current training batch and dividing by the number of all negative sample data in the current training batch. This yields the first predicted probability mean corresponding to the negative sample data. This first predicted probability mean reflects the average level of the predicted default probability of the model for the negative sample group (i.e., credit users corresponding to samples that have not actually defaulted or have no default risk) under the current model parameters.
[0049] Furthermore, the difference between the mean of the first predicted probability and the mean of the second predicted probability is calculated, and this difference is used as the loss value of the preset loss function. Through this calculation method, the loss value can quantify the degree of separation between the positive and negative sample groups in the predicted default probability centroid within the current training batch. That is, the greater the difference between the mean of the first and second predicted probabilities, the stronger the model's average ability to distinguish between positive and negative sample groups in the probability space; the smaller the difference, the more the model's probability centroids for positive and negative samples tend to overlap in the probability space, and the weaker its average ability to distinguish between positive and negative sample groups.
[0050] Since the calculation process of the above loss value only involves continuous operations such as summation, division and subtraction, and these continuous operations are mathematically differentiable, the loss value can serve as an effective starting point for backpropagation, allowing the gradient signal to be completely transmitted back to the encoder layer of the pre-trained model from the loss value.
[0051] In one feasible implementation, the method for calculating the loss value of the preset loss function based on the predicted default probability corresponding to the positive sample data and the predicted default probability corresponding to the negative sample data can also be: Calculate the ratio between the mean of the first predicted probability corresponding to positive sample data and the mean of the second predicted probability corresponding to negative sample data within the current training batch; take the natural logarithm of the ratio, and use the logarithmic result as the loss value of the preset loss function; when the two means are equal, the ratio is 1, and the logarithm is zero, indicating that the model has no group discrimination ability in the current batch; when the mean of the first predicted probability is less than the mean of the second predicted probability, the ratio is less than 1, and the logarithm is negative, indicating that the prediction direction of the model is reversed. Since the logarithmic function is continuously differentiable in its domain, and its derivative (i.e., its reciprocal) exists everywhere in the range of positive real numbers, this loss value can serve as an effective starting point for backpropagation, allowing the gradient signal to be completely transmitted back to the encoder layer.
[0052] In one feasible implementation, the expression for the preset loss function is:
[0053] in, , ; in, This is the label for the first risk control result. This represents positive sample data. Represents negative sample data. To predict the probability of default, This indicates the number of all positive samples in the current training batch. This indicates the number of all negative samples in the current training batch. This represents the predicted default probability corresponding to positive sample data. This represents the predicted default probability corresponding to negative sample data. This represents the loss value of the preset loss function.
[0054] The expression for this preset loss function can also be expressed as:
[0055] in, This represents the mean of the first predicted probability. This represents the mean of the second predicted probability.
[0056] Specifically, according to the expression of the aforementioned preset loss function, it includes three operations: summation, division, and subtraction. All three operations are elementary continuous functions and are continuously differentiable within their domains. Therefore, the preset loss function Loss_KS satisfies the differentiability requirement at every stage of the computation chain. The gradient signal can originate from the loss value of this preset loss function and be propagated back layer by layer to the encoder layer of the pre-trained model, thus solving the non-differentiability problem caused by the reliance on sorting and maximum value operations in traditional KS statistics.
[0057] Furthermore, the loss value calculated by the expression of the preset loss function has a monotonically related characteristic to the KS statistic in mathematical terms. The KS statistic measures the maximum vertical distance between the cumulative distribution functions of positive and negative samples, and the magnitude of the KS statistic depends on the degree of separation between the distributions of positive and negative samples in the entire probability space. When the difference between the mean predicted default probabilities of positive and negative samples is greater, the overall positional shift of the corresponding cumulative distribution is greater, and the separation trend between the cumulative distribution functions corresponding to the two is more obvious. Therefore, this embodiment uses the difference between the mean of the first predicted probability and the mean of the second predicted probability as the optimization objective, which is equivalent to driving the model parameter update in the direction of increasing the KS statistic, so that the training objective and the business evaluation objective are aligned on a statistical scale.
[0058] The expression of the above-mentioned preset loss function is calculated within the current training batch. That is, it only performs summation and averaging operations based on the positive and negative sample statistics within the current training batch, without involving cross-batch sample comparisons or global sorting of all samples. This makes the calculation granularity of the loss function suitable for the batch stochastic gradient descent training paradigm, avoiding the bottleneck that the traditional KS statistic cannot be used in batch training due to its reliance on the sorting of the entire data.
[0059] Step S04: Update the model parameters of the pre-trained model according to the loss value, and return to the step of inputting the positive sample data and the negative sample data into the pre-trained model until the preset accuracy condition is met, and obtain the preset risk control model.
[0060] Using this loss value as the optimization objective, the model parameters of the pre-trained model are updated; after the parameter update is completed, this round of training iteration ends. Positive and negative sample data are re-inputted into the pre-trained model with updated parameters to start the next round of training iteration; repeat the above process until the preset accuracy condition is met, then stop training and output the model with the current parameters as the preset risk control model.
[0061] The preset accuracy condition can be at least one of the following: the loss value reaches a preset threshold, the performance metric on the validation set no longer improves, or the number of training epochs reaches a preset upper limit.
[0062] Specifically, using the loss value as the optimization objective, the method for updating the model parameters of the pre-trained model can be as follows: starting with the loss value, calculate the gradient values corresponding to each trainable parameter in the classifier and encoder of the pre-trained model using the backpropagation algorithm; determine the update step size and update direction for each trainable parameter based on the gradient values and the preset learning rate; and update each trainable parameter in the classifier and encoder according to the update step size and update direction. The preset learning rate can be a fixed learning rate or an adaptive learning rate that decays with each training epoch.
[0063] In one feasible implementation, the method for updating the model parameters of the pre-trained model based on the loss value can be: The gradient of the preset loss function with respect to the model parameters in the pre-trained model is calculated using the backpropagation algorithm; the model parameters are updated according to the gradient ascent strategy based on the gradient value and the preset learning rate, with the maximum loss value as the update direction.
[0064] Specifically, starting from the loss value node, following the chain rule of differentiation, the algorithm sequentially passes through the linear mapping layer and activation function layer of the classification head, and then back through the self-attention layer and feedforward network layer of the encoder, calculating the partial derivative of each parameter in each layer. After completing the gradient calculation, with the maximum loss value as the update direction, the model parameters are updated according to the gradient values of each parameter and the preset learning rate, following the gradient ascent strategy.
[0065] Reference Figure 2 Since the preset loss function used in this embodiment includes elementary continuous operations such as summation, division and subtraction, and the calculation chain is differentiable throughout, the gradient value can be completely transmitted from the loss value node to the bottom layer of the encoder during the backpropagation process. This allows the parameters of the encoder part to also obtain effective gradient signals, realizing end-to-end synchronous optimization of the encoder and the classification head.
[0066] Specifically, the loss value can be used as the input for backpropagation, and the built-in automatic differentiation engine can be invoked to traverse the computation graph backward from the loss value to automatically calculate the gradient values of the model parameters; a preset learning rate can be obtained, which is pre-set in the model configuration file; and a gradient ascent strategy can be adopted to add the current parameter value of the model parameter to the product of the preset learning rate and the corresponding gradient value of the model parameter to obtain the updated model parameters.
[0067] Since a larger loss value indicates a stronger average ability to distinguish between positive and negative samples in predicting default probabilities, updating parameters along the gradient ascent direction is equivalent to adjusting the model parameters in a direction that further separates the probabilities of positive and negative samples. In this embodiment, the update direction is to maximize the loss value. Based on the gradient value and the preset learning rate, the model parameters are updated according to the gradient ascent strategy. Each parameter update directly serves to improve the model's ranking ability. This optimization direction is mathematically consistent with the degree of separation between positive and negative samples measured by the KS statistic in the evaluation phase. This aligns the optimization objectives in the training phase with those in the business evaluation phase, avoiding the ineffective optimization caused by the inconsistency between the cross-entropy training direction and the KS evaluation direction in the background technology. This improves training efficiency and model prediction accuracy, and achieves batch-level KS optimization.
[0068] Based on the first and second embodiments of this application, in the third embodiment of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description and will not be repeated hereafter. In addition, the credit sample data also includes verification sample data and corresponding second risk control result labels, the second risk control result labels including default and non-default. Before the step of updating the model parameters of the pre-trained model according to the loss value, the following may also be done: At the end of the current training period, multiple validation samples from the validation sample data are input into the pre-trained model, and the corresponding validation default probabilities are output by the pre-trained model. Based on the validation default probabilities corresponding to each validation sample, the first KS statistic corresponding to the pre-trained model is calculated. If the first KS statistic corresponding to multiple consecutive training periods before the current training period does not show a positive increase, it is determined that the pre-trained model meets the preset accuracy condition, and the model parameters of the pre-trained model are stopped from being updated.
[0069] Validation sample data is a subset of the credit sample data, independent of the training sample data, used to monitor model performance during training. Validation sample data is not involved in updating model parameters; it is only used to evaluate the generalization ability of the current model at the end of each training cycle, providing a basis for early stopping decisions. Validation sample data and training sample data are taken from the same time period.
[0070] Input all validation samples from the validation sample data into the pre-trained model under the current parameters, and output the validation default probability corresponding to each validation sample through the forward calculation of the model; based on the validation default probability corresponding to each validation sample and the second risk control result label corresponding to each validation sample, calculate the first KS statistic of the current model on the validation set according to the traditional definition of the KS statistic; the first KS statistic reflects the current model's ability to sort and distinguish positive and negative samples in the validation set.
[0071] In one feasible implementation, the method for calculating the first KS statistic corresponding to the pre-trained model based on the validation default probability corresponding to each validation sample can be: The verification default probabilities are sorted by size. For each sorted verification default probability, the first cumulative percentage of the number of verification samples with the second risk control result label of default relative to the total number of positive samples in the verification sample data is calculated, and the second cumulative percentage of the number of verification samples with the second risk control result label of negative relative to the total number of negative samples in the verification sample data is calculated. The absolute value of the difference between the first cumulative percentage and the second cumulative percentage corresponding to each sorted position is calculated, and the maximum value among all the absolute values corresponding to all sorted positions is taken as the first KS statistic corresponding to the pre-trained model.
[0072] Specifically, the default probabilities of each verification sample can be sorted in ascending order, placing samples with lower default probabilities at the beginning of the sequence and samples with higher default probabilities at the end. The corresponding second risk control result labels are then rearranged according to this sorted order. Starting with the first verification sample corresponding to the sorted default probabilities, each sorting position is iterated through. For each sorting position, the number of verification samples with the second risk control result label "default" among all verification samples before and including that position is counted, and the proportion of such samples to the total number of defaulting verification samples is calculated to obtain the first cumulative proportion. Simultaneously, the number of verification samples with the second risk control result label "not defaulted" among all verification samples before and including that position is counted, and the proportion of such samples to the total number of non-defaulting verification samples is calculated to obtain the second cumulative proportion.
[0073] Furthermore, for each ranking position, the absolute value of the difference between the first cumulative proportion and the second cumulative proportion corresponding to that ranking position is calculated. This absolute value reflects the degree of separation between the cumulative distributions of positive and negative samples at that cut point. The absolute values corresponding to all ranking positions are compared, and the maximum value among all absolute values is taken as the first KS statistic for the pre-trained model. This first KS statistic reflects the best ability of the current pre-trained model to distinguish between defaulted and non-defaulted samples on the validation set; that is, the degree of separation between positive and negative samples that the model can achieve at the optimal cut point.
[0074] Specifically, the traditional definition of the KS statistic can be expressed as:
[0075] Among them, among them, and These are the cumulative distribution functions of the predicted scores for positive samples (corresponding to the first cumulative proportion) and the cumulative distribution functions of the predicted scores for negative samples (corresponding to the second cumulative proportion), respectively.
[0076] The first KS statistic calculated above provides a performance metric at the end of each training cycle that perfectly aligns with business evaluation standards, serving as the data basis for early termination judgment. Since the calculation of this first KS statistic strictly adheres to the original definition of the KS statistic, its value accurately reflects the model's ranking ability on the validation set. Therefore, using this metric as the basis for early termination judgment ensures that the monitoring standards of the training process are aligned with business objectives; (Refer to...) Figure 2 .
[0077] Furthermore, the trend of the first KS statistic is compared with the historical first KS statistic recorded in the previous training cycles: if the first KS statistic has not shown a positive increase in the previous training cycles, that is, the KS statistic of each cycle has not increased compared with the previous cycle, then it is determined that the model has converged and continuing training will no longer produce a substantial gain on the model's ranking ability. At this time, it is determined that the pre-trained model meets the preset accuracy condition, triggering the early stopping mechanism and stopping the update of the model parameters of the pre-trained model.
[0078] Through the above verification, the model automatically terminates training when its ranking ability on the validation set approaches saturation, effectively avoiding overfitting caused by overtraining, i.e., the model over-adapts to the training data and loses its ability to generalize to unseen data, while reducing unnecessary consumption of computing resources.
[0079] In one feasible implementation, after the step of training the preset risk control model, the following can also be done: Obtain out-of-sample data and corresponding third risk control result labels; input the out-of-sample data into multiple candidate risk control models saved during the training of the pre-trained model, and output the corresponding out-of-sample default probability through each candidate risk control model; calculate the second KS statistic corresponding to each candidate risk control model based on the out-of-sample default probability and the corresponding third risk control result label; and select the candidate risk control model with the highest second KS statistic as the preset risk control model.
[0080] It should be noted that out-of-time (OOT) data refers to credit sample data that is completely independent of and does not overlap with the training and validation sample data in the time dimension.
[0081] During the training of the pre-trained model, multiple candidate risk control models can be saved. The multiple candidate risk control models saved during the training process are loaded into the inference environment respectively, and out-of-sample data is input into each candidate risk control model respectively. The out-of-sample default probability corresponding to each verification sample is output through the forward calculation of each model.
[0082] For each candidate risk control model, based on the out-of-sample default probability output by the model and the corresponding third risk control result label, the second KS statistic for each candidate risk control model is calculated according to the standard definition of the second KS statistic. Specifically, the second KS statistic is the maximum vertical distance between the cumulative distribution functions of positive and negative samples on the out-of-sample data.
[0083] The second KS statistic corresponding to all candidate risk control models is compared, and the candidate risk control model with the highest second KS statistic is selected as the final preset risk control model, which is used to deploy to the business production environment for real-time risk control analysis of credit users.
[0084] Reference Figure 2 Out-of-sample data and validation sample data are taken from different time periods, completely isolated in the time dimension, which can effectively test the stability of each candidate model under different time windows. During training, candidate models saved from different training periods may perform similarly on different validation set KS statistics. However, since the validation set and training set are identically distributed, some models may overfit the data distribution characteristics of that specific time window on the validation set. By introducing out-of-sample data across time periods to uniformly evaluate each candidate model, and selecting the candidate model with the second highest KS statistic on the out-of-sample data, we can ensure that the finally deployed model maintains stable ranking and discrimination capabilities when facing customer group drift in the time dimension, thereby improving the model's predictive accuracy across time periods in actual financial risk control business.
[0085] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the credit risk control method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0086] This application provides a credit risk control device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the credit risk control method in the first embodiment described above.
[0087] The following is for reference. Figure 4The diagram illustrates a structural schematic of a credit risk control device suitable for implementing embodiments of this application. The credit risk control device in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, tablets, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital televisions and desktop computers. Figure 4 The credit risk control device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0088] like Figure 4 As shown, the credit risk control device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the credit risk control device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the credit risk control equipment to communicate wirelessly or wiredly with other devices to exchange data. While the figure shows credit risk control equipment with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0089] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0090] The credit risk control device provided in this application, employing the credit risk control method described in the above embodiments, can solve the technical problem that the model training direction and business optimization direction cannot be aligned, making it difficult to ensure the predictive accuracy of the model in actual financial risk control business. Compared with the prior art, the beneficial effects of the credit risk control device provided in this application are the same as those of the credit risk control method provided in the above embodiments, and other technical features of this credit risk control device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0091] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0092] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0093] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the credit risk control method in the above embodiments.
[0094] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0095] The aforementioned computer-readable storage medium may be included in the credit risk control equipment; or it may exist independently and not be assembled into the credit risk control equipment.
[0096] The aforementioned computer-readable storage medium carries one or more programs, which, when executed by the credit risk control device, cause the credit risk control device to perform the aforementioned credit risk control method.
[0097] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar 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 a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0098] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0099] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0100] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., computer programs) for executing the above-described credit risk control method. This solves the technical problem that the model training direction and business optimization direction cannot be aligned, making it difficult to ensure the predictive accuracy of the model in actual financial risk control operations. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the credit risk control method provided in the above embodiments, and will not be repeated here.
[0101] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the credit risk control method described above.
[0102] The computer program product provided in this application can solve the technical problem that the model training direction and the business optimization direction cannot be aligned, making it difficult to ensure the predictive accuracy of the model in actual financial risk control business. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the credit risk control method provided in the above embodiments, and will not be repeated here.
[0103] The above descriptions are merely some embodiments of this application and do not limit the scope of protection of this application. Any equivalent structural transformations made based on the technical concept of this application and the content of this specification and drawings, or direct / indirect applications in other related technical fields, are included within the scope of protection of this application. All actions involving the acquisition of signals, information, or data in this application are performed in accordance with the relevant data protection laws and policies of the country where the application is located and with authorization from the owner of the corresponding device.
Claims
1. A credit risk control method, characterized in that, The credit risk control methods include: Obtain the current credit data of credit users; The current credit data is input into a preset risk control model, and the preset risk control model outputs a risk control result. The risk control result includes the current default probability of the credit user. The preset risk control model is trained on a pre-trained model based on credit sample data and with a preset loss function as the optimization objective. The credit sample data includes positive sample data and negative sample data. The preset loss function is used to measure the group average discrimination ability of the pre-trained model in predicting the default probability of the positive sample data and the negative sample data.
2. The credit risk control method as described in claim 1, characterized in that, Before the step of obtaining credit data from credit users, the method further includes: Obtain credit sample data, which includes training sample data and corresponding first risk control result labels. The training sample data is divided into positive sample data and negative sample data based on the first risk control result labels. The positive sample data and the negative sample data are input into a pre-trained model, and the pre-trained model outputs the predicted default probability. The loss value of the preset loss function is calculated based on the predicted default probability corresponding to the positive sample data and the predicted default probability corresponding to the negative sample data. Based on the loss value, update the model parameters of the pre-trained model, and return to the step of inputting the positive sample data and the negative sample data into the pre-trained model until the preset accuracy condition is met, and obtain the preset risk control model.
3. The credit risk control method as described in claim 2, characterized in that, The step of calculating the loss value of the preset loss function based on the predicted default probability corresponding to the positive sample data and the predicted default probability corresponding to the negative sample data includes: Calculate the mean of the first predicted probability corresponding to the positive sample data based on the predicted default probability corresponding to all positive sample data in the current training batch and the number of all positive sample data in the current training batch. The mean of the second predicted probability corresponding to the negative sample data is calculated based on the predicted default probability corresponding to all negative sample data in the current training batch and the number of all negative sample data in the current training batch. Calculate the difference between the mean of the first predicted probability and the mean of the second predicted probability, and use the difference as the loss value of the preset loss function.
4. The credit risk control method as described in claim 3, characterized in that, The expression for the preset loss function is: in, , ; in, This is the label for the first risk control result. This represents positive sample data. Indicates negative sample data. To predict the probability of default, This indicates the number of all positive samples in the current training batch. This indicates the number of all negative samples in the current training batch. This represents the predicted default probability corresponding to positive sample data. This represents the predicted default probability corresponding to negative sample data. This represents the loss value of the preset loss function.
5. The credit risk control method as described in claim 3, characterized in that, The step of updating the model parameters of the pre-trained model based on the loss value includes: The gradient values of the preset loss function with respect to the model parameters in the pre-trained model are calculated using the backpropagation algorithm. With maximizing the loss value as the update direction, the model parameters are updated according to the gradient value and the preset learning rate, following the gradient ascent strategy.
6. The credit risk control method as described in claim 2, characterized in that, The credit sample data also includes verification sample data and corresponding second risk control result labels, the second risk control result labels including default and non-default. Before the step of updating the model parameters of the pre-trained model based on the loss value, the method further includes: At the end of the current training cycle, multiple verification samples from the verification sample data are input into the pre-trained model, and the corresponding verification default probability is output through the pre-trained model; Calculate the first KS statistic corresponding to the pre-trained model based on the verification default probability corresponding to each verification sample; If the first KS statistic for multiple consecutive training periods prior to the current training period does not show a positive increase, it is determined that the pre-trained model meets the preset accuracy condition, and the model parameters of the pre-trained model are stopped from being updated.
7. The credit risk control method as described in claim 6, characterized in that, The step of calculating the first KS statistic corresponding to the pre-trained model based on the validation default probability corresponding to each validation sample includes: The verification default probabilities are sorted by size. For each sorted verification default probability, the first cumulative percentage of the number of verification samples with the second risk control result label of default in all verification samples before each sorting position is calculated, and the second cumulative percentage of the number of verification samples with the second risk control result label of negative in the verification sample data is calculated, which is also calculated as the total number of negative samples in the verification sample data. Calculate the absolute value of the difference between the first cumulative percentage and the second cumulative percentage corresponding to each of the sorting positions, and take the maximum value among all the absolute values corresponding to the sorting positions as the first KS statistic corresponding to the pre-trained model.
8. The credit risk control method as described in claim 2, characterized in that, After the step of training the preset risk control model, the following steps are also included: Obtain out-of-sample data and corresponding third-party risk control result labels; The out-of-sample data is input into multiple candidate risk control models saved during the training of the pre-trained model, and each candidate risk control model outputs the corresponding out-of-sample default probability. Based on the out-of-sample default probability and the corresponding third risk control result label, calculate the second KS statistic for each candidate risk control model; The candidate risk control model with the highest second KS statistic is selected as the preset risk control model.
9. A credit risk control device, characterized in that, The credit risk control device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the credit risk control method as described in any one of claims 1 to 8.
10. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the credit risk control method as described in any one of claims 1 to 8.