Model training method, input completion method and related device
By generating a training sample set and training the input completion model, the problem of insufficient matching between recommended completion content and user intent in intelligent customer service was solved, thus improving the user experience.
Patent Information
- Application Number
- CN202211184539.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-27
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2042-09-27
AI Technical Summary
In intelligent customer service response scenarios, existing technologies struggle to effectively improve the matching degree between recommended supplementary content and user intent, resulting in a poor user experience.
By acquiring multiple historical session data, a training sample set is generated. This sample set is then used to train an input completion model, taking into account user input text, recommended completion content, and clicked content. The model is then optimized to more accurately match user intent.
This improved the matching degree between recommended supplementary content and user intent, thus enhancing the user experience.
Smart Images

Figure CN115564057B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of artificial intelligence services, in particular to a model training method, an input completion method and related devices. BACKGROUND
[0002] In the intelligent customer service response scenario, the process of inputting problem text by the user often has a pause. At each pause moment, the intelligent customer service can complete the input according to the input content, and show the user multiple recommended completion contents. The user can select and click any recommended completion content, or continue to input. Since the occurrence of the user's click behavior depends on whether the recommended completion content matches the user's intention, in order to improve the user experience, the existing input completion technology should focus on how to make the recommended completion content more match the user's intention. SUMMARY
[0003] In order to overcome the deficiencies of the prior art, the embodiments of the present application provide a model training method, an input completion method, a model training device, an input completion device and related devices.
[0004] The technical scheme of the embodiments of the present application can be implemented as follows:
[0005] In a first aspect, the embodiments of the present application provide a model training method, which comprises:
[0006] Obtain a plurality of historical session data, each of the historical session data comprises at least one user behavior record, and each of the user behavior record comprises user input text, recommended completion content and clicked content;
[0007] Generate a training sample set based on the user input text, the recommended completion content and the clicked content in each of the user behavior record;
[0008] Use the training sample set to train a pre-constructed input completion model to obtain a trained input completion model, wherein the trained input completion model is used to complete the text input by the user.
[0009] Optionally, each of the user behavior record in each of the historical session data has a serial number, and the training sample set comprises a training sample corresponding to each of the historical session data.
[0010] The step of generating a training sample set based on the user input text, the recommended completion content and the clicked content in each of the user behavior record comprises:
[0011] For each of the historical session data, if the historical session data includes multiple user behavior records, and the clicked content in the user behavior record with the largest serial number is not empty, the user behavior record with the largest serial number is taken as a first record;
[0012] The user behavior record with the largest serial number in the historical session data other than the first record is taken as a second record;
[0013] A training sample corresponding to the historical session data is obtained, wherein the training sample includes the user input text and the clicked content in the first record, and the recommended completion content in the second record.
[0014] Optionally, the step of generating a training sample set based on the user input text, the recommended completion content and the clicked content in each of the user behavior records further includes:
[0015] For each of the historical session data, if the historical session data includes one user behavior record, and the clicked content in the user behavior record is not empty, a training sample corresponding to the historical session data is obtained, wherein the training sample includes the user input text and the clicked content in the user behavior record.
[0016] Optionally, the step of generating a training sample set based on the user input text, the recommended completion content and the clicked content in each of the user behavior records includes:
[0017] The user input texts in all the user behavior records are de-duplicated to obtain each sample text;
[0018] The recommended completion contents in all the user behavior records are de-duplicated to obtain each sample completion content;
[0019] For any target sample text, each user behavior record in which the user input text is the target sample text is obtained;
[0020] According to the recommended completion content in each user behavior record, the number of recommendations of each of the sample completion contents is counted;
[0021] According to the clicked content in each user behavior record, the number of clicks of each of the sample completion contents is counted;
[0022] A training sample corresponding to the target sample text is obtained, and the training sample includes the number of recommendations and the number of clicks of each of the sample completion contents;
[0023] Traverse each of the sample texts to obtain a training sample corresponding to each of the target sample texts, wherein the training sample set comprises the training sample corresponding to each of the target sample texts.
[0024] In a second aspect, an embodiment of the present application provides an input completion method applied to an electronic device, wherein the electronic device is deployed with a search engine, and the method comprises:
[0025] obtaining a to-be-completed text input by a user;
[0026] inputting the to-be-completed text into a pre-trained input completion model to obtain a plurality of first recommended completion contents arranged according to click probabilities, wherein the input completion model is obtained by using the model training method according to any one of the preceding embodiments;
[0027] inputting the to-be-completed text into the search engine to obtain a plurality of second recommended completion contents arranged according to click probabilities;
[0028] generating a recommended completion content list according to each of the first recommended completion contents and each of the second recommended completion contents to complete the to-be-completed text.
[0029] Optionally, the step of generating the recommended completion content list according to each of the first recommended completion contents and each of the second recommended completion contents comprises:
[0030] for each of the second recommended completion contents, if there is a first recommended completion content identical to the second recommended completion content, deleting the second recommended completion content;
[0031] if there is no first recommended completion content identical to the second recommended completion content, retaining the second recommended completion content;
[0032] arranging the retained second recommended completion contents in the recommended completion content list in a preset number according to the click probabilities;
[0033] arranging each of the first recommended completion contents in the recommended completion content list in a preset number according to the click probabilities.
[0034] In a third aspect, an embodiment of the present application provides a model training device, which comprises:
[0035] a first obtaining module configured to obtain a plurality of historical conversation data, wherein each of the historical conversation data comprises at least one user behavior record, and each of the user behavior records comprises a user input text, a recommended completion content and a clicked content;
[0036] The generating module is configured to generate a training sample set based on the user input text, the recommended completion content, and the clicked content in each of the user behavior records.
[0037] The training module is configured to train a pre-constructed input completion model by using the training sample set to obtain a trained input completion model, wherein the trained input completion model is configured to complete the user input text.
[0038] In a fourth aspect, an embodiment of the present application provides an input completion device applied to an electronic device, wherein the electronic device is deployed with a search engine, and the device comprises:
[0039] The second obtaining module is configured to obtain the user input text to be completed.
[0040] The processing module is configured to:
[0041] input the text to be completed into a pre-trained input completion model to obtain a plurality of first recommended completion contents arranged according to a clicked probability, wherein the input completion model is obtained by using the model training method according to any one of the preceding embodiments.
[0042] input the text to be completed into the search engine to obtain a plurality of second recommended completion contents arranged according to a clicked probability.
[0043] generate a recommended completion content list according to each of the first recommended completion contents and each of the second recommended completion contents to complete the text to be completed.
[0044] In a fifth aspect, an embodiment of the present application provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the computer program is executed by the processor to implement the model training method according to the first aspect and / or the input completion method according to the second aspect.
[0045] In a sixth aspect, the present application provides a computer readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the model training method according to the first aspect and / or the input completion method according to the second aspect.
[0046] Compared with the prior art, the model training method provided by the embodiment of the application firstly acquires a plurality of historical session data, each historical session data including at least one user behavior record, and each user behavior record including user input text, recommendation completion content and clicked content; then generates a training sample set based on the user input text, the recommendation completion content and the clicked content in each user behavior record; and finally trains a pre-constructed input completion model by using the training sample set to obtain a trained input completion model, wherein the trained input completion model is used for completing the text input by the user. Since the training sample used for training the model in the embodiment of the application not only considers the text input by the user and the clicked content when the click behavior occurs, but also considers the non-clicked recommendation completion content displayed multiple times before the click behavior occurs, the model can learn more user behavior information, the input completion model obtained can more quickly and accurately display the recommendation completion content matching the user's intention, and the user experience is improved. BRIEF DESCRIPTION OF DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the embodiments of the application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the application, and therefore should not be regarded as a limitation to the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0048] Figure 1 An application scenario diagram is provided for the embodiment of the application.
[0049] Figure 2 A flowchart of a model training method is provided for the embodiment of the application. Figure One ;
[0050] Figure 3 A flowchart of a model training method is provided for the embodiment of the application. Figure Two ;
[0051] Figure 4 A flowchart of a model training method is provided for the embodiment of the application. Figure Three ;
[0052] Figure 5 An input completion process example is provided for the embodiment of the application. Figure One ;
[0053] Figure 6 An input completion process example is provided for the embodiment of the application. Figure Two ;
[0054] Figure 7A flowchart of an input completion method provided by an embodiment of the present application is shown in FIG. 1.
[0055] Figure 8 A function unit block diagram of a model training device provided by an embodiment of the present application is shown in FIG. 10.
[0056] Figure 9 A function unit block diagram of an input completion device provided by an embodiment of the present application is shown in FIG. 20.
[0057] Figure 10 A structural schematic block diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 30.
[0058] Icon: 100 - model training device; 101 - first acquisition module; 102 - generation module; 103 - training module; 200 - input completion device; 201 - second acquisition module; 202 - processing module; 300 - electronic device; 310 - memory; 320 - processor. DETAILED DESCRIPTION
[0059] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations.
[0060] Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative labor are within the scope of protection of the present application.
[0061] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0062] In addition, if the terms "first", "second" and the like are used, they are only used to distinguish descriptions, and cannot be understood as indicating or implying relative importance.
[0063] It should be noted that: the features in the embodiments of the present application can be combined with each other without conflict.
[0064] Please refer to Figure 1, the application program running on the mobile terminal (such as a mobile phone, a tablet computer, etc.) has a smart customer service, the user inputs "how to buy" in the search bar, the smart customer service of the application program performs input completion on the text input by the user, that is, multiple different recommended completion contents are displayed below the search bar, including "how to buy cheap tickets", "how to buy albums", "how to buy high-speed rail tickets", etc., and the four words "how to buy" in each recommended completion content are displayed in bold, and the remaining part (such as tickets, albums, high-speed rail tickets, clothes, etc.) is the result of the smart customer service completing the question text input by the user. At this time, if the user's intention is "to buy an album", since there is currently a recommended completion content "how to buy an album" that matches the user's intention, the user can directly click the recommended completion content, and if the user's intention is "to buy a membership", since none of the current recommended completion contents hits the user's intention, the user can only choose to continue inputting the question text.
[0065] Since the occurrence of the user's click behavior depends on whether the displayed recommended completion content matches the user's intention, in order to quickly display recommended completion contents that can match the user's intention to the user and improve the user experience, the input completion method is provided in the embodiments of the present application.
[0066] Before introducing the input completion method, the model training method is introduced in detail in the embodiments of the present application.
[0067] Please refer to Figure 2 The model training method includes steps S101-S103.
[0068] S101, obtain multiple historical conversation data.
[0069] Each historical conversation data includes at least one user behavior record, and each user behavior record includes user input text, recommended completion content and clicked content.
[0070] Since there is often a pause in the input process of the user in the smart customer service response scene, at each pause moment, the smart customer service can perform input completion according to the input content and display multiple recommended completion contents to the user. Understandably, one historical conversation data represents one user's input process, and each time a pause occurs in the user's input process, a user behavior record is generated, and the user input text in the user behavior record refers to all the content input at the current pause moment.
[0071] The user behavior record can also include the current input text, which refers to the content input after the last pause to the current pause.
[0072] Exemplarily, as shown in Table 1, the historical session data 1 includes a user behavior record 1 and a user behavior record 2, i.e., two pauses occur in the user input process.
[0073] The user input text in the user behavior record 1 is "member", which means that all the content has been input as "member" when the first pause occurs, and the current input text is "member", which means that the content input from the beginning of the user input to the occurrence of the first pause is "member".
[0074] When the first pause occurs, the intelligent customer service shows the user three recommended completion contents of "member purchase", "member use" and "joint member purchase" according to the all content "member" that has been input. The user does not perform a click operation on the three recommended completion contents displayed, and therefore, the clicked content in the user behavior record 1 is empty.
[0075] Similarly, the user input text in the user behavior record 2 is "member purchase", which means that all the content has been input as "member purchase" when the second pause occurs, and the current input text is "purchase", which means that the content input from the first pause to the occurrence of the second pause is "purchase".
[0076] When the second pause occurs, the intelligent customer service shows the user three recommended completion contents of "member purchase", "child member purchase" and "joint member purchase" according to the all content "member purchase" that has been input. The user performs a click operation on the "joint member purchase" among the three recommended completion contents displayed, and therefore, the clicked content in the user behavior record 1 is "joint member purchase".
[0077] Table 1
[0078]
[0079]
[0080] S102, generating a training sample set based on the user input text, the recommended completion content and the clicked content in each user behavior record.
[0081] The embodiment of the application provides two possible implementation manners of the step S102, which will be introduced in detail respectively.
[0082] Please refer to Figure 3 In the first possible implementation manner, the step S102 includes sub-steps S102-1 to S102-3.
[0083] S102-1, for each historical session data, if the user behavior record included in the historical session data is multiple and the clicked content in the user behavior record with the largest serial number is not empty, the user behavior record with the largest serial number is taken as the first record.
[0084] Exemplarily, the historical session data 2 in the above table 1 includes three user behavior records, and the user behavior record with the largest serial number, i.e., the user behavior record 3, has non-empty clicked content, so the user behavior record 3 is taken as the first record.
[0085] S102-2, the user behavior record with the largest serial number in the historical session data except the first record is taken as the second record.
[0086] Exemplarily, the historical session data 2 in the above table 1 includes three user behavior records, and the user behavior record with the largest serial number, i.e., the user behavior record 3, has non-empty clicked content, so the user behavior record 3 is taken as the first record.
[0087] S102-3, obtaining a training sample corresponding to the historical session data.
[0088] The training sample includes the user input text and the clicked content in the first record, and the recommended completion content in the second record.
[0089] Exemplarily, the training sample obtained based on the historical session data in the table 1 is shown in table 2, the training sample 1 corresponds to the historical session data 1, the first record in the historical session data 1 is the user behavior record 2, and the second record is the user behavior record 1.
[0090] x1 in the training sample 1 is the user input text "member purchase" in the user behavior record 2, x2 is the current input text "purchase" in the user behavior record 2, x3, x4 and x5 are respectively three recommended completion contents "member purchase", "member use" and "joint member purchase" in the user behavior record 1, and y is the clicked content "joint member purchase" in the user behavior record 2.
[0091]
[0092] Please refer to Figure 3 , the step S102 further includes a sub-step S102-4 parallel to the sub-steps S102-1-S102-3.
[0093] S102-4, for each historical session data, if the historical session data includes one user behavior record and the clicked content in the user behavior record is non-empty, a training sample corresponding to the historical session data is obtained.
[0094] The training sample includes the user input text and the clicked content in the user behavior record.
[0095] Exemplarily, referring to Table 2 again, training sample 3 corresponds to historical session data 3, and the historical session data 3 includes one user behavior record, i.e., user behavior record 1, which means that the user input process only has one pause.
[0096] Since the clicked content in the user behavior record 1 is not empty, the training sample 3 is obtained.
[0097] The x1 in the training sample 2 is the user input text “member” in the user behavior record 1, the x2 is the current input text “member” in the user behavior record 1, the x3, x4 and x5 are all empty, and the y is the clicked content “joint member purchase” in the user behavior record 1.
[0098] Next, a second possible implementation of the step S102 will be introduced.
[0099] Referring to Figure 4 In the second possible implementation, the step S102 includes sub-steps S102-5 to S102-11.
[0100] S102-5, performing a deduplication processing on the user input texts in all user behavior records to obtain each sample text.
[0101] Exemplarily, performing a deduplication processing on the user input texts in all user behavior records included in the historical session data shown in Table 1 can obtain four sample texts, which are “member”, “member purchase”, “member how” and “member how to cancel”.
[0102] S102-6, performing a deduplication processing on the recommendation completion contents in all user behavior records to obtain each sample completion content.
[0103] Exemplarily, performing a deduplication processing on the recommendation completion contents in all user behavior records included in the historical session data shown in Table 1 can obtain seven sample completion contents, which are “member purchase”, “member use”, “joint member purchase”, “child member purchase”, “cancel member”, “cancel member automatic renewal” and “why member cannot be cancelled”.
[0104] S102-7, obtaining, for any target sample text, each user behavior record whose user input text is the target sample text.
[0105] Exemplarily, taking the sample text “member” as the target sample text, the user behavior record 1 in the historical session data 1, the user behavior record 1 in the historical session data 2 and the user behavior record 1 in the historical session data 3 shown in Table 1 all have the complete input text “member”.
[0106] S102-8, according to the recommended completion content in each user behavior record, the recommended number of times of each sample completion content is counted.
[0107] Exemplarily, according to the recommended completion content in the three user behavior records obtained when the target sample text is “member”, the recommended number of times of each sample completion content is counted.
[0108] For the sample completion text “member purchase”, the recommended completion content “member purchase” exists in the three user behavior records, and therefore, the recommended number of times of the sample completion text is 3 times.
[0109] For the sample completion text “member use”, the recommended completion content “member use” exists in the three user behavior records, and therefore, the recommended number of times of the sample completion text is 3 times.
[0110] For the sample completion text “joint member purchase”, the recommended completion content “joint member purchase” exists in the three user behavior records, and therefore, the recommended number of times of the sample completion text is 3 times.
[0111] For the sample completion text “child member purchase”, the recommended completion content “child member purchase” does not exist in the three user behavior records, and therefore, the recommended number of times of the sample completion text is 0 times.
[0112] For the sample completion text “cancel member”, the recommended completion content “cancel member” does not exist in the three user behavior records, and therefore, the recommended number of times of the sample completion text is 0 times.
[0113] For the sample completion text “cancel member automatic renewal”, the recommended completion content “cancel member automatic renewal” does not exist in the three user behavior records, and therefore, the recommended number of times of the sample completion text is 0 times.
[0114] For the sample completion text “why can't the member cancel”, the recommended completion content “why can't the member cancel” does not exist in the three user behavior records, and therefore, the recommended number of times of the sample completion text is 0 times.
[0115] S102-9, according to the clicked content in each user behavior record, the clicked number of times of each sample completion content is counted.
[0116] Exemplarily, according to the clicked content in the three user behavior records obtained when the target sample text is “member”, the clicked number of times of each sample completion content is counted.
[0117] Specifically, for the sample completion text “member purchase”, the clicked content in the three user behavior records is not “member purchase”, and therefore, the clicked number of times of the sample completion text is 0 times.
[0118] For the sample completion text "member use", the clicked content in the three user behavior records is not "member use", so the number of clicks of the sample completion text is 0.
[0119] For the sample completion text "joint member purchase", since the clicked content in the user behavior record 1 in the historical session data 3 is "member purchase", the number of clicks of the sample completion text is 1.
[0120] For the sample completion text "child member purchase", the clicked content in the three user behavior records is not "child member purchase", so the number of clicks of the sample completion text is 0.
[0121] For the sample completion text "cancel member", the clicked content in the three user behavior records is not "cancel member", so the number of clicks of the sample completion text is 0.
[0122] For the sample completion text "cancel member automatic renewal", the clicked content in the three user behavior records is not "cancel member automatic renewal", so the number of clicks of the sample completion text is 0.
[0123] For the sample completion text "why can't the member cancel", the clicked content in the three user behavior records is not "why can't the member cancel", so the number of clicks of the sample completion text is 0.
[0124] In S102-10, a training sample corresponding to the target sample text is obtained.
[0125] As a possible implementation manner, the training sample corresponding to the target sample text can include the number of recommendations and the number of clicks of each sample completion content.
[0126] It can be understood that the difference between the number of recommendations and the number of clicks represents the number of unclicked times of the sample completion content.
[0127] For any sample completion content, the difference between the number of clicks and the number of unclicked times can be used to represent the heat of the sample completion content.
[0128] For example, when the target sample text is "member", the number of recommendations of the determined sample completion content "member purchase" is 3, the number of clicks is 0, and the number of unclicked times of the sample completion content is 3, so the difference between the number of clicks and the number of unclicked times representing the heat of the sample completion content is -3.
[0129] As another possible implementation, the training sample corresponding to each target sample text can include a value representing the heat of each sample completion content, i.e., the difference between the number of clicks and the number of non-clicks of each sample completion content.
[0130] S102-11, traversing each sample text to obtain the training sample corresponding to each target sample text.
[0131] The training sample set includes the training sample corresponding to each target sample text.
[0132] For example, the training sample obtained based on the historical session data in Table 1 is shown in Table 3. The training sample 1 includes the sample text "member", and the values representing the heat of the sample completion contents "member purchase", "member use", "joint member purchase", "child member purchase", "member cancellation", "cancel member automatic renewal", and "why can't the member cancel".
[0133] Table 3
[0134]
[0135] S103, using the training sample set to train the pre-constructed input completion model to obtain the trained input completion model.
[0136] In the embodiment of the present application, the input completion model can be constructed based on the Bert model, and then the input completion model is trained using the training sample set to obtain the trained input completion model for completing the text input by the user.
[0137] For the input completion model obtained based on the training sample set in Table 2, when completing the text input by the user, as shown in Figure 5 , the input is CLS+input text tokenization+SEP1+current input text tokenization+SEP2+last recommended completion content embedding, and the output is n recommended completion contents arranged according to the click probability.
[0138] For the input completion model obtained based on the training sample set in Table 3, when completing the text input by the user, as shown in Figure 6 , the input of the model is the text input by the user, and the output is n recommended completion contents arranged according to the click probability.
[0139] After introducing the above model training method, the input completion method provided by the embodiment of the present application will be described in detail.
[0140] Please refer to Figure 7 , the input completion method includes steps S201-S204.
[0141] S201, obtaining a to-be-completed text input by a user;
[0142] S202, inputting the to-be-completed text into a pre-trained input completion model to obtain a plurality of first recommended completion contents arranged according to click probabilities.
[0143] The input completion model is obtained by using the above model training method.
[0144] S203, inputting the to-be-completed text into a search engine to obtain a plurality of second recommended completion contents arranged according to click probabilities.
[0145] The search engine can be Solr (an independent enterprise-level search application server), Elasticsearch (a highly scalable open source full-text search and analysis engine), etc.
[0146] S204, generating a recommended completion content list according to each first recommended completion content and each second recommended completion content to complete the to-be-completed text.
[0147] Optionally, the implementation process of step S204 can include sub-steps S204-1 to S204-4.
[0148] S204-1, for each second recommended completion content, if there is a first recommended completion content identical to the second recommended completion content, the second recommended completion content is deleted.
[0149] S204-2, if there is no first recommended completion content identical to the second recommended completion content, the second recommended completion content is retained.
[0150] For example, 64 first recommended completion contents arranged according to click probabilities are obtained by using the input completion model, which are K1, K2, …, K64 respectively, and 3 second recommended completion contents arranged according to click probabilities are obtained by using the search engine, which are L1, L2 and L3 respectively. Since L2 is identical to K24, L2 is deleted and L1 and L3 are retained.
[0151] S204-3, a predetermined number of retained second recommended completion contents are sequentially written into the recommended completion content list according to the click probabilities.
[0152] The predetermined number can be set as needed.
[0153] S204-4, each first recommended completion content is sequentially written into the recommended completion content list according to the click probabilities.
[0154] It can be understood that in the recommended completion content list, the predetermined number of retained second recommended completion contents are arranged in front of all the first recommended completion contents.
[0155] In the process of completing the text to be completed, the first certain number of recommended completion contents in the recommended completion content list are displayed to the customer according to actual needs.
[0156] Compared with the prior art, the embodiments of the present application have the following technical effects:
[0157] (1) The training samples for training the model not only consider the text input by the user and the recommended completion content clicked when the click behavior occurs, but also consider the recommended completion content not clicked that is displayed multiple times before the click behavior occurs, so that the model can learn more user behavior information, the input completion model obtained can more quickly and accurately display the recommended completion content matching the user's intention, and the user experience is improved.
[0158] (2) The recommended completion content finally displayed to the user is obtained by using the recommended completion content output by the input completion model and the recommended completion content output by the search engine, and the user experience is further improved.
[0159] In order to perform the above method embodiments and the corresponding steps in each possible implementation, an implementation of a model training device 100 and an input completion device 200 is given below.
[0160] Please refer to Figure 8 The model training device 100 comprises a first acquisition module 101, a generation module 102 and a training module 103.
[0161] The first acquisition module 101 is configured to acquire a plurality of historical session data, each historical session data comprising at least one user behavior record, and each user behavior record comprising user input text, recommended completion content and clicked content.
[0162] The generation module 102 is configured to generate a training sample set based on the user input text, the recommended completion content and the clicked content in each user behavior record.
[0163] The training module 103 is configured to train a pre-constructed input completion model by using the training sample set to obtain a trained input completion model, wherein the trained input completion model is used to complete the text input by the user.
[0164] Optionally, each user behavior record in each historical session data has a serial number, the training sample set includes a training sample corresponding to each historical session data, and the generation module 102 is specifically configured to, for each historical session data, if the user behavior record included in the historical session data is multiple and the clicked content in the user behavior record with the largest serial number is not empty, taking the user behavior record with the largest serial number as a first record; taking the user behavior record with the largest serial number in the historical session data except the first record as a second record; obtaining a training sample corresponding to the historical session data, wherein the training sample includes the user input text and the clicked content in the first record, and the recommended completion content in the second record.
[0165] Optionally, the generation module 102 is further specifically configured to, for each historical session data, if the user behavior record included in the historical session data is one and the clicked content in the user behavior record is not empty, obtaining a training sample corresponding to the historical session data, wherein the training sample includes the user input text and the clicked content in the user behavior record.
[0166] Optionally, the generation module 102 is specifically configured to: performing deduplication processing on the user input text in all user behavior records to obtain each sample text; performing deduplication processing on the recommended completion content in all user behavior records to obtain each sample completion content; for any target sample text, obtaining each user behavior record whose user input text is the target sample text; according to the recommended completion content in each user behavior record, counting the recommended times of each sample completion content; according to the clicked content in each user behavior record, counting the clicked times of each sample completion content; obtaining a training sample corresponding to the target sample text, the training sample including the recommended times and the clicked times of each sample completion content; and traversing each sample text to obtain a training sample corresponding to each target sample text, wherein the training sample set includes the training sample corresponding to each target sample text.
[0167] Please refer to Figure 9 , the input completion device 200 includes a second acquisition module 201 and a processing module 202.
[0168] The second acquisition module 201 is configured to acquire the user inputted to-be-completed text.
[0169] The processing module 202 is configured to input the text to be completed into a pre-trained input completion model to obtain a plurality of first recommended completion contents arranged according to click probabilities, wherein the input completion model is obtained by using the model training method according to any one of the preceding embodiments; input the text to be completed into a search engine to obtain a plurality of second recommended completion contents arranged according to click probabilities; and generate a recommended completion content list according to each first recommended completion content and each second recommended completion content to complete the text to be completed.
[0170] Optionally, the processing module 202 is specifically configured to, for each second recommended completion content, if there is a first recommended completion content identical to the second recommended completion content, delete the second recommended completion content; if there is no first recommended completion content identical to the second recommended completion content, retain the second recommended completion content; write a preset number of retained second recommended completion contents into the recommended completion content list in sequence according to the click probabilities; and write each first recommended completion content into the recommended completion content list in sequence according to the click probabilities.
[0171] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the model training apparatus 100 and the input completion apparatus 200 described above can refer to the corresponding process in the preceding method embodiments, which will not be described here.
[0172] Further, the embodiment of the present application also provides an electronic device 300, please refer to Figure 10 The electronic device 300 can include a memory 310 and a processor 320.
[0173] The processor 320 can be a general central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of programs of the model training method and / or the input completion method provided in the above method embodiments.
[0174] The memory 310 can be a ROM, or other type of static storage device that can store static information and instructions; a RAM, or other type of dynamic storage device that can store information and instructions; an Electrically Erasable Programmable-Only Memory (EEPROM), a Compact disc Read-Only Memory (CD-ROM) or other optical disk storage, a magnetic disk storage or other magnetic storage devices, or any other medium capable of storing desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to this. The memory 310 can exist independently, and is connected to the processor 320 through a communication bus. The memory 310 can also be integrated with the processor 320. The memory 310 is configured to store machine executable instructions for implementing the solutions of the present application. The processor 320 is configured to execute the machine executable instructions stored in the memory 310, so as to implement the above-mentioned method embodiments.
[0175] The embodiments of the present application further provide a computer readable storage medium containing a computer program, which, when executed, can be used to perform the model training method provided by the above-mentioned method embodiments, and / or the related operations in the input completion method.
[0176] To sum up, in the model training method, the input completion method and the related apparatus provided by the embodiments of the present application, the model training method comprises the following steps: first, obtaining a plurality of historical session data, each historical session data comprising at least one user behavior record, and each user behavior record comprising user input text, recommended completion content and clicked content; then, generating a training sample set based on the user input text, the recommended completion content and the clicked content in each user behavior record; and finally, training a pre-constructed input completion model by using the training sample set to obtain a trained input completion model, wherein the trained input completion model is used to complete the text input by a user. In the embodiments of the present application, the training sample used for training the model not only considers the text input by the user and the clicked content when the click behavior occurs, but also considers the recommended completion content that is not clicked and is displayed multiple times before the click behavior occurs, so that the model can learn more user behavior information, the input completion model obtained can more quickly and accurately display the recommended completion content matching the user's intention, and the user experience is improved.
[0177] The above merely illustrates the specific embodiments of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A model training method, characterized in that, The method comprises: obtaining a plurality of historical session data, each of the historical session data comprising at least one user behavior record, each of the user behavior record comprising user input text, recommended completion content and clicked content; generating a training sample set based on the user input text, the recommended completion content and the clicked content in each of the user behavior record, each of the user behavior record in each of the historical session data having a serial number, the training sample set comprising a training sample corresponding to each of the historical session data; training a pre-constructed input completion model using the training sample set to obtain a trained input completion model, wherein the trained input completion model is used to complete the text input by the user; the step of generating the training sample set based on the user input text, the recommended completion content and the clicked content in each of the user behavior record comprises: for each of the historical session data, if the user behavior record included in the historical session data is multiple and the clicked content in the user behavior record with the largest serial number is not empty, the user behavior record with the largest serial number is taken as a first record; the user behavior record with the largest serial number in the historical session data except the first record is taken as a second record; obtaining a training sample corresponding to the historical session data, wherein the training sample comprises the user input text and the clicked content in the first record, and the recommended completion content in the second record.
2. The method of claim 1, wherein, the step of generating the training sample set based on the user input text, the recommended completion content and the clicked content in each of the user behavior record further comprises: for each of the historical session data, if the user behavior record included in the historical session data is one and the clicked content in the user behavior record is not empty, obtaining a training sample corresponding to the historical session data, wherein the training sample comprises the user input text and the clicked content in the user behavior record.
3. The method of claim 1, wherein, the step of generating the training sample set based on the user input text, the recommended completion content and the clicked content in each of the user behavior record comprises: de-duplicating the user input text in all of the user behavior records to obtain each sample text; de-duplicating the recommended completion content in all of the user behavior records to obtain each sample completion content; for any target sample text, obtaining each user behavior record in which the user input text is the target sample text; according to the recommended completion content in each user behavior record, counting the recommended times of each sample completion content; according to the clicked content in each user behavior record, counting the clicked times of each sample completion content; obtaining a training sample corresponding to the target sample text, the training sample comprising the recommended times and the clicked times of each sample completion content; traversing each sample text to obtain a training sample corresponding to each target sample text, wherein the training sample set comprises a training sample corresponding to each target sample text.
4. An input completion method characterized by comprising: The method is applied to an electronic device deployed with a search engine, and comprises: obtaining a user-inputted text to be completed; inputting the text to be completed into a pre-trained input completion model to obtain a plurality of first recommended completion contents arranged according to click probabilities; inputting the text to be completed into the search engine to obtain a plurality of second recommended completion contents arranged according to click probabilities; generating a recommended completion content list according to each of the first recommended completion contents and each of the second recommended completion contents to complete the text to be completed.
5. The method of claim 4, wherein, The step of generating the recommended completion content list according to each of the first recommended completion contents and each of the second recommended completion contents comprises: for each of the second recommended completion contents, if there is a first recommended completion content identical to the second recommended completion content, deleting the second recommended completion content; if there is no first recommended completion content identical to the second recommended completion content, retaining the second recommended completion content; writing a preset number of retained second recommended completion contents into the recommended completion content list in sequence according to the click probabilities; writing each of the first recommended completion contents into the recommended completion content list in sequence according to the click probabilities.
6. A model training apparatus characterized by comprising: The device comprises: a first obtaining module configured to obtain a plurality of historical session data, each of the historical session data comprising at least one user behavior record, and each of the user behavior records comprising a user-inputted text, a recommended completion content and a clicked content; a generating module configured to generate a training sample set based on the user-inputted text, the recommended completion content and the clicked content in each of the user behavior records; each of the user behavior records in each of the historical session data has a serial number, and the training sample set comprises a training sample corresponding to each of the historical session data; a training module configured to train a pre-constructed input completion model by using the training sample set to obtain a trained input completion model, wherein the trained input completion model is used to complete a user-inputted text; the generating module is specifically configured to, for each of the historical session data, if the historical session data comprises a plurality of user behavior records and the clicked content in the user behavior record with the largest serial number is not empty, take the user behavior record with the largest serial number as a first record, take the user behavior record with the largest serial number in the historical session data except the first record as a second record, and obtain a training sample corresponding to the historical session data, wherein the training sample comprises the user-inputted text and the clicked content in the first record, and the recommended completion content in the second record.
7. An input completion device characterized by comprising: The device is applied to an electronic device deployed with a search engine, and comprises: a second obtaining module configured to obtain a user-inputted text to be completed; a processing module configured to inputting the text to be completed into a pre-trained input completion model to obtain a plurality of first recommended completion contents arranged according to click probabilities, wherein the input completion model is obtained by using the model training method according to any one of claims 1-3; inputting the text to be completed into the search engine to obtain a plurality of second recommended completion contents arranged according to click probabilities; generating a recommended completion content list according to each of the first recommended completion contents and each of the second recommended completion contents to complete the text to be completed.
8. An electronic device, comprising: It comprises a memory and a processor, the memory stores a computer program, and the computer program is executed by the processor to realize the model training method according to any one of claims 1-3, and / or the input completion method according to any one of claims 4-5.
9. A computer-readable storage medium, characterized in that, It stores a computer program, and the computer program is executed by a processor to realize the model training method according to any one of claims 1-3, and / or the input completion method according to any one of claims 4-5.
Citation Information
Patent Citations
Sorting model establishing method and device and query automatic completion method and device
CN112528157A