Enterprise imaginary role dialogue system construction method
By using the closed-source large language model to build a question-and-answer library for the enterprise fictional character dialogue system and fine-tuning the open source model, the problems of medium and high cost of building the enterprise fictional character dialogue system, the problem of low character portraits, difficulty in building a professional knowledge base and illusion is solved, and the effects of significant cost-effectiveness, fine character portraits, strong professional knowledge answering capabilities, and high interactive experience are achieved.
Patent Information
- Application Number
- CN202510287405.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-06-27
AI Technical Summary
In the prior art, the construction of enterprise fictional role dialogue systems has problems such as high cost, lack of fine character portraits, difficulty in building professional knowledge bases, and knowledge illusion.
By using the closed-source large language model to build a self-cognitive Q&A library, a character style Q&A library and a professional knowledge Q&A library, and fine-tune the open-source large language model to form a fictional role dialogue system for an enterprise.
It reduces the cost of building a dialogue system, improves the precision of character portraits, efficiently builds a professional knowledge base, reduces the phenomenon of knowledge illusion, and provides a high-quality customer interaction experience.
Smart Images

Figure CN120216642A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and particularly to a method for constructing an enterprise fictional character dialogue system. Background Art
[0002] At present, enterprise fictional characters (such as enterprise mascots), as vivid representatives of the company image, can create many values for the company and have become a necessity for most companies. On the one hand, it can significantly improve brand recognition, enabling consumers to quickly remember the company among many competitors; on the other hand, enterprise fictional characters can attract the attention of the audience in various marketing and promotion activities, shorten the distance with consumers, and enhance brand affinity. Constructing a dialogue system for enterprise fictional characters has many benefits. It can not only enable enterprise fictional characters to interact with customers at any time to further strengthen the brand image, but also provide unique service experiences for customers through personalized dialogue chats, helping the company's business development.
[0003] Currently, the common practices for constructing LLM (Large Language Model) role-playing dialogue systems are as follows: relying on role profiles and a large number of role knowledge texts, and with the help of prompt engineering, using closed-source LLMs represented by GPT-4 to carry out role-playing. However, these methods have several drawbacks, for example:
[0004] High cost of closed-source LLMs: Although closed-source LLMs represented by GPT-4 perform well in role-playing, their API call costs are high. For small and medium-sized enterprises to construct enterprise fictional character dialogue systems, the cost is unbearable. Moreover, closed-source LLMs cannot be directly fine-tuned for professional data. Limited by the context window, it is difficult for enterprises to deeply customize enterprise fictional character dialogue systems that meet their own needs.
[0005] Coarse fictional character portraits: Most of the currently played roles are derived from film and television book works, and such roles have clear and definite definitions and rich script or book materials as support. However, for those fictional characters lacking a large amount of relevant materials and with imprecise definitions, such as enterprise mascots, their general role portraits often have only simple descriptions and poor fineness, resulting in it being difficult to highlight distinct character traits during role-playing.
[0006] It is difficult to build a professional knowledge base for fictional characters: In traditional role-playing tasks, characters in movies, TV shows, and books can build a professional knowledge system based on a large amount of relevant scripts or book materials. However, fictional characters that do not have sufficient data support and precise definitions usually do not have a professional knowledge base, or require a lot of manpower and time to manually build a knowledge base. The lack of a professional knowledge base will result in insufficient knowledge reserves during role-playing, and it will be impossible to show the knowledge that the corresponding character should have; manually building a knowledge base is costly. As a typical fictional character, corporate mascots happen to need to be empowered with professional knowledge in fields related to the company, and therefore face difficulties.
[0007] Simple imitation leads to knowledge illusion: In role-playing, the ability to answer in accordance with the character's personality style is crucial. Given the superior performance of closed-source LLMs, when using LLMs to build role-playing chat systems, open-source LLMs with relatively weak performance are often used to imitate top closed-source LLMs such as GPT-4, that is, the closed-source LLMs are first allowed to generate answers with the character's style, and then the open-source LLMs learn these answers. However, although this method can grasp the language style, it is very easy to cause knowledge illusions. The reason is that when excellent closed-source LLMs answer, they will be mixed with a lot of knowledge that is not related to the character's language style, so that the open-source LLMs not only learn the style during the learning process, but also absorb unnecessary knowledge, which ultimately leads to knowledge illusions. Summary of the invention
[0008] In view of this, the present invention provides a method for constructing an enterprise fictional character dialogue system, in which a closed-source large language model is used to construct a self-cognition question and answer library, a role style question and answer library, and a professional knowledge question and answer library, and the open-source large language model is fine-tuned to convert it into an enterprise fictional character dialogue system, which helps to solve the technical problems described in the background technology.
[0009] To achieve the above object, the technical solution adopted by the present invention is:
[0010] In a first aspect, the present invention provides a method for constructing a corporate fictional character dialogue system, the method comprising:
[0011] S1. Use a closed-source large language model to build a self-perception Q&A database, a role style Q&A database, and a professional knowledge Q&A database for corporate fictional characters;
[0012] S2. Use the self-cognition question and answer library, role style question and answer library, and professional knowledge question and answer library of the enterprise fictional character as training data, and fine-tune the open source large language model to make it a dialogue system for the enterprise fictional character.
[0013] In an optional implementation, in S1, a closed-source large language model is used to construct a self-cognition question-and-answer library, a role style question-and-answer library, and a professional knowledge question-and-answer library of a fictional character of an enterprise. The specific process includes:
[0014] Design a role profile for the company's fictional role based on the role profile table; use a closed-source large language model to answer questions in the self-cognition question library based on the role profile of the company's fictional role, and summarize the questions and generated answers to build a self-cognition question and answer library for the company's fictional role;
[0015] Obtain an open-source dialogue dataset of questions without professional knowledge, remove the answer data therein, retain the question data, and form a dialogue question dataset; input the dialogue question dataset into an open-source large language model to generate answers without character language style, and build a styleless answer library; use a closed-source large language model to modify the answers in the styleless answer library according to the character profile of the enterprise's fictional character and the character style setting of the enterprise's fictional character, add the character language style, and summarize the questions and the revised answers to build a character style question and answer library of the enterprise's fictional character;
[0016] The elements of the scoring standard for the relevance of nouns to corporate fictional characters, the entry noun set, and the database size requirement constant are integrated. The coarse-grained professional knowledge base is crawled from the network knowledge base through a crawler program, and a closed-source large language model is used to set the role style of the corporate fictional characters. Key knowledge is extracted from the coarse-grained professional knowledge base to generate question-and-answer pairs, and a professional knowledge question-and-answer base for the corporate fictional characters is constructed.
[0017] In an optional implementation, the information description in the character profile table includes: basic information, appearance, personality traits, background story, skills and expertise, catchphrases, and application scenarios.
[0018] In an optional implementation, the network knowledge base is: Wiki encyclopedia; based on the database size requirement constant combined with the knowledge relevance between the Wiki page title and the corporate fictional character, the crawler retrieval depth of the Wiki page is calculated to control the size of the coarse-grained professional knowledge base crawled by the crawler program.
[0019] In an optional implementation, the specific process of crawling the coarse-grained professional knowledge base includes:
[0020] Create a new Wiki page processing queue, add the Wiki pages corresponding to each noun in the entry noun set to the queue, and assign a crawler search depth L = 0 to each page in the queue. Perform the following operations on each page:
[0021] If its L = 0, calculate the knowledge relevance of the enterprise fictional character corresponding to the page title to replace its L, and continue the following judgment: If L = 1, crawl the page information and remove the page from the queue at the same time; If L > 1, crawl the page information, add all relevant hyperlink pages in the page to the queue Q, and assign the crawler retrieval depth of L - 1 to these pages, and then remove the page from the queue; Finally, summarize all the crawled page information into a coarse-grained professional knowledge base.
[0022] In an alternative embodiment, the closed-source large language model uses GPT-4.
[0023] In an alternative embodiment, the open-source large language model uses ChatGLM-3.
[0024] In a second aspect, the present invention also provides an electronic device, including a processor and a memory, where the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-mentioned method for constructing an enterprise fictional character dialogue system.
[0025] Compared with the prior art, the present invention provides a method for constructing an enterprise fictional character dialogue system, which at least has the following beneficial technical effects:
[0026] 1. Significantly cost-effective: The present invention abandons directly using the expensive closed-source large language model as the final dialogue system, only uses it to generate training data, and then relies on fine-tuning the open-source large language model to construct the enterprise fictional character dialogue system. Compared with relying on the API call of the closed-source large language model, the cost of the enterprise to build the dialogue system is greatly reduced, enabling small and medium-sized enterprises to easily have customized enterprise fictional character dialogue services and avoiding the economic burden brought by the high cost of the closed-source large language model.
[0027] 2. Fine and accurate character portraits: Through the character profile and self-awareness question bank of the enterprise fictional character, the two work together to be able to finely define the persona of the enterprise fictional character in all aspects and at multiple levels. Different from the rough character portraits of fictional and data-scarce characters in traditional role-playing, the present invention enables the enterprise fictional character to have distinct and three-dimensional persona characteristics, and can accurately convey the brand personality when interacting with customers, enhancing brand recognition and affinity.
[0028] 3. Efficient and intelligent construction of a professional knowledge base: An innovative strategy is proposed to automatically construct a professional knowledge base by crawling page information from web knowledge bases (such as Wikipedia). Based on factors such as the relevance score of nouns to IP, entry nouns, and the constant demand for database size, a knowledge base closely adapted to the fictional characters of the enterprise is quickly built. The whole process requires no cumbersome manual intervention, avoiding the high costs and infringement risks of manually constructing a knowledge base, efficiently empowering the fictional characters of the enterprise with the ability to answer professional knowledge, and ensuring that accurate and authoritative responses can be given when facing problems in professional fields.
[0029] 4. Effective suppression of knowledge hallucinations: A unique method for generating a question-and-answer library with the role style of fictional characters of the enterprise is designed. While leveraging the high-quality style data of closed-source large language models, redundant knowledge is cleverly reduced. This avoids the problem of knowledge hallucinations caused by open-source large language models blindly imitating closed-source large language models, enabling the fictional character dialogue system of the enterprise to have accurate and reliable answers while maintaining the charm of the language style, providing customers with a high-quality and non-misleading interaction experience, and effectively maintaining the brand image of the enterprise.
[0030] Other features and advantages of the present invention will be described in the subsequent specification, and some of them will become obvious from the specification or be understood by implementing the present invention. The objectives and other advantages of the present invention can be achieved and obtained through the structures specifically pointed out in the written specification and the accompanying drawings.
[0031] The technical solutions of the present invention will be further described in detail below through the accompanying drawings and embodiments. Description of the Drawings
[0032] To more clearly illustrate the technical solutions in the embodiments of the present application or in the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0033] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the present invention and do not constitute a limitation to the present invention.
[0034] Figure 1 It is a schematic flow chart of the method for constructing a fictional character dialogue system of the enterprise provided by the embodiment of the present invention.
[0035] Figure 2 It is a schematic diagram of the principle of the method for constructing a fictional character dialogue system of the enterprise provided by the embodiment of the present invention.
[0036] Figure 3Pseudo-code schematic diagram for crawling a coarse-grained professional knowledge base using a crawler program provided by an embodiment of the present invention.
[0037] Figure 4 Schematic diagram of the electronic device structure provided by an embodiment of the present invention. Detailed implementation manners
[0038] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some but not all of the embodiments of the present invention.
[0039] In the description of the present invention, it should be noted that in some processes described in the specification and drawings of this application, there are multiple operations that appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order in which they appear herein or may be executed in parallel. In addition, various serial numbers, etc. are only for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0040] Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed present invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
[0041] See Figure 1 and Figure 2 As shown, an embodiment of the present invention provides a method for constructing an enterprise fictional character dialogue system. The specific task is a role-playing task, and the focus is on building a dialogue system; by means of deep learning and analysis of a large amount of text, combined with specific role definitions, accurately simulate the language styles, knowledge systems and thinking modes of various roles, so that when facing user questions, it can give professional and role-setting-compliant responses in the tone of a specific role; the method mainly includes the following steps:
[0042] S1. Use a closed-source large language model to construct a self-awareness Q&A library, a role style Q&A library, and a professional knowledge Q&A library for enterprise fictional characters;
[0043] S2. Use the self-awareness Q&A library, role style Q&A library, and professional knowledge Q&A library of the enterprise fictional characters as training data to fine-tune an open-source large language model to make it an enterprise fictional character dialogue system.
[0044] The core process of the present invention is to use a closed-source LLM to build a self-awareness Q&A library, a character style Q&A library, and a professional knowledge Q&A library for enterprise fictional characters, and fine-tune the open-source LLM to transform it into an enterprise fictional character dialogue system.
[0045] To address the problem of the high cost of closed-source LLMs, the method of the present invention abandons the practice of using a closed-source LLM as the final dialogue system, and only uses its excellent role-playing ability to generate training data for subsequent fine-tuning of the open-source LLM, thereby leveraging the advantages of the closed-source LLM at low cost.
[0046] To address the problem of the lack of refinement in the fictional character portrait, in this method, a character profile table capable of precisely defining the persona of an enterprise fictional character and a self-awareness question bank composed of carefully selected questions about the character's identity are created. The combination of the two is used to build a refined character profile and self-awareness Q&A library, and then an enterprise fictional character dialogue system that can vividly display the persona of the enterprise fictional character is trained.
[0047] To address the problem of building a professional knowledge base for fictional characters, in this method, a strategy for quickly building a large-scale professional domain knowledge base from Wikipedia is formulated. Specifically, by using elements such as the noun-IP relevance score, Wiki entry nouns, and database size requirement constants, a professional knowledge base closely related to the knowledge domain of the enterprise fictional character (enterprise mascot) and with a controllable scale is built. There is no need for manual intervention throughout the process, and there is no risk of infringement. With the help of this knowledge base, an enterprise fictional character dialogue system with the ability to answer professional knowledge questions can be trained.
[0048] To address the problem of knowledge hallucination caused by simple imitation, in this method, a method for generating a character style Q&A library for enterprise fictional characters that can both generate high-quality style data with the help of a closed-source LLM and reduce additional redundant knowledge is created, so as to facilitate the training of an enterprise fictional character dialogue system with few knowledge hallucinations and excellent style answering ability.
[0049] The following details the specific implementation and principle of the method of the present invention:
[0050] In the embodiment of the present invention, the closed-source LLM used to generate Q&A library data is GPT-4, and the open-source LLM fine-tuned into the final enterprise fictional character dialogue system is ChatGLM-3. QA (Question-Answer) represents the Q&A pair dataset, that is, the set of pairs of data composed of questions and answers.
[0051] According to enterprise requirements, using the character profile table P of the enterprise fictional character (see Table 1 below), a complete character profile P of the enterprise fictional character is designed. IP, this file enables GPT-4 in the subsequent process to understand the persona of the enterprise's fictional character, generate answers according to the persona, and then construct various Q&A libraries for training the local open-source LLMChatGLM-3 to make it an enterprise fictional character dialogue system. This is the key data basis for building the enterprise fictional character dialogue system.
[0052] Table 1 Character Profile Table (P)
[0053] Basic Information Character Name, Nickname, Gender, Age Appearance Image Styling Style, Physical Characteristics, Clothing Matching Personality Traits Core Personality, Personality Layers, Causes of Personality Background Story Character Origin, Growth Experience, Association with the Enterprise Skills and Expertise Professional Skills, Special Abilities Catchphrase Habitual Expressions, Emotional Expressions, Characteristic Phrases Application Scenarios Online Scenarios, Offline Scenarios
[0054] Furthermore, input P n ; for example, P1 is Prompt1, which is generally the input to a large language model LLM (such as GPT-4) and is called a Prompt in the field of natural language processing; in the present invention, for each P n is named as follows:
[0055] P1: Self-awareness generation instruction;
[0056] P2: Style information generation instruction;
[0057] P3: Knowledge relevance scoring instruction;
[0058] P4: Professional knowledge extraction instruction.
[0059] In the embodiment of the present invention, the input P1 is designed to drive GPT-4 to answer the questions in the self-awareness question bank Q IP according to the persona of the enterprise's fictional character self for each question in the self-awareness question bank Q self as follows:
[0060] ① Basic information:
[0061] What's your name?
[0062] What do people usually call you (nickname)?
[0063] What's your gender?
[0064] What do you think your gender means to you?
[0065] How old are you this year?
[0066] At this age, how do you feel and what are your thoughts?
[0067] ② Appearance:
[0068] How would you describe your overall styling? Is it more cartoonish, realistic, or some other style?
[0069] Tell me about your height and body type. Are you satisfied with your physical characteristics? Why?
[0070] Tell me about your facial features. Which one are you most satisfied with and which one do you think is the most distinctive?
[0071] Talk about your clothing combinations, colors, styles, and accessories. What do they reflect about your preferences and personality?
[0072] ③Personality characteristics:
[0073] Use a few words to summarize your core personality traits. How do you think these traits were formed?
[0074] Do your emotions and reactions change in different situations? Give an example.
[0075] Looking back on your growing up experience, what things had the greatest impact on the shaping of your character?
[0076] ④Background story:
[0077] Do you still remember how you were born? What was the reason for your birth?
[0078] What important growth points have you experienced along the way? What do these experiences mean to you?
[0079] What role do you play in the business?
[0080] How closely connected are you to the company’s business and culture?
[0081] ⑤ Skills and expertise:
[0082] What is your strongest professional skill? How did you develop it?
[0083] In addition to professional skills, do you have any special abilities? How did you discover and master these special abilities?
[0084] ⑥Catchphrase:
[0085] What is the phrase you often say? Why is it this phrase?
[0086] What special meaning does it have to you and your business?
[0087] ⑦Application scenarios:
[0088] In the online virtual world, where do you like to appear and what do you like to do most?
[0089] When it comes to offline real-life scenarios, in which situations do you think you can play the most important role? Why?
[0090] Furthermore, the questions and generated answers are summarized to build a self-awareness QA database of the company's fictional characters.self-IP , train ChatGLM-3 for subsequent processes to endow the enterprise's fictional character with self-cognitive ability:
[0091] QA self-IP = [Q self ; GPT-4(P1(P IP ,Q self ))]
[0092] Obtain the open-source chat conversation dataset QA from the network chat_raw , and require that the question content be simple common sense questions and not involve professional field knowledge questions. Remove the answer data therein and retain the question data to form the dialogue question dataset Q chat .
[0093] Furthermore, directly input Q chat into the original ChatGLM-3 to make it generate answers without any character language style, and build a non-style answer library QA chat :
[0094] QA chat = [Q chat ; ChatGLM-3(Q chat )]
[0095] Design P2 so that GPT-4 polishes the answers in QA IP according to the persona of the enterprise's fictional character. The specific requirement is to add only the language style of the enterprise's fictional character on the basis of retaining the original content of the answer to the greatest extent, so as to avoid introducing redundant and unnecessary knowledge in the answer. For example, polish "The company was founded in 1999." into "Haha, I know! The company was founded in 1999!" Summarize the questions and the re-polished answers to build the role-style Q&A library QA chat of the enterprise's fictional character for subsequent processes to train ChatGLM-3 to learn the ability to answer questions in the language style of the enterprise's fictional character: chat-IP QA
[0096] QA chat-IP = [Q chat ; GPT-4(P2(P IP ,QA chat ))]
[0097] Design P3(E, t, P IP ) so that GPT-4 can evaluate the relevance S of a certain noun t to the knowledge of the enterprise's fictional character corresponding to the role profile P IP of the enterprise's fictional character according to the relevance scoring standard E of the noun t to the enterprise's fictional character:
[0098] S = GPT-4(P3(E, t, PIP ))
[0099] In a specific implementation, the scoring criteria (E) for the relevance between a noun and a fictional corporate role are as follows:
[0100] 1 point: The concept represented by the noun has no overlap with the industry, business field, and core value proposition of the company's fictional character. From the perspective of the company's fictional character's role profile, business scope, service objects, etc., the noun cannot establish direct or indirect links with the company's daily operations, product services, brand image building, etc. For example, a fictional character of a technology company focusing on high-end software development, the noun "agriculture" belongs to this category, because software development and agricultural technology belong to different industrial fields, and generally there is no possibility of technology sharing, business collaboration, or targeting the same customer groups. When building a professional knowledge question and answer library or conducting role interactions, the knowledge related to the noun will hardly be involved.
[0101] 2 points: There is a certain weak correlation between the noun and the fictional character of the enterprise. This correlation may be reflected in a broader business scope, or in the peripheral auxiliary areas of the enterprise's operations. On the one hand, it may be related to non-core links in the upstream and downstream of the industrial chain where the enterprise is located. For example, for a fictional character of an enterprise that focuses on the manufacture of electronic products, although "logistics and distribution" is not a direct content of its product research and development and production, the product from the factory to the market is inseparable from the logistics link. When constructing the knowledge base, it may occasionally be necessary to involve general knowledge such as logistics optimization and cost control to respond to customers' inquiries about product delivery cycle and delivery service quality; on the other hand, it may be a general support area required for corporate operations, such as a creative design studio mascot. The noun "leasing" does not involve the core of creative output, but it is related to operating costs and daily management. It will have a certain correlation in some scenarios involving popular science of studio operations and introduction of cost structure.
[0102] 3 points: The noun is closely linked to the company's fictional characters and is a key component of the image, business, and professional field represented by the company's fictional characters. It is directly related to the company's core products, main services, core technologies, and unique brand image building elements. Taking a professional fitness chain company's fictional character as an example, nouns such as "fitness", "diet", and "exercise" should all be rated 3 points, because these are the key to attracting customers, building brand competitiveness, and achieving business growth. Whether it is to create a professional knowledge Q&A library or to shape the professional personality of the company's fictional character chat dialogue robot, the knowledge Q&A and interactive exchanges around these nouns will be frequent and in-depth, and are an indispensable part of the company's fictional character knowledge system.
[0103] In this embodiment, the S evaluated in the subsequent process will be used as the relevance of a certain Wiki page title t to the knowledge of the enterprise fictional character, and will determine the crawling depth of the knowledge content of this Wiki page. Simply put, it is to clarify how much associated knowledge about this page the enterprise fictional character dialogue system needs to master.
[0104] In a specific implementation, manually screen no less than 5 nouns to form a Wiki entry noun set T. The selection criterion should be a specific professional field, covering a wide range of content, and suitable for existing as a Wiki title. At the same time, ensure its relevance S to the role profile P of the enterprise fictional character IP The relevance S of the corresponding enterprise fictional character's knowledge is equal to 3. For example: for the fictional character of a design enterprise, select the nouns "design, art, geometry, material", and the corresponding knowledge relevance S = 3.
[0105] According to the needs of the enterprise, define the database size requirement constant C, which is required to be a positive integer, and the default value is 1. This constant is used to combine the relevance S of a certain Wiki page title t to the enterprise fictional character to calculate the crawling retrieval depth L of this Wiki page, so as to achieve the purpose of controlling the size of the coarse-grained professional knowledge base crawled by the crawler program. Specific formula:
[0106] L = C × S
[0107] Use the crawler program to crawl the coarse-grained professional knowledge base from Wiki. The detailed process is as follows:
[0108] Create a new Wiki page processing queue Q, add the Wiki pages corresponding to each noun t in T to the queue, and assign a crawling depth L = 0 to each page in the queue. Access the page at the head of the queue to start processing until the queue is empty. Each page performs the following operations. If its L = 0, calculate the S corresponding to the page title t and replace its L, and continue the following judgment; if L = 1, crawl the information of this page and remove this page from the queue at the same time; if L > 1, crawl the information of this page, add all the blue hyperlink pages in the page to the queue Q, and assign a depth L = L - 1 to these pages, and then remove this page from the queue.
[0109] Finally, summarize all the page information crawled into a coarse-grained professional knowledge base K. The corresponding pseudo-code is as Figure 3 shown. Divide each page in K into text blocks by each paragraph to form a text block set K seg .
[0110] Furthermore, design P4 to drive GPT-4 to extract key knowledge from K seg and build it into a question-and-answer QA pair. At the same time, the answer needs to be in accordance with the language style of the enterprise fictional character set by P IP to form a professional knowledge Q&A library QA of the enterprise fictional characterK-IP 。
[0111] QA K-IP = GPT-4(P4(K seg , P IP ))
[0112] Finally, use QA self-IP , QA chat-IP , QA K-IP as training data to fine-tune ChatGLM-3, endowing it with the self-cognition ability as a fictional corporate role, the ability to converse in the language style of a fictional corporate role, and the ability to answer professional knowledge related to a fictional corporate role, so as to make it the final fictional corporate role dialogue system.
[0113] From the description of the above embodiments, those skilled in the art can know that: The present invention provides a method for constructing a fictional corporate role dialogue system. In this method, a role profile table P is used to construct the role profile P of a fictional corporate role IP , combined with the open-source LLM, P IP and the self-cognition question bank Q self to construct the self-cognition Q&A library QA of a fictional corporate role self-IP , endowing the fictional corporate role dialogue system with self-cognition ability. In this method, first, ChatGLM-3 is used to generate question answers, and then the closed-source GPT-4 is used to polish the answers in terms of style to construct the role style Q&A library QA chat-IP of a fictional corporate role. Then, QA chat-IP is used to fine-tune ChatGLM-3, so that the dialogue system has both style and content accuracy, and avoids knowledge redundancy and hallucinations. In this method, elements such as the noun and fictional corporate role relevance scoring standard E, the Wiki entry noun set T, and the database size requirement constant C are also integrated, and a professional knowledge Q&A library QA of a fictional corporate role is constructed from Wiki through a crawler program K-IP , and professional knowledge is equipped for the fictional corporate role according to the enterprise requirements. Finally, the self-cognition Q&A library QA self-IP of a fictional corporate role, the role style Q&A library QA chat-IP , and the professional knowledge Q&A library QA K-IP of a fictional corporate role are comprehensively used to fine-tune ChatGLM-3 and transform it into a fictional corporate role dialogue system.
[0114] The specific advantages of the method of the present invention include:
[0115] 1. Significantly cost-effective: The present invention abandons the direct use of expensive closed-source large language models as the final dialogue system, only using them to generate training data, and subsequently relying on fine-tuning open-source large language models to build an enterprise fictional character dialogue system. Compared with relying on API calls of closed-source large language models, it significantly reduces the cost for enterprises to build dialogue systems, enabling small and medium-sized enterprises to easily have customized enterprise fictional character dialogue services and avoiding the economic burden brought by the high cost of closed-source large language models.
[0116] 2. Precise and accurate character portraits: Through the combination of the character profile and self-awareness question bank of the enterprise fictional character, they can work together to precisely define the character settings of the enterprise fictional character in all aspects and at multiple levels. Different from the rough character portraits of fictional and data-scarce characters in traditional role-playing, the present invention endows the enterprise fictional character with distinct and three-dimensional character characteristics, enabling it to accurately convey the brand personality when interacting with customers and enhancing brand recognition and affinity.
[0117] 3. Efficient and intelligent construction of professional knowledge bases: An innovative strategy is proposed to automatically construct a professional knowledge base by crawling page information from network knowledge bases (such as Wikipedia). According to factors such as the relevance score of nouns to IP, entry nouns, and the constant demand for database size, a knowledge base closely adapted to the enterprise fictional character can be quickly built. The whole process does not require cumbersome manual intervention, avoiding the high cost and infringement risks of manually building a knowledge base, efficiently empowering the enterprise fictional character with the ability to answer professional knowledge questions, and ensuring that it can give accurate and authoritative responses when facing professional field problems.
[0118] 4. Effective suppression of knowledge hallucinations: A unique method for generating a character style Q&A library for enterprise fictional characters is designed. While leveraging the high-quality style data of closed-source large language models, it cleverly reduces additional redundant knowledge. It avoids the knowledge hallucination problem caused by open-source large language models blindly imitating closed-source large language models, enabling the enterprise fictional character dialogue system to maintain the charm of the language style while providing accurate and reliable answers, providing customers with a high-quality and non-misleading interaction experience and effectively maintaining the enterprise brand image.
[0119] Furthermore, as shown in Figure 4 The embodiment of the present invention also provides an electronic device, which may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13. It may also include a computer program stored in the memory 11 and executable on the processor 10. The processor executes the computer program to implement a method for building an enterprise fictional character dialogue system in the above method embodiment.
[0120] Among them, the processor 10 may be composed of integrated circuits in some embodiments. For example, it may be composed of a single packaged integrated circuit, or may be composed of multiple packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core of the electronic device, connecting various components of the entire electronic device through various interfaces and circuits, and executing various functions of the electronic device and processing data by running or executing programs or modules stored in the memory 11, and calling the data stored in the memory 11.
[0121] Among them, the memory 11 may be, for example, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above. More specific examples (non-exhaustive list) of the storage medium include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disk read-only memory (CD-ROM), digital versatile disk (DVD), memory stick, floppy disk, mechanically encoded device, and any suitable combination of the above.
[0122] Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, electronic devices, or computer program products. Therefore, the present invention may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention may adopt the form of a computer program product implemented on one or more storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.
[0123] It should be noted that the word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The present invention can be implemented by means of hardware including several different components and by means of a suitably programmed computer.
[0124] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments, and the same or similar parts among the various embodiments can be referred to each other.
[0125] The foregoing description of the disclosed embodiments enables those skilled in the art to practice or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for constructing a corporate fictional character dialogue system, characterized in that: The method includes: S1. Use a closed-source large language model to build a self-perception Q&A database, a role style Q&A database, and a professional knowledge Q&A database for corporate fictional characters; S2. Use the self-cognition question and answer library, role style question and answer library, and professional knowledge question and answer library of the enterprise fictional character as training data, and fine-tune the open source large language model to make it a dialogue system for the enterprise fictional character.
2. The method for constructing a corporate fictional character dialogue system according to claim 1, characterized in that: In S1, a closed-source large language model is used to construct a self-cognition Q&A library, a role style Q&A library, and a professional knowledge Q&A library of a fictional character of an enterprise. The specific process includes: Design a role profile for the company's fictional role based on the role profile table; use a closed-source large language model to answer questions in the self-cognition question library based on the role profile of the company's fictional role, and summarize the questions and generated answers to build a self-cognition question and answer library for the company's fictional role; Obtain an open-source dialogue dataset of questions without professional knowledge, remove the answer data therein, retain the question data, and form a dialogue question dataset; input the dialogue question dataset into an open-source large language model to generate answers without character language style, and build a styleless answer library; use a closed-source large language model to modify the answers in the styleless answer library according to the character profile of the enterprise's fictional character and the character style setting of the enterprise's fictional character, add the character language style, and summarize the questions and the revised answers to build a character style question and answer library of the enterprise's fictional character; The elements of the scoring standard for the relevance of nouns to corporate fictional characters, the entry noun set, and the database size requirement constant are integrated. The coarse-grained professional knowledge base is crawled from the network knowledge base through a crawler program, and a closed-source large language model is used to set the role style of the corporate fictional characters. Key knowledge is extracted from the coarse-grained professional knowledge base to generate question-and-answer pairs, and a professional knowledge question-and-answer base for the corporate fictional characters is constructed.
3. The method for constructing a corporate fictional character dialogue system according to claim 2, characterized in that: The information description in the character profile includes: basic information, appearance, personality traits, background story, skills and expertise, catchphrases and application scenarios.
4. The method for constructing a corporate fictional character dialogue system according to claim 2, characterized in that: The network knowledge base is: Wiki encyclopedia; according to the database size requirement constant combined with the knowledge relevance of the Wiki page title and the enterprise fictional role, the crawler retrieval depth of the Wiki page is calculated to control the size of the coarse-grained professional knowledge base crawled by the crawler program.
5. The method for constructing a corporate fictional character dialogue system according to claim 4, characterized in that: The specific process of crawling the coarse-grained professional knowledge base includes: Create a new Wiki page processing queue, add the Wiki pages corresponding to each noun in the entry noun set to the queue, and assign a crawler search depth L = 0 to each page in the queue. Perform the following operations on each page: If L=0, calculate the knowledge relevance of the fictional corporate character corresponding to the page title and replace L, and continue the following judgment: If L=1, crawl the page information and remove the page from the queue; if L>1, crawl the page information, add all related hyperlink pages in the page to the queue Q, and assign the crawler retrieval depth of L-1 to these pages, and then remove the page from the queue; finally, summarize all the crawled page information into a coarse-grained professional knowledge base.
6. The method for constructing a corporate fictional character dialogue system according to claim 1, characterized in that: The closed-source large language model adopts GPT-4.
7. The method for constructing a corporate fictional character dialogue system according to claim 1, characterized in that: The open source large language model adopts ChatGLM-3.
8. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement a method for constructing an enterprise fictional character dialogue system as described in any one of claims 1-7.
Citation Information
Cited By
DeepSeek-based role large model fine tuning corpus automatic generation method
CN120849555A