Thick-tail robust stock section prediction method based on multi-task loss function
By using the multi-task loss functions of ATGRU and QuantTailLoss, the robustness and accuracy issues of stock return prediction under heavy-tailed distributions are solved, and efficient and stable prediction of stock cross-sectional returns in financial markets is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING UNIV OF POSTS & TELECOMM
- Filing Date
- 2026-02-04
- Publication Date
- 2026-05-15
AI Technical Summary
Existing technologies for stock return prediction models in the context of heavy-tailed distributions suffer from poor robustness and low prediction accuracy. In particular, they lack effective means to handle extreme values, leading to the failure of investment strategies and risk management.
We employ the Heavy-Tailed Robust Adaptive Network (ATGRU) model and the multi-task loss function (QuantTailLoss). By dynamically weighting the soft-truncation MSE loss, the efficiency-optimized ranking loss, and the cross-sectional distribution loss, we construct a heavy-tailed adaptation and ranking optimization method without the distribution assumption.
It significantly improves the robustness and stability of stock cross-sectional return forecasting, enhances the reproducibility and ranking ability of forecasts, and adapts to the complex time-varying characteristics of financial markets.
Smart Images

Figure CN122048528A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine learning technology, and more specifically to a heavy-tailed robust stock cross-section prediction method based on a multi-task loss function. Background Technology
[0002] Currently, stock return forecasting is a core task in quantitative finance, and its accuracy directly impacts the economic efficiency of investment portfolios. Financial return data (especially daily and higher-frequency data) generally exhibits heavy-tailed characteristics—the probability of extreme events is significantly higher than expected by the normal distribution theory. Heavy-tailed distributions cause variance to lose its stable risk measurement attribute, making traditional estimation methods based on finite moments prone to bias. Experience shows that the actual probability of events exceeding three standard deviations is approximately twice that under the normality assumption. This difference reveals a fundamental flaw in the normality assumption model: underestimating the risk of extreme market volatility, leading to the failure of investment strategies and risk management. Mainstream loss functions, represented by mean squared error (MSE), are theoretically based on the assumption of a normal distribution of errors, and are naturally highly sensitive to extreme values. In a heavy-tailed environment, extreme values are not anomalies but an inherent component of the distribution, causing MSE to be easily dominated by a few extreme returns, leading to overfitting and impairing generalization ability, resulting in unstable performance and poor reproducibility in financial time-series forecasting. The limitations of MSE extend beyond its sensitivity to extreme values: as a typical "point estimation" loss function, it only measures the absolute difference between predicted and actual values, ignoring key characteristics of the prediction distribution (such as variance). Risk (often characterized by distributional features like variance) is just as crucial as expected return, a deficiency particularly pronounced in financial scenarios. More fundamentally, MSE fails to incorporate ranking optimization into its objectives. Core quantitative finance tasks such as stock selection and portfolio construction inherently focus on high-precision predictions of relative stock rankings (cross-sectional ranking) rather than absolute return values. In practice, MSE inherently conflicts with maximizing the information coefficient (IC, a core indicator measuring the correlation between predicted and actual return rankings): regardless of whether the means are equal but the variance / fat-tailed estimators are inconsistent, or in scenarios with inconsistent means, MSE fails to effectively characterize the quality of IC, further demonstrating its unsuitability for cross-sectional stock ranking tasks.
[0003] To address the heavy-tailed challenge, the financial community has explored alternatives such as logistic distributions and exponential power distributions to characterize heavier tails or more peaked features. However, these methods all rely on pre-defined distribution forms, making it difficult to capture the complex time-varying characteristics of real financial data. In the field of deep learning, research on stock cross-sectional ranking has not yet systematically addressed the issues of heavy tails and extreme values, and a solution that balances the assumptions of no distribution, heavy-tail robustness, and ranking adaptability has not yet been developed. The current core challenges are: constructing a loss function with intrinsic robustness, freeing it from the underlying distribution parameterization pre-set and adapting it to the stock cross-sectional ranking task; and simultaneously designing an efficient model architecture to collaboratively suppress extreme value interference and improve prediction stability and reproducibility.
[0004] Therefore, how to provide a stock cross-sectional return prediction method that takes into account the assumption of no distribution, heavy tail robustness, and ranking fit is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] In view of this, the present invention provides a heavy-tailed robust stock cross-section prediction method based on a multi-task loss function to solve the problems existing in the background art.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: A robust, heavy-tailed stock cross-section prediction method based on a multi-task loss function includes: Collect historical market data for stocks to construct the input dataset; A thick-tailed robust adaptive network model is constructed, which includes an AT module and an ATGRU module. A multi-task loss function is constructed, which integrates the three sub-task losses—soft-truncation MSE loss, efficiency-optimized sorting loss, and cross-sectional distribution loss—through a dynamic weighting algorithm. The thick-tailed robust adaptive network model is trained using the input dataset. The model parameters are optimized through dynamic weighted multi-task learning to obtain the trained thick-tailed robust adaptive network model. The stock data to be predicted is input into the trained heavy-tailed robust adaptive network model to obtain the stock cross-sectional return prediction results.
[0007] Optionally, the ATGRU module is used to perform a normalized dynamic tanh operation on the input data, and then integrate the GRU recurrent neural network and the temporal dimension attention mechanism to process the data after the operation to obtain the attention mechanism result; finally, residual fusion and regression output are performed on the attention mechanism result.
[0008] Optionally, the AT module first uses normalization to map the input stock data to the (0,1) interval, and then uses the nonlinear capability of dynamic Tanh to compress extreme values. Optionally, the multi-task loss function is expressed as follows:
[0009] In the formula, i =1,2,3 L 1=TrunMse is the soft-truncated MSE loss. L 2 = Q-Ranknetloss is the ranking loss after efficiency optimization. L 3 = Q - KDELoss is the cross-sectional distributed loss. The loss function is determined by the task priority and the stability of the loss function. It is determined by the variance of the current task.
[0010] Optionally, the soft-truncated MSE loss can be represented as follows:
[0011] In the formula, This represents taking the 95th percentile of the residual values. r The residual value, Parameters for controlling smoothness, .
[0012] Optionally, the optimized sorting loss is specifically as follows: First, by label Segment the samples K Each box B 1,..., B K Binning is performed based on quantile thresholds; finally, each bin... B j Defined as representative score Representative tags Sample size ,satisfy Finally, the optimized sorting loss is:
[0013] In the formula, For indicator functions, Let represent the ranking prediction score of the model's output for the i-th sample, and This represents the median of the j-group in the label. () represents the sigmoid activation function.
[0014] Optionally, the cross-sectional distribution loss is specifically as follows: The residual samples are simplified using equal-frequency binning, with the following steps: First, the residuals ε are sorted and uniformly divided into m bins to obtain the number of samples in each bin; then, the median of each bin is taken as the representative point; finally, the bin weights are defined; based on the binning results, the approximate kernel density is calculated, and finally, the cross-sectional distribution loss is obtained based on the approximate kernel density.
[0015] Where m is the number of bins. Here, K is the bin weight, K() is the Gaussian kernel function, and ε is the residual. It is the median of the residual bins. Where is the kernel bandwidth and n is the number of samples.
[0016] As can be seen from the above technical solution, compared with the prior art, this invention discloses a heavy-tailed robust stock cross-sectional prediction method based on a multi-task loss function. Addressing the problem of poor robustness and low prediction accuracy of traditional prediction models due to the heavy-tailed characteristics of stock return data, this invention proposes a Heavy-Tailed Robust Adaptive Network Model (ATGRU) and a multi-task loss function, QuantTailLoss. ATGRU adaptively suppresses the propagation of extreme values through a normalized dynamic Tanh activation function; QuantTailLoss fuses TrunMSE (soft-truncated point-to-point regression loss), Q-RankNetLoss (efficiency-optimized ranking loss), and Q-KDELoss (cross-sectional distribution loss) through a dynamic weighting mechanism, achieving heavy-tailed adaptation and ranking optimization without distribution assumptions. Experimental verification shows that this invention significantly improves the mean and stability of RankIC on the CSI300 and CSI1000 datasets, providing a robust and efficient prediction solution for heavy-tailed distributed markets. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0018] Figure 1 This is a schematic diagram of the thick-tailed robust adaptive network model structure provided by the present invention; Figure 2 This is a schematic diagram showing the result of the data tail being processed without any further processing after passing through tanh, as provided by the present invention. Figure 3 A schematic diagram showing the result of linear fitting of the data provided in this invention after tanh, replacing the affine transformation; Figure 4 A schematic diagram illustrating the efficiency analysis of the average time spent for different numbers of boxes provided by this invention; Figure 5 A comparison chart showing the time spent by the model when using sample data of different sizes, provided for the present invention; Figure 6 A schematic diagram illustrating the effect of adding different noise ratios to features on the ATGRU model, provided by this invention. Figure 7 This diagram illustrates the impact of the binning hyperparameter k provided by this invention on the model IC and RankIC. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 are within the scope of protection of the present invention.
[0020] This invention discloses a heavy-tailed robust stock cross-section prediction method based on a multi-task loss function, comprising: Collect historical market data for stocks to construct the input dataset; A thick-tailed robust adaptive network model is constructed, which includes an AT module and an ATGRU module. A multi-task loss function is constructed, which integrates three sub-task losses—soft-truncation MSE loss, efficiency-optimized sorting loss, and cross-sectional distribution loss—through a dynamic weighting algorithm. The heavy-tailed robust adaptive network model (ATGRU) is trained using the input dataset. The model parameters are optimized through dynamic weighted multi-task learning to obtain the trained heavy-tailed robust adaptive network model. The stock data to be predicted is input into the trained heavy-tailed robust adaptive network model to obtain the stock cross-sectional return prediction results.
[0021] This invention studies the problem of predicting cross-sectional stock returns. For example... Figure 1 As shown, the model input consists of market information (such as price, trading volume, etc.) for N stocks over the past L days, and the output is the profit prediction vector for day T+1. The model's performance is then evaluated. Unlike time series forecasting (modeling time series predictions for a single stock), this task requires processing cross-sections of N stocks simultaneously. This invention proposes the ATGRU model (a lightweight GRU architecture incorporating attention mechanisms), whose normalized dynamic Tanh activation function alleviates distribution drift. Simultaneously, the QuantTailLoss multi-task loss function is designed to improve the model's robustness in cross-section ranking tasks.
[0022] Lightweight ATGRU module
[0023] The ATGRU module combines a lightweight GRU with additive temporal attention and the AT module, which is a module that integrates standardized and dynamic Tanh.
[0024] ATGRU module
[0025] The model input is normalized using a dynamic tanh operation, the formula is as follows:
[0026] in For data input, Linear represents the linear layer. AT represents the AT module.
[0027] Then, the GRU recurrent neural network and the temporal attention mechanism are combined:
[0028] in The output in formula (1) is T, where T is the total time step and t is a single time step. is the dimension of the hidden layer. In formula (3) Generate hidden layers for GRU. and For different linear layers, Softmax is the activation function. This is the output of the Softmax example above.
[0029] The different Linear layers mentioned above are linear layers that perform residual fusion and regression output on the results of the attention mechanism:
[0030] in The hidden layer of the last layer of H generated by GRU. For the output of formula (4), This is the final predicted value.
[0031] For the final predicted fully connected linear layer, encapsulate W fc and b fc The output dimension is the dimension of the prediction target.
[0032] AT module
[0033] By combining dynamic Tanh and normalization, normalization is first used to map stock data to the (0,1) interval, and then the non-linear capability of dynamic Tanh is used to compress extreme values. The ATGRU model includes a normalized dynamic Tanh (AT module). Normalization first ensures the stability of the dynamic Tanh... α AT This makes the model's output more robust and allows for adaptive adjustment of the model's tail shape.
[0034] If the input is (B, C, L), representing three dimensions: stock, channel, and sequence, and if it's a cross-sectional heavy-tailed problem, depending on the parameters and the standardized dimension, standardization can be performed on either the feature dimension or the stock dimension.
[0035] The dimension for calculating the mean and variance can be a time series dimension, which involves tail compression of the time series; alternatively, it can be tail compression based on a stock cross-sectional dimension. This is a fixed parameter, set to 0.1. Learnable parameters. α raw Activate via Softplus and add a minimum value constraint:
[0036] Then use the dynamic Tanh activation function:
[0037] in γ c and β c These are trainable parameters that are independent of the feature dimension channels.
[0038] Multi-task loss function: QuantTailLoss
[0039] The cross-sectional return distribution of sectors varies significantly over time, thus requiring the loss function to be dynamically adaptable. Furthermore, the relationship between features and returns exhibits complex nonlinear characteristics, and the extreme values and heavy tails in the return distribution further increase the difficulty of prediction. To address these challenges, this invention proposes QuantTailLoss—a loss function for cross-sectional stock return prediction—which utilizes a multi-task design to tackle the aforementioned difficulties.
[0040] The multi-task loss function is expressed as follows:
[0041] In the formula, i =1,2,3 L 1=TrunMse is the soft-truncated MSE loss. L 2 = Q-RankNetloss is the ranking loss after efficiency optimization. L 3 = Q - KDELoss is the cross-sectional distributed loss. The loss function is determined by the task priority and the stability of the loss function. It is determined by the variance of the current task.
[0042] Q-KDELoss: Bin-based cross-sectional distribution loss
[0043] Q-KDELoss is based on the statistical principles of kernel density estimation (KDE) and maximum likelihood estimation (MLE). Traditional MLE requires a pre-defined residual distribution (such as a normal distribution), but financial return data often exhibits complex characteristics such as heavy tails and skewness, making parametric assumptions prone to failure. KDE provides a non-parametric alternative: a smoothing kernel function is placed at each data point, and the summations form a continuous density estimate, requiring no prior distribution.
[0044] Gaussian kernel and KEDLOSS definition
[0045] Using a Gaussian kernel that is positive definite, globally non-zero, and invariant to rotation or translation, it is suitable for scenarios with heavy-tailed and non-normal residuals, such as financial returns. The formula is as follows:
[0046] Where σ is the bandwidth, controlling the smoothness of the kernel function, and μ is the distance between points. Let the sample residuals... , Y i For the true value, For model predictions, the traditional kernel density estimation (KDE) formula is:
[0047] Substituting equation (11) into the negative log-likelihood function, we obtain the definition of KEDLoss:
[0048] Direct calculation formula 12 requires O ( n 2 Its storage and time complexity make it difficult to adapt to big data scenarios.
[0049] Quantile binning acceleration strategy
[0050] The residual samples are simplified by equal-frequency binning. The steps are as follows: First, the residuals ε are sorted and uniformly divided into m bins to obtain the number of samples in each bin; then, the median of each bin is taken as the representative point; finally, the bin weights are defined; based on the binning results, the approximate kernel density is calculated, and finally, the cross-sectional distribution loss is obtained based on the approximate kernel density.
[0051] The residual samples are simplified using equal-frequency binning, and the steps are as follows: First, the residuals ε are sorted and then uniformly divided into m bins, with the number of samples in each bin being... Then take the median of each box as the representative point. Finally, define the bin weights. ,satisfy Based on the binning results, the formula for calculating the approximate kernel density estimate is rewritten as follows:
[0052] Where σ represents bandwidth, determined using a robust bandwidth selection method, the Silverman rule of thumb.
[0053] Will Substituting into the loss function yields the accelerated version Q-KEDLoss:
[0054] At this point, the computational complexity is reduced to O ( n log n + n · m The space complexity is reduced to O ( m When m When n (e.g., m = 80~150) is reached, the efficiency is improved by two orders of magnitude.
[0055] Q-RankNetLoss: Optimizing Cross-Section Ranking
[0056] RankNet is a classic ranking learning model whose loss function is based on binary cross-entropy, used to optimize the relative order of sample pairs. This invention optimizes the efficiency of the original ranking loss. The steps of the quantile Q-RankNet model based on quantile binning are as follows: First, by label... Segment the samples K Each box B 1,..., B K Binning is performed based on quantile thresholds; finally, each bin... B j Defined as representative score Representative tags Sample size ,satisfy Finally, the optimized sorting loss is:
[0057] In the formula , Let represent the ranking prediction score of the model's output for the i-th sample, and This represents the median of the j-group in the label. () represents the sigmoid activation function.
[0058] The improved quantile RankNetLoss reduces complexity by replacing "sample-sample pairs" with "sample-bin pairs". Experiments show that when the number of bins reaches 100, binning achieves the same effect as no binning, but with higher efficiency. Furthermore, it is more robust to label noise because the loss is based on a coarse-grained judgment of "whether a threshold is exceeded," rather than a fine-grained ranking between individual stocks.
[0059] TrunMSE: Point-to-point optimization of cross-sections
[0060] For ordinary point-to-point MSE, the heavy-tailed distribution corresponding to the financial cross-section is also unsuitable. The residuals of the MSE are truncated at the 95th quantile to remove the interference of extreme values in the stock heavy tails on the model.
[0061] Loss function definition
[0062] Common MSE loss functions: |r| 2 Let r be the residual. Since extreme values can interfere with model updates, the residuals of the MSE are hard-truncated. However, the biggest drawback of hard truncation is that it is not differentiable. Therefore, the TrunMse method is proposed to perform soft truncation on the MSE. The principle is to use the nonlinearity of tanh on the activation function to perform soft truncation on extreme values. TrunMSE is a smooth piecewise function, with a general form as follows: c γ ·[ t γ · + The function is to find values greater than 0 in the range of |r|≈c. c γ Partial transition to constant c γ When γ equals 2, it is equivalent to MSE truncation; when γ equals 1, it is MAE truncation, where γ>=0. When γ=2, the theoretical basis of truncated TrunMSE is:
[0063] In the formula, , r=label-pred (Residual value) , ε It is a smooth term, satisfying -1, This achieves a smooth transition. To control the smoothness parameter, it was set to 0.5 in the experiment, and the final TruMse was differentiable and continuous at all orders.
[0064] Multi-task weighted algorithm
[0065] In multi-task learning, the loss scales for different tasks can vary greatly (e.g., classification loss vs. regression loss). Directly adding them together can lead to some tasks dominating the training. The traditional approach in UW is to manually adjust the weights, but here we introduce task-related homoscedasticity uncertainty (i.e., the variance of observation noise for each task) and treat the weights as learnable parameters, allowing the model to automatically learn how to balance the tasks. We introduce the task priority, i.e., the Stability Decoupled UncertaintyWeighting (SDUW) weighting algorithm, to balance the loss across multiple tasks.
[0066] Multi-task weighted algorithm
[0067] 1. Symbol Definition
[0068] N: Total number of tasks; Tasks in the current batch i The loss (scalar, used to calculate the total loss); Tasks in the e-th epoch i The average loss (scalar, i.e., the average loss of the full sample calculated at the end of each epoch, used for stability quantification). K Sliding window size (stores the data from the most recent K epochs) ; Trainable parameters (task) i Uncertainty log variance ; P Priority task set t Target Tasks. In this experiment, the distributed loss function is set as the priority task set, and the ranking task and point-to-point MSE are set as the target task set.
[0069] 2. Coefficient of variation (measure of loss volatility)
[0070] For the task i When the sliding window is full In this invention, K is set to 100, representing one epoch, and the mean (absolute value) of the loss within the window is calculated as follows: Standard deviation of loss within the window: ( (mean within the window), coefficient of variation (relative fluctuation value) ( =10 -8 (Preventing zero). If the window is not full, ( ).
[0071] 3. Calculation of dynamic coefficients
[0072] (1) Priority Task Collective Stability
[0073] Single priority task (j) Stability of P): (Range ([0,1]), the smaller the fluctuation, the closer it is to 1). Collective stability (overall stability of priority tasks):
[0074] (2) Adjustment coefficient
[0075] Base coefficient (stability of a single task): , ( i T ). Target task adjustment amount: (Range [-1, 1], the more stable the priority task, the larger Δ). Adjusted coefficients:
[0076] (3) The final dynamic coefficients need to be normalized to ensure that the sum is approximately equal to the number of tasks n:
[0077] 4. Total Loss Function: The total loss is the weighted sum of the dynamic coefficients and the "uncertainty weighting term":
[0078] in, It is the core term of the original uncertainty-weighted algorithm (similar to the loss based on homoscedastic uncertainty in multi-task learning), and the dynamic coefficient. c i Furthermore, the weights of each task are adjusted based on the loss fluctuation. This method estimates the loss fluctuation (coefficient of variation) in real time through a sliding window, dynamically adjusts the target task weights based on the stability of priority tasks, and retains trainable uncertainty parameters, ultimately achieving adaptive weighting of multi-task losses.
[0079] experiment
[0080] During the validation set phase, an early stopping mechanism was used to prevent overfitting. Since training is IC-driven, negative IC values were used as early stopping parameters for the validation set, with a stopping patience of 10.
[0081] Table 1. Cross-sectional metrics of model performance (mean ± variance) for the CSI300 / CSI1000 datasets.
[0082] Experimental setup
[0083] Dataset
[0084] As shown in Table 1, experiments were conducted on two different datasets of the Chinese stock market to evaluate the effectiveness and generalizability of the proposed QuantTailLoss. The CSI 1000 index represents the performance of small and mid-cap stocks in the A-share market. The CSI 300 index represents the performance of large-cap stocks in the A-share market. The datasets were trained from June 2021 to June 2023, validated for 6 months, and tested in 2024. The early stop was set to 10 rounds with a learning rate of 0.0008. Furthermore, when ranking stock returns, stocks that hit their daily price limit up or down, were suspended from trading, or were delisted (ST stocks) on day t were filtered.
[0085] Baseline model
[0086] Two types of models were used: one type is stock-based prediction models, such as GATS, COGRASP, ADGAT, STHEN SR, Master, and StockMixer. The second category is time series models: nlinear, PDF, itransformer, and patchmlp models.
[0087] Evaluation indicators
[0088] Two types of indicators are used: one is the IC information coefficient and the RankIC ranking information coefficient to evaluate the model's performance; the other is volatility risk indicators to measure the model's ability to withstand risks and extreme values, such as the MDD maximum backtest and the Sharpe ratio.
[0089] Experimental results
[0090] Five random seeds (42 / 100 / 200 / 300 / 400) were used, and the mean and variance were taken as the statistical results. The default binning was 100. The atgru model used QuantTailLoss as the loss function, while other models used MSE. The best-performing indicator was highlighted in bold, and the second best was drawn with a line. For the MDD indicator, smaller is better; for other indicators, larger is better.
[0091] 1. Test method: A two-sample t-test was used, where † indicates p-value ≤ 0.01 (highly significant), and ‡ indicates p-value ≤ 0.01. [0.01, 0.05) (significant), § indicates p-value [0.05, 0.1) (marginally significant), unlabeled indicates p-value ≥ 0.1 (not significant).
[0092] 2. Key findings: The atgru model showed highly significant optimality in multiple core metrics (IC, RankIC, cumret, etc.) on both datasets. The pdf and nlinear models showed significant advantages in specific metrics, while the gcn and gats models showed insignificant performance and low values in some metrics.
[0093] Table 2. IC / Rank IC Improvement Comparison Using MSE and Huber Loss on the CSI1000 Dataset Table 3 Ablation experiments of the atgru model on CSI1000
[0094] Model Analysis
[0095] When the tail exponents of the data are the same ( α tail (Same), but different in the AT module α AT The shape produced by compressing the tail end is also different.
[0096] For example, in Figure 2 and Figure 3 A t-distribution with 5 degrees of freedom was created to simulate stock data, and the effects of different α tests on the distribution tails were investigated. Figure 2 This is the result of the tail being processed without any additional processing, because tanh compresses the data to the range [-1, 1]. Figure 3 The result of replacing affine transformation with linear fitting revealed that when α decreases, there is linear compression of the distribution tails; when α is large, a bimodal distribution appears at the truncation point due to the soft truncation of a large number of values by tanh. Figure 4 The paper analyzes the efficiency of binning with different numbers of bins. The figure shows that the average time is longer when no binning is used (k=0), while the average time is significantly reduced when binning is used. Figure 5 The model's time consumption is shown when using sample data of different sizes, and binning significantly reduces the time consumption.
[0097] exist Figure 6 The study analyzed the impact of adding different noise ratios to the features on the ATGRU model, and found that the model performance did not change significantly. Figure 7 The study shows the impact of different hyperparameters k on the model's IC and RankIC. When using fewer bins (20-60), the model performance decreases slightly, while when the number of bins is greater than 80, the model performance tends to stabilize.
[0098] ablation experiment
[0099] Table 2 shows a comparison of the loss function of the present invention with that of MSE and Huber loss on CSI1000. It can be seen that adding the loss function of the present invention significantly improves the performance of various models, demonstrating the significant advantage of the present invention's loss function. The ablation experiments of the atgru model on CSI1000 are shown in Table 3. "atgru w / o ln" represents the atgru model with the AT module removing temporal normalization and using cross-sectional normalization. All previous experimental results were based on atgru using temporal normalization (ln) for a time-weighted model. "atgru w / o Loss" represents the model using MSE after removing the QuantTailLoss loss. "atgru w / o norm" represents the original AT module based on temporal normalization, with only the normalization removed and only dynamic tanh applied. "atgru w / o tanh" represents the original atgru model based on temporal normalization, with only dynamic tanh removed. "atgru w / o Lossweight" represents the original atgru model based on temporal normalization, with only the multi-task dynamic weighting removed.
[0100] Ablation experiments show that: The "atgru w / o ln" (removing temporal normalization and using cross-sectional normalization) model is the best in terms of return and Sharpe ratio, but its ranking ability (RankICIR) is slightly inferior to the full model. The full atgru (LN + temporal heavy tail + dynamic tanh + multi-task weighting + QuantTailLoss) model significantly outperforms the full model in RankIC (0.05) and RankICIR (0.409), and has the strongest ranking stability. Removing QuantTailLoss and replacing it with MSE (atgru w / o Loss) results in a halving of IC and Sharpe, indicating that the tail loss is crucial to the prediction discrimination. Removing normalization (atgru w / o norm), dynamic tanh (atgru w / o tanh), or multi-task weighting (atgru w / o Loss weight) all degrade performance, validating the necessity of each component.
[0101] In summary, the complete ATGRU is optimal in terms of sorting capability and robustness, with each module making a clear contribution.
[0102] As described above, this invention proposes ATGRU, a lightweight model combining a GRU recurrent neural network and attention. The model incorporates a normalized dynamic Tanh to adaptively model the tail shape of financial data. A multi-task robust loss function, QuantTailLoss, is also proposed for stock cross-sectional ranking tasks. Furthermore, the efficiency of the loss function is optimized to adapt to various financial markets. Experiments demonstrate that the model of this invention achieves excellent performance on the CSI300 and CSI1000 datasets.
[0103] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0104] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A robust stock cross-section prediction method based on a multi-task loss function, characterized in that, include: Collect historical market data for stocks to construct the input dataset; A thick-tailed robust adaptive network model is constructed, which includes an AT module and an ATGRU module. A multi-task loss function is constructed, which integrates the three sub-task losses—soft-truncation MSE loss, efficiency-optimized sorting loss, and cross-sectional distribution loss—through a dynamic weighting algorithm. The thick-tailed robust adaptive network model is trained using the input dataset. The model parameters are optimized through dynamic weighted multi-task learning to obtain the trained thick-tailed robust adaptive network model. The stock data to be predicted is input into the trained heavy-tailed robust adaptive network model to obtain the stock cross-sectional return prediction results.
2. The method for predicting stock cross-sections based on a multi-task loss function according to claim 1, characterized in that, The ATGRU module is used to perform normalization dynamic tanh operation on the input data, and then integrates GRU recurrent neural network and temporal dimension attention mechanism to process the data after operation to obtain the attention mechanism result; finally, residual fusion and regression output are performed on the attention mechanism result.
3. The method for predicting stock cross-sections based on a multi-task loss function according to claim 1, characterized in that, The AT module first uses normalization to map the input stock data to the (0,1) interval, and then uses the non-linear capability of dynamic Tanh to compress extreme values.
4. The method for predicting stock cross-sections based on a multi-task loss function according to claim 1, characterized in that, The multi-task loss function is expressed as follows: In the formula, i =1,2,3 L 1=TrunMse is the soft-truncated MSE loss. L 2 = Q-RankNetloss is the ranking loss after efficiency optimization. L 3 = Q - KDELoss is the cross-sectional distributed loss. The loss function is determined by the task priority and the stability of the loss function. It is determined by the variance of the current task.
5. The method for predicting stock cross-sections based on a multi-task loss function according to claim 4, characterized in that, The soft-truncated MSE loss is expressed as follows: In the formula, This represents taking the 95th percentile of the residual values. r The residual value, Parameters for controlling smoothness, , ε It is a smoothing term.
6. The method for predicting stock cross-sections based on a multi-task loss function according to claim 4, characterized in that, The optimized sorting loss is specifically as follows: First, by label Segment the samples K Each box B 1,..., B K Binning is performed based on quantile thresholds; finally, each bin... B j Defined as representative score Representative tags Sample size ,satisfy Finally, the optimized sorting loss is: In the formula, For indicator functions, Let represent the ranking prediction score of the model's output for the i-th sample, and This represents the median of the j-group in the label. () represents the sigmoid activation function.
7. The method for predicting stock cross-sections based on a multi-task loss function according to claim 4, characterized in that, The specific cross-sectional distribution loss is as follows: The residual samples are simplified using equal-frequency binning, with the following steps: First, the residuals ε are sorted and uniformly divided into m bins to obtain the number of samples in each bin; then, the median of each bin is taken as the representative point; finally, the bin weights are defined; based on the binning results, the approximate kernel density is calculated, and finally, the cross-sectional distribution loss is obtained based on the approximate kernel density. Where m is the number of bins. Here, K is the bin weight, K() is the Gaussian kernel function, and ε is the residual. It is the median of the residual bins. Where is the kernel bandwidth and n is the number of samples.