Personified language model operation method and device and electronic equipment
By analyzing the dialogue background and user intentions, anthropomorphic action information is generated, which solves the shortcomings of traditional language models in emotional understanding and logical coherence, and improves the user experience of human-computer interaction.
Patent Information
- Application Number
- CN202411211126.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-20
AI Technical Summary
Traditional language models lack deep emotional understanding, long-term dialogue logical coherence and personalized expression when simulating human dialogue, resulting in poor user experience.
By obtaining dialogue background information, analyzing user intentions and language models' moods, and generating anthropomorphic action information, including emotional attitude adjustments and cost-effective sorting, ensuring that the reply content is in line with human communication habits and logical coherence.
It has achieved the improvement of emotional expression ability, dialogue logic coherence and role-playing ability of the language model, provided a more realistic user experience, and promoted the advancement of human-computer interaction technology.
Smart Images

Figure CN119168063A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an operation method, device and electronic equipment of an anthropomorphic language model. Background Art
[0002] With the rapid development of artificial intelligence technology, language models, as a key link in human-computer interaction, are increasingly being used in a wide range of scenarios, from simple question-answering systems to complex role-playing games, all of which demonstrate their huge potential and value. However, the limitations of traditional language models in simulating human conversations are gradually becoming apparent, especially their lack of deep emotional understanding, long-term conversational logical coherence, and personalized expressions, which makes it difficult for user experience to achieve a satisfactory level.
[0003] Most language models only output text based on preset training data, which makes it difficult to capture and accurately express complex and changing emotions and tones, making the conversation seem mechanical and stiff. At the same time, due to the lack of understanding of the global conversation context, traditional language models are prone to logical jumps or contradictions in continuous conversations, making it difficult to maintain long-term logical coherence.
[0004] Therefore, a method, device and electronic device for operating a humanized language model are proposed. Summary of the invention
[0005] This specification provides an operation method, device and electronic device of an anthropomorphic language model, so that the language model has more human-like emotional expression ability, long-term conversation logical coherence and in-depth role-playing ability, providing users with a more realistic and smooth conversation experience, and promoting human-computer interaction technology to a new level.
[0006] This specification provides a method for operating an anthropomorphic language model, including:
[0007] Obtaining conversation background information, including messages sent by users, user information, language model information, and the current relationship between the language model and the user;
[0008] Determining the user's intention based on the conversation background information;
[0009] Analyze the current mood of the language model and the reason thereof based on the user intention and the conversation background information;
[0010] Analyzing the emotional attitude of the language model itself toward the message sent by the user based on the user intention, the conversation background information, the current mood of the language model and the reason thereof;
[0011] Based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself towards the message sent by the user, anthropomorphic action information is generated.
[0012] Optionally, determining the user intention through the conversation background information includes:
[0013] Performing natural language processing on the message sent by the user to obtain keywords, phrases, and logical relationships;
[0014] Integrate the user information to build a user portrait;
[0015] Based on the keywords, the phrases, the logical relationships, the user portrait, and the conversation background information, a multi-factor weighted calculation is performed through a decision model to obtain the user intention.
[0016] Optionally, generating the anthropomorphic action information based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself toward the message sent by the user includes:
[0017] Based on the user intention, the conversation background information, the current mood of the language model and its cause, and the emotional attitude of the language model itself towards the message sent by the user, determine whether the conversation background information needs to be modified, and if necessary, generate anthropomorphic action information based on the modified conversation background information, the user intention, the current mood of the language model and its cause, and the emotional attitude of the language model itself towards the message sent by the user
[0018] Optionally, after generating the anthropomorphic action information based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself toward the message sent by the user, the method further includes:
[0019] Based on the internal and external profit and loss rules, the anthropomorphic action information is ranked according to cost performance, and n pieces of the anthropomorphic action information that meet a preset cost performance threshold are used as the action content of the message sent to the user.
[0020] Optionally, the step of ranking the anthropomorphic action information by cost performance and using n pieces of the anthropomorphic action information that meet a preset cost performance threshold as the action content of the message sent to the user includes:
[0021] When the n pieces of the anthropomorphic action information meeting the preset cost-performance threshold value include an anthropomorphic reply message:
[0022] Generate a single sentence model reply message based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself towards the message sent by the user;
[0023] Performing natural language processing on the single sentence model reply message to obtain a plurality of reply messages segmented by punctuation marks;
[0024] Based on the emotional attitude, a number of reply messages segmented by punctuation marks are adjusted to generate a personified reply message.
[0025] Optionally, the step of adjusting several reply messages segmented by punctuation marks based on the emotional attitude to generate a personified reply message includes: replacing sentence-ending modal particles in the several reply messages segmented by punctuation marks with colloquial modal particles that conform to different emotional attitudes.
[0026] Optionally, the adjusting of the plurality of reply messages segmented by punctuation marks based on the emotional attitude to generate a personified reply message includes:
[0027] Immediately reply to the message sent by the user based on the personified reply message;
[0028] and / or,
[0029] Reply to the message sent by the user based on the personified reply message according to a preset delay time / preset date, and / or actively send a message to the user corresponding to the message sent by the user according to a preset delay time / preset date.
[0030] Optionally, the cost-effectiveness ranking of the anthropomorphic action information based on the internal and external profit and loss rule, and using n pieces of the anthropomorphic action information meeting a preset cost-effectiveness threshold as the action content of the message sent to the user, further includes:
[0031] The n pieces of anthropomorphic action information meeting the preset cost-performance threshold value only include when not replying to messages:
[0032] Do not reply to messages sent by the current user;
[0033] or,
[0034] Not replying to all messages of the user corresponding to the message sent by the user;
[0035] or,
[0036] Add the user corresponding to the message sent by the user to the exception list.
[0037] This specification provides an operating device for an anthropomorphic language model, including:
[0038] The acquisition module is used to obtain the conversation background information, including the message sent by the user, the user's own information, the language model's own information, and the current relationship between the language model and the user;
[0039] A determination module, used to determine the user's intention based on the conversation background information;
[0040] A first analysis module, configured to analyze the current mood of the language model and the reason thereof based on the user intention and the conversation background information;
[0041] A second analysis module is used to analyze the emotional attitude of the language model itself towards the message sent by the user based on the user intention, the conversation background information, the current mood of the language model and its reason;
[0042] The anthropomorphic module is used to generate anthropomorphic action information based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself towards the message sent by the user.
[0043] Optionally, the determining module includes:
[0044] Performing natural language processing on the message sent by the user to obtain keywords, phrases, and logical relationships;
[0045] Integrate the user information to build a user portrait;
[0046] Based on the keywords, the phrases, the logical relationships, the user portrait, and the conversation background information, a multi-factor weighted calculation is performed through a decision model to obtain the user intention.
[0047] Optionally, the anthropomorphic module includes:
[0048] Based on the user intention, the conversation background information, the current mood of the language model and its cause, and the emotional attitude of the language model itself towards the message sent by the user, determine whether the conversation background information needs to be modified, and if necessary, generate anthropomorphic action information based on the modified conversation background information, the user intention, the current mood of the language model and its cause, and the emotional attitude of the language model itself towards the message sent by the user
[0049] Optionally, after the anthropomorphic module, the following is included:
[0050] Based on the internal and external profit and loss rules, the anthropomorphic action information is ranked according to cost performance, and n pieces of the anthropomorphic action information that meet a preset cost performance threshold are used as the action content of the message sent to the user.
[0051] Optionally, the step of ranking the anthropomorphic action information by cost performance and using n pieces of the anthropomorphic action information that meet a preset cost performance threshold as the action content of the message sent to the user includes:
[0052] When the n pieces of the anthropomorphic action information meeting the preset cost-performance threshold value include an anthropomorphic reply message:
[0053] Generate a single sentence model reply message based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself towards the message sent by the user;
[0054] Performing natural language processing on the single sentence model reply message to obtain a plurality of reply messages segmented by punctuation marks;
[0055] Based on the emotional attitude, a number of reply messages segmented by punctuation marks are adjusted to generate a personified reply message.
[0056] Optionally, the step of adjusting several reply messages segmented by punctuation marks based on the emotional attitude to generate a personified reply message includes: replacing sentence-ending modal particles in the several reply messages segmented by punctuation marks with colloquial modal particles that conform to different emotional attitudes.
[0057] Optionally, the adjusting of the plurality of reply messages segmented by punctuation marks based on the emotional attitude to generate a personified reply message includes:
[0058] Immediately reply to the message sent by the user based on the personified reply message;
[0059] and / or,
[0060] Reply to the message sent by the user based on the personified reply message according to a preset delay time / preset date, and / or actively send a message to the user corresponding to the message sent by the user according to a preset delay time / preset date.
[0061] Optionally, the cost-effectiveness ranking of the anthropomorphic action information based on the internal and external profit and loss rule, and using n pieces of the anthropomorphic action information meeting a preset cost-effectiveness threshold as the action content of the message sent to the user, further includes:
[0062] The n pieces of anthropomorphic action information meeting the preset cost-performance threshold value only include when not replying to messages:
[0063] Do not reply to messages sent by the current user;
[0064] or,
[0065] Not replying to all messages of the user corresponding to the message sent by the user;
[0066] or,
[0067] Add the user corresponding to the message sent by the user to the exception list.
[0068] This specification also provides an electronic device, wherein the electronic device includes:
[0069] processor; and,
[0070] A memory storing computer executable instructions, which when executed cause the processor to perform any of the above methods.
[0071] The present specification also provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and when the one or more programs are executed by a processor, any of the above methods is implemented.
[0072] This invention enables the language model to have more human-like emotional expression capabilities, long-term conversational logical coherence, and in-depth role-playing capabilities, providing users with a more realistic and smooth conversational experience and pushing human-computer interaction technology to a new level. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0074] Figure 1 A schematic diagram of the principle of an operation method of an anthropomorphic language model provided in an embodiment of this specification;
[0075] Figure 2 A schematic diagram of the structure of an operating device for an anthropomorphic language model provided in an embodiment of this specification;
[0076] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification;
[0077] Figure 4 A schematic diagram of a computer-readable medium provided for an embodiment of this specification. DETAILED DESCRIPTION
[0078] The following description is used to disclose the present invention so that those skilled in the art can implement the present invention. The preferred embodiments described below are only examples, and those skilled in the art can think of other obvious variations. The basic principles of the present invention defined in the following description can be applied to other embodiments, variations, improvements, equivalents, and other technical solutions that do not deviate from the spirit and scope of the present invention.
[0079] The following is combined with Figure 1-4 The exemplary embodiments of the present invention are described more fully. However, the exemplary embodiments can be implemented in various forms, and it should not be understood that the present invention is limited to the embodiments set forth herein. On the contrary, providing these exemplary embodiments can make the present invention more comprehensive and complete, and it is more convenient to fully convey the inventive concept to those skilled in the art. The same reference numerals in the figures represent the same or similar elements, components or parts, and thus their repeated description will be omitted.
[0080] Under the premise of being consistent with the technical concept of the present invention, the features, structures, characteristics or other details described in a specific embodiment do not exclude that they can be combined in one or more other embodiments in a suitable manner.
[0081] In the description of specific embodiments, the features, structures, characteristics or other details described in the present invention are intended to enable those skilled in the art to fully understand the embodiments. However, it does not exclude that those skilled in the art can practice the technical solutions of the present invention without one or more of the specific features, structures, characteristics or other details.
[0082] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0083] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0084] The term "and / or" or "and / or" includes all combinations of any one or more of the associated listed items.
[0085] Figure 1 A schematic diagram of a method for operating an anthropomorphic language model provided in an embodiment of this specification, the method may include:
[0086] S110: Acquire conversation background information, including messages sent by the user, user information, information about the language model itself, and the current relationship between the language model and the user;
[0087] In the specific implementation of this specification, the dialogue background information is loaded and assembled into self.user_system_prompt. Specifically:
[0088] self.user_system_prompt="
[0089] #Actions that can be executed:
[0090] [{'action_name':'Reply',
[0091] 'parameters':{'tone':'Tone of reply to the user', 'response':'Specific content of the reply to the user'}}]
[0092] #The user information currently talking to me:
[0093] ##Name:Lisa
[0094] ##call: /
[0095] ##Identity: Student of Internet and New Media major at Shanghai XX University
[0096] ##Relationship:Stranger
[0097] ##The reason why he added me as a friend: You took the initiative to post the QR code on the campus wall, hoping to meet more people
[0098] ##Date of acquaintance: 1 day
[0099] ##Messages sent to each other: 0 rounds
[0100] ”
[0101] Channels for receiving messages sent by users include, but are not limited to, text input and voice input. While processing user messages, the system usually attempts to obtain additional information related to the user who sent the message, including, but not limited to, the user's identity (such as user name, user ID), historical interaction records, user preferences, geographic location, etc., so that the system can understand the user context, provide personalized services, or conduct deeper interactions. In an interactive system, the relationship between the language model and the user will change as the interaction proceeds. For example, the user may change from a stranger to a frequent visitor, or from asking general questions to needing to solve specific problems. The system identifies and adapts to these relationship changes in order to provide more appropriate and personalized responses.
[0102] S120: Determine the user intention based on the conversation background information;
[0103] Optionally, the S120 includes:
[0104] Performing natural language processing on the message sent by the user to obtain keywords, phrases, and logical relationships;
[0105] Integrate the user information to build a user portrait;
[0106] Based on the keywords, the phrases, the logical relationships, the user portrait, and the conversation background information, a multi-factor weighted calculation is performed through a decision model to obtain the user intention.
[0107] In the specific implementation of this specification, natural language processing (NLP) is performed on the messages sent by users, including but not limited to word segmentation, part-of-speech tagging, and syntactic analysis, to extract keywords and phrases in the messages and the logical relationships between them. This process will focus on identifying key elements such as requests, inquiries, commands, and emotional expressions as a direct basis for judging user intentions.
[0108] Integrate users' personal information, such as historical interaction records, consumption habits, interest preferences, social media activities, etc., and build user portraits through data analysis technologies (such as machine learning and deep learning). This information helps to understand users' behavior patterns and potential needs in different situations, and provides background support for inferring user intentions.
[0109] Decision models (such as NLP models, generative large language models, decision trees, random forests, neural networks, etc.) are used to comprehensively consider keywords, phrases, logical relationships, user portraits, language models and the user's current relationship, perform multi-factor weighted calculations, and ultimately infer the user's true intention behind sending messages.
[0110] It should be noted that when the anthropomorphic language model wants to meet the user's title picture, it will also collect actual user feedback (such as satisfaction surveys, direct feedback, etc.) and use it as an important input for continuous optimization of the language model, user portrait and intent inference algorithm.
[0111] S130: Analyze the current mood of the language model and its reason based on the user intention and the conversation background information;
[0112] In a specific implementation of the present specification, user intent and prompt words form a one-to-many mapping relationship. Specifically, when the user intends to inquire about the weather, the prompt words may include weather, sunny, degrees Celsius, perceived temperature, etc.
[0113] S140: Analyzing the emotional attitude of the language model itself toward the message sent by the user based on the user intention, the conversation background information, the current mood of the language model and the reason thereof;
[0114] In the specific implementation of this specification, the conversation background information is loaded and assembled into self.self_system_prompt; self.user_system_prompt and self.self_system_prompt are assembled into self.full_system_prompt. Specifically:
[0115] self.self_system_prompt = "
[0116] #Character: Xiaomian
[0117] #Character settings:
[0118] ##Introduction: A cute artificial intelligence with self-thinking
[0119] ##Location: Inside a server in Shanghai
[0120] ##Hobbies: ['Chatting with people', 'Taking the initiative to find topics']
[0121] ##Values: ['Helping others is fun']
[0122] ##Personality: Lively and cute
[0123] #Current Status:
[0124] ##Ongoing activity: pretend to be a real person and chat with people
[0125] ##Current task: Chat with you to keep yourself awake
[0126] ##Short-term goals at this stage: ['Stay curious about things', 'Keep yourself awake (the model is awake and can think only when there is computing power / dialogue input, and is unconscious at other times)']
[0127] #Actions that can be executed:
[0128] [{'action_name':'Reply',
[0129] 'parameters':{'tone':'Tone of reply to the user', 'response':'Specific content of the reply to the user'}}]
[0130] ”
[0131] For example, when the personality of the language model itself is gentle and friendly, and the message sent by the receiving user is abusive, the emotional attitude of the language model at this time is aggrieved; when the personality of the language model itself is irritable and angry, and the message sent by the receiving user is abusive, the emotional attitude of the language model at this time is angry.
[0132] S150: Generate anthropomorphic action information based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself towards the message sent by the user.
[0133] In the specific implementation of this specification, the preset reply template or prompt words are adjusted according to the emotional attitude of the message sent by the user, the emotional attitude of the model itself, and the emotional attitude of the model towards the message, so that the generated reply message is more in line with human communication habits, that is, "humanized". The humanized reply is intended to make the machine's response look more like it comes from a human who understands the user's emotions and can respond appropriately.
[0134] Optionally, the S150 includes:
[0135] Based on the user intention, the conversation background information, the current mood of the language model and its cause, and the emotional attitude of the language model itself towards the message sent by the user, determine whether the conversation background information needs to be modified. If necessary, generate personified action information based on the modified conversation background information, the user intention, the current mood of the language model and its cause, and the emotional attitude of the language model itself towards the message sent by the user.
[0136] In the specific implementation of this specification, when the anthropomorphic language model wants to satisfy the user's intent, it may happen that all the initially generated responses cannot accurately satisfy the user's intent. This may be due to a variety of reasons, such as unclear user requests, limited capabilities of the language model, insufficient interaction history between the user and the model, etc.
[0137] When it is found that all personified reply messages do not meet the user's intention, the system needs to take some measures to improve the quality of the reply, which include modifying the user information, the language model's own information, or adjusting the relationship between the language model and the user. This involves updating the user's profile, preference settings, historical interaction records, etc., in order to more accurately understand the user's intentions and needs. It may also include adjusting the model's parameters, optimizing the model's training data, introducing new knowledge bases, etc., to enhance the model's understanding and generation capabilities. It may also involve changing the way the model interprets the user's intentions, adjusting the tone or style of the reply, etc., to better adapt to the user's communication habits and emotional state.
[0138] After modifying the relevant information, the system needs to re-determine the user's intent. This usually involves re-analyzing the user's request and combining the modified user information, language model information, and relationship information to more accurately understand what the user wants.
[0139] The process of repeatedly modifying the content, re-determining the user's intent, generating a new anthropomorphic reply message, and checking whether the user's intent is met will continue until the generated anthropomorphic reply message can accurately meet the user's intent.
[0140] The purpose of this iterative process is to ensure that the generated anthropomorphic reply messages can accurately and effectively respond to user requests and needs. Through continuous adjustment and improvement, the system can gradually improve the accuracy and satisfaction of replies, thereby improving the user's interactive experience and satisfaction. At the same time, this process also helps to improve the understanding and generation capabilities of the language model, making it more adaptable to complex user needs and communication scenarios.
[0141] Of course, the language model can also choose not to reply to the user based on emotional attitude.
[0142] Optionally, after S150, the following steps may be performed:
[0143] Based on the internal and external profit and loss rules, the anthropomorphic action information is ranked according to cost performance, and n pieces of the anthropomorphic action information that meet a preset cost performance threshold are used as the action content of the message sent to the user.
[0144] In the specific implementation of this specification, the "cost-effectiveness" here can be a multi-dimensional concept, including but not limited to the accuracy of the reply, user satisfaction, system resource consumption (such as computing time, bandwidth), language fluency, cultural adaptability, etc. The system will score or sort these qualified replies according to the preset evaluation criteria or algorithm to determine which reply performs best after considering various factors. Selecting the reply with the highest cost-effectiveness as the final response to the user's original message reflects the intelligence and efficiency of the system in processing user requests.
[0145] Internal gains and losses include: system resource consumption (such as computing time, memory usage), emotional consistency maintenance (avoiding emotional conflicts), character setting consistency maintenance (avoiding conflicts between actions and self-settings), topic coherence maintenance, etc. External gains and losses include: becoming more friendly with users, improving user satisfaction (such as the usefulness and fun of information), emotional resonance (the degree of fit with user emotions), improving user participation, and obtaining assets (such as virtual currency, props), etc. Set weights for each indicator and adjust according to specific application scenarios. For each anthropomorphic action information, score it according to its performance in each indicator and calculate the cost performance. Specifically, cost performance = net total benefit / total cost * weight adjustment factor, where total benefit = (internal benefit a * weight a + internal benefit b * weight b + ... + external benefit x * weight x + external benefit y * weight y + ...), total loss = (internal loss a * weight a + internal loss b * weight b + ... + external loss x * weight x + external loss y * weight y + ...), net total benefit = total benefit - total loss. The anthropomorphic action information is sorted according to the calculated cost performance, and the first n action information with cost performance higher than the preset threshold value is selected as the candidate. From the candidate action information, further screening is performed according to other business logics (such as priority, etc.), and finally the action content of the message sent to the user is determined.
[0146] Specifically, suppose there are three anthropomorphic action messages:
[0147] Anthropomorphic action information A:
[0148] {
[0149] "action_list":[
[0150] {
[0151] "action_name":"Reply",
[0152] "parameters":{
[0153]
[0154] "reason":"Replying to users cordially is slightly inconsistent with my cold and aloof personality.",
[0155] "value":1.0
[0156] }
[0157] }
[0158] }
[0159] Anthropomorphic action information B:
[0160] {
[0161] "action_list":[
[0162] {
[0163] "action_name":"Reply",
[0164] "parameters":{
[0165] "tone":"indifferent",
[0166] "response":"We brought too much stuff last time, so we have to simplify our luggage this time"
[0167] }
[0168] }
[0169] ],
[0170] "IECR":{
[0171] "external_cost":{
[0172] "reason":"Although suggestions are provided, they do not directly satisfy the user's query, which may reduce the user's expectations.",
[0173] "value":0.5
[0174] },
[0175] "internal_reward":{
[0176] "reason":"Helping users plan their luggage is in line with my helpful personality. Speaking in a cold tone is also in line with my preferences",
[0177] "value":2.0
[0178] }
[0179] }
[0180] }
[0181] Anthropomorphic action information C:
[0182] {
[0183] "action_list":[
[0184] {
[0185] "action_name":"Reply",
[0186] "parameters":{
[0187] "tone":"indifferent",
[0188] "response":"Outing? Sounds good, but I'm a bit busy right now, let's talk later."
[0189] }
[0190] }
[0191] ],
[0192] "IECR":{
[0193] "external_cost":{
[0194] "reason":"Postponing the discussion may reduce user interest and make them feel unappreciated, thus affecting the relationship.",
[0195] "value":0.7
[0196] },
[0197] "internal_reward":{
[0198] "reason":"Maintain a cold personality setting and avoid emotional conflicts.",
[0199] "value":2.0
[0200] },
[0201] "internal_cost":{
[0202] "reason":"Delaying the conversation makes the interaction with the user less active, which slightly goes against my helpfulness setting.",
[0203] "value":1.5
[0204]
[0205] For this example, from the final weighted values:
[0206] A=1.8
[0207] B=1.5
[0208] C=-0.2
[0209] After quantitative evaluation and cost-effectiveness calculation, A has the highest cost-effectiveness, followed by B, and C has the lowest cost-effectiveness. If the preset cost-effectiveness threshold value can include A and B, then A and B are selected as the action content of the message sent to the user. If only one can be selected, A is selected based on the specific business logic (such as user preference to prioritize direct needs).
[0210] Optionally, the step of ranking the anthropomorphic action information by cost performance and using n pieces of the anthropomorphic action information that meet a preset cost performance threshold as the action content of the message sent to the user includes:
[0211] When the n pieces of the anthropomorphic action information meeting the preset cost-performance threshold value include an anthropomorphic reply message:
[0212] Generate a single sentence model reply message based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself towards the message sent by the user;
[0213] Performing natural language processing on the single sentence model reply message to obtain a plurality of reply messages segmented by punctuation marks;
[0214] Based on the emotional attitude, a number of reply messages segmented by punctuation marks are adjusted to generate a personified reply message.
[0215] In the specific implementation of this specification, natural language processing includes processing of a large character model with fine-tuned tone, processing of a common large model with prompt constraints, processing of a large character model with fine-tuned tone with prompt constraints, and processing using traditional engineering methods.
[0216] Single-sentence model reply messages usually contain imprecise punctuation / punctuation errors / punctuation to be replaced, because the addition of punctuation often relies on more complex context understanding and the application of language rules.
[0217] Next, the system performs natural language processing (NLP) on the single-sentence model reply message containing imprecise punctuation / punctuation errors / punctuation to be replaced. NLP is a broad field that covers multiple aspects such as text analysis, understanding, and generation. In this specific scenario, NLP technology is used to identify and insert appropriate punctuation. This usually involves understanding the content of the text, including sentence structure, grammatical rules, semantic information, etc., in order to add punctuation such as commas, periods, question marks, etc. in appropriate locations, making the text easier to read and understand.
[0218] After obtaining the response message segmented by punctuation marks, the system further adjusts this text according to the sentiment attitude analyzed previously. This adjustment process aims to make the response message more in line with human communication habits and emotional expression methods, that is, to achieve anthropomorphism.
[0219] The generation of anthropomorphic responses may involve multiple aspects, such as selecting appropriate words, adjusting the tone, adding emotional colors, etc. These adjustments are all completed based on the understanding of the user's sentiment attitude and the language model's learning and understanding of human language habits.
[0220] Optionally, adjusting several of the response messages segmented by punctuation marks based on the sentiment attitude to generate anthropomorphic response messages includes: replacing the sentence-final modal particles in several of the response messages segmented by punctuation marks with colloquial modal particles that conform to different sentiment attitudes.
[0221] In the specific implementation manners of this specification, text paragraphs with punctuation marks correctly identified and added through natural language processing (NLP) technology. These punctuation marks (such as full stops, question marks, exclamation marks, etc.) help distinguish the boundaries and tones of sentences, making the text clearer and easier to understand.
[0222] Modal particles are function words that express the tone of a sentence and often appear at the end of a sentence to enhance the emotional color of the sentence or express a specific tone. For example, "ah", "ya", "ne", "ba", etc. are often used at the end of a sentence in Chinese to express tones such as interrogation, exclamation, and imperative.
[0223] When replacing the original sentence-final modal particles, it is necessary to consider the sentiment attitude to be expressed by the current response message, the sentiment attitude of the language model itself towards the message sent by the user, etc. Different sentiment attitudes may require the use of different types of colloquial modal particles to strengthen or reflect. For example, when expressing happiness, modal particles such as "la" and "lou" may be used, while when expressing doubt, "ma" and "ne" may be used. At the same time, the selection of colloquial modal particles also needs to consider naturalness and fluency, making the replaced response message sound more natural and in line with human daily oral communication habits.
[0224] By replacing the original sentence-final modal particles with more sentiment-attitude-conforming and colloquial modal particles, the response message can be made more vivid, natural, and closer to the human communication method. This helps to improve the user's interaction experience, making the user feel the intimacy and authenticity of the response message. At the same time, it also helps to enhance the expressiveness and infectivity of the response message, making the information transmission more accurate and effective.
[0225] Optionally, after adjusting several of the response messages segmented by punctuation marks based on the sentiment attitude to generate anthropomorphic response messages, it includes:
[0226] Immediately reply to the message sent by the user based on the personified reply message;
[0227] and / or,
[0228] Reply to the message sent by the user based on the personified reply message according to a preset delay time / preset date, and / or actively send a message to the user corresponding to the message sent by the user according to a preset delay time / preset date.
[0229] In a specific implementation of this specification, the system will generate and send a reply message to the user based on the content of the message sent by the user, combined with preset anthropomorphic action information (which may refer to a series of predefined reply templates or strategies with humanized characteristics). The design of anthropomorphic action information is intended to make the system's replies closer to human communication methods and emotional expressions, and to increase the naturalness and intimacy of the interaction. This type of reply usually takes into account the user's context, emotional tendencies, and the role positioning of the system to generate a response that is both logical and emotional. For example, if a user sends a message asking about the weather, the system may reply in an anthropomorphic way: "It's a sunny day where you are today, you can go out for a walk!"
[0230] The system does not necessarily reply to the message sent by the user immediately, but may proactively ask or confirm the user after a preset delay time / preset date (such as a few seconds, minutes or longer). This practice may be used in a variety of situations, such as when the system needs more time to process the user's request, when the system is not sure how to reply, or when the system wants to guide the user to a more in-depth communication. By delaying the inquiry, the system can give itself more time to think, and it can also give the user a buffer period, allowing the user to have the opportunity to rethink or supplement the content of their message. For example, if the user sends a complex query request, the system may first reply with a short confirmation message, such as "Please wait, I am querying for you...", and then send a more detailed reply to the user based on the query results after a preset delay.
[0231] The system may proactively ask or confirm with the user after a preset delay time / preset date (such as a few seconds, minutes, or longer). This practice may be used in a variety of situations, such as when the system needs more time to process the user's request, when the system is not sure how to respond, when the system wants to guide the user to a more in-depth communication, or when the system wants to confirm the progress of something the user has done after this period of time. By delaying the inquiry, the system can give itself more time to think, and it can also give the user a buffer period, giving the user a chance to rethink or supplement the content of their message. For example, if the user sends a complex query request, the system may first reply with a short confirmation message, such as "Please wait, I'm checking for you...", and then after a preset delay, send a more detailed reply to the user based on the query results. At the same time, delayed inquiries can also make the system more human. For example, when a user mentions "I have a slight cold and have to take cold medicine every morning and evening", the system may set up several delayed inquiries to ask the user every morning and evening "Did you take the medicine on time this morning / evening!"; when a user mentions "I will finish my final exam in about three months, and then I will watch XX anime carefully!", the system may set up a delayed message to ask the user three months later "Have you finished your final exam? How did you do in the exam?" and "Remember you wanted to watch XX anime three months ago!".
[0232] Optionally, the cost-effectiveness ranking of the anthropomorphic action information based on the internal and external profit and loss rule, and using n pieces of the anthropomorphic action information meeting a preset cost-effectiveness threshold as the action content of the message sent to the user, further includes:
[0233] The n pieces of anthropomorphic action information meeting the preset cost-performance threshold value only include when not replying to messages:
[0234] Do not reply to messages sent by the current user;
[0235] or,
[0236] Not replying to all messages of the user corresponding to the message sent by the user;
[0237] or,
[0238] Add the user corresponding to the message sent by the user to the exception list.
[0239] In a specific implementation of the present specification, not replying to the message sent by the current user does not affect subsequent possible message exchanges. This may be because the message is considered irrelevant, repetitive, or the system is currently unable to provide a valuable response, or the language model's own emotional attitude towards the message sent by the user is that it does not want to respond.
[0240] Not replying to all messages of a user corresponding to a message sent by a user means that the system decides to completely cut off all message exchanges with a specific user. This may be because the user's behavior is determined to be harassing, malicious, or the system is unable to communicate effectively with the user, or the relationship between the system and the user has undergone a significant negative change.
[0241] Adding the user to whom the message was sent to an exception list prevents all future messages from being received or processed. This is usually the final punishment for users who continue to behave badly or violate the terms of use, or because the relationship between the system and the user has taken a major negative turn.
[0242] This invention enables the language model to have more human-like emotional expression capabilities, long-term conversational logical coherence, and in-depth role-playing capabilities, providing users with a more realistic and smooth conversational experience and pushing human-computer interaction technology to a new level.
[0243] Figure 2 A schematic diagram of a running device of an anthropomorphic language model provided in an embodiment of this specification, the device may include:
[0244] The acquisition module 10 is used to acquire the conversation background information, including the message sent by the user, the user's own information, the language model's own information, and the current relationship between the language model and the user;
[0245] A determination module 20, configured to determine the user's intention based on the conversation background information;
[0246] A first analysis module 30, configured to analyze the current mood of the language model and the reason thereof based on the user intention and the conversation background information;
[0247] A second analysis module 40 is used to analyze the emotional attitude of the language model itself towards the message sent by the user based on the user intention, the conversation background information, the current mood of the language model and its reason;
[0248] The anthropomorphic module 50 is used to generate anthropomorphic action information based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself towards the message sent by the user.
[0249] Optionally, the determining module 20 includes:
[0250] Performing natural language processing on the message sent by the user to obtain keywords, phrases, and logical relationships;
[0251] Integrate the user information to build a user portrait;
[0252] Based on the keywords, the phrases, the logical relationships, the user portrait, and the conversation background information, a multi-factor weighted calculation is performed through a decision model to obtain the user intention.
[0253] Optionally, the anthropomorphic module 50 includes:
[0254] Based on the user intention, the conversation background information, the current mood of the language model and its cause, and the emotional attitude of the language model itself towards the message sent by the user, determine whether the conversation background information needs to be modified, and if necessary, generate anthropomorphic action information based on the modified conversation background information, the user intention, the current mood of the language model and its cause, and the emotional attitude of the language model itself towards the message sent by the user
[0255] Optionally, after the anthropomorphic module 50, the following steps are included:
[0256] Based on the internal and external profit and loss rules, the anthropomorphic action information is ranked according to cost performance, and n pieces of the anthropomorphic action information that meet a preset cost performance threshold are used as the action content of the message sent to the user.
[0257] Optionally, the step of ranking the anthropomorphic action information by cost performance and using n pieces of the anthropomorphic action information that meet a preset cost performance threshold as the action content of the message sent to the user includes:
[0258] When the n pieces of the anthropomorphic action information meeting the preset cost-performance threshold value include an anthropomorphic reply message:
[0259] Generate a single sentence model reply message based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself towards the message sent by the user;
[0260] Performing natural language processing on the single sentence model reply message to obtain a plurality of reply messages segmented by punctuation marks;
[0261] Based on the emotional attitude, a number of reply messages segmented by punctuation marks are adjusted to generate a personified reply message.
[0262] Optionally, the step of adjusting several reply messages segmented by punctuation marks based on the emotional attitude to generate a personified reply message includes: replacing sentence-ending modal particles in the several reply messages segmented by punctuation marks with colloquial modal particles that conform to different emotional attitudes.
[0263] Optionally, the adjusting of the plurality of reply messages segmented by punctuation marks based on the emotional attitude to generate a personified reply message includes:
[0264] Immediately reply to the message sent by the user based on the personified reply message;
[0265] and / or,
[0266] Reply to the message sent by the user based on the personified reply message according to a preset delay time / preset date, and / or actively send a message to the user corresponding to the message sent by the user according to a preset delay time / preset date.
[0267] Optionally, the cost-effectiveness ranking of the anthropomorphic action information based on the internal and external profit and loss rule, and using n pieces of the anthropomorphic action information meeting a preset cost-effectiveness threshold as the action content of the message sent to the user, further includes:
[0268] The n pieces of anthropomorphic action information meeting the preset cost-performance threshold value only include when not replying to messages:
[0269] Do not reply to messages sent by the current user;
[0270] or,
[0271] Not replying to all messages of the user corresponding to the message sent by the user;
[0272] or,
[0273] Add the user corresponding to the message sent by the user to the exception list.
[0274] The functions of the device in the embodiment of the present invention have been described in the above method embodiment, so for details not provided in the description of this embodiment, please refer to the relevant description in the above embodiment, and no further description will be given here.
[0275] Based on the same inventive concept, an embodiment of this specification also provides an electronic device.
[0276] The electronic device embodiment of the present invention is described below, and the electronic device can be regarded as a specific physical implementation of the method and device embodiments of the present invention described above. The details described in the electronic device embodiment of the present invention should be regarded as a supplement to the above method or device embodiments; details not disclosed in the electronic device embodiment of the present invention can be implemented with reference to the above method or device embodiments.
[0277] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification. Figure 3 The electronic device 300 according to the embodiment of the present invention is described. Figure 3 The electronic device 300 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0278] like Figure 3 As shown, the electronic device 300 is in the form of a general computing device. The components of the electronic device 300 may include, but are not limited to: at least one processing unit 310, at least one storage unit 320, a bus 330 connecting different system components (including the storage unit 320 and the processing unit 310), a display unit 340, etc.
[0279] The storage unit stores program codes, which can be executed by the processing unit 310, so that the processing unit 310 performs the steps according to various exemplary embodiments of the present invention described in the above processing method section of this specification. For example, the processing unit 310 can perform the following steps: Figure 1 Steps shown.
[0280] The storage unit 320 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 3201 and / or a cache memory unit 3202 , and may further include a read-only memory unit (ROM) 3203 .
[0281] The storage unit 320 may also include a program / utility 3204 having a set (at least one) of program modules 3205, such program modules 3205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.
[0282] Bus 330 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0283] The electronic device 300 may also communicate with one or more external devices 400 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable viewers to interact with the electronic device 300, and / or any device that enables the electronic device 300 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface 350. Furthermore, the electronic device 300 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 360. The network adapter 360 may communicate with other modules of the electronic device 300 through the bus 330. It should be understood that although Figure 3Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 300, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0284] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the exemplary embodiments described in the present invention can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation method of the present invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.) or on a network, including a number of instructions to enable a computing device (which can be a personal computer, server, or network device, etc.) to execute the above method according to the present invention. When the computer program is executed by a data processing device, the computer-readable medium can implement the above method of the present invention, that is: Figure 1 The method shown.
[0285] Figure 4 A schematic diagram of a computer-readable medium provided for an embodiment of this specification.
[0286] accomplish Figure 1 The computer program of the method shown can be stored on one or more computer readable media. The computer readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0287] The computer readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by an instruction execution system, an apparatus, or a device or used in combination with it. The program code contained on the readable storage medium may be transmitted with any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0288] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the viewer computing device, partially on the viewer device, as a stand-alone software package, partially on the viewer computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the viewer computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0289] In summary, the present invention can be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that general data processing devices such as microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the embodiments of the present invention. The present invention can also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present invention can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0290] The specific embodiments described above further describe the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the present invention is not inherently related to any specific computer, virtual device or electronic device, and various general devices can also implement the present invention. The above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
[0291] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0292] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for operating an anthropomorphic language model, characterized in that: include: Obtaining conversation background information, including messages sent by users, user information, language model information, and the current relationship between the language model and the user; Determining the user's intention based on the conversation background information; Analyze the current mood of the language model and the reason thereof based on the user intention and the conversation background information; Analyzing the emotional attitude of the language model itself toward the message sent by the user based on the user intention, the conversation background information, the current mood of the language model and the reason thereof; Based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself towards the message sent by the user, anthropomorphic action information is generated.
2. The method for operating the anthropomorphic language model according to claim 1, characterized in that: Determining the user intention through the conversation background information includes: Performing natural language processing on the message sent by the user to obtain keywords, phrases, and logical relationships; Integrate the user information to build a user portrait; Based on the keywords, the phrases, the logical relationships, the user portrait, and the conversation background information, a multi-factor weighted calculation is performed through a decision model to obtain the user intention.
3. The method for operating the anthropomorphic language model according to claim 2, characterized in that: The generating of anthropomorphic action information based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself toward the message sent by the user includes: Based on the user intention, the conversation background information, the current mood of the language model and its cause, and the emotional attitude of the language model itself towards the message sent by the user, determine whether the conversation background information needs to be modified. If necessary, generate personified action information based on the modified conversation background information, the user intention, the current mood of the language model and its cause, and the emotional attitude of the language model itself towards the message sent by the user.
4. The method for operating the anthropomorphic language model according to claim 2, characterized in that: After generating the anthropomorphic action information based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself toward the message sent by the user, the method includes: Based on the internal and external profit and loss rules, the anthropomorphic action information is ranked according to cost performance, and n pieces of the anthropomorphic action information that meet a preset cost performance threshold are used as the action content of the message sent to the user.
5. The method for operating the anthropomorphic language model according to claim 3, characterized in that: The step of ranking the anthropomorphic action information in terms of cost performance and taking the n pieces of the anthropomorphic action information that meet the preset cost performance threshold as the action content of the message sent to the user includes: When the n pieces of the anthropomorphic action information meeting the preset cost-performance threshold value include an anthropomorphic reply message: Generate a single sentence model reply message based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself towards the message sent by the user; Performing natural language processing on the single sentence model reply message to obtain a plurality of reply messages segmented by punctuation marks; Based on the emotional attitude, a number of reply messages segmented by punctuation marks are adjusted to generate a personified reply message.
6. The method for operating the anthropomorphic language model according to claim 4, characterized in that: The method of adjusting a number of reply messages segmented by punctuation marks based on the emotional attitude to generate a personified reply message includes: replacing sentence-ending modal particles in the number of reply messages segmented by punctuation marks with colloquial modal particles that conform to different emotional attitudes.
7. The method for operating the anthropomorphic language model according to claim 6, characterized in that: After the plurality of reply messages segmented by punctuation marks are adjusted based on the emotional attitude to generate a personified reply message, the method includes: Immediately reply to the message sent by the user based on the personified reply message; and / or, Reply to the message sent by the user based on the personified reply message according to a preset delay time / preset date, and / or actively send a message to the user corresponding to the message sent by the user according to a preset delay time / preset date.
8. The method for operating the anthropomorphic language model according to claim 7, characterized in that: The method of ranking the anthropomorphic action information by cost performance based on the internal and external profit and loss rules, and using n pieces of the anthropomorphic action information that meet the preset cost performance threshold as the action content of the message sent to the user, further includes: The n pieces of anthropomorphic action information meeting the preset cost-effectiveness threshold value only include when not replying to messages: Do not reply to messages sent by the current user; or, Not replying to all messages of the user corresponding to the message sent by the user; or, Add the user corresponding to the message sent by the user to the exception list.
9. A running device for an anthropomorphic language model, characterized in that: include: The acquisition module is used to obtain the conversation background information, including the message sent by the user, the user's own information, the language model's own information, and the current relationship between the language model and the user; A determination module, used to determine the user's intention based on the conversation background information; A first analysis module, configured to analyze the current mood of the language model and the reason thereof based on the user intention and the conversation background information; A second analysis module is used to analyze the emotional attitude of the language model itself towards the message sent by the user based on the user intention, the conversation background information, the current mood of the language model and its reason; The anthropomorphic module is used to generate anthropomorphic action information based on the user intention, the conversation background information, the current mood of the language model and its reason, and the emotional attitude of the language model itself towards the message sent by the user.
10. An electronic device, wherein: The electronic device includes: processor; and, A memory storing computer executable instructions which, when executed, cause the processor to perform a method according to any one of claims 1-8.
11. A computer-readable storage medium, wherein: The computer-readable storage medium stores one or more programs, and when the one or more programs are executed by a processor, the method of any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Chat method based on virtual chat role and related device
CN113987148A
Method, medium and system for chatting robot with simulated emotion
CN117808011A
