Tea intelligent inquiry method, device and system based on large language model and storage medium
By building an intelligent tea diagnosis system and using the large language model ChatTea, we have solved the shortcomings of intelligent decision-making in tea planting, achieved efficient and accurate tea disease diagnosis and cultivation management, and improved the modernization level of the tea industry.
Patent Information
- Application Number
- CN202510804235.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-09-26
AI Technical Summary
Existing tea planting technologies lack efficient intelligent decision-making support and real-time response methods, and have a low level of informatization, which has hindered the modernization of the tea industry, especially in terms of pest and disease control and response to meteorological disasters.
Build a tea intelligent consultation system based on a large language model. By collecting tea professional knowledge data, build a tea intelligent consultation large language model ChatTea, use quantitative technology to deploy it to the tea intelligent consultation platform, combine with the interactive feedback module to dynamically obtain user consultation information and optimize the answer strategy.
It provides high-precision and efficient answers to tea disease diagnosis and cultivation management, improves the scientific nature and user experience of tea management, and enhances the personalized adaptability and robustness of the model.
Smart Images

Figure CN120706554A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of the intersection of tea planting and artificial intelligence, and in particular to a method, device, system and storage medium for intelligent tea diagnosis based on a large language model. Background Art
[0002] Tea is one of the world's three most popular beverages. With the rapid development of the global tea industry, tea plantation area, production, consumption, and global trade are showing a sustained upward trend. However, several pressing challenges remain within the production process, particularly in tea cultivation, pest and disease control, and meteorological disaster response, which urgently require greater technological support and innovative approaches. Currently, the tea industry has a low level of informatization and lacks efficient platforms for knowledge transfer and problem-solving. Despite the continuous advancement of modern technology, existing technologies still have limitations, particularly in intelligent decision-making support and real-time response. These information silos and technological barriers hinder the modernization of the tea industry and affect the stability of tea production and quality. Against this backdrop, developing an accurate and efficient intelligent tea diagnosis model to provide timely and scientific decision-making support for tea farmers has become an urgent task.
[0003] In recent years, with the rapid development of artificial intelligence (AI), technologies such as big data, deep learning, knowledge graphs, and large language models have been widely applied in knowledge-based diagnosis, demonstrating their strong potential. Large language models can effectively understand and generate natural language, enhancing computers' ability to understand complex problems.
[0004] Chinese patent "Application Number: CN202411663537.6" discloses a "knowledge question answering method, device and storage medium based on knowledge graph". The method first processes the natural language question input by the user, extracts the subject entity therein, and converts the question into an embedded vector representation. Subsequently, the subject entity is mapped to the knowledge graph, and the candidate answer entity is screened out based on its proximity relationship. By calculating the similarity between the subject entity, the candidate answer entity and the question vector, the candidate answers are sorted, and a set of relationship paths from the subject entity to the candidate answer is extracted from the knowledge graph. Finally, by calculating the similarity between the question embedding vector and the relationship path embedding vector, the answer reasoning is completed, thereby improving the accuracy and reasoning efficiency of knowledge question answering.
[0005] This patented solution uses the structured characteristics of the knowledge graph to optimize the reasoning ability of the question-answering system, but it mainly relies on the integrity and update efficiency of the knowledge graph. If the knowledge graph is missing or lagging, the quality of the question-answering will be significantly affected. In addition, this method has limitations when processing unstructured data. It is difficult to understand complex semantics by relying solely on entity recognition and similarity calculation. Especially in cases where multiple rounds of reasoning, implicit relationship mining, or cross-domain knowledge integration are required, inaccurate answers are prone to occur. Because its mechanism based on relational path reasoning is relatively rigid and cannot effectively handle the ambiguity and openness of language, an intelligent question-answering method combined with a large language model (LLM) is needed to enhance the system's understanding of complex problems and adaptive reasoning capabilities. Summary of the Invention
[0006] The technical problem to be solved by the present invention is to provide a method, device, system and storage medium for intelligent tea diagnosis based on a large language model.
[0007] In order to solve the above technical problems, the technical solution of the present invention is:
[0008] A tea intelligent diagnosis method based on a large language model, the method comprising:
[0009] Construction of a knowledge corpus in the tea field: Collecting tea professional knowledge data, and using a general large language model combined with manual semi-supervision to build a corpus;
[0010] Construction of ChatTea, a large language model for intelligent tea diagnosis: The base model is fine-tuned and trained using the corpus's low-rank matrix to build ChatTea, a large language model for intelligent tea diagnosis.
[0011] Establishment of tea intelligent diagnosis platform: Use quantitative technology to quantify ChatTea and deploy it to the tea intelligent diagnosis platform;
[0012] Answers to medical questions: Input platform users’ medical questions into ChatTea to get answers.
[0013] Preferably, in the construction of the tea field knowledge corpus, the collected tea professional knowledge data covers common tea planting, processing, pest and disease control knowledge, and deeply explores the content of tea-related sub-fields; in the construction of the corpus by the general large language model combined with manual semi-supervision, the manual semi-supervision is conducted by at least three tea experts with more than five years of experience for multiple rounds of review to ensure data accuracy and reliability from a professional perspective, thereby further improving the quality of the corpus; the corpus storage structure adopts an Aplace structure, which can be specifically divided into three parts: Instruction, Input and Output; wherein Instruction mainly describes the task type and goal, Input is the given context or question content, Output is the correct answer to the corresponding task or the expected model-generated content, and Input is not a required structure.
[0014] Preferably, in the construction of the ChatTea large language model for intelligent tea diagnosis, the base model adopts an open source model with excellent performance in the field of natural language processing and adaptive parameter scale, and is pre-trained on the Chinese general corpus; it has good language understanding and generation capabilities, and can provide a solid foundation for knowledge learning in the field of intelligent tea diagnosis;
[0015] The low-rank matrix fine-tuning training adopts a dynamic learning rate adjustment strategy, which dynamically adjusts the learning rate according to the training rounds and the validation set loss to improve the generalization ability and convergence speed of the model;
[0016] The fine-tuning training method divides the tea domain knowledge corpus into a training corpus, a validation corpus, and a test corpus in a ratio of 8:1:1. A bypass is added to the base model to freeze most of the original pre-trained weights of the model and only adjust the low-rank matrix. Two new low-rank matrices A and B are introduced into the original pre-trained language model (PLM), and training is performed using the training corpus. During the training process, only the parameters of the two matrices A and B are updated.
[0017] During the model implementation, the instructions in the input corpus are passed to the base model in the form of a token sequence. The pre-trained weight matrix of the base model is W0. Two new matrices, matrix A and matrix B, are inserted next to W0. These two matrices work together with W0 on the input X to generate the adjusted output h.
[0018] X is the instruction in the corpus, where the original weight matrix Frozen during training; the matrix and matrix They are matrices initialized randomly and initialized to zero, with rank rank << min(d, k). By updating the parameters of A and B, the model output can be effectively adjusted while avoiding updating the entire model parameters, reducing the computational burden of training. The calculation formula for the output h is:
[0019] h = W0 + ΔWx = W0x + BAx
[0020] The dynamic learning rate adjustment strategy adjusts the learning rate lr dynamically according to the training round t and the validation set loss L
[0026] , , , max , max , , , , ,
[0027] , , , , max , cur ,
[0025] , ,
[0029] ,
[0024] ,
[0028] ,
[0023] , Specifically, a cosine annealing learning rate scheduler is adopted, and its formula is as follows:
[0021]
[0022] where lr t is the learning rate for the t-th round of training, lr min is the minimum value of the learning rate to prevent the model from converging too slowly due to too small learning rate; lr max is the maximum value of the learning rate. Using a larger learning rate at the beginning of training can accelerate the convergence speed of the model; T cur is the current training round, and T max is the total number of training rounds.
[0023] Preferably, in the construction of the intelligent tea consultation platform, the quantization technology adopts the mixed-precision quantization method to reduce the storage space and computational amount of the model while ensuring the model performance; in this method, the ChatTea parameters are quantized from FP32 (single-precision floating-point number) to FP16 (half-precision floating-point number);
[0024] The original model parameter matrix is represented by FP32; the quantized parameter matrix is Use the linear quantization formula to map W to FP16:
[0025] <round(·) is a rounding function that maps the scaled value to the nearest FP16 representable value;
[0030] The deployment to the tea intelligent consultation platform adopts containerization technology, which packages the model and its dependent environment into an independent container, making it easy to deploy and expand on different nodes.
[0031] Preferably, the training process of the ChatTea language model for intelligent tea diagnosis includes the following steps:
[0032] After preprocessing, the professional corpus in the tea field is divided into training corpus, validation corpus and test corpus in a ratio of 8:1:1;
[0033] The model was trained using samples from the training corpus. The performance of the model's responses was evaluated using the Bilingual Evaluation Understudy Score-4 (BLEU-4) and Recall-Oriented Understudy for Gisting Evaluation (ROUGE). The model's response efficiency was evaluated using steps per second.
[0034] BLEU calculates the score by comparing the tuple matching (n-gram) between the text generated by the model and the reference text. BLEU-4 specifically refers to the matching of four tuples (4-gram). The higher the BLEU score, the more similar the generated text is to the reference text. The calculation formula of BLEU is:
[0035]
[0036] Among them, p n is the n-gram precision, which indicates how many n-grams in the generated text match the n-grams in the reference text; w n is the weight, N is the maximum order of n-gram, in BLEU-4, N=4; BP is the brevity penalty (Brevity Penalty), which is used to penalize the case where the generated text is too short:
[0037]
[0038] Among them, r is the length of the reference text and c is the length of the generated text;
[0039] ROUGE compares the text content generated by the model with the reference text content to obtain the corresponding score. It can also be used to measure the degree of match between the generated results and the reference results. The difference is that ROUGE is based on recall rate, while BLEU focuses on precision rate.
[0040] ROUGE-N calculates the recall rate by splitting the results generated by the model and the reference results according to N-gram. The specific formula is:
[0041]
[0042] Where n is the length of n-gram, gram n Represents n-gram, Count match (gram n ) is the maximum number of n-grams that co-occur in the generated text and the reference text set; RS (Reference Summaries) is the reference text set, and S represents each reference in the set; in ROUGE-1 and ROUGE-2, it refers to the 1-gram and 2-gram ROUGE respectively;
[0043] The core idea of ROUGE-L is to calculate the longest common subsequence (LCS) between the reference text and the generated text. LCS is the longest sequence of words that co-occur in the generated text and the reference text while preserving their relative order. The calculation formula of ROUGE-L is as follows:
[0044]
[0045] Where LCS(X, Y) is the longest common subsequence length of the generated text and the reference text, m and n represent the length of the reference text and the generated text respectively, and R lcs and P lcs Represent the recall rate and precision rate, F lcs That is ROUGE-L.
[0046] In addition, to achieve the above-mentioned purpose, the present invention further provides a tea intelligent diagnosis device based on a large language model, which is applied to the above-mentioned tea intelligent diagnosis method, and the tea intelligent diagnosis device includes:
[0047] Corpus construction module, used to build a professional knowledge corpus in the tea field;
[0048] The large language model module is used to input the target crop's professional knowledge corpus into the pre-trained large language model and, through fine-tuning training, enable it to have the professional capabilities of tea intelligent diagnosis. The fine-tuned base model has pre-trained parameters. A new bypass is added to freeze most of the original pre-trained weights of the base model and only adjust the low-rank matrix. Two new low-rank matrices A and B are introduced into the original base model, and training is performed using the training corpus. During the training process, only the parameters of the two matrices A and B are updated.
[0049] The interactive feedback module is used to obtain user consultation information, record the questions entered by the user, and provide high-quality consultation results.
[0050] In addition, to achieve the above-mentioned purpose, the present invention also provides a tea intelligent diagnosis system based on a large language model. The tea intelligent diagnosis system includes a processor, a graphics processing unit, and a memory coupled to the processor, and the memory stores program instructions that can be executed by the processor; when the processor executes the program instructions stored in the memory, it implements the steps of the tea intelligent diagnosis method described above.
[0051] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which program instructions are stored. When the program instructions are executed by a processor, the steps of the above-mentioned intelligent tea diagnosis method are implemented.
[0052] The above technical solution has the following advantages:
[0053] (1) This application uses ChatTea, a large language model for intelligent tea diagnosis, which can provide high-precision and efficient answers to tea-related questions, covering multiple areas such as tea disease diagnosis, cultivation management, and processing technology. This effectively avoids the knowledge bias and redundant information that may exist in general large models in the tea field.
[0054] (2) This application constructs a high-quality professional corpus specifically for the tea field, and uses preprocessing techniques such as deduplication, standardization, and noise filtering to ensure the accuracy and consistency of the corpus data. Combined with an 8:1:1 training, validation, and test data partitioning strategy, the model can be trained in a stable learning environment, thereby ensuring the robustness and generalization ability of ChatTea in the tea intelligent diagnosis task.
[0055] (3) The intelligent consultation system in this application integrates an interactive feedback module that can dynamically obtain the user's consultation information and optimize the model's answer strategy based on historical consultation records. This module not only improves the user experience, but also enables ChatTea to continuously learn and optimize during the continuous interaction process, thereby enhancing its adaptability to personalized questions and achieving more accurate tea knowledge consultation. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 This is a structural diagram of the tea intelligent diagnosis model ChatTea of the present invention;
[0057] Figure 2 This is an example data diagram of the Zhaotong University tea intelligent consultation platform corpus in a specific embodiment of the present invention;
[0058] Figure 3 This is a graph showing the proportion of high-frequency words in the Zhaotong University tea intelligent consultation platform corpus in a specific embodiment of the present invention;
[0059] Figure 4 : is a scatter plot of character lengths of the Zhaotong University tea intelligent consultation platform corpus in a specific embodiment of the present invention;
[0060] Figure 5 This is a flow chart of fine-tuning training of the Zhaotong College tea intelligent diagnosis platform in a specific embodiment of the present invention;
[0061] Figure 6 This is a comparison diagram of the effects of the Zhaotong University tea intelligent consultation platform model in a specific embodiment of the present invention;
[0062] Figure 7 This is a diagram of the login window of the Zhaotong College Tea Intelligent Diagnosis Platform in a specific embodiment of the present invention;
[0063] Figure 8 This is a configuration diagram of the network search engine of the Zhaotong College tea intelligent consultation platform in a specific embodiment of the present invention;
[0064] Figure 9 This is the initial page diagram of the Zhaotong College tea intelligent consultation platform in a specific embodiment of the present invention;
[0065] Figure 10 This is a diagram showing the answer effect of the Zhaotong University tea intelligent consultation platform model in a specific embodiment of the present invention;
[0066] Figure 11 Schematic diagram of the process of the present invention. DETAILED DESCRIPTION
[0067] The following is a further description of specific embodiments of the present invention in conjunction with the accompanying drawings. It should be noted that the description of these embodiments is intended to facilitate understanding of the present invention and does not constitute a limitation of the present invention. In addition, the technical features involved in the various embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
[0068] Example 1
[0069] A tea intelligent diagnosis model, ChatTea (ChatTea is a custom name for the tea intelligent diagnosis model), includes: an input text token module (Input Text Tokens), a token embedding module (Token Embeddings), a self-attention mechanism module (Self-attention), a feedforward neural network (Feedforward Network), an autoregressive decoding (Autoregressive Decoding), and an output text token module (Output Text Tokens), which together constitute a decoder architecture (Decoder-only). Figure 1 As shown;
[0070] The input text markup module is used to receive text information input by the user and decompose it into basic semantic units for subsequent processing. This module supports multiple input methods, including direct text input, voice-to-text content, and OCR-recognized tea packaging or test report text.
[0071] The token embedding module is responsible for converting input text tokens into high-dimensional dense vector representations to capture semantic information. This module uses a pre-trained word embedding model and fine-tunes it with a professional corpus in the tea field.
[0072] The self-attention module is used to calculate dependencies within text, enabling the model to capture semantic relevance globally. This mechanism can focus on key factors in tea-related descriptions.
[0073] The feedforward neural network is the core computational unit of the model, performing nonlinear transformations on the output of the self-attention mechanism to extract deeper features. This module, composed of a multi-layer perceptron (MLP), enhances the model's expressive power, enabling it to accurately identify tea quality issues.
[0074] The autoregressive decoding module is used to gradually generate answers to intelligent medical consultations. This module dynamically predicts the next optimal vocabulary based on the generated content and optimizes the output by combining it with the tea domain knowledge base, making the answers to medical consultations more professional and natural.
[0075] The output text markup module is responsible for converting the decoded results into natural language text for user understanding. This module combines language generation optimization strategies, such as temperature scaling and top-k sampling, to ensure the fluency and professionalism of the generated content.
[0076] The above is the main control flow of the system of the present invention when it is working. This model fully utilizes the advantages of the decoder-only architecture to achieve efficient and accurate intelligent tea diagnosis, and improve the scientific nature of tea management and decision-making.
[0077] Example 2
[0078] A tea intelligent diagnosis method based on a large language model includes the following steps:
[0079] S10: Construction of a knowledge corpus in the tea field: First, the system collects professional knowledge data covering tea planting, processing, pest and disease control, etc. through multiple channels. In order to ensure the professionalism and accuracy of the corpus data, a general large language model combined with manual semi-supervision is used to clean, annotate and organize the original text. The manual review process is carried out by at least three experts with more than five years of experience in the tea industry to conduct multiple rounds of verification and modification to ensure the scientificity and reliability of the corpus content. The constructed corpus is stored in a structured Aplace format. The Aplace structure is divided into three parts: Instruction, Input and Output. Among them, Instruction is used to describe the task type and goal; Input provides context or specific question content (non-required field); Output is the answer or instruction output that the model expects to generate. This structure helps to improve the model's context understanding ability and answer accuracy;
[0080] S20: Construction of ChatTea, a large language model for intelligent tea consultation: When constructing ChatTea, an intelligent tea consultation model, a Chinese open source pre-trained model with excellent performance in the field of natural language processing was selected as the base model, which has good language understanding and generation capabilities. The base model has been pre-trained on the Chinese general corpus and adapted to the medium parameter scale, which is convenient for subsequent efficient fine-tuning in specific fields. In order to efficiently adapt to the field of tea knowledge, the low-rank matrix fine-tuning (LoRA) method is used for training, which significantly reduces the computational overhead of parameter adjustment. In the implementation of the model, the Instruction in the input corpus is passed to the base model in the form of a Token sequence. The pre-trained weight matrix of the base model is W0; two new matrices are inserted next to W0, namely Matrix A and Matrix B; these two matrices act together with W0 on the input X to finally generate the adjusted output h. x is the Instruction in the corpus, where the original weight matrix Frozen during training; the matrix and matrix They are matrices initialized randomly and initialized to zero respectively, with rank << min(d, k). By updating the parameters of A and B, the model output can be effectively adjusted while avoiding updating the entire model parameters, reducing the computational burden of training. The calculation formula for the output h is:
[0081] h = W0 + ΔWx = W0x + BAx
[0082] During the training process, according to the training round t and the validation set loss L val The learning rate lr is dynamically adjusted; specifically, the cosine annealing learning rate scheduler is adopted, and its formula is as follows:
[0083]
[0084] where lr t is the learning rate for the t-th round of training, lr min is the minimum value of the learning rate, preventing the model from converging too slowly due to an overly small learning rate; lr max is the maximum value of the learning rate. Using a larger learning rate at the beginning of training can accelerate the convergence speed of the model; T cur is the current training round, and T max is the total number of training rounds.
[0085] The performance of the model's answers is evaluated through the Bilingual Evaluation Understudy Score-4 (BLEU-4) and ROUGE (Recall-Oriented Understudy for Gisting Evaluation); the model's response efficiency is evaluated using steps per second.
[0086] BLEU calculates the score by comparing the tuple matching (n-gram) between the text generated by the model and the reference text. BLEU-4 specifically refers to the matching of four-tuples (4-gram). The higher the BLEU score, the higher the similarity between the generated text and the reference text. The calculation formula for BLEU is:
[0087]
[0088] where p n is the precision of the n-gram, indicating how many n-grams in the generated text match the n-grams in the reference text; w nis the weight, N is the maximum order of n-gram, in BLEU-4, N=4; BP is the brevity penalty (Brevity Penalty), which is used to penalize the case where the generated text is too short:
[0089]
[0090] Among them, r is the length of the reference text and c is the length of the generated text;
[0091] ROUGE compares the text content generated by the model with the reference text content to obtain the corresponding score. It can also be used to measure the degree of match between the generated results and the reference results. The difference is that ROUGE is based on recall rate, while BLEU focuses on precision rate.
[0092] ROUGE-N calculates the recall rate by splitting the results generated by the model and the reference results according to N-gram. The specific formula is:
[0093]
[0094] Where n is the length of n-gram, gram n Represents n-gram, Count match (gram n ) is the maximum number of n-grams that co-occur in the generated text and the reference text set; RS (Reference Summaries) is the reference text set, and S represents each reference in the set; in ROUGE-1 and ROUGE-2, it refers to the 1-gram and 2-gram ROUGE respectively;
[0095] The core idea of ROUGE-L is to calculate the longest common subsequence (LCS) between the reference text and the generated text. LCS is the longest sequence of words that co-occur in the generated text and the reference text while preserving their relative order. The calculation formula of ROUGE-L is as follows:
[0096]
[0097] Where LCS(X, Y) is the longest common subsequence length of the generated text and the reference text, m and n represent the length of the reference text and the generated text respectively, and R lcs and P lcs Represent the recall rate and precision rate, F lcs That is ROUGE-L.
[0098] S30: Tea intelligent consultation platform construction: In order to deploy the ChatTea model and support actual user use, the model is compressed from FP32 precision to FP16 using mixed precision quantization technology. ChatTea parameters are converted from FP32 (single precision floating point) to FP16.
[0099] Quantized to FP16 (half-precision floating point);
[0100] The original model parameter matrix is It is represented by FP32; the parameter matrix after quantization is Map W to FP16 using the linear quantization formula:
[0101]
[0102] Where S is the scaling factor used to scale the FP32 value to the FP16 representation range. S is calculated as:
[0103]
[0104] max(|W|) is the maximum absolute value in the parameter matrix W, Q max It is the maximum quantized value that can be represented in FP16;
[0105] round(·) is a rounding function that maps the scaled value to the nearest FP16 representable value;
[0106] Subsequently, using containerization technology, the model and its dependent environments were packaged into an independent container, enabling cross-platform deployment and efficient scalability, building a fully functional tea intelligent diagnosis service platform.
[0107] S40: Question answering: Users submit questions through the tea intelligent consultation platform, such as "What is the best time to pick spring tea?" or "How to prevent and control tea tree anthracnose?" The system encapsulates the questions into an Instruction-Input structure and inputs them into the ChatTea model. The model generates answers based on the learned tea expertise and returns them to the user through the platform.
[0108] In this embodiment, S10 collects professional knowledge data covering tea planting, processing, pest and disease control, etc. through multiple channels, and uses a general large language model and manual semi-supervised methods to clean, annotate, and organize the original text to build a structured tea domain knowledge corpus. This process is completed under multiple rounds of verification by no less than three experts with more than five years of experience in the tea industry to ensure the professionalism, scientificity, and domain adaptability of the corpus. The data is organized in the instruction-input-output Aplace format to improve the model's contextual understanding ability and generation accuracy.
[0109] In this embodiment, the S20 uses the low-rank matrix fine-tuning (LoRA) method to perform efficient domain adaptation training on the model based on the Chinese open source pre-trained language model, and combines the Instruction information in the tea corpus to guide the model to learn tea domain knowledge and common consultation tasks. During the training process, the base model parameters are frozen, and only the inserted low-rank matrix is updated, which significantly reduces the computational burden. At the same time, the cosine annealing learning rate scheduling strategy is introduced to dynamically adjust the learning rate and improve the model convergence efficiency. After the model training is completed, it has the ability to understand user input and combine the knowledge base to perform reasoning and generate answers to tea-related consultations, covering aspects such as tea quality, planting management, and disease prevention;
[0110] In this embodiment, the S30 compresses the parameters of the ChatTea model from FP32 to FP16 using mixed-precision quantization technology, effectively improving inference efficiency and reducing system computing resource consumption. This improves platform response speed and operating efficiency without significantly affecting model performance. Subsequently, containerization technology is used to deploy the model and its operating environment, building a tea intelligent consultation service platform that supports cross-platform access and efficient scalability.
[0111] In this example, the intelligent tea diagnosis model, ChatTea, is built on a large Chinese language model and receives user input questions via an instruction-input structure. The model utilizes core modules such as a self-attention mechanism and a feedforward neural network, combined with domain knowledge learned from a tea corpus, to achieve efficient and accurate intelligent tea diagnosis.
[0112] Example 3
[0113] According to the method of Example 1 and Example 2, a complete construction method was successfully constructed to successfully construct a tea intelligent diagnosis system based on a large language model, and on this basis, a tea intelligent diagnosis platform based on a large language model was developed and applied to the Zhaotong College intelligent education platform.
[0114] First, we collected domestic tea-related professional books, papers, and reports as data sources. Using a general large language model and manual semi-supervised methods, we constructed a corpus for intelligent tea diagnosis. This corpus includes 10 books on tea, 200 articles on the subject from the past five years, and 300 news items from the past five years, totaling 10 million words. The corpus covers a wide range of areas, including tea cultivation, production, processing, resources, culture, and germplasm resources.
[0115] Based on the above data sources, a high-quality corpus of over 1 million words in the field of tea was constructed, with a total of 24,765 question and answer data. Figure 2 The example data of the constructed tea corpus is shown.
[0116] The keywords in the corpus are highly concentrated, particularly around concepts such as tea, tea trees, culture, development, quality, prevention and treatment, and tea gardens. This concentration of keywords reflects the data's specialized focus on the tea industry, encompassing multiple aspects of tea research, production, and cultivation. Figure 3 The results show that "tea" accounts for the highest proportion in the corpus, accounting for 2.7%, "tea" accounts for 1.7%, and "tea culture" accounts for 1.5%. Through in-depth analysis of high-frequency words in the corpus, it was found that high-frequency words cover tea planting, production, and culture.
[0117] In the constructed corpus, the character length of Instruction is mainly concentrated between 10 and 50, while the character length of Output is mostly concentrated between 0 and 400. The specific distribution is as follows: Figure 4 This distribution characteristic reflects the diversity and complexity of the data, which helps improve the generalization ability and accuracy of the model when processing texts of different lengths.
[0118] The present invention adds a bypass to the Meta-Llama-3.1-8B-Instruct base model, freezing most of the original pre-trained weights of the model and only adjusting the low-rank matrix. This method can effectively fine-tune large-scale pre-trained models while reducing the number of parameters that need to be updated. Specifically, the present invention introduces two new low-rank matrices A and B in the original pre-trained language model, and only updates the parameters of these two matrices during the training process. During the implementation of the model, the Instruction in the input corpus is passed to the base model in the form of a Token sequence, and the pre-trained weight matrix of the base model is W0. Two new matrices are inserted next to W0, namely Matrix A and Matrix B. These two matrices act together with W0 on the input X to finally generate the adjusted output h. The specific process is as follows: Figure 5 shown.
[0119] X is the instruction in the corpus, where the original weight matrix Frozen during training. and matrix The matrices are randomly initialized and zero initialized respectively, with rank rank << min(d, k). By updating the parameters of A and B, the model output can be effectively adjusted while avoiding updating the entire model parameters, reducing the computational burden of training. The calculation formula for the output h is:
[0120] h=W0+ΔWx=W0x+BAx
[0121] In this example, when training ChatTea, a large language model for intelligent tea diagnosis, the corpus was divided into training, validation, and test sets in a ratio of 8:1:1. The model was evaluated using bilingual evaluation pseudo-metrics and ROUGE. The BLEU-4, ROUGE-1, ROUGE-2, and ROUGE-L evaluation metrics on the test set reached 21.731%, 43.683%, 21.331%, and 37.268%, respectively. Figure 6 The comparison between ChatTea and mainstream large language models in the field of intelligent tea diagnosis is demonstrated.
[0122] Through model quantification technology, the tea intelligent diagnosis language model ChatTea was quantified and deployed to the Zhaotong University intelligent platform. Figures 7 to 10 The platform's login window, network engine configuration, initialization page, and model answer effect are displayed respectively.
[0123] Furthermore, those skilled in the art will appreciate that all or part of the steps in the method of the above-described embodiment can be implemented by instructing the relevant hardware through a computer program. The computer program includes program instructions, which can be stored in a computer-readable storage medium. The program instructions are executed by at least one processor in the crop disease inversion system to implement the steps in the method of the above-described embodiment.
[0124] Therefore, the present invention also provides a computer-readable storage medium, which stores a tea intelligent diagnosis model ChatTea based on a large language model. When the tea intelligent diagnosis system based on a large language model is executed, it implements the various steps of the tea intelligent diagnosis method based on a large language model as described in the above embodiment.
[0125] It should be noted that since the storage medium provided in the embodiments of this application is the storage medium used to implement the method of the embodiments of this application, based on the method described in the embodiments of this application, those skilled in the art will be able to understand the specific structure and deformation of the storage medium, and therefore will not be described in detail here. All storage media used in the method of the embodiments of this application fall within the scope of protection to be provided by this application.
[0126] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0127] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0128] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0130] It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claim. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third etc. does not indicate any order. These words may be interpreted as names.
[0131] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. It is apparent to those skilled in the art that various changes, modifications, substitutions, and variations to these embodiments may be made without departing from the principles and spirit of the present invention, and these changes and modifications still fall within the scope of protection of the present invention.
Claims
1. A tea intelligent diagnosis method based on a large language model, characterized by The method includes: Construction of a knowledge corpus in the tea field: Collecting tea professional knowledge data, and using a general large language model combined with manual semi-supervision to build a corpus; Construction of ChatTea, a large language model for intelligent tea diagnosis: The base model is fine-tuned and trained using the corpus's low-rank matrix to build ChatTea, a large language model for intelligent tea diagnosis. Establishment of tea intelligent diagnosis platform: Use quantitative technology to quantify ChatTea and deploy it to the tea intelligent diagnosis platform; Answers to medical questions: Input platform users’ medical questions into ChatTea to get answers.
2. The method according to claim 1, characterized in that In the construction of the tea field knowledge corpus, the collected tea professional knowledge data covers common tea planting, processing, and pest and disease control knowledge, and deeply explores the content of tea-related sub-fields; in the construction of the corpus by combining the general large language model with manual semi-supervision, manual semi-supervision is carried out by at least three tea experts with more than five years of experience for multiple rounds of review to ensure data accuracy and reliability from a professional perspective, further improving the quality of the corpus; the corpus storage structure adopts the Aplace structure, which can be specifically divided into three parts: Instruction, Input and Output; among them, Instruction mainly describes the task type and goal, Input is the given context or question content, and Output is the correct answer to the corresponding task or the expected model-generated content. Input is not a required structure.
3. The method according to claim 1, characterized in that In the construction of the ChatTea large language model for intelligent tea diagnosis, the base model adopts an open source model with excellent performance in the field of natural language processing and adaptive parameter scale, and is pre-trained on the Chinese general corpus. It has good language understanding and generation capabilities and can provide a solid foundation for knowledge learning in the field of intelligent tea diagnosis. The low-rank matrix fine-tuning training adopts a dynamic learning rate adjustment strategy, which dynamically adjusts the learning rate according to the training rounds and the validation set loss to improve the generalization ability and convergence speed of the model; The fine-tuning training method divides the tea domain knowledge corpus into a training corpus, a validation corpus, and a test corpus in a ratio of 8:1:
1. A bypass is added to the base model to freeze most of the original pre-trained weights of the model and only adjust the low-rank matrix. Two new low-rank matrices A and B are introduced into the original pre-trained language model (PLM), and training is performed using the training corpus. During the training process, only the parameters of the two matrices A and B are updated. During the model implementation, the instructions in the input corpus are passed to the base model in the form of a token sequence. The pre-trained weight matrix of the base model is W0. Two new matrices, matrix A and matrix B, are inserted next to W0. These two matrices work together with W0 on the input X to generate the adjusted output h. x is the instruction in the corpus, where the original weight matrix Frozen during training; the matrix and matrix The matrices are randomly initialized and zero-initialized, with a rank of rank << min(d, k). By updating the parameters of A and B, the model output can be effectively adjusted while avoiding updating the parameters of the entire model, reducing the computational burden of training. The calculation formula for output h is: h=W0+ΔWx=W0x+BAx The dynamic learning rate adjustment strategy is based on the training round t and the validation set loss L during the training process. val Dynamically adjust the learning rate lr; specifically use the cosine annealing learning rate scheduler (Cosine Annealing Learning Rate Scheduler), whose formula is as follows: Among them, lr t is the learning rate for the tth round of training, lr min It is the minimum value of the learning rate, which prevents the learning rate from being too small and causing the model to converge too slowly; lr max Is the maximum value of the learning rate. Using a larger learning rate in the early stage of training can accelerate the convergence of the model; T cur is the current training round, T max is the total number of training rounds.
4. The method according to claim 1, wherein In the construction of the tea intelligent consultation platform, the quantization technology adopts a mixed precision quantization method to reduce the storage space and computational complexity of the model while ensuring the performance of the model. In this method, the ChatTea parameters are quantized from FP32 (single-precision floating point) to FP16 (half-precision floating point); The original model parameter matrix is It is represented by FP32; the quantized parameter matrix is Map W to FP16 using the linear quantization formula: Where S is the scaling factor used to scale the FP32 value to the FP16 representation range. S is calculated as: max(|W|) is the maximum absolute value in the parameter matrix W, Q max is the maximum quantized value that can be represented in FP16; round(·) is a rounding function that maps the scaled value to the nearest FP16 representable value; The deployment to the tea intelligent consultation platform adopts containerization technology, which packages the model and its dependent environment into an independent container, making it easy to deploy and expand on different nodes.
5. The method according to claim 1, wherein The training process of the ChatTea language model for intelligent tea diagnosis includes the following steps: After preprocessing, the professional corpus in the tea field is divided into training corpus, validation corpus and test corpus in a ratio of 8:1:1; The model is trained using samples from the training corpus, and the bilingual evaluation pseudo-indicator (Bilingual Evaluation Understudy Score-4, BLEU-4) and ROUGE (Recall-Oriented Understudy for Gisting Evaluation) is used to evaluate the performance of the model's answers. The model's response efficiency is evaluated using steps per second. BLEU calculates the score by comparing the tuple matching (n-gram) between the text generated by the model and the reference text. BLEU-4 specifically refers to the matching of four tuples (4-gram). The higher the BLEU score, the more similar the generated text is to the reference text. The calculation formula of BLEU is: Among them, p n is the n-gram precision, which indicates how many n-grams in the generated text match the n-grams in the reference text; w n is the weight, N is the maximum order of n-gram, in BLEU-4, N=4; BP is the brevity penalty (Brevity Penalty), which is used to penalize the case where the generated text is too short: Among them, r is the length of the reference text and c is the length of the generated text; ROUGE is calculated by comparing the text content generated by the model with the reference text content to obtain the corresponding score. It can also be used to measure the degree of match between the generated results and the reference results. The difference is that ROUGE is based on the recall rate. BLEU focuses on accuracy; ROUGE-N calculates the recall rate by splitting the results generated by the model and the reference results according to N-gram. The specific formula is: Where n is the length of n-gram, gram n Represents n-gram, Count match (gram n ) is the maximum number of n-grams that co-occur in the generated text and the reference text set; RS (Reference Summaries) is the reference text set, and S represents each reference in the set; in ROUGE-1 and ROUGE-2, it refers to the 1-gram and 2-gram ROUGE respectively; The core idea of ROUGE-L is to calculate the longest common subsequence (LCS) between the reference text and the generated text. LCS is the longest sequence of words that co-occur in the generated text and the reference text while preserving their relative order. The calculation formula of ROUGE-L is as follows: Where LCS(X, Y) is the longest common subsequence length of the generated text and the reference text, m and n represent the length of the reference text and the generated text respectively, and R lcs and P lcs Represent the recall rate and precision rate, F lcs That is ROUGE-L.
6. A tea intelligent diagnosis device based on a large language model, applied to the tea intelligent diagnosis method according to any one of claims 1 to 5, characterized in that: The tea intelligent diagnosis device comprises: Corpus construction module, used to build a professional knowledge corpus in the tea field; The large language model module is used to input the target crop's professional knowledge corpus into the pre-trained large language model and, through fine-tuning training, enable it to have the professional capabilities of tea intelligent diagnosis. The fine-tuned base model has pre-trained parameters. A new bypass is added to freeze most of the original pre-trained weights of the base model and only adjust the low-rank matrix. Two new low-rank matrices A and B are introduced into the original base model, and training is performed using the training corpus. During the training process, only the parameters of the two matrices A and B are updated. The interactive feedback module is used to obtain user consultation information, record the questions entered by the user, and provide high-quality consultation results.
7. A tea intelligent diagnosis system, characterized in that: The intelligent tea diagnosis system includes a processor, a graphics processing unit, and a memory coupled to the processor, wherein the memory stores program instructions that can be executed by the processor; when the processor executes the program instructions stored in the memory, the steps of the intelligent tea diagnosis method as described in any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores program instructions, and when the program instructions are executed by the processor, the steps of the intelligent tea diagnosis method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Knowledge graph-based knowledge question and answer method and device and storage medium
CN119621887A
Cited By
Tea technology large model construction method and system, computer equipment and medium
CN120893546A