LLM model reasoning method based on multidisciplinary and related equipment
By determining relevant disciplines and their complexity levels in user input, the method optimizes LLM reasoning to match complexity, ensuring accurate and efficient multi-disciplinary responses, addressing the challenge of complex medical queries.
Patent Information
- Application Number
- CN202510288734.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-07-15
AI Technical Summary
Large-scale language model (LLM) is difficult to effectively reason in the face of complex medical problems involving multiple different disciplines, resulting in inaccurate inference results and waste of computing resources.
By determining the multiple disciplines related to the user's input text and their inference complexity, constructing prompt words corresponding to the discipline, and inputting them to match the LLM model for inference calculation, generating inference results corresponding to the discipline, using a multi-disciplinary perspective to simulate multi-disciplinary team collaboration, combining search enhancement generation technology and multi-disciplinary knowledge base for auxiliary reasoning.
While ensuring the accuracy of inference results, it reduces the overall inference complexity of the LLM model, improves inference efficiency, avoids waste of computing resources, and improves user experience.
Smart Images

Figure CN120317360A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of this specification relate to the technical field of large models, and in particular, to a multi-disciplinary based LLM model inference method and related devices. Background Art
[0002] Large Language Models (LLMs), or pre-trained models, are language models constructed by deep neural networks containing hundreds of billions of parameters. Using self-supervised learning methods, they have mastered many language phenomena through pre-training on large and diverse public datasets.
[0003] Due to their excellent language understanding ability, LLM models can communicate with users and perform corresponding inference tasks to answer users' questions. However, in some cases, the text input by users may involve content from multiple different disciplines. Especially in the medical field, the problems presented by users during medical consultations are very likely to cover complex content related to multiple departments such as the Department of Respiratory Medicine, the Department of Otorhinolaryngology, and the Department of Psychiatry. This poses a great challenge to the inference ability of LLM models. Summary of the Invention
[0004] In view of this, one or more embodiments of this specification provide a multi-disciplinary based LLM model inference method and related devices.
[0005] In a first aspect, this specification provides a multi-disciplinary based LLM model inference method, the method comprising:
[0006] Obtain a target text input by a user;
[0007] Determine multiple disciplines related to the target text, and the inference complexity corresponding to each of the multiple disciplines;
[0008] For any target discipline among the multiple disciplines, construct a prompt corresponding to the target discipline based on the target text and the target discipline, and input the prompt into an LLM model that matches the inference complexity of the target discipline. The LLM model performs inference calculations on the target text based on the prompt to generate an inference result corresponding to the target discipline; wherein, the length of the inference result corresponding to each discipline is positively correlated with the inference complexity of that discipline.
[0009] In a second aspect, this specification provides a multi-disciplinary based LLM model inference device, the device comprising:
[0010] An obtaining unit, configured to obtain a target text input by a user;
[0011] A determination unit for determining multiple disciplines related to the target text and the inference complexity corresponding to each of the multiple disciplines respectively;
[0012] An inference unit for, for any target discipline among the multiple disciplines, constructing a prompt word corresponding to the target discipline based on the target text and the target discipline, and inputting the prompt word into an LLM model matching the inference complexity of the target discipline. The LLM model performs inference calculations on the target text based on the prompt word to generate an inference result corresponding to the target discipline; wherein the length of the inference result corresponding to each discipline is positively correlated with the inference complexity of that discipline.
[0013] Correspondingly, this specification also provides a computing device, including: a memory and a processor; a computer program / instructions that can be run by the processor is stored on the memory; when the processor runs the computer program / instructions, it executes the multi-disciplinary LLM model inference method described in the first aspect above.
[0014] Correspondingly, this specification also provides a computer-readable storage medium, on which a computer program / instructions is stored. When the computer program / instructions are run by a processor, it executes the multi-disciplinary LLM model inference method described in the first aspect above.
[0015] Correspondingly, this specification also provides a computer program product, which includes computer program / instructions. When the computer program / instructions are executed by a processor, it executes the multi-disciplinary LLM model inference method described in the first aspect above.
[0016] In summary, after obtaining the target text input by the user, the present application can determine multiple disciplines related to the target text, as well as the reasoning complexities corresponding to the multiple disciplines respectively. Further, for any target discipline among the multiple disciplines, the present application can construct a prompt word corresponding to the target discipline based on the target text and the target discipline, and input the prompt word into an LLM model matching the reasoning complexity of the target discipline. The LLM model performs reasoning calculations on the target text based on the prompt word to generate a reasoning result corresponding to the target discipline; wherein, the length of the reasoning result corresponding to each discipline is positively correlated with the reasoning complexity of the discipline. In this way, the present application determines multiple disciplines related to the target text input by the user, adaptively adjusts the reasoning complexities corresponding to different disciplines, and then can perform multi-disciplinary reasoning calculations on the target text according to the multiple disciplines and their corresponding reasoning complexities. It realizes comprehensive and multi-angle reasoning analysis by combining multi-disciplinary knowledge, while minimizing the overall reasoning complexity of the LLM model as much as possible, ensuring the correctness of the final reasoning result, avoiding waste of unnecessary computing resources and storage resources, improving the reasoning efficiency, and thus guaranteeing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a schematic diagram of a system architecture provided by an exemplary embodiment;
[0018] Figure 2 is a schematic flowchart of a method for reasoning an LLM model based on multiple disciplines provided by an exemplary embodiment;
[0019] Figure 3 is a schematic diagram of the training process of a planner provided by an exemplary embodiment;
[0020] Figure 4 is a schematic diagram of a reasoning plan generated by a planner provided by an exemplary embodiment;
[0021] Figure 5 is a schematic diagram of the structure of a device for reasoning an LLM model based on multiple disciplines provided by an exemplary embodiment;
[0022] Figure 6 is a schematic diagram of the structure of a computing device provided by an exemplary embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0023] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. On the contrary, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0024] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily executed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step for description in other embodiments.
[0025] It should be noted that the "plurality" referred to in this application means two or more.
[0026] In addition, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or reject.
[0027] Due to its excellent language understanding ability, the LLM model can converse with users and perform corresponding reasoning tasks to answer users' questions and solve their doubts. Exemplarily, taking the medical scenario as an example, the reasoning task may be to provide users with medication advice or perform disease diagnosis, or to recommend suitable departments for users to visit (such as the Department of Stomatology, Department of Psychiatry, Department of Cardiology, or Department of Respiratory Medicine, etc.) before they see a doctor. This specification does not make specific limitations in this regard. Exemplarily, taking the shopping scenario as an example, the reasoning task may be to recommend various types of goods that meet the user's preferences (such as electronic products, home furnishings, and clothing, etc.). This specification does not make specific limitations in this regard.
[0028] However, the text input by users may involve complex content corresponding to multiple different disciplines, which poses a great challenge to the reasoning ability of the LLM model. Especially in the medical field, the problems of users seeing a doctor are very likely to cover complex content related to multiple departments such as the Department of Respiratory Medicine, Department of Otorhinolaryngology, and Department of Psychiatry, and the medical factual requirements for model reasoning in the medical field are relatively high. Any incorrect reasoning result may endanger the physical health of users.
[0029] Based on this, this specification provides a technical solution, which performs multi-disciplinary inference calculations according to multiple disciplines related to the user input text and the inference complexities respectively corresponding to the multiple disciplines, so as to ensure the correctness of the inference results and minimize the overall inference complexity as much as possible, and improve the inference efficiency.
[0030] In implementation, this application first obtains the target text input by the user, and then can determine multiple disciplines related to the target text and the inference complexities respectively corresponding to the multiple disciplines. Further, for any target discipline among the multiple disciplines, this application can construct a prompt word corresponding to the target discipline based on the target text and the target discipline, and input the prompt word into an LLM model matching the inference complexity of the target discipline. The LLM model performs inference calculations on the target text based on the prompt word to generate an inference result corresponding to the target discipline; wherein, the length of the inference result corresponding to each discipline is positively correlated with the inference complexity of the discipline.
[0031] In the above technical solution, after this application obtains the target text input by the user, it can determine multiple disciplines related to the target text and adaptively adjust the inference complexities corresponding to different disciplines, and then can perform multi-disciplinary inference calculations on the target text according to the multiple disciplines and their corresponding inference complexities. In this way, this application can, while ensuring comprehensive and multi-angle inference analysis by combining multi-disciplinary knowledge, minimize the overall inference complexity of the LLM model as much as possible, not only ensure the correctness of the final inference result, but also avoid waste of unnecessary computing resources and storage resources, improve the inference efficiency, and thus ensure the user experience.
[0032] Please refer to Figure 1 , Figure 1 which is a schematic diagram of a system architecture provided by an exemplary embodiment. One or more embodiments provided in this specification can be specifically implemented in the Figure 1 system architecture shown or a similar system architecture.
[0033] As Figure 1 shown, an LLM model is installed in the computing device, and the LLM model can be used to perform inference tasks related to the target application scenario. As Figure 1 shown, the user can have multiple rounds of conversations with the LLM model through an input device (such as a keyboard or a touch screen, etc.) provided by the computing device to consult questions related to the target application scenario to the LLM model and obtain corresponding answers, etc.
[0034] In one illustrated embodiment, the above-mentioned target application scenario can be a medical scenario, a shopping scenario, or any other possible scenario, and this specification does not make specific limitations thereon.
[0035] In one illustrated embodiment, the above-mentioned LLM model can be a pre-trained LLM base model, or it can also be an LLM service model obtained by further performing fine-tuning training on the pre-trained LLM base model based on a dataset related to the target application scenario. This specification does not make specific limitations thereon.
[0036] Furthermore, to solve the problem that the LLM model lacks professional knowledge of the target application scenario, in one illustrated embodiment, the Retrieval-Augmented Generation (RAG) technology can be used to assist the LLM model in performing inference calculations. Among them, RAG is a technology that combines information retrieval and text generation, aiming to use an external knowledge base to improve the generation quality of the LLM model.
[0037] Furthermore, considering that the text input by the user may contain complex content related to multiple disciplines, therefore, based on the RAG technology, this application can also combine knowledge bases corresponding to multiple disciplines respectively to assist the LLM model in performing multi-disciplinary and multi-angle inference calculations, so as to ensure the inference ability of the LLM model when dealing with complex multi-disciplinary problems.
[0038] In one illustrated embodiment, this application can adopt the Multidisciplinary Teams (MDTS) to achieve multi-disciplinary inference calculations. Still taking the medical scenario as an example, MDTS can simulate the collaboration of multi-disciplinary teams in a real medical environment. For example, MDTS allows the LLM model to simulate (or act as) different specialist doctors, such as cardiologists, psychiatrists, etc., to analyze and discuss a case from different professional perspectives. This multi-disciplinary collaboration method is similar to multi-disciplinary consultations in hospitals, which can integrate professional knowledge in different fields, reduce biases brought by a single perspective, and improve the inference effect.
[0039] In one illustrated embodiment, MDTS can let the LLM model simulate different specialist doctors by constructing prompts (prompts). Exemplarily, the prompt can include prompt fragments such as "Assume you are a cardiologist, please analyze..." to let the LLM model simulate a cardiologist. Specifically, the LLM model will call the knowledge base corresponding to cardiology to analyze the problem from the perspective of a cardiologist.
[0040] Next, it will be combined with Figure 1The system architecture shown is used to illustrate the multi-disciplinary LLM model inference method provided in this application.
[0041] First, as Figure 1 shown, the user can input the target text through the input device (such as a keyboard or a touch screen, etc.) provided by the computing device. Correspondingly, the computing device can obtain the target text input by the user.
[0042] Exemplarily, taking the target application scenario as a medical scenario as an example, the target text may include the patient's medical consultation problems. For example, it may be "Doctor, I had a sore throat two days ago, and I've been having a runny nose and coughing continuously recently. What medicine should I take?", or it may also be "My wife is 4 months pregnant, but she has been having high blood pressure. Can she take antihypertensive drugs?", etc. This specification does not make specific limitations on this.
[0043] Further, as Figure 1 shown, the computing device can input the obtained target text into a pre-trained scheduler, and the scheduler determines multiple disciplines related to the target text, as well as the inference complexity corresponding to each of the multiple disciplines. For specific details, reference can be made to the description of the corresponding embodiments below Figures 2 - 4 and will not be elaborated here.
[0044] Further, as Figure 1 shown, the computing device can construct multiple prompt words corresponding to the multiple disciplines based on the above target text and the multiple disciplines, and then input the multiple prompt words into the LLM models that match the inference complexity of the multiple disciplines respectively. Correspondingly, the LLM models can perform multi-disciplinary inference calculations on the target text based on the multiple prompt words, so as to generate inference results corresponding to each of the multiple disciplines. For specific details, reference can be made to the description of the corresponding embodiments below Figure 2 and will not be elaborated here.
[0045] It can be understood that the length of the inference result corresponding to each discipline is often positively correlated with the inference complexity of that discipline, that is, the higher the inference complexity, the deeper and wider the inference calculations the LLM model will perform, consuming more computing resources and storage resources, and thus generating a longer, richer and more comprehensive inference result.
[0046] Further, as Figure 1 shown, the LLM model can further generate a response text corresponding to the target text based on the generated inference results corresponding to the multiple disciplines respectively. Exemplarily, still taking the medical scenario as an example, the response text corresponding to the target text may include a medical diagnosis result.
[0047] As described above, the present application determines multiple disciplines related to the target text input by the user, adaptively adjusts the inference complexity corresponding to different disciplines, and then can perform multi-disciplinary inference calculations on the target text according to the multiple disciplines and their corresponding inference complexities. It realizes reducing the overall inference complexity of the LLM model as much as possible while ensuring comprehensive and multi-angle inference analysis by combining multi-disciplinary knowledge, not only ensuring the correctness of the final inference result, but also avoiding unnecessary waste of computing resources and storage resources, improving the inference efficiency, and thus ensuring the user experience.
[0048] In one illustrated embodiment, Figure 1 The computing device shown can be, for example, a smart wearable device, a smartphone, a tablet computer, a laptop computer, a desktop computer, a server, or a server cluster composed of multiple servers, etc., and this specification does not make specific limitations on this.
[0049] Please refer to Figure 2 , Figure 2 which is a schematic flowchart of a method for inferring an LLM model based on multiple disciplines provided by an exemplary embodiment. This method can be applied to Figure 1 the computing device in the system architecture shown. As Figure 2 shown, this method can specifically include the following steps S201 - step S203.
[0050] Step S201, obtain the target text input by the user.
[0051] First, the computing device can obtain the target text input by the user.
[0052] In one illustrated embodiment, the target text can be the dialogue text of multiple rounds of conversations between the user and the LLM model. For example, it can be the latest dialogue text input by the user in the current round, or can also include the historical dialogue text input by the user, and this specification does not make specific limitations on this.
[0053] In one illustrated embodiment, the target text can also be a case, a summary of the condition, or a historical medical record input by the user, etc., and this specification does not make specific limitations on this.
[0054] Exemplarily, still taking the medical scenario as an example, the target text can include the medical consultation problem of the patient (i.e., the user). For example, it can be "Doctor, I had a sore throat two days ago, and I've been having a runny nose and coughing constantly lately. What medicine should I take?", or it can also be "My wife is 4 months pregnant, but she has been having high blood pressure. Can she take antihypertensive drugs?", etc., and this specification does not make specific limitations on this.
[0055] Step S202: Determine multiple disciplines related to the target text, as well as the reasoning complexities corresponding to the multiple disciplines respectively.
[0056] Further, after obtaining the target text input by the user, the computing device can determine multiple disciplines related to the target text, as well as the reasoning complexities corresponding to the multiple disciplines respectively.
[0057] In an illustrated embodiment, still taking the medical scenario as an example, the above-mentioned disciplines can be disciplines related to the medical field (such as respiratory medicine and otolaryngology, etc.). Correspondingly, determining each discipline and its corresponding reasoning complexity is equivalent to simulating a medical team, which can include at least one doctor related to the discipline. It is not difficult to understand that the more doctors included in the medical team, the higher the reasoning complexity.
[0058] It should be noted that this specification does not particularly limit the specific implementation manner of determining the above-mentioned multiple disciplines and their corresponding reasoning complexities.
[0059] In an illustrated embodiment, when determining multiple disciplines related to the target text, it may include: performing entity extraction on the target text to extract the text entities (or entity mentions) included in the target text; further, in a way of entity linking, searching for entities matching the extracted text entities from the knowledge graph. Then, determine multiple disciplines related to the entity according to the entities found from the knowledge graph, etc., and this specification does not make specific limitations on this.
[0060] In an illustrated embodiment, still taking the medical scenario as an example, the target text and a preset entity extraction instruction can be input into the LLM model, and the LLM model extracts the text entities in the medical field included in the target text according to the entity extraction instruction, such as disease names, symptoms, and drug names, etc., and this specification does not make specific limitations on this. Further, the extracted text entities can be matched with the entities in the medical knowledge graph to clarify their specific meanings and correlations, so as to identify the specific medical problems involved in the target text, and then determine multiple disciplines related to the target text, etc., and this specification does not make specific limitations on this.
[0061] Exemplarily, assume the target text is "Doctor, I've had a sore throat for the past two days, and I've been having a runny nose and coughing constantly recently. What medicine should I take?" The multiple disciplines related to the target text can include respiratory medicine and otolaryngology, etc., or the disciplines related to the target text can also only include general practice medicine, and this specification does not make specific limitations on this. Among them, general practice medicine is mainly used to provide comprehensive and simple clinical medical diagnoses.
[0062] Exemplarily, assume that the target text is "My wife is 4 months pregnant, but has been suffering from high blood pressure. Can she take antihypertensive drugs?" Then the multiple disciplines related to this target text can include obstetrics and cardiovascular medicine, etc. This specification does not make specific limitations on this.
[0063] In an illustrated embodiment, when determining the inference complexity corresponding to multiple disciplines respectively, the inference complexity corresponding to each discipline can be determined according to the complexity of each discipline itself and / or the content complexity (or problem complexity) of the relevant content of this discipline included in the target text. Among them, the inference complexity corresponding to each discipline can be positively correlated with the complexity of this discipline itself. For example, it is positively correlated with the disease diagnosis difficulty or treatment difficulty of each department. Among them, the inference complexity corresponding to each discipline can also be positively correlated with the content complexity of the relevant content of this discipline included in the target text. For example, it is positively correlated with the complexity of the problem symptoms described by the user, etc. This specification does not make specific limitations on this.
[0064] In an illustrated embodiment, since general practice mainly provides comprehensive simple clinical medical diagnoses, the inference complexity corresponding to general practice can be relatively low. This specification does not make specific limitations on this.
[0065] In an illustrated embodiment, the overall inference complexity can also be determined according to the overall complexity of the medical problems included in the target text, and then the inference complexity corresponding to multiple disciplines respectively can be further determined, etc. This specification does not make specific limitations on this.
[0066] In an illustrated embodiment, the target text can be input into a pre-trained planner, and this planner can determine multiple disciplines related to this target text, as well as the inference complexity corresponding to these multiple disciplines respectively. Exemplarily, still taking the medical scenario as an example, this planner can be a medical decision planner (Med-Scheduler).
[0067] In an illustrated embodiment, in the loss function of this application's planner, a penalty term negatively correlated with the correctness of the inference result and a penalty term positively correlated with the inference complexity are introduced. That is to say, the more correct the inference result is during the training process (i.e., the closer it is to the true value of the training sample), the less the penalty (for example, the lower the penalty score, or the higher the reward score), and the higher the inference complexity, the more the penalty (for example, the higher the penalty score, or the lower the reward score).
[0068] It should be noted that the specific training method of the planner is not particularly limited in this specification. In an illustrated embodiment, various reinforcement learning methods such as Proximal Policy Optimization (PPO) or Direct Preference Optimization (DPO) can be adopted, and this specification does not make specific limitations on this. Alternatively, in an illustrated embodiment, the training method of unified alignment optimization (UAO) can also be used to efficiently train the planner. Among them, UAO can unify the formats of various types of training sample data corresponding to multiple original training methods (such as PPO and DPO), and then use the training sample data in the unified format to perform unified and comprehensive training on the planner, which can greatly improve the training efficiency.
[0069] Next, the training process of the planner will be described in conjunction with the accompanying drawings.
[0070] Please refer to Figure 3 , Figure 3 which is a schematic diagram of the training process of a planner provided by an exemplary embodiment. As Figure 3 shown, the training data set of the planner can be obtained first. The training data set can include problem samples and answer samples corresponding to the problem samples, and the answer samples can be used as training labels (i.e., ground truths). Further, as Figure 3 shown, the problem samples can be input into the planner to be trained. The planner can generate an inference plan (Plan) that matches the problem samples. The inference plan can include at least one determined subject and the inference complexity corresponding to each of the at least one subject.
[0071] Please refer to Figure 4 , Figure 4 which is a schematic diagram of an inference plan generated by a planner provided by an exemplary embodiment. As Figure 4 shown, the planner generates 3 inference plans that match the input problem samples, namely Plan-1, Plan-2, and Plan-3. It should be noted that based on one input problem sample, the planner usually can generate one inference plan corresponding to the problem sample. However, in an illustrated embodiment, in order to achieve data augmentation and enrich the training samples in this application, the Figure 4 shown problem sample can be copied three times to obtain three identical problem samples, and then these three identical problem samples are sequentially input into the planner, so that the planner sequentially generates three inference plans such as Plan-1, Plan-2, and Plan-3.
[0072] AsFigure 4 As shown, Plan-1 includes Subject A, and the reasoning complexity corresponding to Subject A can be equivalent to simulating the reasoning complexity of three doctors. Plan-2 includes Subject B and Subject C, and the reasoning complexity corresponding to Subject B and Subject C respectively can be equivalent to simulating the reasoning complexity of two doctors. Plan-3 includes Subject D, Subject E, and Subject F, and the reasoning complexity corresponding to Subject D, Subject E, and Subject F respectively can be equivalent to simulating the reasoning complexity of three doctors. It is not difficult to understand that an LLM model can be used to simulate one doctor. The more doctors to be simulated in each subject, the more LLM models are called, and the higher the reasoning complexity.
[0073] Exemplarily, Subject A can be general practice medicine. The reasoning plan Plan-1 is equivalent to forming an initial assessment team (IAT) consisting of two doctors, which can be used to summarize the condition and make a preliminary diagnosis of the text input by the user, etc.
[0074] Exemplarily, Subject B can be general practice medicine, and Subject C can be respiratory medicine. The reasoning plan Plan-2 is equivalent to forming a diagnostic support team (DST) consisting of two respiratory medicine experts on the basis of forming an initial assessment team consisting of two doctors.
[0075] Exemplarily, Subject D can be general practice medicine, Subject E can be respiratory medicine, and Subject F can be cardiology. The reasoning plan Plan-3 is equivalent to further forming a treatment planning team (TPT) consisting of three cardiology experts on the basis of forming an initial assessment team consisting of three doctors and a diagnostic support team consisting of three respiratory medicine experts. This specification does not make specific limitations here.
[0076] Further, as Figure 3 shown, the agent executor can execute the reasoning calculation for the problem sample respectively based on multiple reasoning plans generated by the planner, so as to generate response texts corresponding to the multiple reasoning plans respectively, that is, the final answer. In an illustrated embodiment, the agent executor may include an LLM model. The LLM model is the core technical basis of the Atomic Agent, providing the agent with powerful natural language understanding and generation capabilities. The agent is an application of the LLM model, providing the LLM model with an actual application scenario and execution capabilities, etc., which will not be elaborated here.
[0077] Specifically, for any target inference plan among multiple inference plans (such as any one of the above-mentioned Plan-1, Plan-2, and Plan-3), a prompt can be constructed first based on the above-mentioned question samples and at least one discipline included in the target inference plan, and then the prompt is input into the executor. Based on the prompt, the executor performs inference calculations for the question sample according to at least one discipline included in the target inference plan and its corresponding inference complexity, so as to obtain a response text corresponding to the question sample.
[0078] Furthermore, as Figure 3 shown, the planner can be reinforced based on the deviation between the response text corresponding to each of the multiple inference plans and the answer sample of the question sample. As Figure 3 shown, if the response text corresponding to any target inference plan among the multiple inference plans is the correct answer, that is, there is no deviation from the answer sample, or the deviation is within the preset range, then a reward can be given to the target physical plan, or less punishment can be imposed; if the response text corresponding to the target inference plan is the wrong answer, that is, the deviation from the answer sample is large, then a penalty can be imposed on the target physical plan, and the greater the deviation, the more the penalty.
[0079] In addition, as Figure 3 shown, in addition to imposing penalties based on the correctness of the generated response text, the present application can also impose complexity penalties on the planner. The higher the inference complexity of the inference plan, the more the penalty. Exemplarily, if the response texts corresponding to multiple inference plans are all correct answers, but the inference complexity of a certain inference plan is relatively high, then a complexity penalty also needs to be imposed on this inference plan. As Figure 4 shown, assuming that the response texts generated based on Plan-2 and Plan-3 are both correct answers, but the inference complexity of Plan-3 is relatively high (including three medical teams, and each medical team includes three doctors), then a complexity penalty needs to be imposed on Plan-3.
[0080] As described above, by setting and training the planner (such as Med-Scheduler), the present application can more flexibly face more open inference problems, and dynamically configure the MDTS discussion group (such as medical teams of different disciplines and complexities) according to the complexity of the problem. This makes the classification of subtasks more detailed, that is, the classification of inference calculation tasks of different disciplines is more detailed, allowing the LLM model to only repeatedly think about the key difficult subtasks, reducing the generation cost of the LLM model, reducing the overall inference complexity and inference time, and thus ensuring the user experience.
[0081] Step S203: For any target subject among the multiple subjects, construct a prompt word corresponding to the target subject based on the target text and the target subject, and input the prompt word into an LLM model that matches the reasoning complexity of the target subject. The LLM model performs reasoning calculations on the target text based on the prompt word to generate a reasoning result corresponding to the target subject. Among them, the length of the reasoning result corresponding to each subject is positively correlated with the reasoning complexity of the subject.
[0082] Further, after determining the multiple subjects corresponding to the target text input by the user and the reasoning complexities respectively corresponding to the multiple subjects, the computing device can construct multiple prompt words corresponding to the multiple subjects based on the target text and the multiple subjects. Further, the multiple prompt words can be respectively input into an LLM model that matches the reasoning complexities of the multiple subjects. Correspondingly, the LLM model can perform multi-subject reasoning calculations on the target text based on the multiple prompt words, so as to generate reasoning results respectively corresponding to the multiple subjects. Among them, the length of the reasoning result corresponding to each subject is positively correlated with the reasoning complexity of the subject.
[0083] In an illustrated embodiment, the prompt word corresponding to any target subject among the multiple subjects may include a prompt word segment instructing the LLM model to simulate an expert corresponding to the target subject. For example, it may include prompt word segments such as "Assume you are a cardiologist,..." or "Please view from the perspective of an orthopedic surgeon,...", so that the LLM model simulates a cardiologist or an orthopedic surgeon.
[0084] Next, taking any target subject among the multiple subjects as an example, the reasoning calculation process for each subject will be described. It should be understood that the reasoning calculation processes for the other subjects among the multiple subjects are the same as those of the target subject.
[0085] In an illustrated embodiment, for any target subject among the multiple subjects, a prompt word corresponding to the target subject can be constructed based on the target text and the target subject, and the prompt word can be input into an LLM model that matches the reasoning complexity of the target subject. The LLM model performs reasoning calculations on the target text based on the prompt word to generate a reasoning result corresponding to the target subject.
[0086] Specifically, after determining the inference complexity corresponding to the target subject, N LLM models that match the inference complexity of the target subject can be called; among them, the number of LLM models called is positively correlated with the inference complexity of the target subject, and N is an integer greater than or equal to 1. It should be understood that each LLM model can be used to simulate an expert. The higher the inference complexity of the target subject, the more experts are usually arranged, and correspondingly, the more LLM models are called.
[0087] Further, the prompt words corresponding to the target subject are input into the N LLM models. The N LLM models respectively perform inference calculations related to the target subject based on the prompt words, and finally generate an inference result corresponding to the target subject. Among them, the finally generated inference result corresponding to the target subject may include the inference results respectively generated by the N LLM models.
[0088] It should be noted that this specification does not make a special limitation on the specific implementation manner of calling N LLM models. In an illustrated embodiment, N LLM models can be called in parallel or sequentially in order. This specification does not make a specific limitation on this.
[0089] In an illustrated embodiment, although the above N LLM models all perform inference calculations related to the target subject, the specific inference tasks can be different. Taking the cardiology department as an example, one or more of the N LLM models can be used to simulate cardiologists to summarize and analyze the patient's condition (equivalent to simulating a cardiology analyst), and one or more other LLM models can be used to simulate cardiologists to formulate treatment plans (equivalent to simulating a cardiology therapist), etc. This specification does not make a specific limitation on this.
[0090] Based on this, the above prompt words corresponding to the target subject can specifically include multiple prompt words related to multiple inference tasks of the target subject, and each prompt word in the multiple prompt words can include a prompt word segment indicating that the LLM model performs the corresponding inference task.
[0091] Exemplarily, the multiple prompt words related to multiple inference tasks of the target subject can respectively include prompt word segments such as "Suppose you are a cardiologist, please analyze the patient's condition...", "Suppose you are a cardiologist, please formulate a treatment plan based on the patient's situation...", etc., so that the LLM model can simulate cardiologists to perform different inference tasks.
[0092] Correspondingly, each of the multiple prompt words related to multiple reasoning tasks of the target subject can be input into the corresponding LLM model among the N LLM models. Based on the multiple prompt words, the N LLM models perform reasoning calculations related to the multiple reasoning tasks on the target text. Correspondingly, the finally generated reasoning results corresponding to the target subject may include multiple reasoning results corresponding to the multiple reasoning tasks.
[0093] Exemplarily, still taking the target subject as cardiology as an example, assuming that the reasoning complexity corresponding to cardiology is equivalent to the reasoning complexity of simulating three doctors, that is, assuming N is equal to 3, the prompt word corresponding to the condition analysis task can be input into one of the LLM models. This LLM model can perform reasoning calculations related to the condition analysis task on the target text based on the prompt word and generate reasoning results related to the condition analysis of cardiology. And, the prompt word corresponding to the treatment plan formulation task can be input into the other two LLM models. These two LLM models can perform reasoning calculations related to the treatment plan formulation task on the target text respectively based on the prompt word and generate reasoning results related to the treatment plan formulation of cardiology. Correspondingly, the finally generated reasoning results corresponding to cardiology may include multiple reasoning results corresponding to the above condition analysis task and treatment plan formulation task.
[0094] In an illustrated embodiment, in addition to implementing different reasoning complexities by invoking different numbers of LLM models as described above, different reasoning complexities can also be achieved by constructing prompt words, enabling the LLM model to perform reasoning calculations according to different reasoning complexities.
[0095] In an illustrated embodiment, after determining multiple subjects corresponding to the target text input by the user and the reasoning complexities respectively corresponding to the multiple subjects, the computing device can construct prompt words respectively corresponding to the multiple subjects and their reasoning complexities based on the target text, the multiple subjects, and the reasoning complexities respectively corresponding to the multiple subjects. Further, the prompt words can be input into the LLM model, and the LLM model performs multi-subject reasoning calculations on the target text based on the prompt words according to the multiple subjects and their corresponding reasoning complexities, generating reasoning results corresponding to the multiple subjects respectively.
[0096] Exemplarily, for any target subject among the multiple subjects, if the reasoning complexity of the target subject is relatively low (for example Figure 4If only the reasoning complexity of two doctors is simulated as shown, then the prompt words corresponding to the target subject and its reasoning complexity may include prompt word fragments such as "simple analysis...", so that the LLM model can perform relatively simple reasoning calculations related to the target subject based on the input prompt words, and generate shorter reasoning results corresponding to the target subject. If the reasoning complexity of the target subject is high (for example Figure 4 If the reasoning complexity of three doctors needs to be simulated as shown, then the prompt words corresponding to the target subject and its reasoning complexity may include prompt word fragments such as "detailed analysis...", so that the LLM model can perform relatively complex reasoning calculations related to the target subject based on the input prompt words, and generate longer reasoning results corresponding to the target subject. This specification does not make specific limitations on this.
[0097] In an illustrated embodiment, one LLM model can be used to perform reasoning calculations for multiple disciplines. Accordingly, the prompt words corresponding to multiple disciplines and their reasoning complexities can be input into one LLM model respectively. This one LLM model can, based on the prompt words, call the knowledge bases corresponding to multiple disciplines in parallel, and perform reasoning calculations for multiple disciplines according to the reasoning complexities corresponding to the multiple disciplines respectively (equivalent to one LLM model simulating different experts simultaneously), so as to generate reasoning results corresponding to the multiple disciplines respectively. Or, this one LLM model can also call the knowledge bases corresponding to multiple disciplines in sequence and perform reasoning calculations for multiple disciplines in sequence according to the reasoning complexities corresponding to the multiple disciplines respectively (equivalent to one LLM model simulating different experts in sequence), so as to generate reasoning results corresponding to the multiple disciplines respectively. This specification does not make specific limitations on this.
[0098] In an illustrated embodiment, multiple LLM models can also be used to perform reasoning calculations for multiple disciplines. Accordingly, the prompt words corresponding to multiple disciplines and their reasoning complexities can be input into multiple LLM models respectively. Each LLM model among the multiple LLM models can, based on its own prompt words, perform reasoning calculations for the target text for the discipline according to the discipline and its reasoning complexity in the prompt words, and generate reasoning results corresponding to the discipline, etc. This specification does not make specific limitations on this.
[0099] In an illustrated embodiment, if the reasoning complexities corresponding to multiple disciplines are relatively low, one LLM model can be shared. If the reasoning complexity corresponding to a certain discipline is high and there is a large amount of calculation data, a separate LLM model can be trained and the separate LLM model can be used to perform reasoning calculations for the discipline. This specification does not make specific limitations on this.
[0100] Furthermore, after generating inference results corresponding to multiple disciplines respectively, the LLM model can further generate a response text corresponding to the target text based on the generated inference results corresponding to multiple disciplines respectively. In an illustrated embodiment, after generating inference results corresponding to multiple disciplines respectively, the LLM model can simulate different experts to conduct multiple rounds of discussions based on these multiple disciplines to achieve knowledge complementarity, error correction, etc. among multiple inference results, and finally reach a consensus, so as to generate a response text corresponding to the target text.
[0101] Exemplarily, still taking the medical scenario as an example, the target text may include the patient's medical consultation problem. Correspondingly, the response text corresponding to the target text may include a medical diagnosis result. Exemplarily, the medical diagnosis result may include condition analysis, disease diagnosis result, medication advice, treatment method advice, etc., and this specification does not make specific limitations on this.
[0102] In addition, in an illustrated embodiment, in order to further improve the reasoning ability of the LLM model for complex problems, the way of Chain of Thought (CoT) can be adopted to perform reasoning calculations. Among them, the Chain of Thought can enable the LLM model to gradually decompose a complex problem into multiple sub-problems, and sequentially execute the reasoning steps corresponding to the multiple sub-problems, and output intermediate reasoning results corresponding to the multiple reasoning steps respectively. The Chain of Thought not only greatly improves the reasoning performance of the LLM model on complex problems, but also the output intermediate reasoning results can facilitate users to understand the thinking process of the model, improving the interpretability of the LLM model's reasoning.
[0103] Based on this, the above prompt words may further include a preset reasoning path, and the reasoning path may include multiple reasoning steps executed in sequence. Exemplarily, still taking the medical scenario as an example, the multiple reasoning steps may sequentially include: all possible disease diagnoses, diseases that completely do not match the symptoms, easily confused diseases, the final diagnosis result, etc., and this specification does not make specific limitations on this.
[0104] Correspondingly, for any target subject among multiple subjects, when the LLM model performs inference calculations on the target text based on the prompt words corresponding to the target subject and generates inference results corresponding to the target subject, it may specifically include: sequentially performing multiple inference steps on the target text and generating intermediate inference results corresponding to the multiple inference steps respectively; further, generating inference results corresponding to the target subject based on the intermediate inference results corresponding to the multiple inference steps respectively. In an illustrated embodiment, in the above-mentioned inference calculation process related to the target subject, the length of the intermediate inference results corresponding to each inference step may also be positively correlated with the inference complexity of the target subject, that is, the higher the inference complexity, the longer the length of the intermediate inference results.
[0105] In an illustrated embodiment, when generating intermediate inference results corresponding to multiple inference steps respectively, it may specifically include: generating multiple candidate intermediate inference results corresponding to each inference step among the multiple inference steps, and inference ideas (or inference bases) corresponding to the multiple candidate intermediate inference results respectively; then, scoring the inference ideas corresponding to the multiple candidate intermediate inference results through a pre-trained reward model; further, the inference idea with the highest score may be determined from the multiple inference ideas, and the candidate intermediate inference result corresponding to the inference idea with the highest score may be determined as the intermediate inference result corresponding to each inference step.
[0106] In an illustrated embodiment, the above-mentioned reward model may be a Process Reward Model. Below, the training process of this reward model will be elaborated.
[0107] First, obtain the training dataset of the reward model. In an illustrated embodiment, the training dataset may include correct inference ideas and incorrect inference ideas corresponding to multiple inference steps involved in performing inference calculations on problem samples.
[0108] Further, positive and negative sample pairs may be constructed based on the correct inference ideas and the corresponding incorrect inference ideas, and the reward model may be trained based on the positive and negative sample pairs.
[0109] In an illustrated embodiment, when obtaining the training dataset of the reward model, it may specifically include: obtaining problem samples and corresponding correct answer samples and incorrect answer samples; further, the generation model generates correct inference ideas corresponding to multiple inference steps involved in performing inference calculations on the problem sample based on the problem sample and the correct answer sample, and generates incorrect inference ideas corresponding to the multiple inference steps respectively based on the problem sample and the incorrect answer sample.
[0110] In one illustrated embodiment, the above-mentioned generation model may be an LLM model, and this specification does not make specific limitations thereon.
[0111] In one illustrated embodiment, when obtaining an incorrect answer sample corresponding to a question sample, the correct answer sample corresponding to the question sample may be modified, such as adjusting the content order, etc., to obtain the incorrect answer sample, and this specification does not make specific limitations thereon.
[0112] Exemplarily, the above-mentioned target text may be a summary of the user's condition, for example, including "The patient is a 29-year-old female with repeated papules, acne, and pustules on the prominent parts of the face and the tip of the nose for several months (chief complaint), obvious seborrhea. Since the onset of the disease, there has been no fever, headache, cough, expectoration, chest tightness, shortness of breath, abdominal pain, or diarrhea. The spirit and appetite are okay, the night rest is good, and the defecation and urination are normal. Physical examination shows papules, acne, and pustules on the prominent parts of the face and the tip of the nose, mostly occurring in seborrheic areas, and no obvious abnormalities are seen in the remaining skin and mucous membranes, and the nails are normal."
[0113] On this basis, still taking the above-mentioned multiple reasoning steps that sequentially include the 4 reasoning steps of "all possible disease diagnoses", "diseases that do not conform to the symptoms at all", "easily confused diseases", and "final diagnosis results" as an example.
[0114] Among them, the intermediate reasoning result corresponding to the reasoning step of "all possible disease diagnoses" may be: acne, rosacea, folliculitis, seborrheic dermatitis, contact dermatitis. Correspondingly, the reasoning idea corresponding to this reasoning step may be: The patient's condition summary mentions papules, acne, and pustules on the prominent parts of the face and the tip of the nose, which conform to acne, rosacea, and folliculitis. At the same time, considering the possibility of excessive sebum gland secretion or contact with allergic substances, the face is one of the common parts. Therefore, seborrheic dermatitis and contact dermatitis are also initially suspected.
[0115] Among them, the intermediate reasoning result corresponding to the reasoning step of "diseases that do not conform to the symptoms at all" may be: contact dermatitis, sebaceous gland hyperplasia. Correspondingly, the reasoning idea corresponding to this reasoning step may be: Since the patient did not mention symptoms or history related to allergies or contact with irritants, and did not mention obvious erythema or itching, which does not conform to the typical manifestations of contact dermatitis. At the same time, the patient's symptoms are mainly papules, acne, and pustules, and there are no characteristics of yellow papules, so sebaceous gland hyperplasia is excluded.
[0116] Among them, the intermediate reasoning results corresponding to the reasoning step of "confusing diseases" can be: folliculitis, rosacea, seborrheic dermatitis. Correspondingly, the reasoning idea corresponding to this reasoning step can be: The patient has no scaly skin lesions, so seborrheic dermatitis is excluded; since the patient did not mention pain or itching symptoms, folliculitis is excluded; the patient did not mention persistent erythema and telangiectasia, so rosacea is excluded.
[0117] Among them, the intermediate reasoning results corresponding to the reasoning step of "final diagnosis result" can be: acne. Correspondingly, the reasoning idea corresponding to this reasoning step can be: Combining the patient's specific symptoms (papules, comedones, pustules, located in the facial area with obvious sebum overflow) and excluding other diseases that do not match or are easily confused, acne meets all the clinical features.
[0118] In addition, in some possible implementation manners, after obtaining the target text input by the user, in addition to determining multiple disciplines related to the target text and the reasoning complexity corresponding to each of the multiple disciplines, the planner can also determine multiple discipline combinations related to the target text and the reasoning complexity corresponding to each of the multiple discipline combinations. Among them, each discipline combination can include at least one discipline, and each discipline combination can be equivalent to simulating a multi-disciplinary collaborative medical team. For example, in Figure 4 Plan-1 above, discipline A therein can also be discipline combination A, and the three doctors therein can be a cardiologist, a general practitioner, and a neurologist respectively. This specification does not make specific limitations on this. It should be noted that the reasoning calculation process of the multi-disciplinary combination is similar to the reasoning calculation process of multiple disciplines in the above embodiments, except that when performing reasoning calculation for each discipline combination, it is necessary to call the knowledge base corresponding to at least one discipline included in the discipline combination.
[0119] In summary, the present application determines multiple disciplines related to the target text input by the user and adaptively adjusts the reasoning complexity corresponding to different disciplines, and then can perform multi-disciplinary reasoning calculation on the target text according to the multiple disciplines and their corresponding reasoning complexities. It realizes comprehensive and multi-angle reasoning analysis by combining multi-disciplinary knowledge, and at the same time reduces the overall reasoning complexity of the LLM model as much as possible. It not only ensures the correctness of the final reasoning result, but also avoids unnecessary waste of computing resources and storage resources, improves the reasoning efficiency, and thus ensures the user experience.
[0120] Specifically, on the one hand, the present application sets and trains a planner in the macro architecture, which can determine multiple disciplines related to the target text input by the user and adaptively adjust the reasoning complexity corresponding to different disciplines, thereby realizing the adaptive planning of subtasks with different levels of difficulty, that is, reasoning calculation tasks with different reasoning complexities for different disciplines.
[0121] On the other hand, at the level of microscopic atomic agent reasoning in this application, by constructing Step-Wise Rationale (step-by-step reasoning idea), it assists in generating medical decisions with Rationale, making each step of reasoning more well-founded. Additionally, by using PRM to constrain each step of the reasoning idea, it improves the accuracy of reasoning facts and ensures the user experience.
[0122] Corresponding to the implementation of the above method process, the embodiments of this specification also provide a multi-disciplinary based LLM model reasoning device, which can be applied to Figure 1 the computing device in the system architecture shown. Please refer to Figure 5 , Figure 5 which is a schematic structural diagram of a multi-disciplinary based LLM model reasoning device provided by an exemplary embodiment. As Figure 5 shown, the device 50 includes:
[0123] An acquisition unit 501, configured to acquire the target text input by the user;
[0124] A determination unit 502, configured to determine multiple disciplines related to the target text, and the reasoning complexity corresponding to each of the multiple disciplines;
[0125] A reasoning unit 503, configured to, for any target discipline among the multiple disciplines, construct a prompt word corresponding to the target discipline based on the target text and the target discipline, and input the prompt word into an LLM model that matches the reasoning complexity of the target discipline. The LLM model performs reasoning calculations on the target text based on the prompt word to generate a reasoning result corresponding to the target discipline; wherein, the length of the reasoning result corresponding to each discipline is positively correlated with the reasoning complexity of that discipline.
[0126] In an illustrated implementation manner, the device 50 further includes a generation unit 504, configured to:
[0127] Generate a response text corresponding to the target text based on the reasoning results corresponding to the multiple disciplines respectively.
[0128] In an illustrated implementation manner, the reasoning unit 503 is specifically configured to:
[0129] Invoke N LLM models that match the reasoning complexity of the target discipline; wherein, the number of LLM models invoked is positively correlated with the reasoning complexity; N is an integer greater than or equal to 1;
[0130] Input the prompt into the N LLM models, and each of the N LLM models performs inference calculations on the target text based on the prompt to generate inference results corresponding to the target subject.
[0131] In an illustrated embodiment, the prompt includes multiple prompts related to multiple inference tasks of the target subject, and each prompt contains a prompt fragment indicating that the LLM model performs the corresponding inference task.
[0132] The inference unit 503 is specifically configured to:
[0133] Input each of the multiple prompts into the corresponding LLM model among the N LLM models, and each of the N LLM models performs inference calculations related to the multiple inference tasks on the target text based on the multiple prompts.
[0134] In an illustrated embodiment, the determination unit 502 is specifically configured to:
[0135] Input the target text into a pre-trained planner, and the planner determines multiple subjects related to the target text and the inference complexity corresponding to each of the multiple subjects.
[0136] Among them, in the loss function of the planner, a penalty term negatively correlated with the correctness of the inference result and a penalty term positively correlated with the inference complexity are introduced.
[0137] In an illustrated embodiment, the prompt further includes a preset inference path, and the inference path includes multiple inference steps executed in sequence.
[0138] The inference unit 503 is specifically configured to:
[0139] Sequentially execute the multiple inference steps for the target text to generate intermediate inference results corresponding to the multiple inference steps respectively.
[0140] Generate an inference result corresponding to the target subject based on the intermediate inference results corresponding to the multiple inference steps respectively.
[0141] In an illustrated embodiment, the inference unit 503 is specifically configured to:
[0142] Generate multiple candidate intermediate inference results corresponding to each of the multiple inference steps respectively, and inference ideas corresponding to the multiple candidate intermediate inference results respectively.
[0143] Score the reasoning ideas corresponding to the multiple candidate intermediate reasoning results through a pre-trained reward model;
[0144] Determine the candidate intermediate reasoning result corresponding to the reasoning idea with the highest score as the intermediate reasoning result corresponding to each reasoning step.
[0145] In an illustrated embodiment, the apparatus 50 further includes a training unit 505 for:
[0146] Obtain the training data set of the reward model; the training data set includes correct reasoning ideas and incorrect reasoning ideas corresponding to multiple reasoning steps of the problem sample;
[0147] Train the reward model based on the positive and negative sample pairs composed of the correct reasoning idea and the incorrect reasoning idea.
[0148] In an illustrated embodiment, the prompt words corresponding to the target discipline include a prompt word segment indicating that the LLM model simulates an expert corresponding to the target discipline.
[0149] In an illustrated embodiment, the discipline includes a discipline related to the medical field; the target text includes the medical visit problems of patients.
[0150] The implementation processes of the functions and roles of each unit in the above-mentioned apparatus 50 are specifically described in the above embodiments and will not be elaborated here. It should be understood that the above-mentioned apparatus 50 can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a logically meaningful apparatus, it is formed by the processor (CPU) of the device reading the corresponding computer program instructions into the memory and running. From the hardware level, in addition to the CPU and the memory, the device where the above-mentioned apparatus is located usually also includes other hardware such as chips for wireless signal transceiver, and / or other hardware such as boards for implementing network communication functions.
[0151] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical modules, that is, they may be located in one place, or may be distributed to multiple network modules. Some or all of the units or modules can be selected according to actual needs to achieve the purpose of the solution in this specification. Those of ordinary skill in the art can understand and implement it without creative work.
[0152] The devices, units, and modules illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, and the specific form of the computer can be a personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media player, navigation device, email transceiver, game console, tablet computer, wearable device, in-vehicle computer, or a combination of any several of these devices.
[0153] Corresponding to the above method embodiments, an embodiment of this specification also provides a computing device. Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of a computing device provided by an exemplary embodiment. The computing device can be Figure 1 the computing device in the system architecture shown in Figure 6 and an LLM model can be installed in the computing device. As shown in Figure 6 , the computing device includes a processor 1001 and a memory 1002, and further may include an input device 1004 (such as a keyboard, etc.) and an output device 1005 (such as a display, etc.). The processor 1001, the memory 1002, the input device 1004, and the output device 1005 can be connected through a bus or other means. As shown in
[0154] For a detailed description of each step of the above multi-disciplinary LLM model inference method, please refer to the previous content and will not be elaborated here.
[0155] Corresponding to the above method embodiments, an embodiment of this specification also provides a computer-readable storage medium, on which a computer program is stored. When these computer programs are run by a processor, they execute the various steps of the multi-disciplinary LLM model inference method in the embodiments of this specification. For specific details, please refer to the description of the above embodiments, and details will not be repeated here.
[0156] The above are only the preferred embodiments of this specification and are not intended to limit this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of this specification shall be included within the scope of protection of this specification.
[0157] In a typical configuration, a terminal device includes one or more CPUs, an input / output interface, a network interface, and memory.
[0158] The memory may include non-permanent memory in the computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of, for example, read-only memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
[0159] Computer-readable media includes permanent and non-permanent, removable and non-removable media and can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data.
[0160] Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0161] It should also be noted that the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, commodity or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, commodity or device comprising said element.
[0162] Those skilled in the art should understand that the embodiments of this specification can be provided as a method, a system or a computer program product. Therefore, the embodiments of this specification can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the embodiments of this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
Claims
1. A multi-disciplinary based inference method for LLM models, characterized in that, The method includes: Obtaining the target text input by the user; Determining multiple disciplines related to the target text, and the reasoning complexity corresponding to each of the multiple disciplines; For any target discipline among the multiple disciplines, constructing a prompt word corresponding to the target discipline based on the target text and the target discipline, and inputting the prompt word into an LLM model matching the reasoning complexity of the target discipline. The LLM model performs reasoning calculations on the target text based on the prompt word to generate a reasoning result corresponding to the target discipline. Wherein, the length of the reasoning result corresponding to each discipline is positively correlated with the reasoning complexity of that discipline.
2. The method according to claim 1, characterized in that The method further includes: Generating a response text corresponding to the target text based on the reasoning results corresponding to the multiple disciplines respectively.
3. The method according to claim 1, wherein The step of inputting the prompt word into an LLM model matching the reasoning complexity of the target discipline, and the LLM model performing reasoning calculations on the target text based on the prompt word to generate a reasoning result corresponding to the target discipline includes: Invoking N LLM models matching the reasoning complexity of the target discipline; wherein, the number of LLM models invoked is positively correlated with the reasoning complexity; N is an integer greater than or equal to 1; Inputting the prompt word into the N LLM models, and the N LLM models respectively perform reasoning calculations on the target text based on the prompt word to generate a reasoning result corresponding to the target discipline.
4. The method according to claim 3, characterized in that, The prompt word includes multiple prompt words related to multiple reasoning tasks of the target discipline, and each prompt word contains a prompt word segment indicating the LLM model to perform the corresponding reasoning task; The step of inputting the prompt word into the N LLM models, and the N LLM models respectively perform reasoning calculations on the target text based on the prompt word includes; Inputting each of the multiple prompt words into the corresponding LLM model among the N LLM models, and the N LLM models perform reasoning calculations related to the multiple reasoning tasks on the target text based on the multiple prompt words.
5. The method according to claim 1, wherein The step of determining multiple disciplines related to the target text, and the reasoning complexity corresponding to each of the multiple disciplines includes: Inputting the target text into a pre-trained planner, and the planner determines multiple disciplines related to the target text, and the reasoning complexity corresponding to each of the multiple disciplines; Wherein, in the loss function of the planner, a penalty term negatively correlated with the correctness of the reasoning result and a penalty term positively correlated with the reasoning complexity are introduced.
6. The method according to claim 1, wherein The prompt word further contains a preset reasoning path, and the reasoning path contains multiple reasoning steps executed in sequence; The step of performing reasoning calculations on the target text to generate a reasoning result corresponding to the target discipline includes: Sequentially performing the multiple reasoning steps on the target text to generate intermediate reasoning results corresponding to the multiple reasoning steps respectively; Generate an inference result corresponding to the target subject based on the intermediate inference results respectively corresponding to the multiple inference steps.
7. The method according to claim 6, characterized in that, The generating the intermediate inference results respectively corresponding to the multiple inference steps includes: Generating multiple candidate intermediate inference results respectively corresponding to each of the multiple inference steps, and inference ideas respectively corresponding to the multiple candidate intermediate inference results; Scoring the inference ideas respectively corresponding to the multiple candidate intermediate inference results through a pre-trained reward model; Determine the candidate intermediate inference result corresponding to the inference idea with the highest score as the intermediate inference result corresponding to each inference step.
8. The method according to claim 7, wherein The method further includes: Obtain the training data set of the reward model; the training data set includes correct inference ideas and wrong inference ideas respectively corresponding to multiple inference steps of the problem sample; Train the reward model based on the positive and negative sample pairs composed of the correct inference idea and the wrong inference idea.
9. The method according to any one of claims 1-8, wherein the prompt word corresponding to the target subject includes a prompt word segment instructing the LLM model to simulate an expert corresponding to the target subject.
10. The method according to any one of claims 1-8, characterized in that, The subject includes a subject related to the medical field; the target text includes the medical consultation problem of the patient.
11. An inference device for an LLM model based on multiple disciplines, characterized in that, The device includes: An acquisition unit, configured to acquire a target text input by a user; A determination unit, configured to determine multiple subjects related to the target text, and the inference complexity respectively corresponding to the multiple subjects; An inference unit, configured to, for any target subject among the multiple subjects, construct a prompt word corresponding to the target subject based on the target text and the target subject, and input the prompt word into an LLM model matching the inference complexity of the target subject, and the LLM model performs inference calculation on the target text based on the prompt word to generate an inference result corresponding to the target subject; wherein, the length of the inference result corresponding to each subject is positively correlated with the inference complexity of the subject.
12. A computing device, characterized in that, Includes: A memory and a processor; The memory stores computer programs / instructions that can be run by the processor; When the processor runs the computer programs / instructions, it executes the method according to any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, Stored thereon are computer programs / instructions, and when the computer programs / instructions are executed by a processor, the method according to any one of claims 1-10 is implemented.
14. A computer program product, characterized in that, The computer program product includes computer programs / instructions, and when the computer programs / instructions are executed by a processor, the method according to any one of claims 1-10 is implemented.