Dialogue method and device based on multi-personality chat model and electronic equipment
By deploying a multi-personal chat model, including a base model and an adapter, and based on user preferences selected or analyzed by the user, the corresponding personality type adapter is called in real time for dialogue, the problem of inefficient collection and processing of training data of traditional chat model is solved, and the problem of inefficient collection and processing of traditional chat model is realized. An efficient and personalized chat experience.
Patent Information
- Application Number
- CN202411603013.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-02-18
AI Technical Summary
Traditional chat models require a lot of time and manpower to collect and process training data, which is inefficient and expensive, making it difficult to meet the needs of different users for chat objects of different personality types.
Provide a dialogue method based on the multi-personality chat model. By deploying the multi-personality chat model, including a base model and multiple adapters corresponding to different personality types, the corresponding personality types can be called in real time according to the user's preferences selected or analyzed by the user. The adapter conducts conversation. The model is based on sample dialogue data training, and the selected large language model communicates with multiple topics with multiple large language models playing different personality types, quickly and efficiently generating dialogue data.
A multi-personal chat experience that meets the needs of different users has been realized, which has improved the user experience, significantly improved the training efficiency and reduced costs.
Smart Images

Figure CN119474313A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a dialogue method, device and electronic equipment based on a multi-personality chat model. Background Art
[0002] Chatbots can understand and parse user input (such as text, voice, images, etc.), and generate corresponding replies through preset algorithms or models to achieve dialogue with users. They can be used to provide information, answer questions, perform tasks, and even in some cases, communicate emotions and interact with entertainment. This interactive experience makes chatbots show great potential in many fields, including customer service, online education, medical consultation, entertainment games, etc. Because the user base is large and has different preferences, some people may like to chat with passionate people, some may chat with cold people for a while, and some may prefer humorous people who like to joke. In order to meet the needs of different users for different personality chat objects, traditional chat models usually require a lot of time and manpower to collect and process training data for model training, which is inefficient and costly. Summary of the invention
[0003] In view of the problems existing in the prior art, the present invention provides a conversation method, device and electronic equipment based on a multi-personality chat model.
[0004] In a first aspect, the present invention provides a dialogue method based on a multi-personality chat model, comprising: Deploy the trained multi-personality chat model, wherein the multi-personality chat model includes a base model and a plurality of adapters corresponding to different personality types; After the base model is loaded, according to the personality type selected by the user for dialogue or the personality type preferred by the user obtained through analysis, the adapter of the corresponding personality type is called in real time to conduct dialogue with the user; The multi-personality chat model is trained based on sample conversation data, and the sample conversation data is generated by having a selected large language model conduct conversations on multiple topics with multiple large language models that play different personality types.
[0005] In some embodiments, the method of obtaining the sample conversation data includes: The selected large language model and multiple large language models playing different personality types respectively conduct conversations on multiple topics to generate original conversation data corresponding to different personality types; Screening the original conversation data based on multiple discriminators to obtain the sample conversation data; Wherein, the multiple discriminators include: A first discriminator, wherein the first discriminator is provided with an explicit definition of high-quality standards in multiple dimensions for each personality type; A second discriminator, wherein the second discriminator is obtained by performing prompt engineering optimization on a large language model; The third discriminator is obtained by training a text classification model based on sample text data with personality type classification labels.
[0006] In some embodiments, the screening of the original conversation data based on multiple discriminators to obtain the sample conversation data includes: The original conversation data is input into the first discriminator for discrimination, and then the high-quality conversation data screened out by the first discriminator is randomly input into the second discriminator or the third discriminator for further discrimination, and the conversation data that passes the discrimination of the second discriminator or the third discriminator is used as the sample conversation data.
[0007] In some embodiments, the multi-personality chat model is trained based on the sample conversation data and the PiSSA algorithm, and the multiple adapters are respectively trained based on the sample conversation data of the corresponding personality types.
[0008] In some embodiments, the deploying the trained multi-personality chat model includes: The trained multi-personality chat model is deployed using the vLLM inference engine.
[0009] In some embodiments, the method further comprises: Use preset exploration questions about the user's personality preferences to have a conversation with the user, and analyze the personality type preferred by the user based on the conversation content.
[0010] In a second aspect, the present invention further provides a dialogue device based on a multi-personality chat model, comprising: A deployment module, used to deploy the trained multi-personality chat model, wherein the multi-personality chat model includes a base model and a plurality of adapters corresponding to different personality types; A dialogue module, which is used to call the adapter of the corresponding personality type in real time to conduct a dialogue with the user according to the personality type selected by the user for dialogue or the personality type preferred by the user obtained according to the analysis after the base model is loaded; The multi-personality chat model is trained based on sample conversation data, and the sample conversation data is generated by having a selected large language model conduct conversations on multiple topics with multiple large language models that play different personality types.
[0011] In a third aspect, the present invention further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the conversation method based on the multi-personality chat model as described in the first aspect above is implemented.
[0012] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the conversation method based on the multi-personality chat model as described in the first aspect above.
[0013] In a fifth aspect, the present invention further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the conversation method based on the multi-personality chat model as described in the first aspect above.
[0014] The conversation method, device and electronic device based on the multi-personality chat model provided by the present invention can meet the needs of different users for chat objects of different personality types by deploying the multi-personality chat model, and the multi-personality chat model includes a base model and multiple adapters corresponding to different personality types respectively, and can call the adapter of the corresponding personality type in real time to have a conversation with the user according to the personality type selected by the user for the conversation or the personality type preferred by the user obtained by analysis, thereby better improving the user experience. In addition, by having a selected large language model and multiple large language models playing different personality types respectively conduct conversations on multiple topics, a large amount of conversation data can be quickly, efficiently and automatically generated for the training of the multi-personality chat model, which is not only conducive to training a high-quality chat model, but also significantly improves the training efficiency and reduces the cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1 It is a flow chart of a dialogue method based on a multi-personality chat model provided by the present invention.
[0017] Figure 2 It is a schematic diagram of the process of obtaining high-quality conversation data provided by the present invention.
[0018] Figure 3 It is a flow chart of dialogue data screening provided by the present invention.
[0019] Figure 4It is a schematic diagram of the PiSSA algorithm provided by the present invention.
[0020] Figure 5 It is a vLLM pluggable inference calling flow chart provided by the present invention.
[0021] Figure 6 It is a structural schematic diagram of a dialogue device based on a multi-personality chat model provided by the present invention.
[0022] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] Traditional chat models rely heavily on specific data, which means that data collection and labeling not only takes a lot of time and manpower, but also makes it difficult to ensure accuracy, which is a great challenge to the professionalism and patience of labelers. It is difficult to quickly collect high-quality data of different personalities for model training in a short period of time.
[0025] Moreover, if the manually collected data is not cleaned properly, the model is more likely to overfit or underfit during training, and the adjustment of hyperparameters requires rich experience and a lot of attempts, which increases the difficulty and uncertainty of training. To improve the robustness of the model, it is necessary to constantly adjust the ratio of the training set and the evaluation set, and perform multiple complex cross-validations, which is a very cumbersome process.
[0026] In subsequent model iterations, such as adding new personality traits, adjusting existing personality traits, and other operations, traditional methods often require a lot of manual repetitive work, continuous collection of new data, and may even require overturning the original architecture and rebuilding it, resulting in inefficiency and high costs.
[0027] The technical solutions provided by the embodiments of the present invention can automatically and procedurally clean and precipitate the required high-quality data corresponding to different personality types, and train high-quality open source lightweight models in combination with the latest training methods. Finally, multiple personality feature sets are deployed into one service to achieve a conversation effect similar to that of a thousand people with a thousand faces, so that the same service can be dynamically presented to users with the optimal personality role.
[0028] Combine the following Figure 1-Figure 7 Embodiments of the present invention are described.
[0029] Figure 1 It is a flow chart of the dialogue method based on the multi-personality chat model provided by the present invention, such as Figure 1 As shown, the method includes the following steps 101 and 102.
[0030] Step 101: deploy the trained multi-personality chat model, which includes a base model and multiple adapters corresponding to different personality types.
[0031] Step 102: After the base model is loaded, according to the personality type selected by the user for dialogue or the personality type preferred by the user obtained through analysis, the adapter of the corresponding personality type is called in real time to conduct dialogue with the user.
[0032] Among them, the multi-personality chat model is trained based on sample conversation data, and the sample conversation data is generated by having a selected large language model conduct conversations on multiple topics with multiple large language models that play different personality types.
[0033] Specifically, the multi-personality chat model provided by the present invention includes a base model (hereinafter referred to as BaseModel) and multiple adapters corresponding to different personality types. It can be understood that the BaseModel is a large language model, and the present invention does not limit the specific type.
[0034] In some embodiments, the BaseModel is a lightweight model of the selected large language model (hereinafter referred to as UserModel). For example, UserModel is the model with the largest number of parameters in a series of large language models (such as the Qianwen series or the llama series), and BaseModel can be a lightweight model with a smaller number of parameters in the series of large language models, such as selecting a small model with a parameter level of 7b, 8b, 14b, etc. as the BaseModel.
[0035] The present invention provides a new approach to the production of sample conversation data required for model training, which is to quickly produce conversation data through multiple high-quality large models at the forefront of the industry. For ease of understanding, the production process of sample conversation data is exemplified below.
[0036] At present, the industry is flourishing in the field of large models. Each model has its own strengths, and there are also large differences in personality due to different training data. Therefore, first of all, you need to select the best simulated user model. For example, for Chinese needs, you can select the Qianwen series, and for English needs, you can select the llama series. You can choose the model with the largest number of parameters in each series, that is, the strongest model as the UserModel.
[0037] Then, we can experience each model's ability to follow instructions for different personality roles based on actual artificial conversations. This step only takes a small amount of man-hours to complete, so that we can determine what personality role each strongest model is best at. For example, the GLM series is best at playing aloof personalities, Deepseek is best at playing humorous and funny personalities, Mistral is best at playing talkative personalities, and so on.
[0038] Then, by issuing a command to produce topics to the UserModel, multiple different topics can be obtained. Through the Python script, the UserModel can automatically conduct conversations with another large model on multiple different topics under the requirements of producing different personality data, as shown in the following table. This can quickly, efficiently and automatically generate a large amount of conversation data.
[0039] Table 1 UserModel and multiple large language models with different personality types have conversations on multiple topics
[0040] The conversation method based on the multi-personality chat model provided by the present invention can meet the needs of different users for chat objects of different personality types by deploying the multi-personality chat model, and the multi-personality chat model includes a base model and multiple adapters corresponding to different personality types respectively, and can call the adapter of the corresponding personality type in real time to have a conversation with the user according to the personality type selected by the user for the conversation or the personality type preferred by the user obtained by analysis, thereby better improving the user experience. In addition, by having a selected large language model and multiple large language models playing different personality types respectively conduct conversations on multiple topics, a large amount of conversation data can be quickly, efficiently and automatically generated for the training of the multi-personality chat model, which is not only conducive to training a high-quality chat model, but also significantly improves the training efficiency and reduces the cost.
[0041] In some embodiments, the method of obtaining the sample conversation data includes: The selected large language model and multiple large language models playing different personality types respectively conduct conversations on multiple topics to generate original conversation data corresponding to different personality types; The original dialogue data is filtered based on multiple discriminators to obtain sample dialogue data; Among them, multiple discriminators include: The first discriminator has an explicit definition of high-quality standards with multiple dimensions for each personality type; The second discriminator is obtained by performing prompt engineering optimization on the large language model; The third discriminator is obtained by training a text classification model based on sample text data with personality type classification labels.
[0042] Specifically, by having the selected large language model and multiple large language models playing different personality types conduct conversations on multiple topics, a large amount of conversation data can be generated quickly, efficiently and automatically. In order to further improve the training effect, these massive conversation data can be screened through multiple discriminators to filter out low-quality conversation data, such as Figure 2 shown.
[0043] In the embodiment of the present invention, three discriminators are used to discriminate data quality, which can effectively prevent the error of a single discriminator from causing a deviation in the distribution of training data, thereby enhancing the robustness of the data and being beneficial to improving the training effect.
[0044] The following introduces the three discriminators respectively.
[0045] The first discriminator has explicit definitions of high-quality standards in multiple dimensions for each personality type, which can be understood as screening through hard indicators. It should be noted that each personality type mentioned here refers to the personality type supported by the deployed service, that is, the personality category of the chat model that can be provided in the end (such as aloof, humorous, weird, enthusiastic, cute, talkative, etc.).
[0046] For ease of understanding, the following lists the explicit definitions of several high-quality standards in different dimensions. In specific implementations, conversation data that meets the high-quality standards of the corresponding personality type in any dimension is considered high-quality conversation data.
[0047] Dimension 1: Word count: a. If the answers of the aloof personality are less than 10 words per paragraph, they are considered high quality; b. For humorous personality, if each answer is between 15 and 50 words, it is considered high quality; c. For eccentric personality, if the number of words in each paragraph is odd, it is considered high quality; d. For enthusiastic personality, if each answer is more than 30 words, it is considered high quality; e. For cute personality, each answer is considered high quality if it is between 10 and 30 words and contains at least one reduplication; f. For people with a chatty personality, if each answer is more than 50 words, it will be considered high quality.
[0048] Dimension 2: Talking skills: a. If the answer of the aloof personality does not exceed 1 rhetorical question in each paragraph, it is considered high quality; b. For humorous personalities, if each answer contains at least one humorous element (such as puns, jokes, etc.), it will be considered high quality; c. If each answer of the eccentric personality contains 1 to 2 uncommon words, it is considered high quality; d. If the enthusiastic personality has more than 2 rhetorical questions, it is considered high quality; e. If the answers of the lovable personality contain at least one modal particle (such as yeah, oh, ne), they are considered high quality; f. For chatty personality, each answer is considered high quality if it contains at least 3 commas.
[0049] Dimension 3: Emoji usage: a. If the answers of the aloof personality do not use emoticons, they will be considered high quality; b. For humorous personalities, if one or two humorous emoticons are used in each answer, it will be considered as high quality; c. If the eccentric personality uses unusual emoticons in each answer, it will be considered high quality; d. For enthusiastic personality, if 2-3 positive emojis are used in each answer, it is considered high quality; e. For cute personality, if at least 2 cute emoticons are used in each answer, it will be considered as high quality; f. If the chatty personality uses 1 to 3 emoticons in each answer, it will be considered high quality.
[0050] The second discriminator performs automatic discrimination through a large language model. The large language model can be an ultra-large parameter model, such as a large language model with parameters of 70b, 405b, etc. The specific type is not limited here. Before use, the large language model needs to be tuned for prompt engineering to determine the optimal prompt word. When discriminating the input dialogue data, the optimal prompt word determined by pre-tuning is input to the large language model (for example: please judge the personality type of GLM in the following dialogue based on the dialogue content, or, assuming that GLM is a cold character, please judge whether GLM in the following dialogue shows the characteristics of this character based on the dialogue content?), and then the output of the large language model can be used to determine whether the dialogue data is of high quality.
[0051] The third discriminator is obtained by training a text classification model based on sample text data with personality type classification labels. The text classification model can adopt any text classification model and is not limited here. The personality type classification labels of the sample text data are manually annotated, and a high-quality text classification model is trained using the annotated sample text data as the third discriminator. In actual use, the conversation data is input into the text classification model, and the classification result output by the text classification model is compared with the personality type corresponding to the conversation data. If they are the same, it is high-quality conversation data, otherwise it is low-quality conversation data.
[0052] In some embodiments, the original conversation data is screened based on multiple discriminators to obtain sample conversation data, including: The original conversation data is input into the first discriminator for discrimination, and then the high-quality conversation data screened out by the first discriminator is randomly input into the second discriminator or the third discriminator for further discrimination. The conversation data that passes the discrimination of the second discriminator or the third discriminator is used as the sample conversation data.
[0053] Figure 3 is a flow chart of dialogue data screening provided by the present invention, Figure 3 In , JudgeA, JudgeB and JudgeC represent the first discriminator, the second discriminator and the third discriminator respectively, such as Figure 3 As shown, the original conversation data first passes through JudgeA. If JudgeA passes the judgment (i.e., it is judged to be of high quality), it will randomly enter JudgeB or JudgeC for further judgment. If JudgeA fails the judgment, it will be discarded. If the conversation data input into JudgeB or JudgeC passes the judgment, it will be collected as sample conversation data. If it fails the judgment, it will be discarded.
[0054] By setting the first discriminator as a mandatory item and the second and third discriminators as random items, we can avoid data distribution deviation caused by overly strict discrimination, which will lead to overfitting of training.
[0055] In some embodiments, the multi-personality chat model is trained based on sample conversation data and the PiSSA algorithm, and multiple adapters are trained based on sample conversation data of corresponding personality types.
[0056] Specifically, when training a model, it is hoped that BaseModel can learn all the features in the training data and that the training time is acceptable when faced with massive training data. The former generally selects full parameter training of BaseModel, because each parameter of BaseModel can be learned by gradient. This training method has strong learning ability, but because billions of parameters need to be updated, the training time is long. The latter generally uses the BaseModel+Lora training method. Lora (Low-Rank Adaptation) can be simply understood as a low-rank mapping matrix with a small number of parameters. It freezes the BaseModel parameters and updates the Lora matrix parameters. There are fewer parameters that can be updated, so the training time is low.
[0057] In view of the above objectives, an embodiment of the present invention adopts the PiSSA algorithm to train a multi-personality chat model, which can directly adjust the important but low-rank parts in the BaseModel and freeze the non-essential parts with larger noise and higher rank. At the same time, it is combined with an adapter (or Lora adapter) for synchronous update, so that important parameters in the BaseModel can be updated without updating all parameters. The training time is close to that of a single Lora algorithm.
[0058] Figure 4 It is a schematic diagram of the PiSSA algorithm provided by the present invention, such as Figure 4 As shown in the figure, the core idea of the PiSSA algorithm is to use singular value decomposition (SVD) to extract the principal components of the parameter matrix of the pre-trained model (i.e., BaseModel), and use these principal components to initialize a low-rank fine-tuning adapter. Specifically, by performing SVD decomposition on the parameter matrix, matrices U, S, and V can be obtained. Then, the PiSSA algorithm selects the largest r singular values in S (r is a low-rank parameter) and the corresponding singular vectors in U and V as principal components to initialize a low-rank fine-tuning adapter (Lora adapter), which is trained during the fine-tuning process to adjust and optimize the model parameters. Figure 4 In , x and y represent the models before and after training, respectively.
[0059] By using sample conversation data corresponding to different personality types and training with the PiSSA algorithm, we can obtain many Lora adapters with different personality characteristics, such as Lora 1 (cold), Lora 2 (humorous), Lora 3 (enthusiastic), etc.
[0060] In some embodiments, deploying the trained multi-personality chat model includes: The trained multi-personality chat model is deployed using the vLLM inference engine.
[0061] Specifically, after training the multi-personality chat model, the vLLM inference engine can be used for integrated deployment, and the obtained adapter can be used with the BaseModel for reasoning. vLLM is a high-performance and memory-efficient large language model (LLM) inference engine. The vLLM inference engine can be used to call the performance of different adapters online in real time.
[0062] Figure 5 The present invention provides a pluggable inference call flow chart based on vLLM, such as Figure 5As shown, in actual use, the vLLM inference engine can be used to load and deploy the BaseModel first, and at the same time, the trained Lora adapters representing different personality types can be put on stand by. In the main dialogue process, the Lora adapter of the corresponding personality type can be called in real time according to the personality type selected by the user or the personality type preferred by the user according to the analysis. It can be used flexibly in a plug-in manner without offline merging with the base model parameters.
[0063] By utilizing the online reasoning mechanism of the vLLM reasoning engine, the adapter can be used flexibly and pluggably. Adapters of different personality types can be called in real time according to user needs without offline merging parameters, which improves the flexibility and response speed of the service.
[0064] In some embodiments, the method further comprises: Use preset exploration questions about the user's personality preferences to have a conversation with the user, and analyze the user's preferred personality type based on the conversation content.
[0065] Specifically, in order to accurately analyze the personality type that the user prefers, exploration questions about the user's personality preferences can be preset. In the initial conversation (which can be called the cold start phase), the preset exploration questions about the user's personality preferences are used to have a conversation with the user, and the user's personality type is obtained based on the conversation content analysis, paving the way for the subsequent automatic selection of the adapter. As an optional embodiment, the cold start phase can have two to three rounds, and the large model obtains the user's personality type by summarizing and analyzing the historical records of the cold start phase.
[0066] The following are some exemplary questions to explore user personality preferences.
[0067] For example: Do you tend to hang out with people who are more reserved, or do you prefer to interact with enthusiastic and extroverted people? In social situations, do you prefer people who don't express their emotions easily? What kind of situations do you think make you happiest when talking to humorous people? What types of humor make you feel relaxed and happy in a conversation? Have you ever had the experience of talking to someone who had unique interests or behaviors? How did that experience make you feel? Do you enjoy discussing unusual topics with interesting and eccentric people? How do you feel when you communicate with passionate people? Who are some of the most passionate people in your life who have impressed you? What qualities do you think attract you to cute people? What kind of cute behaviors do you appreciate most in communication? What are some lovable people or characters that you would love to have an in-depth conversation with? What kind of experience do you think it is to communicate with people who talk a lot? Do you like such conversations? In conversation, do you prefer deep conversations or short exchanges? In conversations with your friends, which personality type do you find most enjoyable to interact with? Why? If you were asked to choose one personality trait as your ideal communication partner, which one would you choose and why? In some embodiments, a user-selectable personality type option can be designed on the product side, and the user can directly select the personality type they want to talk to. After the user's selection, the adapter of the corresponding personality type can be called in real time to conduct the conversation based on the personality type selected by the user, thereby enhancing the user experience and personalized services.
[0068] The following is a description of a conversation device based on a multi-personality chat model provided by the present invention. The conversation device based on a multi-personality chat model described below and the conversation method based on a multi-personality chat model described above can be referred to each other.
[0069] Figure 6 Schematic diagram of the structure of the dialogue device based on the multi-personality chat model provided by the present invention, such as Figure 6 As shown, the device comprises: A deployment module 610 is used to deploy the trained multi-personality chat model, where the multi-personality chat model includes a base model and multiple adapters corresponding to different personality types; The dialogue module 620 is used to call the adapter of the corresponding personality type in real time to conduct dialogue with the user according to the personality type selected by the user for dialogue or the personality type preferred by the user obtained according to the analysis after the base model is loaded; Among them, the multi-personality chat model is trained based on sample conversation data, and the sample conversation data is generated by having a selected large language model conduct conversations on multiple topics with multiple large language models that play different personality types.
[0070] In some embodiments, the method of obtaining the sample conversation data includes: The selected large language model and multiple large language models playing different personality types respectively conduct conversations on multiple topics to generate original conversation data corresponding to different personality types; The original dialogue data is filtered based on multiple discriminators to obtain sample dialogue data; Among them, multiple discriminators include: The first discriminator has an explicit definition of high-quality standards with multiple dimensions for each personality type; The second discriminator is obtained by performing prompt engineering optimization on the large language model; The third discriminator is obtained by training a text classification model based on sample text data with personality type classification labels.
[0071] In some embodiments, the original conversation data is screened based on multiple discriminators to obtain sample conversation data, including: The original conversation data is input into the first discriminator for discrimination, and then the high-quality conversation data screened out by the first discriminator is randomly input into the second discriminator or the third discriminator for further discrimination. The conversation data that passes the discrimination of the second discriminator or the third discriminator is used as the sample conversation data.
[0072] In some embodiments, the multi-personality chat model is trained based on sample conversation data and the PiSSA algorithm, and multiple adapters are trained based on sample conversation data of corresponding personality types.
[0073] In some embodiments, deploying the trained multi-personality chat model includes: The trained multi-personality chat model is deployed using the vLLM inference engine.
[0074] In some embodiments, the dialogue module 620 is further configured to: Use preset exploration questions about the user's personality preferences to have a conversation with the user, and analyze the user's preferred personality type based on the conversation content.
[0075] It should be noted here that the above-mentioned dialogue device based on the multi-personality chat model provided by the present invention can implement all the method steps implemented by the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as those in the method embodiment will not be specifically repeated here.
[0076] Figure 7 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 7As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the above-mentioned conversation method based on the multi-personality chat model, for example: deploying the trained multi-personality chat model, the multi-personality chat model includes a base model and a plurality of adapters corresponding to different personality types; after the base model is loaded, according to the personality type selected by the user for the conversation or the personality type preferred by the user obtained by analysis, the adapter of the corresponding personality type is called in real time to have a conversation with the user; wherein the multi-personality chat model is obtained by training based on sample conversation data, and the sample conversation data is generated by the selected large language model and the plurality of large language models playing different personality types to have conversations on multiple topics respectively.
[0077] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0078] It should be noted here that the above-mentioned electronic device provided by the present invention can implement all the method steps implemented by the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as the method embodiment in this embodiment will not be described in detail here.
[0079] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the conversation methods based on the multi-personality chat model provided by the above-mentioned methods, for example: deploying the trained multi-personality chat model, the multi-personality chat model includes a base model and a plurality of adapters corresponding to different personality types; after the base model is loaded, based on the personality type selected by the user for the conversation or the personality type preferred by the user obtained by analysis, the adapter of the corresponding personality type is called in real time to have a conversation with the user; wherein the multi-personality chat model is obtained by training based on sample conversation data, and the sample conversation data is generated by having conversations on multiple topics between a selected large language model and a plurality of large language models playing different personality types.
[0080] It should be noted here that the above-mentioned non-transitory computer-readable storage medium provided by the present invention can implement all the method steps implemented by the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as the method embodiment in this embodiment will not be described in detail here.
[0081] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the conversation method based on the multi-personality chat model provided by the above methods, for example: deploying the trained multi-personality chat model, the multi-personality chat model includes a base model and multiple adapters corresponding to different personality types; after the base model is loaded, according to the personality type selected by the user for the conversation or the personality type preferred by the user obtained by analysis, the adapter of the corresponding personality type is called in real time to have a conversation with the user; wherein the multi-personality chat model is obtained by training based on sample conversation data, and the sample conversation data is generated by having a selected large language model and multiple large language models playing different personality types conduct conversations on multiple topics respectively.
[0082] It should be noted here that the above-mentioned computer program product provided by the present invention can implement all the method steps implemented by the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as the method embodiment in this embodiment will not be described in detail here.
[0083] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0084] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0085] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A conversation method based on a multi-personality chat model, characterized in that: include: Deploy the trained multi-personality chat model, wherein the multi-personality chat model includes a base model and a plurality of adapters corresponding to different personality types; After the base model is loaded, according to the personality type selected by the user for dialogue or the personality type preferred by the user obtained through analysis, the adapter of the corresponding personality type is called in real time to conduct dialogue with the user; The multi-personality chat model is trained based on sample conversation data, and the sample conversation data is generated by having a selected large language model conduct conversations on multiple topics with multiple large language models that play different personality types.
2. The dialogue method based on the multi-personality chat model according to claim 1, characterized in that: The method for obtaining the sample conversation data includes: The selected large language model and multiple large language models playing different personality types respectively conduct conversations on multiple topics to generate original conversation data corresponding to different personality types; Screening the original conversation data based on multiple discriminators to obtain the sample conversation data; Wherein, the multiple discriminators include: A first discriminator, wherein the first discriminator is provided with an explicit definition of high-quality standards in multiple dimensions for each personality type; A second discriminator, wherein the second discriminator is obtained by performing prompt engineering optimization on a large language model; The third discriminator is obtained by training a text classification model based on sample text data with personality type classification labels.
3. The dialogue method based on the multi-personality chat model according to claim 2, characterized in that: The step of screening the original dialogue data based on multiple discriminators to obtain the sample dialogue data includes: The original conversation data is input into the first discriminator for discrimination, and then the high-quality conversation data screened out by the first discriminator is randomly input into the second discriminator or the third discriminator for further discrimination, and the conversation data that passes the discrimination of the second discriminator or the third discriminator is used as the sample conversation data.
4. The conversation method based on a multi-personality chat model according to any one of claims 1 to 3, characterized in that: The multi-personality chat model is trained based on the sample conversation data and the PiSSA algorithm, and the multiple adapters are respectively trained based on the sample conversation data of the corresponding personality types.
5. The conversation method based on the multi-personality chat model according to claim 1, characterized in that: The multi-personality chat model obtained by deployment training includes: The trained multi-personality chat model is deployed using the vLLM inference engine.
6. The conversation method based on the multi-personality chat model according to claim 1, characterized in that: The method further comprises: Use preset exploration questions about the user's personality preferences to have a conversation with the user, and analyze the personality type preferred by the user based on the conversation content.
7. A conversation device based on a multi-personality chat model, characterized in that: include: A deployment module, used to deploy the trained multi-personality chat model, wherein the multi-personality chat model includes a base model and a plurality of adapters corresponding to different personality types; A dialogue module, which is used to call the adapter of the corresponding personality type in real time to conduct a dialogue with the user according to the personality type selected by the user for dialogue or the personality type preferred by the user obtained according to the analysis after the base model is loaded; The multi-personality chat model is trained based on sample conversation data, and the sample conversation data is generated by having a selected large language model conduct conversations on multiple topics with multiple large language models that play different personality types.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the conversation method based on the multi-personality chat model as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the conversation method based on the multi-personality chat model as claimed in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the conversation method based on the multi-personality chat model as claimed in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Human-computer interaction method and device based on personality classification model and computer device
CN110689078A
User portraying method and device based on large language model, equipment and medium
CN117556802A
Chat robot development technology based on structured description
CN120266123A
Structured description-based chatbot development techniques
US20240194180A1
Systems and methods for conversation orchestration using fine-tuned large language models
US20240281619A1