Copywriting generation method and device based on large language model, storage medium, and computer equipment
By constructing a user feature set and using a large language model to generate copy, the problem of lack of personalization in copy generation in the existing technology is solved, a more accurate matching of user preferences and needs is achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202410846000.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-06-27
AI Technical Summary
Existing automated copywriting generation methods are insufficient to understand complex user characteristics, resulting in a lack of pertinence and personalization in the generated copywriting, and are unable to meet the personalized needs of different user groups.
By obtaining the user characteristic data, browsing data and interaction data of historical users, we construct positive samples and negative samples, train decision trees, build user feature sets based on the branches of the decision tree, and use large language models to generate differentiated features for different user feature groups. Copywriting.
It improves the personalization and relevance of the copywriting, enhances the user's willingness and satisfaction to interact, and improves the user experience.
Smart Images

Figure CN118427370B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a method and device for generating text based on a large language model, a storage medium, and a computer device. Background Art
[0002] Formulating differentiated copywriting for different user groups has always been one of the core strategies for implementing information recommendation in various fields. Compared with fixed and unified copywriting, differentiated copywriting tailored for different user groups can more accurately grasp the interests of different user groups and help meet the needs of different user groups.
[0003] The traditional copywriting process usually relies on the experience and intuition of professional copywriters, which is not only inefficient but also difficult to meet the growing demand for personalization. With the development of artificial intelligence technology, especially the emergence of large language models, automated copywriting generation has become feasible. However, the existing automated copywriting generation methods are not sufficient to understand complex user characteristics, resulting in the generated copywriting often lacking pertinence and personalization. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a copywriting generation method and apparatus, storage medium, and computer equipment based on a large language model, so that the generated copywriting can more accurately match the preferences and needs of different user groups, improve the personalization and relevance of the copywriting, better attract the user's attention, and help improve the user's interaction willingness and satisfaction, thereby improving the user experience.
[0005] According to one aspect of the present application, a method for generating text based on a large language model is provided, the method comprising:
[0006] According to the target copy generation requirement, at least one data sample corresponding to at least one historical user is obtained, wherein each data sample includes a plurality of user feature data, user browsing data and user interaction data of the corresponding historical user, the browsed object in the user browsing data matches the target copy generation requirement, and the user interaction data indicates whether an interaction is generated with the browsed object;
[0007] constructing positive samples using data samples of user interaction data representing generated interactions, and constructing negative samples using remaining data samples;
[0008] Training a decision tree using the positive samples and the negative samples, and constructing user feature sets based on each branch of the decision tree, wherein each user feature set includes at least one user feature type label;
[0009] For any user feature set, text generation prompt information is constructed according to the user feature set and the target text generation requirement, and the target text is generated based on the text generation prompt information through a large language model.
[0010] Optionally, before constructing a positive sample using a data sample to which user interaction data representing generated interaction belongs, and constructing a negative sample using the remaining data samples, the method includes:
[0011] Perform feature bucketing on the continuous features in the user feature data to obtain multiple feature buckets corresponding to each continuous feature;
[0012] Using the discrete features in the user feature data and the feature buckets as training features, performing one-hot encoding on each piece of user feature data based on the training features to obtain user encoding features corresponding to each piece of user feature data;
[0013] Accordingly, constructing positive samples using data samples representing user interaction data that generates interaction, and constructing negative samples using remaining data samples, including:
[0014] Positive samples are constructed using user coding features corresponding to data samples to which user interaction data representing generated interactions belong, and negative samples are constructed using user coding features corresponding to remaining data samples.
[0015] Optionally, a decision tree is trained by the positive sample and the negative sample, and user feature sets are constructed based on each branch of the decision tree, including:
[0016] Based on the preset feature importance condition, a decision tree is trained by the positive sample and the negative sample, wherein the decision tree includes a plurality of branches, each branch includes a leaf node and at least one decision node, the user feature type represented by each decision node meets the preset feature importance condition, and each leaf node is marked with a classification label of the leaf node;
[0017] The target branch in each branch is determined according to the classification label of the leaf node, and the user feature sets are respectively constructed based on the user feature type represented by each decision node in each of the target branches.
[0018] Optionally, each leaf node is also marked with the number of samples split from the root node to the leaf node; based on the user feature type represented by each decision node in each of the target branches, a user feature set is constructed respectively, including:
[0019] Determine the ratio of the number of samples corresponding to the leaf nodes in the target branch to the total number of samples of the data samples, and screen the target branch based on the ratio;
[0020] The user feature types represented by each decision node in each target branch after screening are used to construct user feature sets respectively.
[0021] Optionally, after generating the target copy based on the copy generation prompt information by using the large language model, the method further includes:
[0022] In the case where a target copy based on a target user triggers a display signal, a target display copy is determined from target copies corresponding to each user feature set based on a target user feature corresponding to the target user;
[0023] The target display copy reaches the target users.
[0024] Optionally, when a target copy based on a target user triggers a display signal, determining a target display copy from target copies corresponding to each user feature set based on a target user feature corresponding to the target user includes:
[0025] In the case where a target copy based on a target user triggers a display signal, based on a target user feature corresponding to the target user, querying a target user feature set in the user feature set that matches the target user feature, and determining that the target copy associated with the target user feature set is the target display copy;
[0026] If the user feature set does not match the target user feature, the standard text corresponding to the target text generation requirement is used as the target display text.
[0027] Optionally, after the target display copy is delivered to the target user, the method further includes:
[0028] Obtain the user behavior data after each target copy reaches the user, and determine the copy effect of each target copy based on the user behavior data corresponding to each target copy;
[0029] Determine the copy to be adjusted in the target copy that does not meet the preset copy effect according to the copy effect, and adjust and replace the copy to be adjusted.
[0030] Optionally, adjusting and replacing the text to be adjusted includes:
[0031] According to the user feature set corresponding to the copy to be adjusted, the target copy generation requirement and the adjustment requirement corresponding to the copy to be adjusted, copy adjustment prompt information is constructed, and an adjustment copy is generated based on the copy adjustment prompt information through a large language model to replace the copy to be adjusted.
[0032] Optionally, adjusting and replacing the text to be adjusted includes:
[0033] The user feature set corresponding to the to-be-adjusted copy is used as the to-be-adjusted copy, the user behavior data corresponding to the to-be-adjusted copy is obtained as a retraining sample, and a new decision tree is trained using the retraining sample, and a new user feature set is constructed based on each branch of the new decision tree to replace the to-be-adjusted copy;
[0034] For any new user feature set, new copy generation prompt information is constructed according to the new user feature set and the target copy generation requirements, and a new target copy is generated based on the new copy generation prompt information through a large language model to replace the original target copy corresponding to the set to be adjusted.
[0035] Optionally, the target copy generation requirement includes any one of the following: a target object, a target object type, at least one object under a target theme, and at least one object type under a target theme, wherein the object includes a commodity or at least one multimedia material.
[0036] According to another aspect of the present application, a copywriting generation device based on a large language model is provided, the device comprising:
[0037] A data processing module, configured to obtain at least one data sample corresponding to at least one historical user according to the target copy generation requirement, wherein each data sample includes a plurality of user characteristic data, user browsing data and user interaction data of the corresponding historical user, the browsed object in the user browsing data matches the target copy generation requirement, and the user interaction data indicates whether an interaction is generated with the browsed object;
[0038] A model training module, used to construct positive samples using data samples belonging to user interaction data representing generated interactions, and to construct negative samples using remaining data samples; and to train a decision tree using the positive samples and the negative samples;
[0039] A model parsing module, used to construct user feature sets based on each branch of the decision tree, wherein each user feature set includes at least one user feature type label;
[0040] The copywriting generation module is used to construct copywriting generation prompt information for any user feature set according to the user feature set and the target copywriting generation requirements, and generate the target copy based on the copywriting generation prompt information through a large language model.
[0041] Optionally, the data processing module is further used to:
[0042] Perform feature bucketing on the continuous features in the user feature data to obtain multiple feature buckets corresponding to each continuous feature;
[0043] Using the discrete features in the user feature data and the feature buckets as training features, performing one-hot encoding on each piece of user feature data based on the training features to obtain user encoding features corresponding to each piece of user feature data;
[0044] Accordingly, the model training module is also used to:
[0045] Positive samples are constructed using user coding features corresponding to data samples to which user interaction data representing generated interactions belong, and negative samples are constructed using user coding features corresponding to remaining data samples.
[0046] Optionally, the model training module is further used to train a decision tree through the positive samples and the negative samples based on a preset feature importance condition, wherein the decision tree includes multiple branches, each branch includes a leaf node and at least one decision node, the user feature type represented by each decision node meets the preset feature importance condition, and each leaf node is marked with a classification label of the leaf node;
[0047] The model parsing module is also used to determine the target branch in each branch according to the classification label of the leaf node, and to construct a user feature set based on the user feature type represented by each decision node in each of the target branches.
[0048] Optionally, each leaf node is also marked with the number of samples split from the root node to the leaf node; the model parsing module is also used to:
[0049] Determine the ratio of the number of samples corresponding to the leaf nodes in the target branch to the total number of samples of the data samples, and screen the target branch based on the ratio;
[0050] The user feature types represented by each decision node in each target branch after screening are used to construct user feature sets respectively.
[0051] Optionally, the device further comprises: a copywriting display module, configured to:
[0052] In the case where a target copy based on a target user triggers a display signal, a target display copy is determined from target copies corresponding to each user feature set based on a target user feature corresponding to the target user;
[0053] The target display copy reaches the target users.
[0054] Optionally, the copy display module is also used to:
[0055] In the case where a target copy based on a target user triggers a display signal, based on a target user feature corresponding to the target user, querying a target user feature set in the user feature set that matches the target user feature, and determining that the target copy associated with the target user feature set is the target display copy;
[0056] If the user feature set does not match the target user feature, the standard text corresponding to the target text generation requirement is used as the target display text.
[0057] Optionally, the device further comprises: an evaluation and optimization module, configured to:
[0058] Obtain the user behavior data after each target copy reaches the user, and determine the copy effect of each target copy based on the user behavior data corresponding to each target copy;
[0059] Determine the copy to be adjusted in the target copy that does not meet the preset copy effect according to the copy effect, and adjust and replace the copy to be adjusted.
[0060] Optionally, the evaluation and optimization module is further configured to:
[0061] According to the user feature set corresponding to the copy to be adjusted, the target copy generation requirement and the adjustment requirement corresponding to the copy to be adjusted, copy adjustment prompt information is constructed, and an adjustment copy is generated based on the copy adjustment prompt information through a large language model to replace the copy to be adjusted.
[0062] Optionally, the evaluation and optimization module is further used to: take the user feature set corresponding to the to-be-adjusted copy as the to-be-adjusted set, obtain the user behavior data corresponding to the to-be-adjusted copy as a retraining sample, train a new decision tree using the retraining sample, and construct a new user feature set based on each branch of the new decision tree to replace the to-be-adjusted set;
[0063] For any new user feature set, new copy generation prompt information is constructed according to the new user feature set and the target copy generation requirements, and a new target copy is generated based on the new copy generation prompt information through a large language model to replace the original target copy corresponding to the set to be adjusted.
[0064] Optionally, the target copy generation requirement includes any one of the following: a target object, a target object type, at least one object under a target theme, and at least one object type under a target theme, wherein the object includes a commodity or at least one multimedia material.
[0065] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned copywriting generation method based on a large language model is implemented.
[0066] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned method for generating text based on a large language model when executing the program.
[0067] By means of the above technical scheme, the embodiment of the present application provides a method and device for generating a copy based on a large language model, a storage medium, and a computer device, which screens the user browsing data of historical users according to the target copy generation requirements, and further obtains the user interaction data corresponding to the user browsing data and the user feature data of the historical users to jointly construct a data sample, and divides the data sample into positive samples and negative samples based on whether the user indicated by the user interaction data in the data sample has an interactive behavior on the browsed object, thereby training a decision tree, and constructing a user feature set based on each branch of the decision tree to achieve a combination of user features, and finally constructing prompt information for each user feature set, and generating target copy for each user feature set through a large language model, and forming differentiated copy for different user feature groups. The embodiment of the present application uses multiple feature data and user behavior data of historical users to train a decision tree, and forms a user feature set by parsing the user features corresponding to each branch of the decision tree, so as to generate copy for different user feature sets, so that the generated copy can more accurately match the preferences and needs of different user groups, improve the personalization and relevance of the copy, better attract the user's attention, and help improve the user's willingness and satisfaction to interact, thereby improving the user experience.
[0068] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0070] Figure 1 A schematic diagram of a process of a copywriting generation method based on a large language model provided in an embodiment of the present application is shown;
[0071] Figure 2A schematic diagram of a process of another method for generating text based on a large language model provided in an embodiment of the present application is shown;
[0072] Figure 3 A schematic diagram of the structure of a text generation device based on a large language model provided in an embodiment of the present application is shown;
[0073] Figure 4 A schematic structural diagram of a text generation device based on a large language model provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0074] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0075] In this embodiment, a method for generating text based on a large language model is provided. Figure 1 As shown, the method includes:
[0076] Step 101, according to the target copy generation requirement, obtain at least one data sample corresponding to at least one historical user, wherein each data sample includes multiple user feature data, user browsing data and user interaction data of the corresponding historical user, the browsed object in the user browsing data matches the target copy generation requirement, and the user interaction data indicates whether an interaction is generated with the browsed object.
[0077] In an embodiment of the present application, in response to the target copy generation demand, a data sample for decision tree training is obtained. The data sample is generally data generated based on the real behavior of historical users, wherein the data sample includes user browsing data, user interaction data, and user feature data. Whether the user's behavior data will be used as a data sample depends on whether the browsed object matches the target copy generation demand. If it matches, a data sample may be determined based on the user's browsing behavior of the browsed object. For example, the target copy generation demand is generated for a crayfish theme event, and the historical user's browsing behavior data of crayfish products may be used to form a data sample. After the user browses the crayfish product, whether the user interacts with the crayfish product can reflect the user's interest in the crayfish product, and the user feature data is helpful in summarizing what kind of users are interested or not interested in the browsed object.
[0078] Optionally, the target copy generation requirement includes any one of the following: a target object, a target object type, at least one object under a target theme, and at least one object type under a target theme, wherein the object includes a commodity or at least one multimedia material.
[0079] Taking e-commerce platforms as an example, the target copywriting generation requirements can be requirements formulated for the purpose of marketing activities, theme activities and other activities launched by the platform. For example, for the "midnight snack" theme activities of food delivery platforms or local life platforms, the target copywriting generation requirements can include the food category of midnight snacks, and the data samples can be data determined based on the behavior of users browsing the food category of midnight snacks on the platform. The data samples may include user browsing data (indicating that historical users have browsed a certain product in the category of midnight snacks), user interaction data (indicating whether historical users have clicked, collected, placed orders, shared, and other interactive behaviors on a certain product in the category of midnight snacks they browsed), and various user feature data of historical users, among which the user feature data may include user basic portrait data (such as age, gender, consumption level, category preference, etc.), user behavior portrait data (such as the purchase frequency data of various products under the category of midnight snacks obtained by users, etc.).
[0080] Taking a multimedia material sharing platform as an example, the target copywriting generation requirements may be requirements formulated for the purpose of column activities, promotional activities, and other activities launched by the platform. For example, for the theme activities of detective mystery novels on a book sharing platform, the target copywriting generation requirements may include detective mystery novels, and the data samples may be data determined based on the behavior that the list of book introductions browsed by users on the platform includes detective mystery novels. The data samples may include user browsing data (indicating that historical users have browsed detective mystery novels), user interaction data (indicating whether users have clicked, collected, and other interactive behaviors on the detective mystery novels they have browsed), and various user feature data of historical users.
[0081] Step 102: construct a positive sample using the data sample of the user interaction data representing the generated interaction, and construct a negative sample using the remaining data samples.
[0082] In an embodiment of the present application, after collecting data samples, the data samples can be classified, and the data samples that are related to the target copy generation needs and have interactive behaviors (such as clicks, purchases, etc.) are marked as positive samples, indicating that these samples are relevant to the target needs; and the remaining data samples are marked as negative samples, indicating that these samples are irrelevant to the target needs or have a low correlation.
[0083] In an embodiment of the present application, optionally, before step 102, the following may be included: performing feature bucketing for continuous features in the user feature data to obtain multiple feature buckets corresponding to each continuous feature; using discrete features in the user feature data and the feature buckets as training features, and performing one-hot encoding on each user feature data based on the training features to obtain user coding features corresponding to each user feature data; accordingly, step 102 may include: constructing a positive sample using the user coding features corresponding to the data sample to which the user interaction data representing the generated interaction belongs, and constructing a negative sample using the user coding features corresponding to the remaining data samples.
[0084] In the above embodiment, for continuous features (such as age, etc.) in user feature data, the values of these features are continuous and may have a large number of unique values. In order to simplify the model and improve performance, these continuous features are usually bucketed. Feature bucketing is to divide the value range of the continuous feature into several intervals (i.e., "buckets"), and then replace the original continuous value with the identifier of the bucket to which it belongs. In this way, the continuous feature is converted into a discrete feature. In machine learning, discrete features (including continuous features that have been bucketed and features that are originally discrete) usually need to be converted into a format suitable for model processing. One-hot encoding is a method of converting discrete features into binary vectors. For each feature, its possible values will have a corresponding binary bit. If the feature takes a certain value, the corresponding binary bit is 1, and the other bits are 0. In this process, the discrete features in the user feature data and the continuous features that have been bucketed (i.e., feature buckets) will be converted into the form of one-hot encoding to form user coding features. Furthermore, for the encoded data samples, data samples related to user interaction data (such as clicks, purchases, etc.) can be considered to be positively correlated with the target text generation requirements and can be marked as positive samples. The remaining data samples, that is, data samples that have not generated interactions, are considered to be less relevant or irrelevant to the target task and are therefore marked as negative samples. The embodiments of the present application can simplify the data through feature bucketing and one-hot encoding, making the model easier to learn. And for some features, there may be missing values. Through one-hot encoding, missing values can be treated as a special value, so that they can be explicitly handled in the model.
[0085] In specific application scenarios, after collecting data samples, the staff also screened the user feature types in combination with the activity demands to avoid the problem of high training costs and low efficiency caused by using all user features. For example, for the needs of generating floor theme copy, labels such as age, gender, category preference, and number of purchases can be screened. The user feature data in the data sample is further encoded, and the One-Hot encoding method can be used. Among them, the numerical discrete class features are directly one-hot encoded to generate new feature columns. For example, for the user_status (user identity) feature, the values are new users / old users, etc., where user_status=old user, and it is encoded as a new feature column, such as user_status__is_old. When the user is an old user, this column takes the value of 1, otherwise it is 0. The continuous value features are processed by combining equal width / equal frequency bucketing with one-hot encoding. For example, age is first bucketed into 36-40, and then one-hot is used to obtain the feature "tb_age__36_40" column.
[0086] Step 103 : training a decision tree using the positive samples and the negative samples, and constructing user feature sets based on the branches of the decision tree, respectively, wherein each user feature set includes at least one user feature type label.
[0087] In an embodiment of the present application, a decision tree model is trained using positive samples and negative samples, for example, a GBDT decision tree model is selected. And each branch of the trained decision tree is divided based on one or more user features to form multiple user feature sets. The user features in these sets can divide different users into multiple groups based on features, and these groups are divided based on the target copy generation requirements.
[0088] In the embodiment of the present application, optionally, step 103 includes:
[0089] Step 103-1, based on the preset feature importance condition, training a decision tree through the positive sample and the negative sample, wherein the decision tree includes multiple branches, each branch includes a leaf node and at least one decision node, the user feature type represented by each decision node meets the preset feature importance condition, and each leaf node is marked with the classification label of the leaf node;
[0090] Step 103 - 2 , determining the target branch in each branch according to the classification label of the leaf node, and constructing a user feature set based on the user feature type represented by each decision node in each of the target branches.
[0091] In this embodiment, before starting to train the decision tree, one or more feature importance conditions are set. These conditions are usually based on activity requirements, data characteristics or model performance considerations, and are used to filter out features that should be focused on in the decision tree. Use positive samples (i.e., data samples related to user interaction data) and negative samples (i.e., data samples that have not generated interactions) to train the decision tree. During the training process, according to the preset feature importance conditions, user features that meet these conditions are selected as decision nodes, and features that are not significant or not important are filtered out. For example, a threshold is set to filter out valid label features with feature importance greater than 0.01. The entire decision tree structure is constructed by recursively selecting better features and split points. The decision tree consists of multiple branches, each branch starts from the root node and reaches the leaf node through a series of decision nodes. Each decision node represents a user feature, and the sample is assigned to different sub-branches according to the value of the feature. The leaf node is the end point of the decision tree, marked with the classification label corresponding to the leaf node (here, it is a label representing a positive sample or a negative sample). After the decision tree training is completed, the classification labels of the leaf nodes (i.e., positive samples or negative samples) are used to determine which branches are "target branches". For each target branch, all decision nodes in the branch are traversed. Each decision node represents a user feature type. Collecting these user feature types forms a user feature set. Since the paths of each target branch are different, different target branches will construct different user feature sets. The user feature sets constructed based on different target branches can provide guidance for subsequent copywriting generation. For example, based on the characteristics of a specific user feature set, a copywriting that is more in line with the preferences of the user group can be generated.
[0092] In an embodiment of the present application, optionally, each leaf node is also marked with the number of samples split from the root node to the leaf node; step 103-2 includes: determining the ratio of the number of samples corresponding to the leaf nodes in the target branch to the total number of samples of the data samples, and filtering the target branch based on the ratio; using the user feature types represented by each decision node in each filtered target branch, respectively constructing user feature sets.
[0093] In the above embodiment, in the decision tree, each leaf node is not only marked with a classification label (such as a positive sample or a negative sample), but also marked with the number of samples split from the root node to the leaf node. This number reflects the size of the sample set represented by the leaf node, and further reflects the proportion of the user group represented by the leaf node in the entire data set, so as to screen the target branch based on the number of samples: first, determine the proportion of the number of samples corresponding to the leaf node in each target branch (i.e., the branch where the leaf node containing the positive sample or the negative sample is located) to the total number of samples of the entire data sample. Based on the proportion calculated above, the target branch can be screened. For example, a threshold can be set to retain only those target branches whose proportion exceeds the threshold. Doing so can ensure that the focus is on those target branches that contain enough samples, while ignoring those branches with fewer samples and may not be typical enough. After the above screening, the user feature types represented by each decision node in each screened target branch are used to construct user feature sets respectively. These user feature sets represent user feature combinations that are more relevant to the target copywriting generation requirements. The embodiment of the present application can ensure that the constructed user feature set is based on a representative user group with sufficient sample numbers by screening based on the number of leaf node samples. This helps improve the generalization ability of the feature set and its effect in practical applications. If all target branches are considered without filtering, many user feature sets may be obtained, some of which may not be practical or representative. Filtering can reduce unnecessary computational costs while ensuring that only the truly important user feature sets are focused on. In addition, the filtered user feature set is more concise and clear, which helps to better understand which user features have an important impact on the target task, thereby enhancing the interpretability of the model.
[0094] Step 104: for any user feature set, construct text generation prompt information according to the user feature set and the target text generation requirement, and generate the target text based on the text generation prompt information by using a large language model.
[0095] In the embodiment of the present application, for each user feature set, combined with the target copy generation requirements and the user feature labels contained in the set, the copy generation prompt information is constructed. Among them, the target copy generation requirements may also include activity-related information, and the copy generation prompt information may also include the corresponding copy style determined according to the user feature set, so that the generated copy is closer to the style preferred by the corresponding user group. Then, a large language model (such as GPT, BERT, etc.) or a multimodal model is used to generate the target copy based on these prompt information. Thereby, differentiated target copies for different user groups are accurately formed, and content that is highly relevant and personalized to the user group characteristics is provided to meet the unique needs of different user groups. In addition, for the target copy generated by the large language model, further verification and optimization can be performed, and the generated target copy can be verified in terms of semantic consistency, relevance, creativity, etc. For example, semantic consistency verification can be performed by semantically matching the standard copy and the target copy, relevance verification can be performed based on preset manual rules, and the target copy can be manually evaluated for creativity by sampling. When a deficiency is found in some aspects, the problem to be improved, the target copy generation requirements, the target copy to be improved, and the user feature set are regenerated as prompt information, and the target copy is regenerated through the large language model. Manual optimization can also be performed when the target copy is found to have deficiencies, which is not limited here.
[0096] In one example, for a user feature set (25-34 years old, urban white-collar workers, healthy food enthusiasts), a personalized prompt template for late-night crayfish snacks is designed as follows: "Considering that you are an urban white-collar worker between the ages of 25 and 34 and have a special preference for healthy food, we would like to recommend you a late-night snack option that suits your lifestyle: a healthy version of crayfish. In view of your busy work needs during the day, your high standards for food quality, and your pursuit of quality of life, please write a marketing copy for this type of customer, focusing on the three aspects of health, convenience, and deliciousness, while integrating into the life scenarios of urban white-collar workers to increase their interest in choosing our late-night crayfish snacks."
[0097] By applying the technical solution of this embodiment, the user browsing data of historical users is screened according to the target copy generation requirements, and the user interaction data corresponding to the user browsing data and the user feature data of historical users are further obtained to jointly construct a data sample. Based on whether the user indicated by the user interaction data in the data sample has an interactive behavior on the browsed object, the data sample is divided into positive samples and negative samples, thereby training a decision tree, and constructing a user feature set based on each branch of the decision tree to achieve a combination of user features. Finally, prompt information is constructed for each user feature set, and the target copy for each user feature set is generated through a large language model, forming differentiated copy for different user feature groups. The embodiment of the present application uses a variety of feature data and user behavior data of historical users to train a decision tree, and forms a user feature set by parsing the user features corresponding to each branch of the decision tree, thereby generating copy for different user feature sets, so that the generated copy can more accurately match the preferences and needs of different user groups, improve the personalization and relevance of the copy, better attract the attention of users, and help improve the user's willingness and satisfaction to interact, thereby improving the user experience.
[0098] Furthermore, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another copywriting generation method based on a large language model is provided, such as Figure 2 As shown, the method includes:
[0099] Step 201 , when a target copy based on a target user triggers a display signal, a target display copy is determined from target copies corresponding to each user feature set based on a target user feature corresponding to the target user.
[0100] In the embodiment of the present application, when a target copy based on a target user (any user) triggers a display signal (for example, the user visits a certain page or clicks a certain button), a "target display copy" that best suits the user can be selected and determined from the target copy corresponding to the pre-prepared multiple user feature sets according to the target user features corresponding to the target user. In addition, the target copy and the user feature set can be stored in association in advance, and can be directly read when online display is required.
[0101] Optionally, step 201 includes: in the case of detecting a target copy based on a target user triggering a display signal, based on a target user feature corresponding to the target user, querying a target user feature set in the user feature set that matches the target user feature, and determining that the target copy associated with the target user feature set is the target display copy; if none of the user feature sets matches the target user feature, then using a standard copy corresponding to the target copy generation requirement as the target display copy.
[0102] In the above embodiment, when the system detects that the target copy based on the target user triggers a display signal, this signal may be triggered by a certain behavior or event of the user, such as the user visiting a certain page, clicking a certain button, etc. The target user features corresponding to the target user are obtained, and the pre-defined user feature set is queried to determine whether there is a user feature set that matches the target user features. If a user feature set that matches the target user features is found, since each target copy is designed and optimized based on a user group with similar features to the target user, it is more likely to arouse the interest and reaction of the corresponding group of users, and the target copy associated with the set can be directly determined as the target display copy. If a set that matches the target user features is not found in all user feature sets (that is, the target user's features do not have a directly corresponding classification in the existing set), an alternative solution can be adopted. This alternative solution is to use the standard copy corresponding to the target copy generation requirements as the target display copy. Standard copy is usually suitable for most users or users without clear feature classification. Although it may not be as accurate as a copy that matches a specific user feature, it can also provide a certain appeal and effect. This embodiment can provide customized display copy according to the user's personalized characteristics, and can also ensure basic display effects through standard copy when there is no direct matching feature, which helps to improve user experience and copy display effects.
[0103] Step 202: delivering the target display copy to the target user.
[0104] In the embodiment of the present application, after the target display copy is determined, it is delivered to the target user in an appropriate manner (such as a pop-up window, a pop-up page in the APP, email, text message, APP push, etc.).
[0105] Step 203, obtaining user behavior data after each target copy reaches the user, and determining the copy effect of each target copy according to the user behavior data corresponding to each target copy.
[0106] In the embodiment of the present application, after the target copy reaches the user, the system can collect the user's subsequent behavior data, which usually includes whether the user clicks on the copy, whether the user makes a purchase after clicking, and whether the user views more content. Based on these user behavior data, the system can evaluate the copy effect of each target copy, so as to evaluate the degree of influence of each target copy on user behavior. For example, user behavior data includes the user's clicks on the copy, the clicks on the product after entering the product list (or multimedia material list) after clicking, whether the user places an order after clicking, whether the user collects the product after clicking, and other data, so as to comprehensively evaluate the copy effect of the target copy.
[0107] Step 204, determining the copy to be adjusted in the target copy that does not meet the preset copy effect according to the copy effect, and adjusting and replacing the copy to be adjusted.
[0108] In the embodiment of the present application, based on the evaluation results of the copy effect, it can be determined which copy does not meet the preset copy effect standards (such as too low click-through rate, insufficient conversion rate, etc.), and these copies are called "copy to be adjusted". For the copy to be adjusted, the system will further optimize and replace it. The optimization may include modifying the copy content, modifying the user feature set corresponding to the copy, and regenerating the copy content. In order to more accurately understand user needs and preferences and optimize the user experience.
[0109] In an embodiment of the present application, optionally, the text to be adjusted is adjusted and replaced in step 204, including: constructing text adjustment prompt information according to a set of user features corresponding to the text to be adjusted, the target text generation requirements, and the adjustment requirements corresponding to the text to be adjusted, and generating an adjustment text based on the text adjustment prompt information through a large language model to replace the text to be adjusted.
[0110] In this embodiment, when a certain copy is determined to be a copy to be adjusted (that is, the copy effect of the copy does not meet the preset standard), it is first necessary to clarify the adjustment requirements of the copy. For example, the adjustment requirements may include the aspects in which the copy performs poorly (such as low click-through rate, poor conversion rate, etc.), and may also include the reasons for the poor copy effect. Or the adjustment requirements may not include the above information and only reflect "please regenerate the copy". Based on the user feature set corresponding to the copy to be adjusted, combined with the generation requirements of the target copy (such as the user participation and purchase intention to be achieved), and the adjustment requirements of the copy to be adjusted itself (such as the part that needs to be modified, the improvement effect to be achieved, etc.), a copy adjustment prompt information is constructed. The above-constructed copy adjustment prompt information is input into a large language model (such as GPT, BERT, etc.). The large language model will automatically generate one or more adjusted copies based on the input prompt information. These copies will try to solve the problems in the copy to be adjusted and meet the generation requirements of the target copy as much as possible. Finally, the adjusted copy generated by the large language model replaces the original copy to be adjusted. This replacement process may require certain evaluation and screening to ensure that the new copy not only solves the original problem, but also outperforms the original copy in terms of overall effect. The embodiment of the present application automates and intelligentizes the generation and optimization process of the copy. By combining the user feature set, the target copy generation requirements, and the adjustment requirements of the copy to be adjusted, targeted copy adjustment prompt information can be constructed. Then, using the powerful generation capability of the large language model, it is possible to quickly generate adjustment copies that meet the requirements, thereby improving the efficiency and quality of copy optimization.
[0111] In an embodiment of the present application, optionally, the text to be adjusted is adjusted and replaced in step 204, including: taking the user feature set corresponding to the text to be adjusted as the set to be adjusted, obtaining the user behavior data corresponding to the text to be adjusted as a retraining sample, and using the retraining sample to train a new decision tree, and constructing a new user feature set based on each branch of the new decision tree to replace the set to be adjusted; for any new user feature set, constructing new text generation prompt information according to the new user feature set and the target text generation requirement, and generating a new target text based on the new text generation prompt information through a large language model to replace the original target text corresponding to the set to be adjusted.
[0112] In this embodiment, first, the user feature set corresponding to the to-be-adjusted copy is regarded as the to-be-adjusted set. Then, the user behavior data related to the to-be-adjusted copy is obtained as a retraining sample. These behavior data reflect the interaction between the user and the current copy and the user's participation in the activities corresponding to the current copy, which is crucial for subsequent model training. The retraining sample can be the same as the data sample structure mentioned above. A new decision tree model is trained using the obtained retraining sample. Based on each branch of the new decision tree, a new user feature set is constructed respectively. These new sets will update and optimize the user's classification and features according to the new decision tree model. For each new user feature set, combined with the generation requirements of the target copy (such as the user participation and purchase intention to be achieved), a new copy generation prompt information is constructed. This prompt information will serve as a guide for the large language model to generate new copies, and contains specific requirements for target users, target effects, and copy styles. Using the large language model, a new target copy is generated according to the new copy generation prompt information. The large language model can learn the laws and patterns of language based on a large amount of text data, and generate text that conforms to these laws and patterns. The generated new target copy is used to replace the original target copy corresponding to the set to be adjusted. This process ensures that the update and optimization of the copy is based on the latest user behavior data and the training results of the decision tree model. The specific method of retraining the decision tree can be similar to Figure 1 The method described in the embodiment is consistent and will not be repeated here. By using user behavior data to train a new decision tree model, the actual needs and interests of users can be captured more accurately, so as to optimize and reconstruct the user feature set; and by using a large language model to generate new target copy, the language expression and content quality of the copy can be ensured. The entire process not only improves the pertinence and effectiveness of the copy, but also improves the efficiency and quality of copy generation.
[0113] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a copywriting generation device based on a large language model, such as Figure 3 As shown, the device comprises:
[0114] A data processing module, configured to obtain at least one data sample corresponding to at least one historical user according to the target copy generation requirement, wherein each data sample includes a plurality of user characteristic data, user browsing data and user interaction data of the corresponding historical user, the browsed object in the user browsing data matches the target copy generation requirement, and the user interaction data indicates whether an interaction is generated with the browsed object;
[0115] A model training module, used to construct positive samples using data samples belonging to user interaction data representing generated interactions, and to construct negative samples using remaining data samples; and to train a decision tree using the positive samples and the negative samples;
[0116] A model parsing module, used to construct user feature sets based on each branch of the decision tree, wherein each user feature set includes at least one user feature type label;
[0117] The copywriting generation module is used to construct copywriting generation prompt information for any user feature set according to the user feature set and the target copywriting generation requirements, and generate the target copy based on the copywriting generation prompt information through a large language model.
[0118] Optionally, the data processing module is further used to:
[0119] Perform feature bucketing on the continuous features in the user feature data to obtain multiple feature buckets corresponding to each continuous feature;
[0120] Using the discrete features in the user feature data and the feature buckets as training features, performing one-hot encoding on each piece of user feature data based on the training features to obtain user encoding features corresponding to each piece of user feature data;
[0121] Accordingly, the model training module is also used to:
[0122] Positive samples are constructed using user coding features corresponding to data samples to which user interaction data representing generated interactions belong, and negative samples are constructed using user coding features corresponding to remaining data samples.
[0123] Optionally, the model training module is further used to train a decision tree through the positive samples and the negative samples based on a preset feature importance condition, wherein the decision tree includes multiple branches, each branch includes a leaf node and at least one decision node, the user feature type represented by each decision node meets the preset feature importance condition, and each leaf node is marked with a classification label of the leaf node;
[0124] The model parsing module is also used to determine the target branch in each branch according to the classification label of the leaf node, and to construct a user feature set based on the user feature type represented by each decision node in each of the target branches.
[0125] Optionally, each leaf node is also marked with the number of samples split from the root node to the leaf node; the model parsing module is also used to:
[0126] Determine the ratio of the number of samples corresponding to the leaf nodes in the target branch to the total number of samples of the data samples, and screen the target branch based on the ratio;
[0127] The user feature types represented by each decision node in each target branch after screening are used to construct user feature sets respectively.
[0128] Optionally, the device further comprises: a copywriting display module, configured to:
[0129] In the case where a target copy based on a target user triggers a display signal, a target display copy is determined from target copies corresponding to each user feature set based on a target user feature corresponding to the target user;
[0130] The target display copy reaches the target users.
[0131] Optionally, the copy display module is also used to:
[0132] In the case where a target copy based on a target user triggers a display signal, based on a target user feature corresponding to the target user, querying a target user feature set in the user feature set that matches the target user feature, and determining that the target copy associated with the target user feature set is the target display copy;
[0133] If the user feature set does not match the target user feature, the standard text corresponding to the target text generation requirement is used as the target display text.
[0134] Alternatively, if Figure 4 As shown, the device also includes: an evaluation and optimization module, which is used to:
[0135] Obtain the user behavior data after each target copy reaches the user, and determine the copy effect of each target copy based on the user behavior data corresponding to each target copy;
[0136] Determine the copy to be adjusted in the target copy that does not meet the preset copy effect according to the copy effect, and adjust and replace the copy to be adjusted.
[0137] Optionally, the evaluation and optimization module is further configured to:
[0138] According to the user feature set corresponding to the copy to be adjusted, the target copy generation requirement and the adjustment requirement corresponding to the copy to be adjusted, copy adjustment prompt information is constructed, and an adjustment copy is generated based on the copy adjustment prompt information through a large language model to replace the copy to be adjusted.
[0139] Optionally, the evaluation and optimization module is further used to: take the user feature set corresponding to the to-be-adjusted copy as the to-be-adjusted set, obtain the user behavior data corresponding to the to-be-adjusted copy as a retraining sample, train a new decision tree using the retraining sample, and construct a new user feature set based on each branch of the new decision tree to replace the to-be-adjusted set;
[0140] For any new user feature set, new copy generation prompt information is constructed according to the new user feature set and the target copy generation requirements, and a new target copy is generated based on the new copy generation prompt information through a large language model to replace the original target copy corresponding to the set to be adjusted.
[0141] Optionally, the target copy generation requirement includes any one of the following: a target object, a target object type, at least one object under a target theme, and at least one object type under a target theme, wherein the object includes a commodity or at least one multimedia material.
[0142] It should be noted that for other corresponding descriptions of the functional units involved in the text generation device based on a large language model provided in the embodiment of the present application, reference can be made to Figure 1 to Figure 2 The corresponding description in the method will not be repeated here.
[0143] The embodiment of the present application also provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a bus, a processor, a memory and a communication interface, and can also include an input and output interface and a display device. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store location information. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in each method embodiment are implemented.
[0144] Those skilled in the art will appreciate that the structure of the above-mentioned computer device is only a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components, or combine certain components, or have a different arrangement of components.
[0145] In one embodiment, a computer-readable storage medium is provided. The computer-readable storage medium may be non-volatile or volatile, and stores a computer program thereon. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0146] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0147] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0148] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0149] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0150] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A copywriting generation method based on a large language model, characterized in that: The method comprises: According to the target copy generation requirement, at least one data sample corresponding to at least one historical user is obtained, wherein each data sample includes a plurality of user feature data, user browsing data and user interaction data of the corresponding historical user, the browsed object in the user browsing data matches the target copy generation requirement, and the user interaction data indicates whether an interaction is generated with the browsed object; The continuous features in the user feature data are bucketed to obtain a plurality of feature buckets corresponding to each continuous feature; the discrete features in the user feature data and the feature buckets are used as training features, and each piece of user feature data is uniquely encoded based on the training features to obtain a user coding feature corresponding to each piece of user feature data; a positive sample is constructed using the user coding feature corresponding to the data sample to which the user interaction data representing the generated interaction belongs, and a negative sample is constructed using the user coding feature corresponding to the remaining data samples; Based on the preset feature importance condition, a decision tree is trained by the positive sample and the negative sample, wherein the decision tree includes a plurality of branches, each branch includes a leaf node and at least one decision node, the user feature types represented by each decision node meet the preset feature importance condition, and each leaf node is marked with the classification label of the leaf node and the number of samples split from the root node to the leaf node; a target branch in each branch is determined according to the classification label of the leaf node; a ratio of the number of samples corresponding to the leaf nodes in the target branch to the total number of samples of the data sample is determined, and the target branch is screened based on the ratio; a user feature set is constructed respectively using the user feature types represented by each decision node in each screened target branch, wherein each user feature set includes at least one user feature type label; For any user feature set, text generation prompt information is constructed according to the user feature set and the target text generation requirement, and the target text is generated based on the text generation prompt information through a large language model.
2. The method according to claim 1, characterized in that After generating the target copy based on the copy generation prompt information by using the large language model, the method further includes: In the case where a target copy based on a target user triggers a display signal, a target display copy is determined from target copies corresponding to each user feature set based on a target user feature corresponding to the target user; The target display copy reaches the target users.
3. The method according to claim 2, characterized in that In the case where a target copy based on a target user triggers a display signal, determining a target display copy from target copies corresponding to each user feature set based on a target user feature corresponding to the target user includes: In the case where a target copy based on a target user triggers a display signal, based on a target user feature corresponding to the target user, querying a target user feature set in the user feature set that matches the target user feature, and determining that the target copy associated with the target user feature set is the target display copy; If the user feature set does not match the target user feature, the standard text corresponding to the target text generation requirement is used as the target display text.
4. The method according to claim 2, characterized in that: After the target display copy reaches the target user, the method further includes: Obtain the user behavior data after each target copy reaches the user, and determine the copy effect of each target copy based on the user behavior data corresponding to each target copy; Determine the copy to be adjusted in the target copy that does not meet the preset copy effect according to the copy effect, and adjust and replace the copy to be adjusted.
5. The method according to claim 4, characterized in that Adjust and replace the text to be adjusted, including: According to the user feature set corresponding to the copy to be adjusted, the target copy generation requirement and the adjustment requirement corresponding to the copy to be adjusted, copy adjustment prompt information is constructed, and an adjustment copy is generated based on the copy adjustment prompt information through a large language model to replace the copy to be adjusted.
6. The method according to claim 4, characterized in that Adjust and replace the text to be adjusted, including: The user feature set corresponding to the to-be-adjusted copy is used as the to-be-adjusted copy, the user behavior data corresponding to the to-be-adjusted copy is obtained as a retraining sample, and a new decision tree is trained using the retraining sample, and a new user feature set is constructed based on each branch of the new decision tree to replace the to-be-adjusted copy; For any new user feature set, new copy generation prompt information is constructed according to the new user feature set and the target copy generation requirements, and a new target copy is generated based on the new copy generation prompt information through a large language model to replace the original target copy corresponding to the set to be adjusted.
7. A copywriting generation device based on a large language model, characterized in that: The device comprises: A data processing module, configured to obtain at least one data sample corresponding to at least one historical user according to the target copy generation requirement, wherein each data sample includes a plurality of user characteristic data, user browsing data and user interaction data of the corresponding historical user, the browsed object in the user browsing data matches the target copy generation requirement, and the user interaction data indicates whether an interaction is generated with the browsed object; A model training module is used to perform feature bucketing for continuous features in user feature data to obtain multiple feature buckets corresponding to each continuous feature; using discrete features in user feature data and the feature buckets as training features, and performing one-hot encoding on each user feature data based on the training features to obtain user coding features corresponding to each user feature data; constructing positive samples using user coding features corresponding to data samples representing user interaction data to which interactions are generated, and constructing negative samples using user coding features corresponding to remaining data samples; based on a preset feature importance condition, training a decision tree using the positive samples and the negative samples, wherein the decision tree includes multiple branches, each branch includes a leaf node and at least one decision node, the user feature types represented by each decision node meet the preset feature importance condition, and each leaf node is marked with the classification label of the leaf node and the number of samples split from the root node to the leaf node; A model parsing module is used to determine a target branch in each branch according to the classification label of the leaf node; determine the ratio of the number of samples corresponding to the leaf nodes in the target branch to the total number of samples of the data sample, and filter the target branch based on the ratio; and construct user feature sets respectively using the user feature types represented by each decision node in each filtered target branch, wherein each user feature set includes at least one user feature type label; The copywriting generation module is used to construct copywriting generation prompt information for any user feature set according to the user feature set and the target copywriting generation requirements, and generate the target copy based on the copywriting generation prompt information through a large language model.
8. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
9. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
