A method for establishing an advertisement semantic retrieval model based on ANN and LLM
By combining ANN and LLM in the semantic retrieval model, and using BERT and ChatGPT to generate high-quality training data, the problem of insufficient keyword generation in the existing technology is solved, and a more accurate and efficient advertising semantic retrieval effect is achieved.
Patent Information
- Application Number
- CN202410741467.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-06-11
AI Technical Summary
Existing semantic retrieval models have deficiencies in the quality and quantity of generated keywords, resulting in single and inaccurate recall results, which affects the monetization efficiency of advertising.
Adopt an advertising semantic retrieval model based on ANN and LLM, provide a large number of keyword samples through LLM, combine with the BERT model for data filtering and adjustment, add the data generated by ChatGPT to form a high-quality training data set, and combine with ANN to optimize the model performance.
It improves the quality and quantity of generated keywords, establishes a semantic retrieval model with higher accuracy and retrieval efficiency, and ensures that the recalled keywords are more accurate and relevant.
Smart Images

Figure CN118312608B
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of text retrieval, and in particular relates to a method for establishing an advertisement semantic retrieval model based on ANN and LLM. Background Art
[0002] Since 2022, with the advent of a new generation of large-scale models such as ChatGPT3.5 and GPT-4, breakthrough progress has been made in the field of large-scale models. These models not only represent a milestone in the development of general artificial intelligence, but also rapidly promote artificial intelligence technology towards large-scale replicable industrial application stages. Its influence and application potential cannot be underestimated, and have brought new development opportunities to various industries.
[0003] As an important online semantic retrieval module of the search ad recall system, ANN plays a key role. Its functions include intelligently recalling relevant and commercially valuable keywords based on the search terms entered by users, especially in improving the ad recall rate of long-tail low-frequency queries. The successful application of this technology not only improves the recall efficiency of ads, but also further promotes the monetization efficiency of ads.
[0004] Taking the semantic retrieval model as an example, in the field of search advertising, the key task of the semantic retrieval model is to recall relevant and commercially valuable keywords based on the user's search terms / query terms, so as to improve the monetization efficiency of advertising, that is, query-bidword pairs (query terms and keyword pairs), and one query term may correspond to multiple keywords. The semantic retrieval model needs to be trained with training data samples before it can be used for search. However, there are problems in the prior art such as low quality of generated keywords and insufficient training data samples, which leads to the recall results of the traditional semantic retrieval model after training being single and inaccurate. Therefore, it is necessary to improve the quality and quantity of generated keywords to obtain a semantic retrieval model with higher accuracy and retrieval efficiency. The present invention solves this technical problem. Summary of the invention
[0005] The present invention provides a method for establishing an advertisement semantic retrieval model based on ANN and LLM. The ANN algorithm is used, and keyword samples produced by the LLM model are added to improve the quality and quantity of the generated training data samples, thereby establishing a semantic retrieval model with higher accuracy and retrieval efficiency.
[0006] A method for establishing an advertisement semantic retrieval model based on ANN and LLM includes the following steps:
[0007] S1. Provide a large number of keyword samples through LLM, clean the data from different channels, and then process the data to obtain a training data set containing positive samples and negative samples;
[0008] S2. Obtain the data of the most recent period, and filter and screen the data;
[0009] S3, filter representative but low-frequency queries to supplement the training dataset;
[0010] S4. Join ChatGPT to obtain the data produced by ChatGPT and form a new training data set to meet the data volume required for training the ANN model;
[0011] S5. Adjust the data to reduce the number of query-bidword pairs and adjust the number of bidwords under each query;
[0012] S6. Combine the samples obtained above with ANN to test the performance of ANN and further optimize it.
[0013] Furthermore, the step S1 includes the following steps:
[0014] S11. Collect PC high-quality channel traffic, mobile traffic logs and querybidword pairs over a period of time;
[0015] S12. Calculate the number of clicks on query and bidword respectively, and downsample the data. The specific formula is as follows: ,
[0016] Among them, α is the sampling ratio;
[0017] S13. Calculate the data using the trained BERT model, obtain the data relevance score based on the relevance between the data and the advertisement, and set a threshold for the relevance score. Data samples with scores greater than the threshold are retained, and data samples with scores less than or equal to the threshold are filtered out.
[0018] S14, merge all log data, filter out samples that appear several times in the merged data sample, and then regard the samples as positive samples of interest to people, and manually annotate these samples;
[0019] S15, selecting a certain number of samples from the data samples as negative samples, and merging them with the positive samples to form random negative sample triplets;
[0020] S16, obtaining some samples that are related to advertisements but have low relevance, and selecting, from data within a period of time, query and keyword pairs containing computer, mobile recommendation, and secondary request advertisements, and samples whose relevance scores of these combinations are lower than a set threshold, as hard negative samples, and forming hard negative sample triplets;
[0021] S17. Combine the random negative sample triples and the hard negative sample triples to form a training data set containing several query-bidword pairs.
[0022] Furthermore, the step S2 includes the following steps:
[0023] S21. Obtain daily query data from the user's search corpus data over a period of time;
[0024] S22, filtering queries with low information entropy and small number of clicks in the query data;
[0025] S23. Use the trained large-scale BERT model to calculate the relevance score and set a threshold. Keep the query-bidword pairs with a relevance score greater than the threshold and filter out the query-bidword pairs with a score lower than the threshold to select the query-bidword pairs most relevant to the target task.
[0026] Furthermore, the step S3 includes the following steps:
[0027] S31. Filtering from a number of low-frequency queries through the KR service to obtain representative queries, and using the obtained queries to perform searches to extract query-bidword pairs that can be recalled by the search engine but cannot be recalled by the ANN;
[0028] S32, merging the ANN corpus with data from other sources to obtain more data, and continuing to filter to extract more query-bidword pairs;
[0029] S33, calculating the relevance scores of the extracted query-bidword pairs, and obtaining query-bidword pairs that are higher than a threshold.
[0030] Furthermore, the step S4 includes the following steps:
[0031] S41. Add the ChatGPT model to generate the promote keyword text and obtain the corresponding query-bidword pair;
[0032] S42, calculating the relevance score of the query-bidword pair through the BERT model and filtering and screening it to obtain filtered samples;
[0033] S43, processing the obtained samples to obtain a final sample set for subsequent training and analysis tasks;
[0034] S44, adding several query-bidword pairs in the final sample set to the training samples of the ANN model to expand the training data set, and merging all the training data sets together to form a new training data set to meet the data volume required for training the ANN model.
[0035] Furthermore, the step S5 includes the following steps:
[0036] S51. For each query, randomly select a set number of bidwords to add to the sample set;
[0037] S52, when the number of optional bidwords under a certain query is less than the set number, all optional bidwords are selected to be added to the sample set;
[0038] S53, repeat the above steps until the number of query-bidword pairs and the number of queries in the sample set reach the set number.
[0039] Furthermore, the step S43 includes the following steps:
[0040] S431, removing URL query samples, and identifying and filtering URL query samples to ensure that they are not included in the generated samples;
[0041] S432: for the remaining samples, identify the samples that do not contain Chinese characters and whose relevance scores are less than the threshold, and record the samples as HardCase samples;
[0042] S433, randomly selecting a portion of the remaining samples as negative samples to supplement the HardCase samples in the future;
[0043] S434: Merge the remaining samples with the negative samples to form a final sample set for subsequent training and analysis tasks.
[0044] The technical effects of the present invention are as follows:
[0045] (1) This solution uses LLM to generate a large number of keyword corpora and obtain a large number of training data samples. It also filters out samples with low relevance based on the relevance between the query and the keyword, and retains samples with high relevance, thereby ensuring the high quality of the keywords. Then, a large number of high-quality samples are combined with the ANN algorithm to train and optimize the ANN model, thereby establishing a semantic retrieval model with higher accuracy and retrieval efficiency.
[0046] (2) This solution also uses ChatGPT to generate training data samples, which can obtain more samples to train the semantic retrieval model, further improving the quantity and quality of samples, making the semantic retrieval model more accurate and efficient;
[0047] (3) By adjusting the data, the number of query-bidword pairs can be reduced and too many bidwords can be avoided under each query, thereby avoiding too many keywords corresponding to each query word. As a result, when the user enters the search word for query, the recalled keywords are more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION
[0049] The technical solution of the present invention will be clearly and completely described below in conjunction with specific embodiments and drawings.
[0050] See also Figure 1 , a method for establishing an advertisement semantic retrieval model based on ANN and LLM, comprising the following steps:
[0051] S1. Provide a large number of keyword samples through LLM, clean the data from different channels, and then process the data to obtain a training data set containing positive samples and negative samples;
[0052] S2. Obtain the data of the most recent period, and filter and screen the data;
[0053] S3, filter representative but low-frequency queries to supplement the training dataset;
[0054] S4. Join ChatGPT to obtain the data produced by ChatGPT and form a new training data set to meet the data volume required for training the ANN model;
[0055] S5. Adjust the data to reduce the number of query-bidword pairs and adjust the number of bidwords under each query;
[0056] S6. Combine the samples obtained above with ANN to test the performance of ANN and further optimize it.
[0057] Furthermore, step S1 includes the following steps:
[0058] S11. Collect and obtain PC high-quality channel traffic, mobile traffic logs and querybidword pairs in the past 80 days;
[0059] S12. Calculate the number of clicks on query and bidword respectively, and downsample the data. To avoid excessive consumption of computing resources and long training time due to excessive data size, downsample the data and set the sampling ratio α=0.0000000001. The specific formula is as follows: ,
[0060] Among them, α is the sampling ratio;
[0061] S13. Calculate the data using the trained BERT model, obtain the data relevance score based on the relevance between the data and the advertisement, and set a threshold for the relevance score. Data samples with scores greater than the threshold are retained, and data samples with scores less than or equal to the threshold are filtered out. The threshold set in this embodiment is 1.3.
[0062] S14, merge all log data, filter out samples that appear at least 5 times in the merged data sample, and then regard the samples as positive samples of interest to people, and manually annotate these samples;
[0063] S15, selecting a certain number of samples from the data samples as negative samples, and merging them with the positive samples to form random negative sample triplets;
[0064] S16, obtaining some samples that are related to advertisements but have low relevance, and selecting, from the data within a period of time, query and keyword pairs containing computer, mobile recommendation, and secondary request advertisements, and samples whose relevance scores of these combinations are lower than a set threshold, as "hard" negative samples, and forming hard negative sample triplets;
[0065] S17. Combine the random negative sample triples and the hard negative sample triples to form a training data set containing several query-bidword pairs.
[0066] The final training dataset contains about 200 million query-bidword pairs. By doing this, a large-scale training dataset can be generated for training the model to improve its performance and generalization ability. The construction of this dataset takes into account positive samples, random negative samples, and hard negative samples to cover as many situations as possible, so that the model can perform well in various scenarios.
[0067] Furthermore, step S2 includes the following steps:
[0068] S21. Obtain daily query data from the user's search corpus data over a period of time;
[0069] S22, filtering queries with low information entropy and small number of clicks in the query data;
[0070] S23. Use the trained large-scale BERT model to calculate the relevance score and set a threshold. Keep the query-bidword pairs with a relevance score greater than the threshold and filter out the query-bidword pairs with a score lower than the threshold to select the query-bidword pairs most relevant to the target task.
[0071] Information entropy is an indicator used to measure the uncertainty or randomness of data. The lower the information entropy, the more ordered or repetitive the data is. Therefore, queries with low information entropy may mean that they contain less information or are not representative. In addition, queries with low click volume may mean that they are less relevant or less interesting to users. By filtering out these queries with low information entropy and low click volume, the quality of the data can be improved, the noise data can be reduced, and the subsequent analysis and modeling work can be better supported.
[0072] Furthermore, step S3 includes the following steps:
[0073] S31. Filtering from a number of low-frequency queries through the KR service to obtain representative queries, and using the obtained queries to perform searches to extract query-bidword pairs that can be recalled by the search engine but cannot be recalled by the ANN;
[0074] S32, merging the ANN corpus with data from other sources to obtain more data, and continuing to filter to extract more query-bidword pairs;
[0075] S33, calculating the relevance scores of the extracted query-bidword pairs, and obtaining query-bidword pairs that are higher than a threshold.
[0076] In order to use the information in the ANN corpus to supplement or enhance the previous data set to improve the quality and coverage of the data, the ANN corpus can be connected or merged with the query-keyword pairs mentioned above, and then about 4 million query-bidword pairs were screened out. In this way, by merging data from different sources, more comprehensive and diverse data can be obtained, which can better support subsequent analysis or modeling work.
[0077] Further, step S4 includes the following steps:
[0078] S41. Add the ChatGPT model to generate the promote keyword text and obtain the corresponding query-bidword pair;
[0079] S42, calculating the relevance score of the query-bidword pair through the BERT model and filtering and screening it to obtain filtered samples;
[0080] S43, processing the obtained samples to obtain a final sample set for subsequent training and analysis tasks;
[0081] S44, adding several query-bidword pairs in the final sample set to the training samples of the ANN model to expand the training data set, and merging all the training data sets together to form a new training data set to meet the data volume required for training the ANN model.
[0082] The model used in this example is ChatGPT-3.5-turbo-32k, which is a ChatGPT-3.5 model with 32k parameters and turbo tuning. This model is an improvement and optimization of the original ChatGPT-3.5 model to improve its performance and efficiency. It is mainly reflected in the following aspects:
[0083] 1. Higher speed and efficiency: Through tuning and improvements, ChatGPT-3.5-turbo-32k may show higher speed and better responsiveness when generating text.
[0084] 2. Better performance: ChatGPT-3.5-turbo-32k may show better quality and accuracy in generating text, as well as better semantic understanding capabilities.
[0085] 3. Greater scalability: Models using 32k parameters may be able to handle longer text sequences or more complex tasks than smaller models.
[0086] The calculation aggregation script in this solution is as follows
[0087] SELECT query, bidword
[0088] FROM (
[0089] SELECT query, bidword
[0090] FROM t1
[0091] WHERE label IN ('spring', 'climate', 'festival', 'diet') AND rele > 1.5
[0092] AND query NOT LIKE '%http%' AND query NOT LIKE '%www%' AND query NOT LIKE '%.com%'
[0093] UNION ALL
[0094] SELECT query, bidword
[0095] FROM t2
[0096] WHERE matchtype IN ('spring', 'climate', 'festival', 'diet') AND rel_score> 1.4162
[0097] AND query NOT LIKE '%http%' AND query NOT LIKE '%www%' AND query NOT LIKE '%.com%'
[0098] AND RAND() < 0.6
[0099] ) AS combined_data;
[0100] Furthermore, step S5 includes the following steps:
[0101] S51. For each query, randomly select no more than 5 bidwords to add to the sample set;
[0102] S52, when the number of optional bidwords under a query is less than 5, all optional bidwords are added to the sample set;
[0103] S53, repeat the above steps until the number of query-bidword pairs and the number of queries in the sample set reach the set number.
[0104] Further, step S43 includes the following steps:
[0105] S431, removing URL query samples, and identifying and filtering URL query samples to ensure that they are not included in the generated samples;
[0106] S432: for the remaining samples, identify the samples that do not contain Chinese characters and whose relevance scores are less than the threshold, and record the samples as HardCase samples;
[0107] S433, randomly selecting a portion of the remaining samples as negative samples to supplement the HardCase samples in the future;
[0108] S434: Merge the remaining samples with the negative samples to form a final sample set for subsequent training and analysis tasks.
[0109] In order to obtain the actual search behavior data of users over a period of time for subsequent analysis, modeling or other tasks, we obtain the daily click query data from the search corpus data in the last 20 days. These click data have been processed and aggregated with the Web Shield data of the previous 20 days. This data aggregation method can ensure the integrity and accuracy of the data, while also taking into account the particularity of the Web Shield data and providing a more comprehensive perspective.
[0110] The present invention successfully makes up for the model's lack of knowledge about the search term category structure by supplementing the keyword data produced by LLM; improves the quality of generated keywords by optimizing prompt engineering and relevance model filtering; at the same time, adds keyword samples produced by LLM, effectively improving the model's relevant recall results under high, medium and low frequency queries.
[0111] The above embodiments are only preferred embodiments of the present invention. Those skilled in the art can derive other embodiments from the above embodiments without creative work. Therefore, this application protects not only the above embodiments, but also the scope consistent with the principles and features of this application.
Claims
1. A method for establishing an advertisement semantic retrieval model based on ANN and LLM, characterized in that: The following steps are involved: S1. Provide a large number of keyword samples through LLM, clean the data from different channels, and then process the data to obtain a training data set containing positive samples and negative samples; S2. Obtain the data of the most recent period, and filter and screen the data; S3, filter representative but low-frequency queries to supplement the training dataset; S4. Join ChatGPT to obtain the data produced by ChatGPT and form a new training data set to meet the data volume required for training the ANN model; S5. Adjust the data to reduce the number of query-bidword pairs and adjust the number of bidwords under each query; S6. Combining the samples obtained above with ANN to test the performance of ANN and further optimize it; The step S1 includes the following steps: S11. Collect PC high-quality channel traffic, mobile traffic logs and querybidword pairs over a period of time; S12. Calculate the number of clicks on query and bidword respectively, and downsample the data. The specific formula is as follows: ; Among them, α is the sampling ratio; S13. Calculate the data using the trained BERT model, obtain the data relevance score based on the relevance between the data and the advertisement, and set a threshold for the relevance score. Data samples with scores greater than the threshold are retained, and data samples with scores less than or equal to the threshold are filtered out. S14, merge all log data, filter out samples that appear several times in the merged data sample, and then regard the samples as positive samples of interest to people, and manually annotate these samples; S15, selecting a certain number of samples from the data samples as negative samples, and merging them with the positive samples to form random negative sample triplets; S16, obtaining some samples that are related to advertisements but have low relevance, and selecting, from data within a period of time, query and keyword pairs containing computer, mobile recommendation, and secondary request advertisements, and samples whose relevance scores of these combinations are lower than a set threshold, as hard negative samples, and forming hard negative sample triplets; S17, merging the random negative sample triples and the hard negative sample triples to form a training data set containing several query-bidword pairs; The step S2 includes the following steps: S21. Obtain daily query data from the user's search corpus data over a period of time; S22, filtering queries with low information entropy and small number of clicks in the query data; S23. Use the trained large-scale BERT model to calculate the relevance score and set a threshold. Keep the query-bidword pairs with relevance scores greater than the threshold and filter out the query-bidword pairs with scores lower than the threshold to select the query-bidword pairs most relevant to the target task. The step S3 includes the following steps: S31. Filtering from a number of low-frequency queries through the KR service to obtain representative queries, and using the obtained queries to perform searches to extract query-bidword pairs that can be recalled by the search engine but cannot be recalled by the ANN; S32, merging the ANN corpus with data from other sources to obtain more data, and continuing to filter to extract more query-bidword pairs; S33, calculating the relevance scores of the extracted query-bidword pairs to obtain query-bidword pairs that are higher than a threshold; The step S4 includes the following steps: S41. Add the ChatGPT model to generate the promote keyword text and obtain the corresponding query-bidword pair; S42, calculating the relevance score of the query-bidword pair through the BERT model and filtering and screening it to obtain filtered samples; S43, processing the obtained samples to obtain a final sample set for subsequent training and analysis tasks; S44, adding several query-bidword pairs in the final sample set to the training samples of the ANN model to expand the training data set, and merging all the training data sets together to form a new training data set to meet the data volume required for training the ANN model.
2. The method for establishing an advertisement semantic retrieval model based on ANN and LLM according to claim 1, characterized in that: The step S5 includes the following steps: S51. For each query, randomly select a set number of bidwords to add to the sample set; S52, when the number of optional bidwords under a certain query is less than the set number, all optional bidwords are selected to be added to the sample set; S53, repeat the above steps until the number of query-bidword pairs and the number of queries in the sample set reach the set number.
3. The method for establishing an advertisement semantic retrieval model based on ANN and LLM according to claim 1, characterized in that: The step S43 includes the following steps: S431, removing URL query samples, and identifying and filtering URL query samples to ensure that they are not included in the generated samples; S432: for the remaining samples, identify the samples that do not contain Chinese characters and whose relevance scores are less than the threshold, and record the samples as HardCase samples; S433, randomly selecting a portion of the remaining samples as negative samples to supplement the HardCase samples in the future; S434: Merge the remaining samples with the negative samples to form a final sample set for subsequent training and analysis tasks.
