Search

US-20260127371-A1 - MODEL TRAINING AND TEXT GENERATION METHOD, AND RELATED DEVICE

US20260127371A1US 20260127371 A1US20260127371 A1US 20260127371A1US-20260127371-A1

Abstract

In a model training method, a first set of texts is generated based on a conversation of a first user. The first set of texts indicate a tendency of the first user in response to the conversation. A first score of each text of the first set of texts is determined based on behavior data of the first user. The first score indicates a correlation between the tendency of the first user and a behavior of the first user in response to the conversation. The first set of texts is combined based on the first score of each text, to obtain a plurality of pairs of texts. A first prediction model is trained based on the plurality of pairs of texts.

Inventors

  • Quan Lu

Assignees

  • MASHANG CONSUMER FINANCE CO., LTD.

Dates

Publication Date
20260507
Application Date
20250327
Priority Date
20241107

Claims (20)

  1. 1 . A model training method, comprising: generating a first set of texts based on a conversation of a first user, the first set of texts indicating a tendency of the first user in response to the conversation; determining a first score of each text of the first set of texts based on behavior data of the first user, the first score indicating a correlation between the tendency of the first user and a behavior of the first user in response to the conversation; combining the first set of texts based on the first score of each text, to obtain a plurality of pairs of texts; and training a first prediction model based on the plurality of pairs of texts.
  2. 2 . The method according to claim 1 , wherein the determining the first score comprises: determining a first label of each text of the first set of texts based on the behavior data, the first label indicating a type of the behavior of the first user in response to the conversation; obtaining one or more clusters based on sentences in the first set of texts; and determining the first score of each text based on the first label and the one or more clusters.
  3. 3 . The method according to claim 2 , wherein the obtaining the one or more clusters comprises: obtaining sentence vectors of the sentences in the first set of texts; and clustering the sentences into the one or more clusters based on similarities between the sentence vectors of the sentences.
  4. 4 . The method according to claim 3 , the method further comprising: determining a second score of a cluster of the one or more clusters, the second score indicating a correlation between a text in a sentence of the cluster and the first label; and determining a sum of second scores of the one or more clusters to which the sentences in the first set of texts belong.
  5. 5 . The method according to claim 4 , wherein the determining the second score of the cluster further comprises: determining, from the first set of texts, one or more key texts corresponding to the cluster, determining, based on a quantity of the one or more key texts, a correlation coefficient between the cluster and the first label of the text in the sentence included in the cluster; and determining the second score of the cluster based on the correlation coefficient.
  6. 6 . The method according to claim 1 , wherein the training the first prediction model further comprises: inputting the conversation and the plurality of pairs of texts into the first prediction model to obtain a probability range, the probability range having a first upper limit and a first lower limit; inputting the conversation and the plurality of pairs of texts into a second prediction model to obtain a second probability range, the second probability range having a second upper limit and a second lower limit; determining a third probability based on a ratio of the first upper limit and the second upper limit, and a ratio of the first lower limit and the second lower limit; determining a loss of the first prediction model based on the third probability; and adjusting parameters of the first prediction model based on the loss.
  7. 7 . The method according to claim 1 , the method further comprising: generating a second set of texts based on the first prediction model and a conversation of a second user, the second set of texts indicating a tendency of the second user; extracting a first phrase from a sentence in the second set of texts, and generating a first question text based on the sentence, the first question text indicating a question with the first phrase as an answer; checking the first phrase based on the first question text; and obtaining a text based on the checking.
  8. 8 . The method according to claim 7 , wherein the checking the first phrase further comprises: obtaining, from the conversation of the second user, a first text corresponding to an answer to the first question text; and determining, by using a third prediction model, the first phrase passes the checking when the first phrase matches the first text corresponding to the answer to the first question text, and the first phrase does not pass the checking when the first phrase does not match the first text corresponding to the answer to the first question text.
  9. 9 . The method according to claim 8 , the method further comprising: generating a first instruction when the first phrase does not pass the check, the first instruction being configured to cause a second text without the first phrase to be generated; and inputting the first instruction and the conversation of the second user into the first prediction model to obtain the second text corresponding to the answer to the first question text.
  10. 10 . A model training apparatus, the apparatus comprising: processing circuitry configured to generate a first set of texts based on a conversation of a first user, the first set of texts indicating a tendency of the first user in response to the conversation; determine a first score of each text of the first set of texts based on behavior data of the first user, the first score indicating a correlation between the tendency of the first user and a behavior of the first user in response to the conversation; combine the first set of texts based on the first score of each text, to obtain a plurality of pairs of texts; and train a first prediction model based on the plurality of pairs of texts.
  11. 11 . The apparatus according to claim 10 , wherein the processing circuitry is configured to: determine a first label of each text of the first set of texts based on the behavior data, the first label indicating a type of the behavior of the first user in response to the conversation; obtain one or more clusters based on sentences in the first set of texts; and determine the first score of each text based on the first label and the one or more clusters.
  12. 12 . The apparatus according to claim 11 , wherein the processing circuitry is configured to: obtain sentence vectors of the sentences in the first set of texts; and cluster the sentences into the one or more clusters based on similarities between the sentence vectors of the sentences.
  13. 13 . The apparatus according to claim 12 , wherein the processing circuitry is configured to: determine a second score of a cluster of the one or more clusters, the second score indicating a correlation between a text in a sentence of the cluster and the first label; and determine a sum of second scores of the one or more clusters of to which the sentences in the first set of texts belong.
  14. 14 . The apparatus according to claim 13 , wherein the processing circuitry is configured to: determine, from the first set of texts, one or more key texts corresponding to the cluster, determine, based on a quantity of the one or more key texts, a correlation coefficient between the cluster and the first label of the text in the sentence included in the cluster; and determine the second score of the cluster based on the correlation coefficient.
  15. 15 . The apparatus according to claim 10 , wherein the processing circuitry is configured to: input the conversation and the plurality of pairs of texts into the first prediction model to obtain a probability range, the probability range having a first upper limit and a first lower limit; input the conversation and the plurality pair of texts into a second prediction model to obtain a second probability range, the second probability range having a second upper limit and a second lower limit; determine a third probability based on a ratio of the first upper limit and the second upper limit and a ratio of the first lower limit and the second lower limit; determine a loss of the first prediction model based on the third probability; and adjust parameters of the first prediction model based on the loss.
  16. 16 . The apparatus according to claim 10 , wherein the processing circuitry is configured to: generate a second set of texts based on the first prediction model and a conversation of a second user, the second set of texts indicating a tendency of the second user; extract a first phrase from a sentence in the second set of texts, and generating a first question text based on the sentence, the first question text indicating a question with the first phrase as an answer; check the first phrase based on the first question text; and obtain a text based on the check.
  17. 17 . The apparatus according to claim 16 , wherein the processing circuitry is configured to: obtain, from the conversation of the second user, a first text corresponding to an answer to the first question text; and determine, by using a third prediction model, the first phrase passes the checking when the first phrase matches the first text corresponding to the answer to the first question text, and the first phrase does not pass the checking when the first phrase does not match the first text corresponding to the answer to the first question text.
  18. 18 . The apparatus according to claim 17 , wherein the processing circuitry is configured to: generate a first instruction when the first phrase does not pass the check, the first instruction being configured to cause a second text without the first phrase to be generated; and input the first instruction and the conversation of the second user into the first prediction model to obtain the second text corresponding to the answer to the first question text.
  19. 19 . A non-transitory computer-readable storage medium, storing instructions which when executed by a processor cause the processor to perform: generating a first set of texts based on a conversation of a first user, the first set of texts indicating a behavior tendency of the first user in response to the conversation; determining a first score of each text of the first set of texts based on behavior data of the first user, the first score indicating a correlation between the tendency of the first user and a behavior of the first user in response to the conversation; combining the first set of texts based on the first score of each text, to obtain a plurality of pairs of texts; and training a first prediction model based on the plurality of pairs of texts.
  20. 20 . The non-transitory computer-readable storage medium according to claim 19 , wherein the determining the first score further comprises: determining a first label of each text of the first set of texts based on the behavior data, the first label indicating a type of the behavior of the first user in response to the conversation; obtaining one or more clusters based on sentences in the first set of texts; and determining the first score of each text based on the first label and the one or more clusters.

Description

RELATED APPLICATION The present application claims priority to Chinese Patent Application No. 202411582040.1 filed on Nov. 7, 2024, which is hereby incorporated by reference in its entirety. FIELD OF THE TECHNOLOGY This disclosure relates to the field of natural language processing technologies, including to a model training method, a text generation method, and a related device. BACKGROUND OF THE DISCLOSURE A model, for example, a large language model (LLM), has an excellent capability of summarizing text information, and can extract and refine key information elements from a large quantity of raw texts, for further processing into standard structured data, or to help in a next classification or prediction task. However, the model summarizes the text information to minimize information compression loss, and lacks the capability to summarize a particular task. For example, in some service scenarios, the model cannot accurately summarize a behavior tendency of a user from a conversation, affecting the subsequent service processing. SUMMARY Aspects of this disclosure provide a model training method, a text generation method, and a related device, to enable a model to automatically learn to summarize a behavior tendency of a user more quickly and accurately from a conversation record of the user. In an aspect of this disclosure, a model training method is provided. In the method, a first set of texts is generated based on a conversation of a first user. The first set of texts indicates a tendency of the first user in response to the conversation. A first score of each text of the first set of texts is determined based on behavior data of the first user. The first score indicates a correlation between the tendency of the first user and a behavior of the first user in response to the conversation. The first set of texts is combined based on the first score of each text, to obtain a plurality of pairs of texts. A first prediction model is trained based on the plurality of pairs of texts. In an aspect of this disclosure, a text generation method is provided. In the method, a sixth text is generated based on a first model and a conversation record of a second user. The sixth text indicates a behavior tendency of the second user. A first phrase is extracted from a sentence in the sixth text, and a first question text is generated based on the sentence to which the first phrase belongs. The first question text indicates a question with the first phrase as an answer. The first phrase is checked based on the first question text. A seventh text is obtained based on a check result of the first phrase. In an aspect of this disclosure, a model training apparatus including processing circuitry is provided. The processing circuitry is configured to generate a first set of texts based on a conversation of a first user. The first set of texts indicates a tendency of the first user. The processing circuitry is configured to determine a first score of each text of the first set of texts based on behavior data of the first user. The first score indicating a correlation between the tendency of the first user and a behavior of the first user in response to the conversation. The processing circuitry is configured to combine the first set of texts based on the first score of each text, to obtain a plurality of pairs of texts. The processing circuitry is configured to train a first prediction model based on the plurality of pairs of texts. In an aspect of this disclosure, a text generation apparatus including processing circuitry is provided. The processing circuitry is configured to generate a sixth text based on a first model and a conversation record of a second user. The sixth text indicates a behavior tendency of the second user. The processing circuitry is configured to extract a first phrase from a sentence in the sixth text, and generate a first question text based on the sentence to which the first phrase belongs. The first question text indicates a question with the first phrase as an answer. The processing circuitry is configured to check the first phrase based on the first question text. The processing circuitry is configured to obtain a seventh text based on a check result of the first phrase. In an aspect of this disclosure provides an electronic device, including a processor and a memory. The memory is configured to store instructions executable by the processor. The processor being configured to execute the instructions in the memory to perform any of the methods according to this disclosure. In an aspect of this disclosure provides a non-transitory computer-readable storage medium. The non-transitory computer-readable storage medium stores instructions which when executed by a processor, cause the processor to perform any of the methods according to this disclosure. In an aspect of this disclosure provides a computer program product. The computer program product includes a non-transitory computer-readable storage medi