Platform construction method and device based on traditional Chinese medicine formula, equipment and medium

By building a traditional Chinese medicine formula optimization system and optimizing traditional Chinese medicine formulas using base models and corpus, the pharmaceutical efficiency and accuracy problems caused by the complexity of traditional Chinese medicine prescriptions are solved, and efficient and safe personalized traditional Chinese medicine formulas are achieved.

CN118969179APending Publication Date: 2024-11-15GUANGDONG INST OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411001496.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

Due to the high complexity and professionalism of traditional Chinese herbal medicines, it is prone to missed review or missed review, resulting in low pharmaceutical efficiency and formula accuracy.

Method used

Build a traditional Chinese medicine formula optimization system, and automatically load and output traditional Chinese medicine formulas by selecting the base model, building an interactive interface, obtaining traditional Chinese medicine data, establishing corpus and databases, fine-tuning model parameters, and setting loading strategies.

Benefits of technology

It improves the pharmaceutical efficiency and formulation accuracy of traditional Chinese medicine, ensures the safety of medication, reduces side effects, and realizes personalized traditional Chinese medicine formulas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118969179A_ABST
    Figure CN118969179A_ABST
Patent Text Reader

Abstract

The invention provides a construction method of a traditional Chinese medicine formula optimization system. The construction method comprises the steps that a base model is selected, an interactive interface of the base model is constructed, and input information is input into the base model through the interactive interface; obtaining traditional Chinese medicine data, and constructing a corpus according to the traditional Chinese medicine data to obtain a first data set; constructing a database of a base model according to the user table, the question and answer record table and the important data table to obtain a second data set; performing fine tuning according to the first data set and the second data set to obtain a fine tuning parameter value; weight information of a to-be-updated layer in the base model is obtained, and the base model assigns a value to the to-be-updated layer through the fine tuning parameter value according to the weight information; a loading strategy of the base model is set, so that when the traditional Chinese medicine formula optimization system is started, the base model after fine adjustment is automatically loaded according to the data information, and the traditional Chinese medicine formula is output. According to the technical scheme of the embodiment, the pharmacy efficiency and the formula accuracy of the traditional Chinese medicine can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of medical service technology, and in particular to a platform construction method, device, equipment and medium based on traditional Chinese medicine formula. Background Art

[0002] At present, prescriptions for Chinese herbal medicines are mostly reviewed manually. Due to the high complexity and professionalism required for the configuration of traditional Chinese medicine, manual review is prone to errors or omissions, resulting in poor pharmaceutical efficiency and formula accuracy of the final prescription. Summary of the invention

[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a platform construction method, device, equipment and medium based on traditional Chinese medicine formula, which can improve the pharmaceutical efficiency and formula accuracy of traditional Chinese medicine.

[0004] In a first aspect, an embodiment of the present invention provides a method for constructing a traditional Chinese medicine formula optimization system, comprising:

[0005] Selecting a base model, constructing an interactive interface of the base model, and inputting input information into the base model through the interactive interface;

[0006] Acquire traditional Chinese medicine data, build a corpus based on the traditional Chinese medicine data, and obtain a first data set;

[0007] Obtaining a user table, a question-and-answer record table, and a traditional Chinese medicine data table, and constructing a database of the base model according to the user table, the question-and-answer record table, and the important data table to obtain a second data set;

[0008] The base model is fine-tuned according to the first data set and the second data set to obtain a fine-tuning parameter value;

[0009] Obtaining weight information of the layer to be updated in the base model, wherein the base model assigns a value to the layer to be updated through the fine-tuning parameter value according to the weight information;

[0010] The loading strategy of the base model is set so that when the TCM formula optimization system is started, the fine-tuned base model is automatically loaded according to the data information to output the TCM formula.

[0011] In some embodiments of the present invention, the step of constructing a database of the base model according to the user table, the question and answer record table and the important data table includes:

[0012] Acquire the unique identifier, user name information and the first field of the user table, so that the user can log in through the interactive interface according to the unique identifier and confirm the identity information of the user;

[0013] The second field of the user table is obtained, and the second field verifies the user in response to the identity information. After the user passes the verification, the Chinese medicine formula optimization system is accessed to enable the user to perform question-and-answer operations with the base model.

[0014] In some embodiments of the present invention, after accessing the TCM formula optimization system, the method further includes:

[0015] Obtaining a unique record identifier of the question and answer record table, wherein the question and answer record table obtains question and answer information between the user and the base model, and the unique record identifier records the interaction process between the user and the base model according to the question and answer information;

[0016] Obtaining a user unique identifier of the question and answer record table, associating the user unique identifier with the user table, and obtaining a first text of the user table record, wherein the first text is the original question text raised by the user;

[0017] The base model outputs a second text according to the first text, wherein the second text is an answer text provided by the base model according to the original question text.

[0018] In some embodiments of the present invention, model parameters of the base model are obtained, and the model parameters are frozen, wherein the base model is provided with a plurality of language processing layers;

[0019] Adding a first matrix to each of the plurality of language processing layers so that the base model obtains a matrix output result according to the first matrix;

[0020] Obtaining an initial path output result of the base model, adding the matrix output result to the initial path output result to obtain a bypass matrix parameter;

[0021] Training the bypass matrix parameters to obtain an increased-dimensional matrix, a reduced-dimensional matrix and an intermediate layer of the bypass matrix parameters;

[0022] An intrinsic rank is simulated according to the increased dimension matrix, the reduced dimension matrix and the intermediate layer.

[0023] In some embodiments of the present invention, after constructing a corpus based on the traditional Chinese medicine data to obtain a first data set, the method further comprises:

[0024] Dividing the first data set into a training set, a validation set, and a test set;

[0025] Inputting the training set into the base model, and the base model updates model parameters according to the training set;

[0026] The validation set is monitored according to the updated model parameters to obtain monitoring results, and the base model adjusts hyperparameters and monitoring strategies according to the monitoring results.

[0027] In some embodiments of the present invention, after obtaining the weight information of the layer to be updated in the base model, the method further includes:

[0028] Acquiring semantic similarity information of the corpus, and constructing a word relationship network according to the semantic similarity information;

[0029] Extract keywords from the traditional Chinese medicine data table according to a first algorithm, input the keywords into the word relationship network, and obtain a plurality of keywords;

[0030] The first algorithm performs iterative calculation on the keywords and assigns weights to the keywords;

[0031] Prioritize the multiple keywords according to the keyword weights to obtain a ranking result;

[0032] A vocabulary set of all sample texts is obtained, wherein the vocabulary set obtains at least five target keywords according to the sorting result.

[0033] In some embodiments of the present invention, the acquiring of the vocabulary set of all sample texts, after acquiring at least five target keywords according to the sorting result, the vocabulary set information includes:

[0034] Merging the vocabulary set with a preset professional vocabulary library to obtain a keyword set;

[0035] Obtaining keyword quantity information of the keyword set, and obtaining the keyword occurrence count according to the keyword quantity information;

[0036] The keyword extraction is performed using the number of times the keyword occurs as a weight.

[0037] In a second aspect, an embodiment of the present invention provides a device for constructing a system for optimizing a traditional Chinese medicine formula, comprising at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the method for constructing a system for optimizing a traditional Chinese medicine formula as described in the first aspect above.

[0038] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a device for constructing a system for optimizing a traditional Chinese medicine formula as described in the second aspect above.

[0039] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the method for constructing a system for optimizing a traditional Chinese medicine formula as described in the first aspect above.

[0040] The method for constructing a TCM formula optimization system according to an embodiment of the present invention has at least the following beneficial effects:

[0041] Select a base model, build an interactive interface of the base model, input information to the base model through the interactive interface, wherein the base model is provided with multiple language processing layers; obtain Chinese medicine data, build a corpus based on the Chinese medicine data, and obtain a first data set; obtain a user table, a question and answer record table, and a Chinese medicine data table, and build a database of the base model based on the user table, the question and answer record table, and the important data table to obtain a second data set; the base model is fine-tuned according to the first data set and the second data set to obtain a fine-tuning parameter value; obtain the weight information of the layer to be updated in the base model, and the base model assigns the layer to be updated through the fine-tuning parameter value according to the weight information; set the loading strategy of the base model so that the Chinese medicine formula optimization system automatically loads the fine-tuned base model according to the data information when it starts, and outputs the Chinese medicine formula. According to the technical solution of this embodiment, the pharmaceutical efficiency and formula accuracy of Chinese medicine can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 It is a flow chart of a method for constructing a TCM formula optimization system provided by one embodiment of the present invention;

[0043] Figure 2 It is a flowchart of a database for building a base model according to a user table, a question and answer record table and an important data table provided by an embodiment of the present invention;

[0044] Figure 3 It is a flow chart after accessing the Chinese medicine formula optimization system provided by an embodiment of the present invention;

[0045] Figure 4 is a flow chart of fine-tuning a base model according to a first data set and a second data set provided by an embodiment of the present invention;

[0046] Figure 5 It is a flowchart after building a corpus based on traditional Chinese medicine materials and obtaining a first data set provided by an embodiment of the present invention;

[0047] Figure 6 is a flow chart after obtaining weight information of a layer to be updated in a base model provided by an embodiment of the present invention;

[0048] Figure 7is a flow chart after obtaining at least five target keywords according to the sorting result of vocabulary set information provided by an embodiment of the present invention;

[0049] Figure 8 It is a structural diagram of a construction device of a traditional Chinese medicine formula optimization system provided by another embodiment of the present invention. DETAILED DESCRIPTION

[0050] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0051] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., and orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.

[0052] In the description of the present invention, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

[0053] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.

[0054] An embodiment of the present invention provides a method for constructing a traditional Chinese medicine formula optimization system, including selecting a base model, constructing an interactive interface of the base model, and inputting information into the base model through the interactive interface; obtaining traditional Chinese medicine data, constructing a corpus based on the traditional Chinese medicine data, and obtaining a first data set; obtaining a user table, a question and answer record table, and a traditional Chinese medicine data table, and constructing a database of the base model based on the user table, the question and answer record table, and the important data table to obtain a second data set; fine-tuning the base model according to the first data set and the second data set to obtain a fine-tuning parameter value; obtaining weight information of a layer to be updated in the base model, and the base model assigns a value to the layer to be updated through the fine-tuning parameter value according to the weight information; setting a loading strategy for the base model so that the fine-tuned base model is automatically loaded according to the data information when the traditional Chinese medicine formula optimization system is started, and outputs the traditional Chinese medicine formula. According to the technical solution of this embodiment, large-model voice interaction and rapid response requirements in the vertical scenario of traditional Chinese medicine are realized, the Starlette framework and Flashattention-2 attention mechanism are integrated, the reasoning time and response speed of the model are significantly improved, and efficient and scalable APIs and Web services are built to realize instant interaction functions between voice and text; by utilizing the model to analyze the interaction between drug ingredients, optimize the formula combination, avoid adverse drug interactions, ensure medication safety, predict the efficacy of different formulas through professional data set training, and generate personalized Chinese medicine formula granules based on the patient's specific symptoms, constitution and treatment history input, based on the principles of medicinal materials, thereby improving the treatment effect and reducing side effects.

[0055] The control method of the embodiment of the present invention is further described below based on the accompanying drawings.

[0056] Reference Figure 1 , Figure 1 A flowchart of a method for constructing a TCM formula optimization system provided by an embodiment of the present invention, the method for constructing the TCM formula optimization system includes but is not limited to the following steps:

[0057] Step S11, selecting a base model, constructing an interactive interface of the base model, and inputting input information into the base model through the interactive interface;

[0058] It should be noted that the interactive interface provides a responsive design and integrates rich multimedia interactive functions, including embedded video playback, dynamic text carousel and picture carousel, etc., to enhance the user experience of Tonghu. The interactive interface in this embodiment adopts visual elements rich in the characteristics of traditional Chinese medicine culture, and is combined with technical frameworks such as Bootstrap and Vue.js to build an interactive interface that conforms to the theme of traditional Chinese medicine;

[0059] Step S12, obtaining traditional Chinese medicine data, building a corpus based on the traditional Chinese medicine data, and obtaining a first data set;

[0060] It should be noted that the TF-IWF (term frequency-inverse document frequency) method is used to evaluate the importance of a word to a document in a document collection. The user input is matched with the corpus through IF-IWF. The similarity of the symptoms is matched based on the symptoms input by the user and the corpus built based on traditional Chinese medicine. The medicinal materials with the highest similarity are then used through the large model to preliminarily optimize the traditional Chinese medicine formula to ensure that the answer of the base model is accurate and true. When the corpus is built, the first data set is obtained, wherein the first data set contains all the documents in the corpus.

[0061] Step S13, obtaining a user table, a question and answer record table, and a traditional Chinese medicine data table, and constructing a database of a base model according to the user table, the question and answer record table, and the important data table to obtain a second data set;

[0062] It should be noted that the user table, question and answer record table and important data table constitute a database, and the database is used to manage user information, interaction records between users and the system, and related information of traditional Chinese medicine data.

[0063] Specifically, the user table is used to store and manage user information in the database structure, complete user identity information identification, personal information storage, security authentication and database management and statistical analysis; the question and answer record table is a data storage unit, which records the interaction history between the user and the base model in detail, provides data support for the operation, maintenance, optimization and user experience of the traditional Chinese medicine formula platform, and realizes the record tracking, user behavior analysis, question and answer archiving, timestamp recording and performance evaluation of the interaction process between the user and the model; the traditional Chinese medicine data table stores a large amount of medicinal material information, and the user can call the information in the traditional Chinese medicine data table through the corpus to ensure the quality of questions and answers between the user and the base model, so that the content output by the base model is true and effective. Specifically, the traditional Chinese medicine data table is used to display the detailed information of traditional Chinese medicine, and the traditional Chinese medicine name field is used as the standardized name of traditional Chinese medicine to enable users to identify and retrieve specific traditional Chinese medicine. The traditional Chinese medicine data table includes but is not limited to the name of the traditional Chinese medicine, alias, category, medicinal part, origin distribution, nature and taste, efficacy, main indications, contraindications and usage and dosage. The second data set includes a user table, a question and answer record table, a traditional Chinese medicine data table and related question and answer data sets in the database.

[0064] Step S14, fine-tuning the base model according to the first data set and the second data set to obtain a fine-tuning parameter value;

[0065] It should be noted that, for the field of traditional Chinese medicine, the first data set and the second data set are used to fine-tune the base model. The base model is a model that has been pre-trained on large-scale non-standard text data. In this embodiment, the Qwen-7B-Chat-int4 model is used. The model has acquired rich language model knowledge through self-supervised learning and other methods, and has certain language understanding and generation capabilities. In this embodiment, the base model is fine-tuned only by modifying the low-rank part of the weight matrix, rather than comprehensively updating the parameters of the entire base model. On the basis of keeping the weight parameters of the base model frozen, the rank decomposition matrix technology is applied to refine the fully connected layer selected in the base model, and finally the fine-tuning parameter value is obtained to ensure that the base model maintains high performance in subsequent tasks while reducing the amount of training parameters, thereby improving the training efficiency and resource utilization of the base model.

[0066] Step S15, obtaining weight information of the layer to be updated in the base model, and the base model assigns values ​​to the layer to be updated by fine-tuning parameter values ​​according to the weight information;

[0067] It should be noted that when merging multiple weight matrices in the base model, it is necessary to ensure that the remaining part of the original base model is not affected, and it is necessary to find the weights of the fully connected layer or attention layer that needs to be updated in the base model, that is, the layer to be updated, and assign values ​​to the layer to be updated by fine-tuning the parameter values.

[0068] Step S16, setting the loading strategy of the base model so that when the TCM formula optimization system is started, the fine-tuned base model is automatically loaded according to the data information and the TCM formula is output.

[0069] It should be noted that the fine-tuned base model is integrated with the back-end service of the TCM formula optimization system, the base model is instantiated, and services are provided through the API interface. According to the set loading strategy, the fine-tuned base model is automatically loaded when the system starts, and after receiving the user input information, the optimized base model is called for reasoning, so as to output the TCM formula required by the user.

[0070] It should be noted that the Chinese medicine data table stores a large amount of medicinal material information. Users can call the information in the data table through the corpus to ensure the quality of questions and answers and make the output content authentic and effective. This table is used to display detailed information about Chinese medicine. The Chinese medicine name field is used as the standardized name of Chinese medicine to facilitate users to identify and retrieve specific Chinese medicines.

[0071] It should be noted that by integrating modern information technology and traditional Chinese medicine knowledge, the symptoms are matched according to the patient's symptoms combined with the corpus and database, and then the medicinal materials with the highest similarity are analyzed and optimized through the base model, so as to output the Chinese medicine formula, improve the pharmaceutical efficiency and formula accuracy, and assist medical personnel in generating safe and effective treatment plans.

[0072] In addition, in one embodiment, referring to Figure 2 ,exist Figure 1 Step S12 of the illustrated embodiment also includes but is not limited to the following steps:

[0073] Step S21, obtaining a first identifier, user name information and a first field of a user table, so that the user can log in through an interactive interface according to the first identifier and confirm the user's identity information;

[0074] Step S22, obtaining the second field of the user table, wherein the second field verifies the user in response to the identity information. After the user passes the verification, the Chinese medicine formula optimization system is accessed to allow the user to perform question-and-answer operations with the base model.

[0075] It should be noted that through the first identifier, the recipe optimization system can uniquely and clearly identify the identity of each user. The first field contains fields such as user name information and email information, which are used to store user information and account security. The second field (password_hash) stores the user's encrypted password, which is used for identity authentication when the user logs in, ensuring that only verified users can access the recipe optimization system; further, the user table also includes a date field, which records the user's registration time, which is used to track user growth trends, analyze user activity and user cycle management, etc.

[0076] In addition, in one embodiment, referring to Figure 3 ,exist Figure 2 After step S22 of the illustrated embodiment, the following steps are also included but not limited to:

[0077] Step S31, obtaining a record second identifier of a question and answer record table, the question and answer record table obtains question and answer information between the user and the base model, and the record second identifier records the interaction process between the user and the base model according to the question and answer information;

[0078] Step S32, obtaining a second identifier of the question and answer record table, associating the second identifier with the user table, and obtaining a first text of the user table record, wherein the first text is the original question text raised by the user;

[0079] Step S33: the base model outputs a second text according to the first text, wherein the second text is an answer text provided by the base model according to the original question text.

[0080] It should be noted that the question-and-answer record table records each question-and-answer interaction process between the user and the base model, and uses the second identifier (log_id) as the unique identifier of each question-and-answer record to facilitate the management of the optimization system and trace each question-and-answer activity; after the second identifier is recorded, the first text is obtained, and the second identifier associates the user name information with the user table according to the user name information (i.e., the user's unique identifier), thereby associating each question and answer with a specific user and completing the question-and-answer operation between the user and the base model. The user inputs information into the recipe optimization system, and the system saves the input information as the first text. The first text is the original question text raised by the user. The base model answers the original question text of the user and obtains the answer text. The recipe optimization system saves the answer text generated by the user's question according to the base model as the second text, so that the user can review and query, and also provide data resources for system optimization and model iteration. Furthermore, the question-and-answer record table also includes a timestamp field, which records the specific time point when the user asks the question, and is used by the recipe optimization system to analyze the user's active fields, system load conditions, and evaluate the response speed of the base model.

[0081] In addition, in one embodiment, referring to Figure 4 ,exist Figure 1 Step S13 of the illustrated embodiment also includes but is not limited to the following steps:

[0082] Step S41, obtaining model parameters of the base model and freezing the model parameters, wherein the base model is provided with a plurality of language processing layers;

[0083] Step S42, adding a first matrix to each of the multiple language processing layers, so that the base model obtains a matrix output result according to the first matrix;

[0084] Step S43, obtaining the initial path output result of the base model, adding the matrix output result to the initial path output result to obtain the bypass matrix parameter;

[0085] Step S44, training the bypass matrix parameters to obtain the dimension-raising matrix, dimension-reducing matrix and intermediate layer of the bypass matrix parameters;

[0086] Step S45, simulating the intrinsic rank according to the dimension-raising matrix, the dimension-reducing matrix and the intermediate layer.

[0087] It should be noted that the model parameters of the base model are frozen, and then a trainable first matrix is ​​added to each layer of the language processing layer, where the first matrix is ​​a low-rank separable matrix, and the bypass output of the first matrix is ​​added to the output of the preset initial path and input into the network, and only the newly added bypass matrix parameters are trained. Specifically, the first matrix is ​​composed of a dimension-raising matrix and a dimension-reducing matrix, and the dimension of the middle layer is r, thereby simulating the intrinsic rank, and greatly reducing the number of parameters through the dimension-raising matrix and the dimension-reducing matrix.

[0088] Specifically, given a linear layer h = Wx, LoRA transforms the linear layer into h = (W + W′)x, where W represents frozen parameters, W′ = B×A represents trainable parameters, and B∈R d1*r , A∈R r*d2 , rank r<<min(d1,d2). During the pre-training process, the causal language model (CLM) loss function is used to predict subsequent tokens, expressed by the following formula:

[0089]

[0090] Among them, w1,…,w i-1 represents the first i-1 tokens in the sentence, w i Indicates the next token.

[0091] In the process of supervised fine-tuning (SFT), for a given input prompt I = w × 1: m and response R = w m+1:m+n , the loss function is:

[0092]

[0093]

[0094] In addition, in one embodiment, referring to Figure 5 ,exist Figure 1 After step S12 of the illustrated embodiment, the following steps are also included but not limited to:

[0095] Step S51, dividing the first data set into a training set, a validation set and a test set;

[0096] Step S52, inputting the training set into the base model, and the base model updates the model parameters according to the training set;

[0097] Step S53: The validation set is monitored according to the updated model parameters to obtain monitoring results, and the base model adjusts the hyperparameters and monitoring strategy according to the monitoring results.

[0098] It should be noted that in the actual fine-tuning process, the data set is divided into training set, validation set and test set. The training set is used to update the model parameters through the LoRA method. The validation set is used to monitor the performance of the model during the fine-tuning process, and to adjust the hyperparameters and training strategies in a timely manner to ensure that the quality and accuracy of the model's answers to traditional Chinese medicine questions reach an ideal state.

[0099] In addition, in one embodiment, referring to Figure 6 ,exist Figure 1 After step S15 in the illustrated embodiment, the following steps are also included but not limited to:

[0100] Step S61, obtaining semantic similarity information of the corpus, and constructing a word relationship network based on the semantic similarity information;

[0101] Step S62, extracting keywords from the traditional Chinese medicine data table according to the first algorithm, inputting the keywords into the word relationship network, and obtaining a plurality of keywords;

[0102] Step S63, the first algorithm performs iterative calculations on the keywords and assigns keyword weights;

[0103] Step S64, prioritizing the multiple keywords according to the keyword weights to obtain a ranking result;

[0104] Step S65, obtaining a vocabulary set of all sample texts, and obtaining at least five target keywords from the vocabulary set according to the sorting result.

[0105] It should be noted that by constructing a word relationship network and using structured text and other methods to improve the prompt words, the prompt words are integrated into the training data without updating the base model weights, guiding the base model to generate professional and accurate answers when receiving questions in a specific field. In this embodiment, the first algorithm is the TextRank algorithm, which extracts keywords from the traditional Chinese medicine data table by using the first algorithm, and extracts keywords related to traditional Chinese medicine input by users into the base model, denoted as T R =K1……K n , where k i ∈T R , is a keyword, and n represents the number of keywords. The first algorithm is used to automatically extract text keywords based on the graph structure, and to build a word relationship network through the semantic similarity between the crossbar words. In the word relationship network, the first algorithm is used to iteratively calculate the keywords, thereby giving each keyword a corresponding weight, and then forming a priority ranking of the keywords. The first algorithm is applied to the vocabulary set extracted from all sample texts to obtain the top five most representative keywords of each sample.

[0106] In addition, in one embodiment, referring to Figure 7After step S65 of the embodiment shown in FIG. 6 , the following steps are also included but not limited to:

[0107] Step S71, merging the vocabulary set with a preset professional vocabulary library to obtain a keyword set;

[0108] Step S72, obtaining keyword quantity information of the keyword set, and obtaining the keyword occurrence times according to the keyword quantity information;

[0109] Step S73, extracting keywords using the number of times the keywords appear as weights.

[0110] It should be noted that in order to enhance the diversity of the keyword set and expand the coverage of the field of traditional Chinese medicine, an open source professional vocabulary library of traditional Chinese medicine (marked as WD) is introduced, and the keywords (TR) initially extracted by the first algorithm are merged with the professional vocabulary library to construct a more comprehensive keyword set (TW). The comprehensive keyword set is the basis for the subsequent construction of the query corpus, which can effectively improve the pertinence and accuracy of search and analysis.

[0111] Furthermore, the number of times a keyword appears is used as the weight during retrieval, and the weight calculation can be expressed by the following formula:

[0112] w i =1+log(n i );

[0113] Among them, n i Indicates the number of keywords ki.

[0114] like Figure 8 As shown, Figure 8 : is a structural diagram of a construction device of a TCM formula optimization system provided by an embodiment of the present invention. The present invention also provides a construction device of a TCM formula optimization system, comprising:

[0115] The processor 801 may be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0116] The memory 802 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 802 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 802, and the processor 801 calls and executes the construction method of the traditional Chinese medicine formula optimization system of the embodiment of this application;

[0117] Input / output interface 803, used to implement information input and output;

[0118] The communication interface 804 is used to realize the communication interaction between the present apparatus and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);

[0119] A bus 805 that transmits information between the various components of the device (e.g., the processor 801, the memory 802, the input / output interface 803, and the communication interface 804);

[0120] The processor 801 , the memory 802 , the input / output interface 803 and the communication interface 804 are connected to each other in communication within the device via a bus 805 .

[0121] An embodiment of the present application also provides an electronic device, including a construction device of the traditional Chinese medicine formula optimization system as described above.

[0122] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium. The storage medium stores a computer program, and when the computer program is executed by a processor, the method for constructing the above-mentioned traditional Chinese medicine formula optimization system is implemented.

[0123] As a non-transient computer-readable storage medium, the memory can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and are implemented to be located in one place, or may also be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0124] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0125] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions under the shared conditions without violating the spirit of the present invention. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present invention.

Claims

1. A method for constructing a traditional Chinese medicine formula optimization system, characterized in that: include: Selecting a base model, constructing an interactive interface of the base model, and inputting input information into the base model through the interactive interface; Acquire traditional Chinese medicine data, build a corpus based on the traditional Chinese medicine data, and obtain a first data set; Obtaining a user table, a question-and-answer record table, and a traditional Chinese medicine data table, and constructing a database of the base model according to the user table, the question-and-answer record table, and the important data table to obtain a second data set; The base model is fine-tuned according to the first data set and the second data set to obtain a fine-tuning parameter value; Obtaining weight information of the layer to be updated in the base model, wherein the base model assigns a value to the layer to be updated through the fine-tuning parameter value according to the weight information; The loading strategy of the base model is set so that when the TCM formula optimization system is started, the fine-tuned base model is automatically loaded according to the data information to output the TCM formula.

2. The method for constructing a traditional Chinese medicine formula optimization system according to claim 1, characterized in that: The database of the base model is constructed according to the user table, the question and answer record table and the important data table, including: Acquire the unique identifier, user name information and the first field of the user table, so that the user can log in through the interactive interface according to the unique identifier and confirm the identity information of the user; The second field of the user table is obtained, and the second field verifies the user in response to the identity information. After the user passes the verification, the Chinese medicine formula optimization system is accessed to enable the user to perform question-and-answer operations with the base model.

3. The method for constructing a Chinese medicine formula optimization system according to claim 2, characterized in that: After accessing the Chinese medicine formula optimization system, the method further includes: Obtaining a unique record identifier of the question and answer record table, wherein the question and answer record table obtains question and answer information between the user and the base model, and the unique record identifier records the interaction process between the user and the base model according to the question and answer information; Obtaining a user unique identifier of the question and answer record table, associating the user unique identifier with the user table, and obtaining a first text of the user table record, wherein the first text is the original question text raised by the user; The base model outputs a second text according to the first text, wherein the second text is an answer text provided by the base model according to the original question text.

4. The method for constructing a traditional Chinese medicine formula optimization system according to claim 1, characterized in that: The base model is fine-tuned according to the first data set and the second data set, including: Acquiring model parameters of the base model and freezing the model parameters, wherein the base model is provided with a plurality of language processing layers; Adding a first matrix to each of the plurality of language processing layers so that the base model obtains a matrix output result according to the first matrix; Obtaining an initial path output result of the base model, adding the matrix output result to the initial path output result to obtain a bypass matrix parameter; The bypass matrix parameters are trained to obtain an increased dimension matrix, a reduced dimension matrix and an intermediate layer of the bypass matrix parameters; and the intrinsic rank is simulated according to the increased dimension matrix, the reduced dimension matrix and the intermediate layer.

5. The method for constructing a traditional Chinese medicine formula optimization system according to claim 1, characterized in that: After constructing a corpus based on the traditional Chinese medicine data to obtain a first data set, the method further includes: Dividing the first data set into a training set, a validation set, and a test set; Inputting the training set into the base model, and the base model updates model parameters according to the training set; The validation set is monitored according to the updated model parameters to obtain monitoring results, and the base model adjusts hyperparameters and monitoring strategies according to the monitoring results.

6. The method for constructing a traditional Chinese medicine formula optimization system according to claim 1, characterized in that: After obtaining the weight information of the layer to be updated in the base model, the method further includes: Acquiring semantic similarity information of the corpus, and constructing a word relationship network according to the semantic similarity information; Extract keywords from the traditional Chinese medicine data table according to a first algorithm, input the keywords into the word relationship network, and obtain a plurality of keywords; The first algorithm performs iterative calculation on the keywords and assigns weights to the keywords; Prioritize the multiple keywords according to the keyword weights to obtain a ranking result; A vocabulary set of all sample texts is obtained, wherein the vocabulary set obtains at least five target keywords according to the sorting result.

7. The method for constructing a traditional Chinese medicine formula optimization system according to claim 6, characterized in that: The step of obtaining a vocabulary set of all sample texts, wherein the vocabulary set information obtains at least five target keywords according to the sorting result, includes: Merging the vocabulary set with a preset professional vocabulary library to obtain a keyword set; Obtaining keyword quantity information of the keyword set, and obtaining the keyword occurrence count according to the keyword quantity information; The keyword extraction is performed using the number of times the keyword occurs as a weight.

8. A device for constructing a Chinese medicine formula optimization system, characterized in that: It includes at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the method for constructing a traditional Chinese medicine formula optimization system as described in any one of claims 1 to 7.

9. An electronic device, characterized in that: It includes a construction device for the traditional Chinese medicine formula optimization system as described in claim 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method for constructing a traditional Chinese medicine formula optimization system as described in any one of claims 1 to 7.