Transaction behavior generation method based on model cascade technology

By training a quantitative trading behavior generation model based on the autoencoder on the transaction behavior data, and creating an agent with multiple rounds of dialogue capabilities combined with a large language model, the problem that the existing technology cannot reflect the distribution of real behavior is solved, and more accurate and interpretable transaction behavior generation is achieved.

CN120047244APending Publication Date: 2025-05-27TONGJI UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510127849.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-05
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

Existing transaction behavior generation techniques rely on adversarial generative models trained by historical data or large language models based on probability word-by-word generation behavior, and cannot reflect the real behavior distribution.

Method used

Using a trading behavior generation method based on model cascading technology, a quantitative trading behavior generation model based on an autoencoder is trained on the trading behavior data, and an agent with multiple rounds of dialogue capabilities is created in combination with a large language model, so as to generate trading behavior tendencies and generate quantitative trading behaviors.

Benefits of technology

It improves the accuracy and interpretability of transaction behavior generation, can better understand and analyze complex market conditions, generate more accurate and realistic trading behaviors, and adapt to complex and changeable market environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120047244A_ABST
    Figure CN120047244A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of transaction behavior generation, and provides a transaction behavior generation method based on a model cascade technology, and the method is characterized in that the method comprises the following steps: S101, constructing a marked data set; s102, dividing the data set into k groups of training sets and verification sets according to a k-fold cross validation mode, and training a quantitative transaction behavior generation model based on an auto-encoder on the data set; s103, creating an intelligent agent based on a large language model, and realizing perception of the intelligent agent on a transaction scene and generation of a transaction behavior tendency through prompt word engineering of multiple rounds of dialogues; and S104, according to the transaction behavior tendency in the S103, converting the transaction behavior tendency into formatted data from a text form, taking the formatted data as the input of the transaction behavior generation model in the S102, and obtaining finally generated quantized transaction behavior data after model generation. According to the method, the dynamic property of transaction behavior distribution is realized through a two-stage model cascade generation mode, and the method has higher accuracy and robustness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of transaction behavior generation, and in particular to a transaction behavior generation method based on model cascading technology. Background Art

[0002] In the financial market, accurately predicting and generating trading behaviors is crucial for investment strategy formulation and risk management. With the rapid development of artificial intelligence technology, deep learning models and agents based on large language models have been widely used in the field of trading behavior generation. However, these existing technologies still have some inherent limitations and cannot fully meet the needs of the actual financial market.

[0003] Deep learning models excel in processing structured data and identifying complex patterns, but their main drawback is their lack of open domain knowledge understanding. These models often rely heavily on historical data for training, causing them to perform poorly when faced with new, unseen market conditions. Financial markets are dynamic and complex systems that are influenced by a variety of factors, including economic policies, geopolitical events, and technological innovations. This limitation of deep learning models makes it difficult for them to adapt to the continuous changes in the market, thus affecting the accuracy and practicality of the generated trading behaviors.

[0004] On the other hand, although intelligent agents based on large language models have made significant progress in understanding open domain knowledge, they still face serious bias problems when generating trading behaviors. These models generate word by word based on probability. Although they can produce coherent text output, they often have difficulty accurately capturing the precise quantitative relationships and complex causal relationships in the financial market. This generation mode may result in trading behavior recommendations that are too conservative or aggressive and fail to truly reflect the risks and opportunities of the market.

[0005] In view of the above problems, the purpose of the present invention is to propose a trading behavior generation method based on model cascading technology. The method aims to combine the accuracy of deep learning models and the flexibility of large language models while overcoming their respective limitations. A new method is urgently needed to better understand and analyze complex market conditions and generate more accurate and realistic trading behaviors. Summary of the invention

[0006] The technical problem to be solved by the present invention is that the existing transaction behavior production technology relies on an adversarial generative model trained based on historical data or a large language model that generates behavior word by word based on probability. The transaction behaviors generated by both cannot reflect the actual behavior distribution.

[0007] Technical solution of the present invention:

[0008] In order to solve the above technical problems, the present invention provides a transaction behavior generation method based on model cascading technology, comprising the following steps:

[0009] Step S101, based on the transaction scenario and the original transaction behavior data, set the transaction behavior attribute indicators, and based on the indicators, design the transaction behavior classification rules, and then divide the discrete transaction behavior attribute indicator sets based on the rules. For each attribute tuple in the indicator set, mark each data in the original transaction behavior data that meets all the attributes in the tuple as the attribute tuple, forming a labeled data set.

[0010] Step S102: Based on the labeled data set, the data set is divided into k training sets and validation sets in a k-fold cross-validation manner, and a quantitative transaction behavior generation model based on an autoencoder is trained on the data set. The input of the model is an attribute tuple in an indicator set, and the output is a quantitative transaction behavior data.

[0011] Step S103, based on the large language model, an intelligent agent is created that has the ability to conduct multiple rounds of dialogue based on a text modal dialogue window, and the intelligent agent's perception of the transaction scenario and the generation of transaction behavior tendencies are realized through the prompt word engineering of multiple rounds of dialogue.

[0012] Step S104, according to the transaction behavior tendency described in S103, convert it from text form into formatted data as input of the transaction behavior generation model described in S102, and obtain the final generated quantitative transaction behavior data after model generation.

[0013] Specifically, step S101 is:

[0014] Set up the trading scenario;

[0015] According to the transaction scenario, obtain valid market transaction data;

[0016] According to the valid market transaction data, through specific transaction attributes, such as bid change range, transaction position, and transaction type, a discrete transaction behavior attribute label set and transaction behavior attribute classification rules based on transaction indicators are constructed;

[0017] Based on the transaction behavior attribute classification rules, the market transaction data is cleaned to construct a transaction behavior data set based on transaction behavior attribute classification, in which each piece of data belongs to a specific transaction behavior attribute classification label, which is an element of the transaction behavior attribute label set;

[0018] Step S102

[0019] Based on the transaction behavior dataset, several quantized transaction behavior generation models based on autoencoders are trained, and in step S102, a model with the best performance is selected as the transaction behavior generation model to be used, the input of the model is an element in the transaction behavior attribute label set, and the output is a behavior tuple in the same form as the data in the transaction behavior dataset;

[0020] Preferably, one of the transaction behavior generation models is selected as the cascading transaction behavior generation model used in the subsequent model cascading process.

[0021] Step S103

[0022] Based on the large language model, an intelligent agent is created that has the ability to conduct multi-round dialogues based on a text modal dialogue window. The creation and transaction behavior generation process of the intelligent agent includes:

[0023] Set up the large language model used by the agent;

[0024] Setting parameters of the agent according to the effective parameters of the large language model;

[0025] Set the agent's dialog window to empty;

[0026] According to the transaction scenario, set the character profile of the agent;

[0027] According to the character data of the agent, add the same character data information to the agent dialogue window, and set the label of the information in the dialogue window to "system";

[0028] According to the transaction scenario, add content confirming the current transaction scenario to the agent dialogue window, and set the label of the content in the dialogue window to "user";

[0029] The dialog window is used as input to the large language model, the output of the large language model is confirmation of the current scene, and the output content is added to the agent dialog window, and the label of the content in the dialog window is set to "agent";

[0030] Set the agent's observations in the scene;

[0031] Based on the observation, adding content describing the observation in text form to the agent dialogue window, and setting the label of the content in the dialogue window to "user";

[0032] The dialog window is used as input to the large language model, the output of the large language model is a confirmation of the current observation, and the output content is added to the agent dialog window, and the label of the content in the dialog window is set to "agent";

[0033] Adding a prompt word to the agent dialogue window requiring reasoning about the observation, and setting a label of the prompt in the dialogue window to "user";

[0034] The dialog window is used as input to the large language model, the output of the large language model is the inference result based on the observation, and the output content is added to the agent dialog window, and the label of the content in the dialog window is set to "agent";

[0035] Adding a thought chain prompt word to the agent dialogue window, requiring the agent to perform a refined analysis of the observation, and setting the label of the prompt word in the dialogue window to "user";

[0036] The dialog window is used as input to the large language model, the output of the large language model is a refined analysis result of the observation using the thought chain method, and the output content is added to the agent dialog window, and the label of the content in the dialog window is set to "agent";

[0037] Adding a prompt word requiring the generation of a trading behavior strategy based on the reasoning result to the agent dialogue window, and setting the label of the prompt word in the dialogue window to "user";

[0038] The dialog window is used as input to the large language model, and the output of the large language model is a trading behavior strategy generated based on the reasoning result, and the output content is added to the agent dialog window, and the label of the content in the dialog window is set to "agent";

[0039] Adding a prompt word requiring the generation of a transaction behavior tendency expressed in natural language based on the transaction behavior strategy to the agent dialogue window, and setting the label of the prompt word in the dialogue window to "user";

[0040] The dialog window is used as input to the large language model, and the output of the large language model is the trading behavior tendency expressed in natural language generated based on the trading behavior strategy, and the output content is added to the agent dialog window, and the label of the content in the dialog window is set to "agent";

[0041] Adding a prompt word to the agent dialogue window, requiring the transaction behavior tendency to be converted into a transaction behavior attribute label in the same format as the input format of the cascade transaction behavior generation model, and setting the label of the prompt word in the dialogue window to "user";

[0042] The dialog window is taken as input and input into the large language model. The output of the large language model is the transaction behavior attribute label which is the same as the input format of the cascaded transaction behavior generation model after the transaction behavior tendency is converted. The output content is extracted into a tuple data format and recorded as a transaction behavior tendency tuple.

[0043] Step S104

[0044] Input the transaction behavior tendency tuple into the cascade transaction behavior generation model, and the obtained output is recorded as the final transaction behavior;

[0045] From the analysis of the observation by the intelligent agent to the generation of the final transaction behavior, the cascade of the intelligent agent generative model based on the large language model and the cascade transaction behavior generation model is completed, and the transaction behavior generation in the open domain is realized, which takes into account various factors affecting the transaction behavior and reflects the real behavior distribution.

[0046] Compared with the prior art, the present invention has the following advantages or beneficial effects:

[0047] The present invention decomposes the process of transaction behavior generation into the generation of transaction behavior tendency tuples based on a large language model and the generation of quantitative transaction behavior based on an autoencoder. The reasoning made based on information observation in the open domain in the form of multiple rounds of dialogue in text mode is added to the transaction behavior generation process, which increases the amount of information used in the transaction behavior generation process and improves the interpretability of the transaction behavior generation process. At the same time, the present invention uses a data set that has been finely classified with attribute labels to train a quantitative transaction behavior generation model, so that the model has less noise for the mapping between transaction behavior attribute labels and quantitative transaction behaviors, and improves the authenticity of the generated transaction behavior. Through the cascading between models, the present invention effectively utilizes the advantages of the large language model and the autoencoder, makes up for their respective shortcomings, realizes the generation of transaction behaviors aligned with reality, and has the ability to adapt to changes in environmental information and dynamically adjust the distribution of the final generated transaction behaviors synchronously. Compared with traditional methods, this method improves interpretability by introducing a large language model, realizes the dynamic nature of the transaction behavior distribution through the generation method of two-stage model cascading, and has higher accuracy and robustness. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0049] Figure 1 A schematic diagram of the process of a network service anomaly detection method based on attribute network representation learning according to an embodiment of the present invention is shown;

[0050] Figure 2 A schematic diagram showing the process of a network service anomaly detection method based on attribute network representation learning according to an embodiment of the present invention is shown;

[0051] Figure 3 A network schematic diagram of step S102 of an embodiment of the present invention is shown;

[0052] Figure 4 A comparison diagram between the method of the present invention and the traditional method is shown. DETAILED DESCRIPTION

[0053] The following will describe the implementation methods of the present invention in detail with reference to the accompanying drawings and embodiments, so that the implementation process of how the present invention applies technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly. It should be noted that as long as there is no conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other, and the technical solutions formed are all within the protection scope of the present invention.

[0054] Embodiment 1

[0055] In order to solve the technical problems existing in the prior art, an embodiment of the present invention provides a transaction behavior generation method based on model cascading technology.

[0056] Figure 1 A schematic diagram of the process of a transaction behavior generation method based on model cascading technology according to the first embodiment of the present invention is shown; Figure 2 A process diagram of a transaction behavior generation method based on model cascading technology according to an embodiment of the present invention is shown; Figure 1 and Figure 2 As shown, the transaction behavior generation method based on the model cascading technology in an embodiment of the present invention includes the following steps.

[0057] Step S101, based on the transaction scenario and the original transaction behavior data, set the transaction behavior attribute indicators, and based on the indicators, design the transaction behavior classification rules, and then divide the discrete transaction behavior attribute indicator sets based on the rules. For each attribute tuple in the indicator set, mark each data in the original transaction behavior data that meets all the attributes in the tuple as the attribute tuple, forming a labeled data set.

[0058] The transaction behavior data is a quantitative representation of the transaction operations performed by a user in market transactions. This representation contains a series of behavior attributes, including: transaction ID, transaction time t i 、Transaction direction dir i , transaction quantity q i , transaction price p i Transaction amount i and trading account ID.

[0059] The trading behavior attribute indicators are attributes for classifying and ranking trading behaviors from different perspectives, including: trading frequency, trading size, holding time, profit and loss ratio, and trading direction tendency.

[0060] The transaction behavior classification rules are used to classify the levels of transaction behavior attribute indicators.

[0061] Take the trading behavior data in the nickel metal futures product trading scenario as an example. First, obtain the original trading behavior dataset D, which contains n trading records {d 1 ,d 2 ,…,d n}. Each record d i Contains multiple attributes, such as transaction ID, transaction time t i Transaction direction dir i , transaction quantity q i , transaction price p i Transaction amount i and trading account ID, etc.

[0062] Based on the transaction scenario, set the transaction behavior attribute indicator set I = {I 1 ,I 2 ,I 3 ,I 4 ,I 5}, where I 1 Indicates the transaction frequency, I 2 Indicates the transaction size, I 3 Indicates the holding time, I 4 Indicates the profit and loss ratio, I 5 Indicates the trading direction tendency. For each indicator I j , design the corresponding classification rule R j , which is divided into three levels: low, medium and high, denoted as {L j ,M j ,H j}.

[0063] For example, for transaction frequency I 1 , define R 1 As follows: If the average number of transactions per day does not exceed 5, it is classified as L 1 ; If the average number of transactions per day is between 5 and 20, it is classified as M 1 ; If the average number of transactions per day exceeds 20, it is classified as H 1 Similarly, corresponding classification rules are defined for other indicators.

[0064] Next, we construct a discrete set of transaction behavior attribute indicators Ω, where each element ω is a five-tuple (c 1 ,c 2,c 3 ,c 4 ,c 5 ), c j ∈{L j ,M j ,H j} represents the classification result of the jth indicator. Theoretically, the cardinality of Ω is 3^5=243, representing all possible attribute combinations.

[0065] For each record d in the dataset D i , perform the following steps:

[0066] 3. Calculate d i The corresponding index values ​​v {i,j} (j=1,2,3,4,5).

[0067] 4. According to the classification rule R j , determine each indicator value v {i,j} Category c {i,j} .

[0068] 3. D i Labeled as the corresponding attribute tuple ω i =(c {i,1} ,c {i,2} ,c {i,3} ,c {i,4} ,c {i,5} ).

[0069] In actual operation, D is first preprocessed to calculate the statistical indicators of each trading account, such as the average number of daily transactions and the buy-in ratio. Then, each record d in D is traversed. i , according to the statistical results of preprocessing and d i The attribute itself determines the attribute tuple ω to which it belongs i Finally, ω i Add as a tag to d i In the form of new data entry d i ′.

[0070] Through this process, we get a labeled data set D′={d′ 1 ,d′ 2 ,...,d′ n}, where each piece of data is labeled with a specific attribute tuple. This dataset D′ can be used for subsequent analysis and modeling, such as identifying different types of transaction behavior patterns or predicting future transaction trends.

[0071] It should be noted that in actual applications, it may be necessary to dynamically adjust the definition and classification rules of attribute indicators according to specific transaction data characteristics and business needs. For example, it is possible to consider introducing a time weighting factor λ(t) to adjust the weights of transaction characteristics in different time periods, or dynamically adjust the transaction scale classification criteria according to the market volatility index σ(t). In addition, when processing large-scale data, a distributed computing framework F can be used to improve the efficiency of data processing, dividing D into multiple subsets {D 1 ,D 2 ,...,D m} Parallel processing, and finally merging the results to obtain the final labeled dataset D′.

[0072] Step S102: Based on the labeled data set, the data set is divided into k training sets and validation sets in a k-fold cross-validation manner, and a quantitative transaction behavior generation model based on an autoencoder is trained on the data set. The input of the model is an attribute tuple in an indicator set, and the output is a quantitative transaction behavior data.

[0073] like Figure 3 As shown, in step S102, based on the labeled data set D′={d′ 1 ,d′ 2 ,...,d′ n}Build a quantitative trading behavior generation model M based on autoencoder. First, use the k-fold cross-validation method to divide D′ into k subsets {D′ 1 ,D′ 2 ,...,D′ k}, each time select k-1 subsets as training set T i , the remaining subset is used as the validation set V i , a total of k training and validation are performed.

[0074] The core of the model M is a variational autoencoder (VAE) structure, which includes an encoder E and a decoder G. The encoder E converts the input attribute tuple ω = (c 1 ,c 2 ,c 3 ,c 4 ,c 5 ) is mapped to a distribution in the latent space Z in Denotes the parameters of the encoder. The decoder G will be The sampled latent vector z is mapped back to the transaction behavior data space to generate a quantized transaction behavior data d′=G(z).

[0075] During the training process, the model parameters are optimized using the stochastic gradient descent algorithm. Where ψ represents the decoder parameters. The objective function L(θ) consists of two parts: the reconstruction error L r and KL divergence L kl . Reconstruction error L r Measures the similarity between the generated transaction behavior data and the original data, while the KL divergence L kl It is used to normalize the potential space distribution to make it close to the standard normal distribution N(0,I).

[0076] Specifically, for each training set T i , iteratively perform the following steps:

[0077] From T i Randomly sample a mini-batch B = {ω j ,d′ j}.

[0078] For each sample (ω j ,d′ j ), calculated by encoder E

[0079] from Sample the latent vector z in j .

[0080] Use decoder G to generate quantitative trading behavior data d″ j =G(z j ).

[0081] Calculate the reconstruction error L r =∑ j ||d′ j -d″ j || 2 .

[0082] Calculating KL divergence

[0083] Calculate the total loss L(θ) = L r +λL kl , where λ is the balancing factor.

[0084] Calculate the gradient through the back-propagation algorithm And update the model parameters θ.

[0085] After each training cycle, use the validation set V i Evaluate model performance. To improve the generalization ability of the model, regularization techniques such as weight decay and dropout are introduced. In addition, learning rate scheduling strategies such as cosine annealing are adopted to dynamically adjust the learning rate η(t) during training.

[0086] In order to handle the discrete features of different attributes, an embedding layer E is used in the encoder E. emb , mapping discrete attribute values ​​to continuous vector space. At the same time, in order to capture the relationship between attributes, the attention mechanism A(·) is introduced in both the encoder and the decoder, so that the model can dynamically adjust the importance of each feature according to different attribute combinations.

[0087] After the training is completed, a model M is obtained that can generate corresponding quantitative trading behavior data according to the given attribute tuple ω. In practical applications, trading behavior data with different characteristics can be generated by adjusting the vector z in the latent space Z, thereby realizing the simulation and analysis of various trading strategies.

[0088] In actual application scenarios, the quantitative trading behavior generation model M shows significant practical value and flexibility. For example, suppose an attribute tuple ω is input {sample} =(H 1 ,M 2 ,L 3 ,H 4 ,M 5 ), representing a high-frequency trading, medium-sized, short-term position, high profitability, and neutral trading direction. The model M first maps this discrete attribute tuple to a distribution in the latent space Z through the encoder E Then the potential vector z is sampled from this distribution. Then, the decoder G converts z into a specific quantitative trading behavior data d {sample} .

[0089] In step S103, the present invention constructs an intelligent agent A with multi-round dialogue capabilities based on a large language model (LLM) to perceive trading scenarios and generate trading behavior tendencies. GPT-4 was selected as the basic LLM, and its performance in the financial field was improved through fine-tuning and parameter optimization. A system role S was set for A, which was defined as an experienced nickel metal futures trading expert with deep market insight and risk management capabilities.

[0090] Agent A goes through a series of carefully designed multi-round dialogues Γ = {γ 1 ,γ 2 ,...,γ 6} to complete the whole process from scene perception to behavior generation. 1 In the above example, A is provided with the current market conditions O, including the nickel price P. t 、Volume t 、OI t and other key indicators, as well as recent important events E t A confirms his understanding of O by retelling and summarizing, forming a preliminary observation result O′.

[0091] In Gamma 1 In this way, A is guided to make in-depth reasoning about O′. A uses its built-in financial knowledge K f and logical reasoning ability R, generating a series of inferences I = {i 1 ,i 2 ,...,i m These inferences cover multiple aspects such as market trends, supply and demand relationships, and potential risks.

[0092] In order to further refine the analysis, 3 The Chain-of-Thought (CoT) technique is used in the 1 ,q 2 ,...,q n}, prompting A to gradually unfold the thinking process T(I). This process not only improves the transparency of reasoning, but also helps A discover details that may be overlooked, thereby obtaining more detailed observation results O″.

[0093] In Gamma 4 In the above example, based on O″ and T(I), A is required to generate a specific trading behavior strategy Σ. A will consider multiple factors, such as market trend μ, risk assessment ρ, etc., to form a complete trading plan.

[0094] Next, in γ 5 In the process, A is guided to convert Σ into a trading behavior tendency B expressed in natural language. This step aims to convert professional trading strategies into behavioral descriptions that are easier to understand and execute, including trading frequency f, scale s, and holding time δ. t , expected profit and loss ratio π and directional preference d.

[0095] Finally, in γ 6 In the example, A is required to convert B into a trading behavior attribute label ω that matches the input format of the quantitative trading behavior generation model M (constructed in S102) o =(c {1,o} ,c {2,o} ,c {3,o} ,c {4,o} ,c {5,o} ). This step requires A to understand and apply the transaction behavior classification rule R = {R 1 ,R 2 ,...,R 5}, mapping qualitative behavioral tendencies into discrete attribute space Ω.

[0096] During the entire process, through prompt word engineering, the content and structure of the prompt words are adjusted in real time according to the progress of the conversation to ensure the smoothness of the interaction and the effectiveness of information extraction.

[0097] Through this multi-round dialogue and prompt word engineering method, we successfully achieved the in-depth understanding of complex trading scenarios and the generation of accurate trading behavior tendencies by agent A. This method not only fully utilized the powerful language understanding and generation capabilities of LLM, but also effectively guided the formation of reasoning and decision-making through a structured dialogue process. The attribute label ω outputted in the end provides high-quality input for the subsequent generation of quantitative trading behaviors, laying the foundation for the effective operation of the entire intelligent trading system.

[0098] In step S104, the trading behavior tendency generated by agent A in S103 is converted into quantitative trading behavior data, thereby realizing the cascade of the large language model and the quantitative trading behavior generation model. This process makes full use of the variational autoencoder model M trained in S102 to convert the abstract trading strategy into specific trading behavior data.

[0099] First, the transaction behavior attribute label ω output by agent A in S103 o =(c 1 ,c 2 ,c 3 ,c 4 ,c 5 ) as the input of the model M. The encoder E receives ω o , and maps it to the distribution in the latent space Z This step realizes the transformation from discrete attribute space to continuous latent space, laying the foundation for subsequent behavior generation.

[0100] Next, from The latent vector z is obtained by sampling o This sampling process introduces randomness, so that even for the same input ω o , and can also generate diverse trading behavior data. This randomness reflects the fact that even if the strategy is the same in real transactions, the specific execution may be different.

[0101] Then, the decoder G converts z o Map back to the transaction behavior data space to generate the final quantitative transaction behavior data d f =

[0102] G(z o ). f Contains specific transaction information, such as transaction time t f 、Transaction direction dir f , transaction quantity q f , transaction price p f Etc. These data directly reflect the trading strategy Σ formulated by agent A based on the current market conditions O and in-depth analysis I.

[0103] In order to improve the reliability of the generated results, a post-processing step H(d f ). The H(·) function performs rationality checks and fine-tunes the generated transaction behavior data to ensure that it meets the constraints of actual transactions. For example, H(·) will convert the transaction quantity q f Adjust to an integer multiple of the minimum transaction unit, or increase the transaction price p f Limit within a reasonable range of price limits.

[0104] In addition, a feedback mechanism F(d f ,O), the generated transaction behavior data d f Compare with the current market situation O and calculate a rationality score s f If s f If the value is lower than the preset threshold ν, the system will trigger the regeneration process until a d that meets the requirements is obtained. f .

[0105] For example, non-limiting, current market conditions c Contains the current market price p c , generating behavior d fc Included in the price p dc , define the feedback mechanism F c As follows: fc =((p c -p dc ) 2 +ε) -1 ,v=100. That is, when the price in the generation behavior exceeds the current market price by 10%, the regeneration process is triggered.

[0106] This whole process achieves a seamless transition from the high-level decision-making of agent A to specific executable trading behaviors. By combining the generative agent based on the large language model with the quantitative trading behavior generation model, various factors affecting trading behaviors are successfully considered in open domain problems, while ensuring the consistency of the generated behavior with the distribution of real trading behaviors.

[0107] In general, step S104 realizes the intelligent transformation from abstract strategy to specific behavior, providing a powerful and flexible intelligent decision support system for nickel metal futures trading.

[0108] The present invention can not only fully utilize the reasoning ability of large language models and the accuracy of quantitative models, but also adapt to complex and changing market environments, providing traders with more intelligent, accurate and reliable decision support.

[0109] The transaction behavior generation method based on model cascade technology provided by the embodiment of the present invention, by training a specific behavior generation model, combined with a large language model, and fusing the two models, realizes that the patterns hidden in the transaction behavior generation are integrated into the transaction behavior generation process without learning the parameters of the large language model, thereby forming a generation mode of first reasoning and then generating. Compared with the traditional method, the reasoning process of the present invention provides stronger explainability and avoids the bias problem caused by the large language model directly generating transaction behavior; at the same time, the present invention realizes the behavior generation of a diverse group of people through the prompt word engineering of multiple rounds of dialogues, and introduces the factor of human imperfect rationality, so that the behavior generation is more diverse and more aligned with the human behavior in the actual financial scenario. Compared with the traditional method, the present invention has a stronger consistency with reality, and effectively solves the problem that the traditional transaction behavior generation method cannot reflect the real behavior distribution.

[0110] Compare the market trading behavior before and after adding the professional generation model, such as Figure 4 , where (a) is the market trading behavior performance without the addition of the professional generation model, and (b) is the market trading behavior performance with the addition of the professional generation model. It can be seen that the market trading behavior (buying and selling) is more in line with the real market price after the professional generation model. The average buying price and selling price remain consistent, and the selling price is slightly higher than the buying price; on the contrary, when there is no two-stage cascade, the price is very abnormal.

Claims

1. A transaction behavior generation method based on model cascading technology, characterized in that: The following steps are involved: Step S101, based on the transaction scenario and the original transaction behavior data, set the transaction behavior attribute index, and design the transaction behavior classification rules based on the index; then divide the discrete transaction behavior attribute index set based on the rule, and for each attribute tuple in the index set, mark each piece of data in the original transaction behavior data that meets all the attributes in the tuple as the attribute tuple, forming a labeled data set; Step S102: based on the labeled data set, the data set is divided into k groups of training sets and validation sets in a k-fold cross-validation manner, and a quantitative transaction behavior generation model based on an autoencoder is trained on the data set; the input of the model is an attribute tuple in an indicator set, and the output is a piece of quantitative transaction behavior data; Step S103, creating an intelligent agent capable of conducting multiple rounds of dialogue based on a text modal dialogue window based on the large language model, and realizing the intelligent agent's perception of the transaction scenario and the generation of transaction behavior tendency through the prompt word engineering of the multiple rounds of dialogue; Step S104, according to the transaction behavior tendency described in S103, convert it from text form into formatted data as input of the transaction behavior generation model described in S102, and obtain the final generated quantitative transaction behavior data after model generation.

2. The transaction behavior generation method based on model cascading technology according to claim 1 is characterized in that: In step S101, the transaction behavior data is a quantitative representation of the transaction operations performed by a user in the market transaction, and this representation contains a series of behavior attributes, including: transaction ID, transaction time t i 、Transaction direction dir i , transaction quantity q i , transaction price p i Transaction amount i and trading account ID; The transaction behavior attribute indicators are attributes that classify and sort transaction behaviors from different perspectives, including: transaction frequency, transaction size, position holding time, profit and loss ratio, and transaction direction tendency; The transaction behavior classification rules are used to classify the levels of transaction behavior attribute indicators.

3. The transaction behavior generation method based on model cascading technology according to claim 2 is characterized in that: The steps for generating trading behavior data in the nickel metal futures product trading scenario are as follows: First, we obtain the original transaction behavior dataset D, which contains n transaction records {d1, d2, ..., d n }; Each record d i Contains multiple attributes, including: transaction ID, transaction time t i Transaction direction dir i , transaction quantity q i , transaction price p i Transaction amount i and trading account ID; Based on the trading scenario, set the trading behavior attribute indicator set I = {I1, I2, I3, I4, I5}, where I1 represents the trading frequency, I2 represents the trading scale, I3 represents the holding time, I4 represents the profit and loss ratio, and I5 represents the trading direction tendency; For each indicator I j , design the corresponding classification rule R j , which is divided into three levels: low, medium and high, denoted as {L j , M j , H j }; For the transaction frequency I1, define R1 as follows: if the average daily transaction number does not exceed 5 times, it is classified as L1; if the average daily transaction number is between 5 and 20 times, it is classified as M1; if the average daily transaction number exceeds 20 times, it is classified as H1; similarly, define corresponding classification rules for other indicators; Next, we construct a discrete set of transaction behavior attribute indicators Ω, where each element ω is a quintuple (c1, c2, c3, c4, c5), c j ∈{L j , M j , H j } represents the classification result of the jth indicator; For each record d in the dataset D i , perform the following steps:

1. Calculate d i The corresponding index values ​​v {i,j} (j=1, 2, 3, 4, 5); 2. According to the classification rule R j , determine each indicator value v {i,j} Category c {i,j} ; 3. D i Labeled as the corresponding attribute tuple ω i =(c {i,1} , c {i,2} , c {i,3} , c {i,4} , c {i,5} ); Finally, ω i Add as a tag to d i In the above example, a new data entry d′ is formed. i ; Through this process, we get a labeled data set D′={d′1, d′2, ..., d′ n }, where each piece of data is labeled as a specific attribute tuple. This dataset D′ can be used for subsequent analysis and modeling.

4. The transaction behavior generation method based on model cascading technology according to claim 1 is characterized in that: In step S102, based on the labeled data set D′={d′1, d′2, ..., d′ n }Build a quantitative trading behavior generation model M based on autoencoder: First, the k-fold cross-validation method is used to divide D′ into k subsets {D′1, D′2, ..., D′ k }, each time select k-1 subsets as training set T i , the remaining subset is used as the validation set V i , a total of k training and validation; The core of the autoencoder-based quantitative trading behavior generation model M is a variational autoencoder (VAE) structure, which includes an encoder E and a decoder G; the encoder E maps the input attribute tuple ω = (c1, c2, c3, c4, c5) to a distribution in the latent space Z in represents the parameters of the encoder; the decoder G will be The sampled latent vector z is mapped back to the transaction behavior data space to generate a quantized transaction behavior data d′=G(z); During the training process, the stochastic gradient descent algorithm is used to optimize the model M parameters. Where ψ represents the parameters of the decoder; the objective function L(θ) consists of two parts: the reconstruction error L r and KL divergence L kl ; Reconstruction error L r Measures the similarity between the generated transaction behavior data and the original data, while the KL divergence L kl It is used to normalize the potential space distribution to make it close to the standard normal distribution N(0, I); After each training cycle, use the validation set V i Evaluate model performance; After the training is completed, a model M is obtained that can generate corresponding quantitative transaction behavior data based on the given attribute tuple ω.

5. The transaction behavior generation method based on model cascading technology according to claim 4 is characterized in that: In step S102, the trading behavior data with different characteristics are generated by adjusting the vector z in the latent space Z, so as to realize the simulation and analysis of various trading strategies.

6. The transaction behavior generation method based on model cascading technology according to claim 1 is characterized in that: In step S103, an intelligent agent A with multi-round dialogue capability is constructed based on a large language model (LLM) to perceive transaction scenarios and generate transaction behavior tendencies; a system role S is set for A; Agent A completes the whole process from scene perception to behavior generation through a series of carefully designed multi-round dialogues Γ = {γ1, γ2, ..., γ6}; In γ1, the current market situation O is provided to A, and A confirms his understanding of O by repeating and summarizing it, forming a preliminary observation result O′; In γ2, A is guided to make in-depth reasoning about O′; A uses its built-in financial knowledge K f and logical reasoning ability R, generating a series of inferences I = {i1, i2, ..., i m }; These inferences cover market trends, supply and demand relationships, potential risks and other aspects; In order to further refine the analysis, the thinking chain technique τ is used in γ3; by designing a series of guiding questions Q = {q1, q2, ..., q n }, prompting A to gradually unfold the thinking process T(I); this process not only improves the transparency of reasoning, but also helps A discover details that may be overlooked, thereby obtaining more detailed observation results O″. In γ4, based on O″ and T(I), A is required to generate a specific trading behavior strategy ∑; A will consider multiple factors and comprehensively form a complete trading plan; Next, in γ5, guide A to convert ∑ into a trading behavior tendency B expressed in natural language; this step aims to convert professional trading strategies into behavioral descriptions that are easier to understand and execute, including trading frequency f, size s, and holding time δ t , expected profit and loss ratio π and direction preference d; Finally, in γ6, A is required to transform B into a trading behavior attribute label ω that matches the input format of the quantitative trading behavior generation model M (constructed in S102) o =(c {1,o} , c {2,o} , c {3,o} , c {4,o} , c {5,o} ); This step requires A to understand and apply the transaction behavior classification rule R = {R1, R2, ..., R5} to map the qualitative behavior tendency into the discrete attribute space Ω; During the entire process, through prompt word engineering, the content and structure of the prompt words are adjusted in real time according to the progress of the conversation to ensure the smoothness of the interaction and the effectiveness of information extraction.

7. The transaction behavior generation method based on model cascading technology according to claim 6 is characterized in that: In step S103, the process of creating an intelligent agent and generating transaction behavior includes: Set up the large language model used by the agent; Setting parameters of the agent according to the effective parameters of the large language model; Set the agent's dialog window to empty; According to the transaction scenario, set the character profile of the agent; According to the character data of the agent, add the same character data information to the agent dialogue window, and set the label of the information in the dialogue window to "system"; According to the transaction scenario, add content confirming the current transaction scenario to the agent dialogue window, and set the label of the content in the dialogue window to "user"; The dialog window is used as input to the large language model, the output of the large language model is confirmation of the current scene, and the output content is added to the agent dialog window, and the label of the content in the dialog window is set to "agent"; Set the agent's observations in the scene; Based on the observation, adding content describing the observation in text form to the agent dialogue window, and setting the label of the content in the dialogue window to "user"; The dialog window is used as input to the large language model, the output of the large language model is a confirmation of the current observation, and the output content is added to the agent dialog window, and the label of the content in the dialog window is set to "agent"; Adding a prompt word to the agent dialogue window requiring reasoning about the observation, and setting the label of the prompt in the dialogue window to "user"; The dialog window is used as input to the large language model, the output of the large language model is the inference result based on the observation, and the output content is added to the agent dialog window, and the label of the content in the dialog window is set to "agent"; Adding a thought chain prompt word to the agent dialogue window, requiring the agent to conduct a refined analysis of the observation, and setting the label of the prompt word in the dialogue window to "user"; The dialog window is used as input to the large language model, the output of the large language model is the result of a refined analysis of the observation using the thought chain method, and the output content is added to the agent dialog window, and the label of the content in the dialog window is set to "agent"; Adding a prompt word requiring the generation of a trading behavior strategy based on the inference result to the agent dialogue window, and setting the label of the prompt word in the dialogue window to "user"; The dialog window is used as input to the large language model, and the output of the large language model is a trading behavior strategy generated based on the reasoning result, and the output content is added to the agent dialog window, and the label of the content in the dialog window is set to "agent"; Adding a prompt word requiring the generation of a transaction behavior tendency expressed in natural language based on the transaction behavior strategy to the agent dialogue window, and setting the label of the prompt word in the dialogue window to "user"; The dialog window is used as input to the large language model, and the output of the large language model is the trading behavior tendency expressed in natural language generated based on the trading behavior strategy, and the output content is added to the agent dialog window, and the label of the content in the dialog window is set to "agent"; Adding a prompt word to the agent dialogue window, requiring the transaction behavior tendency to be converted into a transaction behavior attribute label in the same format as the input format of the cascade transaction behavior generation model, and setting the label of the prompt word in the dialogue window to "user"; The dialog window is taken as input and input into the large language model. The output of the large language model is the transaction behavior attribute label which is the same as the input format of the cascaded transaction behavior generation model after the transaction behavior tendency is converted. The output content is extracted into a tuple data format and recorded as a transaction behavior tendency tuple.

Citation Information

Patent Citations

  • Transaction behavior type determination method, device and equipment

    CN111401908A