Medical field dialogue method and device based on weak supervision and thinking chain, and readable medium
By training a small-scale large language model using weak supervision and thought chain methods, the problems of inaccurate and inefficient responses in open-task dialogue scenarios in the medical field are solved, achieving efficient and accurate generation of customer service intent and responses.
Patent Information
- Application Number
- CN202510972205.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-15
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-07-15
AI Technical Summary
Existing large language models are unable to generate targeted and personalized responses in open-task dialogue scenarios in the medical field, and the large number of parameters in large models leads to low efficiency.
By employing a weakly supervised approach and a thought chain method, a small-scale large language model is trained by constructing thought chain prompts and first-order logic rules to generate customer service responses that meet business needs.
It enables the generation of accurate customer service intent and responses with small amounts of data, reduces model cost and training volume, improves efficiency, and meets the specific task requirements of dialogue in the medical field.
Smart Images

Figure CN120996180A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of medical field dialogue, and particularly relates to a medical field dialogue method and device based on weak supervision and thought chain and readable medium. BACKGROUND
[0002] The large language model itself is a self-supervised generative pre-training language model (PLM), and the core idea is to learn language general representation from massive text through self-supervised learning, and then adapt to downstream tasks through fine-tuning. Existing large models such as deepseek and qwen are all one-way Transformer autoregressive generation models. Since the autoregressive model models the next token (character) through conditional probability p(x t |x <t ), it can be generated step by step, and is very suitable for query-answer form dialogue mode.
[0003] However, the existing technology directly generates answers, that is, replies to the questions in the dialogue history. If it is used in the task-oriented dialogue scene in the open domain, such as customer service dialogue, legal consultation dialogue and the like, it is not possible to effectively give replies that have positive meaning for the task according to the existing dialogue environment, and there are problems of being too specific or not being able to contain specific personalized information, which cannot meet the needs in the actual application.
[0004] Another problem is that the parameter quantity of the large model that can directly do good thought chain text understanding is large, and there is an efficiency problem in application, so how to use a smaller model to realize the capability of a large model is also a very important problem. SUMMARY
[0005] The present application aims at the above-mentioned technical problems to provide a medical field dialogue method and device based on weak supervision and thought chain and readable medium.
[0006] In a first aspect, the present application provides a medical field dialogue method based on weak supervision and thought chain, comprising the following steps:
[0007] obtaining a dialogue dataset containing a plurality of dialogue samples, each dialogue sample including a visitor sentence and a customer service sentence; constructing a first thinking chain prompt word for generating a corresponding dialogue information summary and a customer service intention according to an input dialogue sample, inputting each dialogue sample in the dialogue dataset and the first thinking chain prompt word into a trained first large language model to obtain a corresponding dialogue information summary and a customer service intention of each dialogue sample, the dialogue information summary including a visitor described illness, a visitor intention and a visitor purpose; constructing a first training dataset according to the dialogue dataset and the dialogue information summary corresponding to each dialogue sample in the dialogue dataset, and constructing a second training dataset according to the dialogue dataset and the customer service intention corresponding to each dialogue sample in the dialogue dataset;
[0008] obtaining the dialogue information summary in the first training dataset through a first-order logic rule to obtain a first prompt word for guiding customer service intention generation, constructing a third training dataset according to the dialogue sample in the first training dataset and the corresponding first prompt word, and mixing the third training dataset and the second training dataset to obtain a mixed training dataset; fine-tuning the trained second large language model using the mixed training dataset and adopting a DoRA training method to obtain a fine-tuned second large language model;
[0009] obtaining a dialogue history to be replied, inputting the dialogue history to be replied into the fine-tuned second large language model to obtain a corresponding predicted customer service intention; inputting the dialogue history to be replied and a second thinking chain prompt word for generating a corresponding dialogue information summary into the trained first large language model to obtain a dialogue information summary corresponding to the dialogue history to be replied, obtaining a second prompt word for guiding reply generation through a first-order logic rule from the dialogue information summary corresponding to the dialogue history to be replied and the predicted customer service intention; inputting the dialogue history to be replied and the second prompt word into a dialogue model to generate a corresponding customer service reply sentence.
[0010] As a preferred, the thinking chain prompt word includes:
[0011] first identifying a visitor described illness and a visitor intention according to an input dialogue sample;
[0012] identifying a visitor purpose according to the visitor described illness, the visitor intention and the input dialogue sample;
[0013] reasoning a dialogue logic meeting business requirements according to the visitor described illness, the visitor intention, the visitor purpose and the input dialogue sample, and mapping at least one customer service intention according to the dialogue logic.
[0014] As a preferred, the dialogue information summary in the first training dataset is obtained through a first-order logic rule to obtain a first prompt word for guiding customer service intention generation, specifically including:
[0015] At least one of the visitor described illness, the visitor intention and the visitor purpose in the dialogue information summary corresponding to the dialogue history in the first training data set is connected through a corresponding logical gate relationship to obtain a plurality of first thinking chain sentences, and all the first thinking chain sentences are combined to obtain a first prompt word.
[0016] As preferred, the dialogue information summary corresponding to the dialogue history to be replied and the predicted customer intention are connected through a first-order logic rule to obtain a second prompt word for guiding the reply generation, specifically including:
[0017] At least one of the visitor described illness, the visitor intention, the visitor purpose and the predicted customer intention in the dialogue information summary corresponding to the dialogue history to be replied is connected through a corresponding logical gate relationship to obtain a plurality of second thinking chain sentences, and all the second thinking chain sentences are combined to obtain a second prompt word.
[0018] As preferred, in the fine-tuning process of the trained second large language model, the dialogue sample in the mixed training data set and the corresponding first prompt word are input into the trained second large language model, or the dialogue sample in the mixed training data set is input into the trained second large language model to obtain the predicted customer intention corresponding to each dialogue sample.
[0019] As preferred, the trained first large language model includes a Qwen2.5-72B model, and the trained second large language model includes a Qwen2.5-0.5B-instruct model.
[0020] In a second aspect, the present application provides a medical field dialogue device based on weak supervision and thinking chain, comprising:
[0021] The data set construction module is configured to obtain a dialogue data set containing a plurality of dialogue samples, each dialogue sample including a visitor sentence and a customer sentence; construct a first thinking chain prompt word for generating a corresponding dialogue information summary and a customer intention according to an input dialogue sample, input each dialogue sample in the dialogue data set and the first thinking chain prompt word into a trained first large language model to obtain a dialogue information summary and a customer intention corresponding to each dialogue sample, the dialogue information summary including a visitor described illness, a visitor intention and a visitor purpose; construct a first training data set according to the dialogue data set and the dialogue information summary corresponding to each dialogue sample therein, and construct a second training data set according to the dialogue data set and the customer intention corresponding to each dialogue sample therein;
[0022] The fine-tuning module is configured to summarize the dialogue information in the first training data set by a first-order logic rule to obtain a first prompt word for guiding the generation of a customer service intention, construct a third training data set according to a dialogue sample in the first training data set and a corresponding first prompt word, and mix the third training data set with the second training data set to obtain a mixed training data set; and fine-tune the trained second large language model by using the mixed training data set and adopting a training manner of DoRA to obtain a fine-tuned second large language model.
[0023] The reply module is configured to obtain a dialogue history to be replied, input the dialogue history to be replied into the fine-tuned second large language model to obtain a corresponding predicted customer service intention, input the dialogue history to be replied and a second thought chain prompt word for generating corresponding dialogue information summary into the trained first large language model to obtain a dialogue information summary corresponding to the dialogue history to be replied, obtain a second prompt word for guiding the generation of a reply by a first-order logic rule from the dialogue information summary corresponding to the dialogue history to be replied and the predicted customer service intention, and input the dialogue history to be replied and the second prompt word into the dialogue model to generate a corresponding customer service reply sentence.
[0024] In a third aspect, the present application provides an electronic device, comprising one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the implementation manners of the first aspect.
[0025] In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method described in any of the implementation manners of the first aspect.
[0026] In a fifth aspect, the present application provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the method described in any of the implementation manners of the first aspect.
[0027] Compared with the prior art, the present application has the following beneficial effects:
[0028] (1) The medical field dialogue method based on weak supervision and thought chain proposed in the present application analyzes the dialogue information summary and the customer service intention of each dialogue sample in the training data set by the trained first large language model, and constructs the first prompt word for guiding the generation of the customer service intention in combination with the first-order logic rule, fine-tunes the trained second large language model by using the dialogue sample and the corresponding first prompt word or the customer service intention, so that it can quickly meet the dialogue service needs of the customer in any limited scene, accurately generate the predicted customer service intention, and the weak supervision is used for training in the fine-tuning process, so that the demand for data volume is not high, and the effect of efficient application at low cost is realized.
[0029] (2) The medical field dialogue method based on weak supervision and thought chain provided in the present application can be implemented by using a large language model with a data size of 0.5B-3B, without the multi-stage thought chain thinking output of a large language model with a data size of 72B, thereby reducing the use cost and training amount of the model.
[0030] (3) The medical field dialogue method based on weak supervision and thought chain provided in the present application uses the customer service intent corresponding to the dialogue history to be replied generated by the fine-tuned second large language model, and further uses the second prompt word for guiding reply generation obtained by combining dialogue information summary through first-order logic rules, to further guide the dialogue model to generate customer service reply sentences meeting specific task scenarios and accurate intents. BRIEF DESCRIPTION OF DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0032] Figure 1 The flowchart of the medical field dialogue method based on weak supervision and thought chain of the embodiments of the present application;
[0033] Figure 2 The schematic diagram of the medical field dialogue device based on weak supervision and thought chain of the embodiments of the present application;
[0034] Figure 3 The hardware structure schematic diagram of the electronic device provided in the embodiments of the present application. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings. Obviously, the described embodiments are only some of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0036] Figure 1 A medical field dialogue method based on weak supervision and thought chain provided in the embodiments of the present application is shown, comprising the following steps:
[0037] S1, obtaining a dialogue dataset containing a plurality of dialogue samples, each dialogue sample including a visitor sentence and a customer service sentence; constructing a first thinking chain prompt word for generating a corresponding dialogue information summary and a customer service intention according to an input dialogue sample, inputting each dialogue sample in the dialogue dataset and the first thinking chain prompt word into a trained first large language model to obtain a corresponding dialogue information summary and a customer service intention of each dialogue sample, the dialogue information summary including a visitor described illness, a visitor intention and a visitor purpose; constructing a first training dataset according to the dialogue dataset and the dialogue information summary corresponding to each dialogue sample in the dialogue dataset, and constructing a second training dataset according to the dialogue dataset and the customer service intention corresponding to each dialogue sample in the dialogue dataset.
[0038] In specific embodiments, the thinking chain prompt word includes:
[0039] According to the input dialogue sample, the visitor described illness and the visitor intention are identified first;
[0040] According to the visitor described illness, the visitor intention and the input dialogue sample, the visitor purpose is identified;
[0041] According to the visitor described illness, the visitor intention, the visitor purpose and the input dialogue sample, a dialogue logic meeting business requirements is reasoned out, and at least one customer service intention is mapped out according to the dialogue logic.
[0042] In specific embodiments, the trained first large language model includes a Qwen2.5-72B model, and the trained second large language model includes a Qwen2.5-0.5B-instruct model.
[0043] Specifically, the embodiments of the present application model the dialogue logic in the medical field by weakly supervised training combined with thinking chain (CoT), so as to help the dialogue history to generate a reply meeting certain business requirements. For an initial dialogue dataset D = {d1, d2, d3,..., d n}, each dialogue sample d k contains a visitor sentence and a customer service sentence.
[0044] By constructing a first thinking chain prompt word (denoted as Prompt cot ), the trained first large language model is caused to generate a dialogue information summary and a customer service intention of the current dialogue sample according to the input dialogue sample, wherein the dialogue information summary includes an illness, a visitor intention and a visitor purpose. The first thinking chain prompt word (Prompt cotThe first step is to understand the visitor's description of the illness and the visitor's intention, the second step is to understand the visitor's purpose in the dialogue sample according to the visitor's description of the illness, the visitor's intention and the dialogue sample, and the last step is to infer the dialogue logic that meets the business needs next according to the visitor's description of the illness, the visitor's intention, the visitor's purpose and the dialogue sample, and to map at least one customer service intention. In this process, the dialogue logic can be output together to facilitate confirmation of whether the output of the customer service intention meets the requirements. The visitor's intention refers to the intention in the visitor's statement in the dialogue sample, and the customer service intention refers to the intention of the statement that the customer service needs to reply. In one of the examples, the first large language model trained is Qwen2.5-72B model, and in other examples, a large language model with strong reasoning ability can also be selected.
[0045] Part of the data is obtained in the above manner for weakly supervised training. The training data set is composed of two parts: the first training data set D train1 and the second training data set D train2 , the former contains dialogue samples and their corresponding dialogue information summaries, and the latter contains only dialogue samples and their customer service intentions.
[0046] As an example, one of the first thought chain prompt words proposed by the embodiments of the present application is as follows:
[0047] Roles and tasks:
[0048] You are a senior customer service of domain, online reception patient consultation, establish trust through professional inquiry, and guide the visitor to leave contact information at the appropriate time of the dialogue, so as to follow up the service.
[0049] The task is to identify the illness expressed by the visitor and the intention of the text replied by the visitor according to the dialogue history between the visitor and the customer service, to judge the main purpose of the visitor in combination with the dialogue history, and finally to infer the intention of the customer service next according to the illness expressed by the visitor, the intention of the text replied by the visitor, the main purpose of the visitor, the dialogue history and the dialogue round.
[0050] Task rules and strategies:
[0051] 1. Ensure that the intention description needs to be selected in the intention list, and cannot be generated at will, and the intention list is: [actions];
[0052] 2. The visitor's intention can be described in combination with the visitor's illness if the visitor's illness is identified.
[0053] 3. The visitor's intention needs to judge the visitor's state, whether there is an expression of explicit consent to leave contact or go to the hospital, whether the visitor has been diagnosed or treated.
[0054] 4. If the visitor has a description of the medical history, it can be inferred that the customer service intent includes "asking if there is a hospital medical history".
[0055] 5. Prohibit repeating the content asked in the previous dialogue history or the content the visitor has mentioned or answered before, and prohibit generating the content answered before.
[0056] Step:
[0057] 1. Disease identification: analyze the dialogue history between the visitor and the customer service, judge the disease described by the visitor, and if the consultation is for medicine, infer the disease according to the efficacy.
[0058] 2. Identify visitor intent: identify the visitor's intent based on the identified disease of the visitor, combined with the dialogue history between the visitor and the customer service.
[0059] 3. Determine the purpose of the visitor: think about the reason why the visitor comes to the hospital for consultation, determine the main purpose of the visitor, such as understanding the price, the degree of pain, the treatment method, etc.
[0060] 4. Reasoning customer service intent: according to the identified disease, visitor intent and visitor purpose, combined with the dialogue history and the round of dialogue history, infer the intent of the customer service.
[0061] Requirements:
[0062] 1. Prohibit outputting "for example:..." such as explanation;
[0063] 2. The intent description is no more than 20 characters;
[0064] 3. Visitor intent and customer service intent are separated by commas in multiple cases;
[0065] 4. Your output format must be: Disease:...\nVisitor intent:...\nVisitor purpose:...\nCustomer service intent:...\n\n.
[0066] The above first thought chain prompt word is only one example, which can be further optimized and adjusted according to the specific requirements to guide the generation of more accurate dialogue information summary and customer service intent.
[0067] S2, the dialogue information summary in the first training data set is obtained by first-order logic rules to get the first prompt word for guiding the generation of customer service intent, according to the dialogue sample in the first training data set and its corresponding first prompt word, a third training data set is constructed, and the third training data set is mixed with the second training data set to obtain a mixed training data set; using the mixed training data set and adopting the training method of DoRA, the trained second large language model is fine-tuned to obtain the fine-tuned second large language model.
[0068] In specific embodiments, the dialogue information summary in the first training data set is summarized by a first-order logic rule to obtain a first prompt word for guiding the customer service intent generation, specifically including:
[0069] At least one of the visitor described symptoms, the visitor intent and the visitor purpose in the dialogue information summary in the first training data set is connected by a corresponding logic gate relationship to obtain a plurality of first thinking chain sentences, and all the first thinking chain sentences are combined to obtain the first prompt word.
[0070] In specific embodiments, in the fine-tuning process of the trained second large language model, the dialogue samples in the mixed training data set and the corresponding first prompt words are input into the trained second large language model, or the dialogue samples in the mixed training data set are input into the trained second large language model to obtain the predicted customer service intent corresponding to each dialogue sample.
[0071] Specifically, before training the model, the dialogue information summary in the first training data set D train1 is summarized by a first-order logic rule (FOL, first order rule) to generate different first thinking chain sentences and combine them as a first prompt word. The first-order logic rule is a superposition rule using AND, OR and NOT logic gate relationships. When constructing the first prompt word, the first training data set D train1At least one of the symptoms described by the visitor, the visitor's intention, and the visitor's purpose is constituted into a first thinking chain sentence by adopting a first-order logic rule, and all first thinking chain sentences are combined to constitute a first prompt word, so that the dialog samples in the first training data set and the corresponding first prompt words are constructed into a third training data set. The third training data set and the second training data set are mixed to obtain a mixed data set, and the trained second large language model is fine-tuned using the mixed data set. In the fine-tuning process, a weakly supervised manner is adopted in combination with a thinking chain, and a DoRA training manner is adopted for training, so that the number of model parameters required for training is very small. DoRA is a weight decomposition LoRA, and its specific training process is not described here. In one example, the trained second large language model takes the Qwen2.5-0.5B-instruct model as the base model, and in other examples, a large language model with small parameters can also be selected. The embodiments of the application can improve the efficiency by 5-10 times compared with the generation of multi-step thinking chains, because multi-step thinking chains can be relatively well completed by at least a 32B model. After fine-tuning, the fine-tuned second large language model becomes a special model that can generate a corresponding predicted customer intention for each dialog history. The trained second large language model is weakly supervised by mixing the dialog text with the first prompt word in the training data set and the dialog text with the customer intention as the label, and the first prompt word composed of the first thinking chain sentence, so that the thinking process required in the customer intention recognition process can be combined, and the training data amount is greatly reduced by using the DoRA training manner.
[0072] S3, obtaining a dialog history to be replied, inputting the dialog history to be replied into the fine-tuned second large language model to obtain a corresponding predicted customer intention; inputting the dialog history to be replied and a second thinking chain prompt word for generating a corresponding dialog information summary into the trained first large language model to obtain a dialog information summary corresponding to the dialog history to be replied, obtaining a second prompt word for guiding reply generation by a first-order logic rule from the dialog information summary corresponding to the dialog history to be replied and the predicted customer intention; inputting the dialog history to be replied and the second prompt word into the dialog model to generate a corresponding customer reply sentence.
[0073] In specific embodiments, the second prompt word for guiding reply generation is obtained from the dialog information summary corresponding to the dialog history to be replied and the predicted customer intention by a first-order logic rule, specifically comprising:
[0074] At least one of the visitor described condition, the visitor intent, the visitor target and the predicted customer intent in the dialogue information summary corresponding to the dialogue history to be replied is connected through a corresponding logical gate relationship to obtain a plurality of second thinking chain sentences, and all the second thinking chain sentences are combined to obtain a second prompt word.
[0075] Specifically, after fine-tuning obtains the fine-tuned second large language model, it can be directly applied in the dialogue system, and the fine-tuned second large language model is used to generate the predicted customer intent corresponding to the dialogue history to be replied. And the second thinking chain prompt word for generating the corresponding dialogue information summary is constructed on the basis of the first thinking chain prompt word in step S1, and the dialogue history to be replied and the second thinking chain prompt word are input into the trained first large language model to obtain the dialogue information summary corresponding to the dialogue history to be replied. Then the dialogue information summary corresponding to the dialogue history to be replied and the predicted customer intent are connected through a first-order logic rule to obtain a second prompt word for guiding reply generation. In this way, the model output result can be a conventional natural text, which can facilitate the next step of directly guiding the model to generate text.
[0076] In one of the examples, the process of obtaining the second prompt word through the first-order logic rule is as follows:
[0077] The visitor intent and the visitor target in the dialogue information summary corresponding to the dialogue history to be replied are connected through an and relationship to construct a second thinking chain sentence;
[0078] The visitor described condition and the visitor target in the dialogue information summary corresponding to the dialogue history to be replied are connected through an or relationship to construct a second thinking chain sentence;
[0079] The visitor intent and the predicted customer intent in the dialogue information summary corresponding to the dialogue history to be replied are connected through an or relationship to construct a second thinking chain sentence;
[0080] The visitor target and the predicted customer intent in the dialogue information summary corresponding to the dialogue history to be replied are connected through an or relationship to construct a second thinking chain sentence;
[0081] The above second thinking chain sentences are combined to obtain the second prompt word.
[0082] As an example, the following proposes a combination of a second thinking chain sentence:
[0083] a+b: The reply needs to combine the visitor described condition "{topic}" in the dialogue history and the main target "{target}" inquired by the visitor in the dialogue history to guide the reply.
[0084] b+c: reply to the main purpose "{target}" that needs to be consulted for the visitor involved in the dialogue history, and reply according to the visitor intent "{action}".
[0085] The second thought chain statement of the two first-order logic rules above is composed in a combined form to form a second prompt word.
[0086] Further, input the dialogue history to be replied to and the second prompt word into the dialogue model, so as to generate and output the corresponding customer service reply statement. Finally, in the case of obtaining the second prompt word, the dialogue model of 14B can achieve the generation capability of the dialogue model of 72B. Of course, for a large parameter model with reasoning capability such as deepseek-32B / r1, the efficiency of outputting the thinking process is also far lower than the method proposed in the embodiment of the present application.
[0087] Further reference Figure 2 As an implementation of the method shown in the above figures, the present application provides an embodiment of a medical field dialogue device based on weak supervision and thought chain. The device embodiment corresponds to the method embodiment shown in Figure 1 , and the device can be applied to various electronic devices.
[0088] The present application provides a medical field dialogue device based on weak supervision and thought chain, comprising:
[0089] The data set construction module 1 is configured to obtain a dialogue data set containing a plurality of dialogue samples, each dialogue sample including a visitor statement and a customer service statement; construct a first thought chain prompt word for generating corresponding dialogue information summary and customer service intent according to the input dialogue sample, input each dialogue sample in the dialogue data set and the first thought chain prompt word into the trained first large language model, obtain the corresponding dialogue information summary and customer service intent of each dialogue sample, and the dialogue information summary includes the visitor's description of the disease, the visitor's intent and the visitor's purpose; construct a first training data set according to the dialogue data set and the dialogue information summary corresponding to each dialogue sample in it, and construct a second training data set according to the dialogue data set and the customer service intent corresponding to each dialogue sample in it;
[0090] The fine-tuning module 2 is configured to obtain the first prompt word for guiding the generation of the customer service intent by the first-order logic rule from the dialogue information summary in the first training data set, construct a third training data set according to the dialogue sample and its corresponding first prompt word in the first training data set, mix the third training data set and the second training data set to obtain a mixed training data set; fine-tune the trained second large language model using the mixed training data set and adopting the training method of DoRA, to obtain the fine-tuned second large language model;
[0091] The reply module 3 is configured to obtain a dialogue history to be replied, input the dialogue history to be replied into the second large language model, obtain a corresponding predicted customer service intention, input the dialogue history to be replied and a second thinking chain prompt word used for generating a corresponding dialogue information summary into the first large language model, obtain a dialogue information summary corresponding to the dialogue history to be replied, obtain a second prompt word used for guiding reply generation through a first-order logic rule from the dialogue information summary corresponding to the dialogue history to be replied and the predicted customer service intention, and input the dialogue history to be replied and the second prompt word into the dialogue model to generate a corresponding customer service reply sentence.
[0092] Figure 3 A hardware structure schematic diagram of an electronic device provided by the embodiment of the present application is shown in the figure. Figure 3 As shown in the figure, the electronic device of the embodiment includes a processor 301 and a memory 302; the memory 302 is used for storing computer execution instructions; the processor 301 is used for executing the computer execution instructions stored by the memory to realize each step executed by the electronic device in the above-mentioned embodiment. For details, please refer to the related description in the foregoing method embodiment.
[0093] Optionally, the memory 302 can be independent or integrated with the processor 301.
[0094] When the memory 302 is independently arranged, the electronic device further includes a bus 303 for connecting the memory 302 and the processor 301.
[0095] The embodiment of the present application further provides a computer storage medium, and the computer storage medium stores computer execution instructions; when the processor 301 executes the computer execution instructions, the method as above is realized.
[0096] The embodiment of the present application further provides a computer program product, and the computer program product includes a computer program; when the computer program is executed by the processor 301, the method as above is realized.
[0097] In the embodiments provided by the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are only schematic. The division of the modules is only a logical function division. There can be another division manner in actual implementation, for example, a plurality of modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the display or discussion about the coupling or direct coupling or communication connection between the modules can be indirect coupling or communication connection through some interfaces, devices or modules, and can be electrical, mechanical or in other forms.
[0098] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units, i.e., may be located in one place, or may be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to implement the embodiments of the present application.
[0099] In addition, each functional module in various embodiments of the present application can be integrated in one processing unit, or each module can be physically present alone, or two or more modules can be integrated in one unit. The unit formed by the above modules can be realized in the form of hardware or in the form of hardware plus software functional unit.
[0100] The integrated modules realized in the form of software functional modules can be stored in a computer readable storage medium. The software functional modules stored in a storage medium include a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor 301 to execute part of the steps of the method of various embodiments of the present application.
[0101] It should be understood that the above processor 301 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor 301 can also be any conventional processor 301, etc. The steps of the method disclosed in the application can be directly embodied as hardware processor 301 execution, or executed by a combination of hardware and software modules in the processor 301.
[0102] The memory 302 can include a high-speed RAM memory, and can also include a non-volatile storage NVM, for example, at least one disk memory, and can also be a U disk, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.
[0103] The bus 303 can be an Industry Standard Architecture (ISA), a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 303 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus 303 in the drawings of the present application does not limit to only one bus 303 or one type of bus 303.
[0104] The storage medium described above can be realized by any type of volatile or nonvolatile storage devices or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic storage, a flash memory, a magnetic disk, or an optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0105] An exemplary storage medium is coupled to the processor 301, so that the processor 301 can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor 301. The processor 301 and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor 301 and the storage medium can also exist as discrete components in an electronic device or a host device.
[0106] Those of ordinary skill in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by relevant hardware instructed by programs. The foregoing programs can be stored in a computer readable storage medium. When the programs are executed, the steps of the above-mentioned method embodiments are executed; and the foregoing storage medium includes various media that can store program codes, such as ROM, RAM, magnetic disks, or optical disks.
[0107] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A weakly supervised and thought chain based medical domain dialogue method, characterized in that, The method comprises the following steps: obtaining a dialogue dataset comprising a plurality of dialogue samples, each dialogue sample comprising a visitor sentence and a customer service sentence; constructing a first thinking chain prompt word for generating a corresponding dialogue information summary and a customer service intention according to an input dialogue sample, inputting each dialogue sample in the dialogue dataset and the first thinking chain prompt word into a trained first large language model to obtain a corresponding dialogue information summary and a customer service intention of each dialogue sample, wherein the dialogue information summary comprises a visitor described disease, a visitor intention and a visitor purpose; constructing a first training dataset according to the dialogue dataset and the dialogue information summary corresponding to each dialogue sample in the dialogue dataset, and constructing a second training dataset according to the dialogue dataset and the customer service intention corresponding to each dialogue sample in the dialogue dataset; obtaining a dialogue information summary in the first training dataset through a first-order logic rule to obtain a first prompt word for guiding customer service intention generation, constructing a third training dataset according to the dialogue sample and the corresponding first prompt word in the first training dataset, and mixing the third training dataset and the second training dataset to obtain a mixed training dataset; fine-tuning a trained second large language model using the mixed training dataset and adopting a DoRA training method to obtain a fine-tuned second large language model; obtaining a dialogue history to be replied, inputting the dialogue history to be replied into the fine-tuned second large language model to obtain a corresponding predicted customer service intention; inputting the dialogue history to be replied and a second thinking chain prompt word for generating a corresponding dialogue information summary into the trained first large language model to obtain a dialogue information summary corresponding to the dialogue history to be replied, and obtaining a second prompt word for guiding reply generation through a first-order logic rule according to the dialogue information summary corresponding to the dialogue history to be replied and the predicted customer service intention; inputting the dialogue history to be replied and the second prompt word into a dialogue model to generate a corresponding customer service reply sentence. 2.The weakly supervised and thought chain based medical domain dialogue method according to claim 1, wherein, The thinking chain prompt word comprises: firstly identifying a visitor described disease and a visitor intention according to an input dialogue sample; identifying a visitor purpose according to the visitor described disease, the visitor intention and the input dialogue sample; reasoning a dialogue logic meeting business requirements according to the visitor described disease, the visitor intention, the visitor purpose and the input dialogue sample, and mapping at least one customer service intention according to the dialogue logic. 3.The weakly supervised and thought chain based medical domain dialogue method according to claim 1, wherein, The first prompt word for guiding customer service intention generation is obtained through a first-order logic rule according to the dialogue information summary in the first training dataset, and specifically comprises: connecting at least one of the visitor described disease, the visitor intention and the visitor purpose in the dialogue information summary in the first training dataset through a corresponding logic gate relationship to obtain a plurality of first thinking chain sentences, and combining all the first thinking chain sentences to obtain the first prompt word. 4.The weakly supervised and thought chain based medical domain dialogue method according to claim 1, wherein, The second prompt word for guiding reply generation is obtained through a first-order logic rule according to the dialogue information summary corresponding to the dialogue history to be replied and the predicted customer service intention, and specifically comprises: At least one of the visitor described condition, the visitor intent, the visitor purpose and the predicted customer intent in the dialogue information summary corresponding to the dialogue history to be replied is connected through a corresponding logical gate relationship to obtain a plurality of second thinking chain sentences, and all the second thinking chain sentences are combined to obtain the second prompt word. 5.The weakly supervised and thought chain based medical domain dialogue method according to claim 1, wherein, In the fine-tuning process of the trained second large language model, the dialogue samples in the mixed training data set and their corresponding first prompt words are input into the trained second large language model, or the dialogue samples in the mixed training data set are input into the trained second large language model to obtain the predicted customer intent corresponding to each dialogue sample. 6.The weakly supervised and thought chain based medical domain dialogue method according to claim 1, wherein, The trained first large language model comprises a Qwen2.5-72B model, and the trained second large language model comprises a Qwen2.5-0.5B-instruct model.
7. A medical field dialogue device based on weak supervision and thought chain, characterized in that, Comprise: A data set construction module configured to obtain a dialogue data set comprising a plurality of dialogue samples, each dialogue sample comprising a visitor sentence and a customer sentence; A first thinking chain prompt word for generating a corresponding dialogue information summary and a customer intent according to an input dialogue sample is constructed, each dialogue sample in the dialogue data set and the first thinking chain prompt word are input into a trained first large language model to obtain a dialogue information summary and a customer intent corresponding to each dialogue sample, the dialogue information summary comprising a visitor described condition, a visitor intent and a visitor purpose; a first training data set is constructed according to the dialogue data set and the dialogue information summary corresponding to each dialogue sample therein, and a second training data set is constructed according to the dialogue data set and the customer intent corresponding to each dialogue sample therein; A fine-tuning module configured to obtain a first prompt word for guiding customer intent generation through a first-order logic rule from the dialogue information summary in the first training data set, construct a third training data set according to the dialogue samples in the first training data set and their corresponding first prompt words, and mix the third training data set and the second training data set to obtain a mixed training data set; A trained second large language model is fine-tuned using the mixed training data set and a DoRA training method to obtain a fine-tuned second large language model. A reply module configured to obtain a dialogue history to be replied, input the dialogue history to be replied into the fine-tuned second large language model to obtain a corresponding predicted customer intent; The dialogue history to be replied and the second thinking chain prompt word for generating a corresponding dialogue information summary are input into the trained first large language model to obtain a dialogue information summary corresponding to the dialogue history to be replied, and the dialogue information summary corresponding to the dialogue history to be replied and the predicted customer intent are connected through a first-order logic rule to obtain a second prompt word for guiding reply generation; The dialogue history to be replied and the second prompt word are input into a dialogue model to generate a corresponding customer reply sentence.
8. An electronic device comprising: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement a method as claimed in any of claims 1-6.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program, which when executed by a processor, implements a method as claimed in any of claims 1-6.
10. A computer program product comprising a computer program, characterized in that, The computer program, which when executed by a processor, implements a method as claimed in any of claims 1-6.
Citation Information
Patent Citations
Emotion support dialogue generation method, system and device based on thinking chain reasoning
CN117932041A
Generative question answering method and device based on classification guidance and readable medium
CN119577075A
Method and device for implementing text2sql model based on thinking chain, computer equipment and readable storage medium
CN119938697A
System and method using intelligent privacy assistant model for large language model operation
US20250131122A1
Intelligent dialogue method and apparatus and electronic device
WO2021249528A1
Cited By
Training method and system of medical dialogue model
CN121351970A
Training method and system of medical dialogue model
CN121351970B
