A method and system for constructing a vertical domain large language model

By preprocessing and reinforcing learning vertical field data, a large vertical field language model is constructed, which solves the problem of poor relevance of general models in vertical fields and realizes intelligent solution of professional problems and knowledge services.

CN119719256BActive Publication Date: 2025-10-14INST OF SCI & TECH INFORMATION OF CHINA ACAD OF RAILWAY SCI GRP CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411260648.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2025-10-14
Estimated Expiration
2044-09-10

AI Technical Summary

Technical Problem

When faced with professional questions in vertical fields, general large language models lack sufficient mining and in-depth understanding of high-quality vertical field data, resulting in low relevance of the answer content.

Method used

By acquiring vertical field data, performing preprocessing, keyword classification, reinforcement learning training, adjusting the neural network structure and weight parameters, generating a vertical field knowledge base and prompt word template, and building an application programming interface for a vertical field large language model.

Benefits of technology

It improves the content relevance of large vertical field models on professional issues, realizes intelligent knowledge management and generative knowledge services, and assists in retrieving high-value information and writing work reports.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719256B_ABST
    Figure CN119719256B_ABST
Patent Text Reader

Abstract

The application provides a construction method and system of a vertical field large language model, relating to the technical field of natural language processing, including extracting topic word information of vertical field data through data preprocessing and classification model, and applying reinforcement learning to train the large model to improve its professional ability. Further, a vertical field knowledge base is generated based on the preprocessed data and topic word information, and heuristic encoding method is used to optimize information retrieval. Finally, the trained large model and knowledge base are deployed, and an application program interface is constructed to realize intelligent service. The application effectively solves the relevance and precision problems of general large models in professional field applications by comprehensively utilizing preprocessing, classification, reinforcement learning and knowledge encoding technologies, and promotes the practical application and development of artificial intelligence in vertical fields.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing, in particular to a method and system for constructing a large language model in a vertical field. BACKGROUND

[0002] As one of the core technologies of generative artificial intelligence, large language models have achieved industrial application in financial investment, medical diagnosis, intelligent railway, etc. due to their excellent generalization ability and language understanding ability. However, when facing professional problems in vertical fields, general large models often cannot provide satisfactory answers due to the lack of sufficient mining and in-depth understanding of high-quality vertical field data. The core of this problem lies in the fact that vertical field data usually has characteristics such as multi-source, information redundancy stacking, and uneven quality. For example, multi-dimensional vertical field text data covering books, the Internet, papers, patents, etc. have differences in professional and data structure, making it difficult for traditional general models to accurately grasp the professional knowledge and context, resulting in low relevance of the answer content.

[0003] There is an urgent need for a large language model construction method in a vertical field based on deep learning and reinforcement learning technology to overcome the limitations of traditional general models in professional field applications, thereby providing efficient and intelligent solutions and knowledge services for various professional problems. SUMMARY

[0004] The purpose of the present application is to provide a method and system for constructing a large language model in a vertical field to improve the above problems. In order to achieve the above purpose, the technical solution adopted by the present application is as follows:

[0005] In a first aspect, the present application provides a method for constructing a large language model in a vertical field, comprising:

[0006] obtaining data information to be processed, the data information to be processed including vertical data information of at least one data source;

[0007] sending the data information to be processed to a preset data preprocessing model for preprocessing to obtain preprocessed data information;

[0008] sending the preprocessed data information to a preset classification model for subject word classification to obtain subject word information of data in at least two categories;

[0009] sending the subject word information of data in all categories to a preset large model in a vertical field for reinforcement learning training, and adjusting the neural network structure and weight parameters of the large model in the vertical field to obtain a trained large model in the vertical field;

[0010] generate a vertical domain knowledge base based on the pretreated data information and the topic word information of the data of all categories, and encode the topic word information of the data of all categories based on a preset heuristic method to obtain a prompt word template of the vertical domain large model;

[0011] deploy the trained vertical domain large model and the vertical domain knowledge base based on a preset deployment scheme, and construct an application program interface of the trained vertical domain large model to obtain the deployed vertical domain large model.

[0012] In a second aspect, the application further provides a construction system of a vertical domain large language model, comprising:

[0013] an acquisition unit configured to acquire data information to be processed, wherein the data information to be processed comprises vertical data information of at least one data source;

[0014] a processing unit configured to send the data information to be processed to a preset data preprocessing model for preprocessing to obtain pretreated data information;

[0015] a classification unit configured to perform topic word classification on the pretreated data information according to a preset classification model to obtain topic word information of data of at least two categories;

[0016] a training unit configured to send the topic word information of the data of all categories to a preset vertical domain large model for reinforcement learning training, and adjust a neural network structure and weight parameters of the vertical domain large model to obtain a trained vertical domain large model;

[0017] an encoding unit configured to generate a vertical domain knowledge base based on the pretreated data information and the topic word information of the data of all categories, and encode the topic word information of the data of all categories based on a preset heuristic method to obtain a prompt word template of the vertical domain large model;

[0018] a deployment unit configured to deploy the trained vertical domain large model and the vertical domain knowledge base based on a preset deployment scheme, and construct an application program interface of the trained vertical domain large model to obtain the deployed vertical domain large model.

[0019] The application has the following beneficial effects:

[0020] The application can remove irrelevant and poor quality data in different data sources, generate fine-tuning weight matrix, knowledge base and prompt word template with vertical field specialty based on high-quality vertical field text data, solve the problem of poor content relevance when a general large model answers professional problems in a vertical field, and ensure the professionalism of input data in the knowledge base and prompt word template of the large model by constructing and training a large model in a vertical field, realize the landing application of the large model in the vertical field, provide intelligent knowledge management and generative knowledge service, and assist in searching high-value information and writing work reports.

[0021] Other features and advantages of the present application will be set forth in the following description, and in part will become apparent from the description, or can be learned by practice of the present application according to the embodiments. The objects and other advantages of the present application will be realized and achieved by means of the structures particularly pointed out in the written description and claims, and the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be considered as limiting the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0023] Figure 1 The figure is a flow chart of the construction method of the vertical field large language model described in the embodiments of the present application.

[0024] Figure 2 The figure is a schematic diagram of the construction system structure of the vertical field large language model described in the embodiments of the present application.

[0025] In the figure: 701, acquisition unit; 702, processing unit; 703, classification unit; 704, training unit; 705, encoding unit; 706, deployment unit; 7021, first processing subunit; 7022, second processing subunit; 7031, third processing subunit; 7032, first classification subunit; 7033, second classification subunit; 7041, first training subunit; 7042, second training subunit; 7043, third training subunit; 7044, fourth training subunit; 70431, acquisition subunit; 70432, fourth processing subunit; 70433, fifth processing subunit; 7051, first encoding subunit; 7052, second encoding subunit; 7053, third encoding subunit. DETAILED DESCRIPTION

[0026] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.

[0027] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. Meanwhile, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance. Embodiment 1

[0028] The present embodiment provides a method for constructing a large language model in a vertical field.

[0029] Referring to Figure 1 , the method includes steps S1, S2, S3, S4, S5 and S6.

[0030] Step S1, obtaining data information to be processed, the data information to be processed including vertical data information of at least one data source;

[0031] It can be understood that this step obtains data distributed in books, journals, patents, enterprise internal data, public network and other different data sources, and obtains data from a specific vertical field data source, which ensures the professionalism and high relevance of the model training data, so that the model can understand and generate professional terms and content in this field. Obtaining data from multiple data sources enables the model to cover different types of information, enhancing the comprehensiveness and robustness of the model. By collecting different types of data comprehensively, the integrity of the model training data is ensured, so that the model can meet the application requirements in various scenarios.

[0032] Step S2, sending the data information to be processed to a preset data preprocessing model for preprocessing to obtain preprocessed data information;

[0033] It can be understood that this step can effectively improve the quality and consistency of the data through preprocessing, thereby providing a reliable basis for subsequent model training. In this step, step S2 includes steps S21 and S22.

[0034] Step S21, all the data information to be processed is constructed into a set, and the set is de-duplicated according to a preset de-duplication formula, to obtain a de-duplicated text block set;

[0035] It can be understood that this step removes repeated and invalid data by de-duplication processing, and ensures the purity and high quality of the data set. In this step, the preset de-duplication formula is as follows:

[0036]

[0037] wherein, denotes a text block set after the kth de-duplication operation, denotes a text block set after the (k-1) th de-duplication operation, denotes the i th text block, denotes the j th text block, denotes the similarity between the i th text block and the j th text block, is a preset parameter.

[0038] Step S22, the de-duplicated text block set is classified according to a preset classification formula, and the classified text block set is subjected to missing value interpolation processing, to obtain preprocessed data information.

[0039] It can be understood that this step ensures the consistency of the format and structure of the data through standardization and classification, which facilitates subsequent processing and analysis. The preset classification formula is as follows:

[0040]

[0041] wherein, denotes the a th word vector, denotes the b th word vector, denotes a preset threshold, denotes the distance between the a th word vector and the b th word vector, denotes a text block set.

[0042] Step S3, the preprocessed data information is sent to a preset classification model for subject word classification, to obtain subject word information of data in at least two categories;

[0043] It can be understood that this step classifies the preprocessed data by subject word, which can effectively extract important subject words in the text and classify these subject words into different technical directions, providing key inputs for subsequent model reinforcement learning training and knowledge base construction. In this step, step S3 includes step S31, step S32 and step S33.

[0044] ​Step S31, the preprocessed data information is searched, whether the preprocessed data information has preset vocabulary information is searched, if yes, the preset vocabulary information is deleted, and data information with deleted preset vocabulary information is obtained;

[0045] It can be understood that this step removes meaningless virtual words in the preprocessed data information, such as "of", "place", "in", etc., and at the same time, removes meaningless real words, such as "based on", "research", "consideration", etc., and retains the main subject words of the vertical field text data set, which are mainly the technical directions and system / devices in the vertical field. By searching and deleting the preset irrelevant vocabulary information, the quality and relevance of the data can be significantly improved, and more reliable input is provided for subsequent subject word classification and model training.

[0046] Step S32, based on the word frequency analysis method, the data information with deleted preset vocabulary information is analyzed for keywords, the vocabulary information with an appearance frequency greater than a preset threshold in the data information with deleted preset vocabulary information is determined, and is taken as a keyword;

[0047] It can be understood that this step can accurately extract high-frequency keywords in the text by the word frequency analysis method, ensuring the representativeness and accuracy of the keywords. The extracted keywords can effectively reduce data noise and improve data purity and quality. The extraction and screening of keywords make the subsequent subject classification and model training more concise and efficient.

[0048] Step S33, calling each data corresponding to a preset technical direction in all data to be processed, each technical direction is respectively calculated with each keyword according to a preset distance calculation formula, and if the distance is less than a preset threshold, the keyword is divided into a category corresponding to the technical direction.

[0049] It can be understood that the preset distance formula in this step is the Euclidean distance, which can accurately measure the similarity between the keyword and the technical direction, and ensure the accuracy of the classification. The classification of the keyword into the corresponding technical direction changes the data from an unordered keyword set to a structured classification result, which is convenient for subsequent processing and analysis.

[0050] Step S4, the subject word information of all categories of data is sent to a preset vertical field large model for reinforcement learning training, and the neural network structure and weight parameters of the vertical field large model are adjusted, and a trained vertical field large model is obtained;

[0051] It can be understood that the model can better adapt to the data of a specific field through reinforcement learning, thereby improving its ability to process related tasks. After reinforcement learning training, the model has better generalization ability when facing new data and can effectively process different categories of data. In this step, step S4 includes steps S41, S42, S43, and S44.

[0052] Step S41, constructing a vertical field knowledge tree structure based on the keywords and their corresponding technical direction categories, wherein the first-level nodes of the vertical field knowledge tree structure are technical directions, and the second-level nodes are keywords;

[0053] It can be understood that this step organizes and classifies keywords according to technical directions, making the knowledge in the field more clear and structured. Users can quickly find and navigate to the required field and related terms based on the knowledge tree structure, and it is convenient to manage and update the key terms and technical directions in the field, thereby maintaining the timeliness and accuracy of the knowledge base.

[0054] Step S42, inputting the vertical field knowledge tree structure as a training data set to a preset vertical field large model for training, wherein the original weight matrix of the vertical field large model is initialized, and a first adjustment weight matrix is determined based on the original weight matrix and a preset weight matrix adjustment formula;

[0055] It can be understood that the preset weight matrix adjustment formula in this step is as follows:

[0056]

[0057] wherein W is the first adjustment weight matrix, is the original weight matrix, is the fine-tuning weight matrix, and A and B are two preset low-rank matrices.

[0058] Step S43, training and calculating the first adjustment weight matrix based on the reinforcement learning method until the first adjustment weight matrix reaches a preset threshold, obtaining a second adjustment weight matrix, wherein the second adjustment weight matrix is the first adjustment weight matrix adjusted by the reinforcement learning method;

[0059] It can be understood that the weight matrix is automatically adjusted according to the reward feedback in the training process to adapt to different data distributions and input conditions. In this step, step S43 includes steps S431, S432, and S433.

[0060] Step S431, obtain the weight matrix in the current state of the state space setting, and set the action of the reinforcement learning to adjust the size of the weight matrix in the current state, wherein the reward function of adjusting the size of the weight matrix is the loss function between the predicted value and the original value of each data on the training data set;

[0061] wherein the reward function is as follows:

[0062]

[0063] wherein, represents the reward function, G represents the number of text training sets, represents the predicted value of the qth word vector on the text training, represents the original value of the qth word vector on the text training.

[0064] Step S432, randomly select an action, judge whether the current state corresponding to the action is a terminal state, if not, calculate the reward function value through the reward function, and iterate to the next state until the current state corresponding to the action is a terminal state, and obtain the weight matrix in the final state;

[0065] Step S433, the weight matrix in the final state is taken as the second adjusted weight matrix.

[0066] It can be understood that this step automatically optimizes the weight matrix according to the preset reward function through the reinforcement learning method, to adapt to the needs of specific tasks and data, and through iterative selection of actions and calculation of rewards, simulates the learning process in the environment, gradually improves the performance of the weight matrix, and improves the performance and robustness of the vertical field large model on complex tasks and data, to provide stronger model support for solving practical problems.

[0067] Step S44, adjusting the multi-head self-attention and the feedforward neural network part in the preset vertical field large model based on the second adjusted weight matrix, to obtain the trained vertical field large model.

[0068] It can be understood that this step adjusts the self-attention and feedforward neural network part according to the optimized weight matrix to improve the performance and generalization ability of the model. According to the specific needs and data characteristics of the vertical field, the model is customized and adjusted to make it more effectively learn and express complex relationships and patterns in the field. Through fine adjustment of the model structure, the performance and application ability of the model on specific tasks are enhanced, and the efficiency and accuracy of problem solving are improved.

[0069] Step S5, generate a vertical domain knowledge base based on the pre-processed data information and the subject keyword information of all categories of data, and encode the subject keyword information of all categories of data based on a preset heuristic method to obtain a prompt word template of the vertical domain large model;

[0070] It can be understood that this step is completed, and in this step, step S5 includes step S51, step S52 and step S53.

[0071] Step S51, the pre-processed data information and the subject keyword information of all categories of data are read, split and embedded to construct a vertical domain knowledge base;

[0072] It can be understood that this step uses word embedding technology to convert text information into dense vector representation, improves the data expression ability and calculation efficiency, helps to optimize and improve the performance and practical application ability of the vertical domain large model, so as to better serve the needs and challenges of specific fields.

[0073] Step S52, the preset user question is embedded, and the embedded user text vector is searched in the vertical domain knowledge base, wherein the correlation degree of the user text vector and the word vector in the vertical domain knowledge base is calculated through a preset similarity calculation formula, and the word vector with the maximum correlation degree with the user text vector is output as a relevant text block;

[0074] It can be understood that the similarity calculation formula in this step is the calculation formula of cosine similarity, by calculating the similarity of the user text vector and the word vector in the knowledge base, the information or answer related to the user question can be accurately found. Helps to improve the response speed and accuracy of the vertical domain large model when processing user queries and demands, so as to improve user experience and service quality.

[0075] Step S53, processing the relevant text block and the user question based on the calculation formula of the preset heuristic algorithm to obtain the prompt word template of the vertical domain large model.

[0076] It can be understood that this step uses heuristic algorithm to process the relevant text block and the user question, generates a prompt word template highly matched with the user demand, and improves the response and answer ability of the model to the user question. The generation formula of the template is as follows:

[0077]

[0078] Wherein, Prompt represents the prompt word template, F represents the function expression of the heuristic algorithm, represents the relevant text block, and Query represents the user question.

[0079] Step S6, deploying the trained vertical field large model and the vertical field knowledge base based on the preset deployment scheme, and constructing an application program interface of the trained vertical field large model to obtain a deployed vertical field large model.

[0080] It can be understood that through the constructed application program interface, users can submit requests and obtain model prediction results in real time, realizing the ability to quickly respond to user needs. The deployed vertical field knowledge base can effectively support the reasoning process of the model, helping the model better understand and process user input. The trained vertical field large model is successfully converted into a useful tool in practical applications, improving the intelligent level of the system and user experience. Embodiment 2:

[0081] As shown in Figure 2 , the embodiment provides a vertical field large language model construction system, please refer to Figure 2 The system includes an acquisition unit 701, a processing unit 702, a classification unit 703, a training unit 704, an encoding unit 705, and a deployment unit 706.

[0082] The acquisition unit 701 is configured to acquire data information to be processed, wherein the data information to be processed includes vertical data information of at least one data source.

[0083] The processing unit 702 is configured to send the data information to be processed to a preset data preprocessing model for preprocessing to obtain preprocessed data information.

[0084] The processing unit 702 includes a first processing subunit 7021 and a second processing subunit 7022.

[0085] The first processing subunit 7021 is configured to construct a set of all data information to be processed, and perform a de-duplication process on the set according to a preset de-duplication formula to obtain a set of de-duplicated text blocks.

[0086] The second processing subunit 7022 is configured to classify the set of de-duplicated text blocks according to a preset classification formula, and perform missing value interpolation processing on the classified set of text blocks to obtain the preprocessed data information.

[0087] The classification unit 703 is configured to send the preprocessed data information to a preset classification model for topic word classification to obtain topic word information of data in at least two categories.

[0088] The classification unit 703 includes a third processing subunit 7031, a first classification subunit 7032, and a second classification subunit 7033.

[0089] The third processing subunit 7031 is configured to search the preprocessed data information, and determine whether the preprocessed data information has preset vocabulary information. If the preprocessed data information has the preset vocabulary information, the preset vocabulary information is deleted, and data information in which the preset vocabulary information is deleted is obtained.

[0090] The first classification subunit 7032 is configured to perform keyword analysis on the data information in which the preset vocabulary information is deleted based on a word frequency analysis method, determine vocabulary information in the data information in which the preset vocabulary information is deleted that has a frequency greater than a preset threshold value, and take the vocabulary information as a keyword.

[0091] The second classification subunit 7033 is configured to call a preset technical direction corresponding to each piece of data in all data to be processed, and perform distance calculation on each technical direction and each keyword according to a preset distance calculation formula. If the distance is less than a preset threshold value, the keyword is divided into a category of the corresponding technical direction.

[0092] The training unit 704 is configured to send topic keyword information of data in all categories to a preset vertical field large model for reinforcement learning training, and adjust a neural network structure and a weight parameter of the vertical field large model to obtain a trained vertical field large model.

[0093] The training unit 704 includes a first training subunit 7041, a second training subunit 7042, a third training subunit 7043, and a fourth training subunit 7044.

[0094] The first training subunit 7041 is configured to construct a vertical field knowledge tree structure based on the keyword and the corresponding technical direction category. A first-level node of the vertical field knowledge tree structure is a technical direction, and a second-level node is a keyword.

[0095] The second training subunit 7042 is configured to input the vertical field knowledge tree structure as training data set to the preset vertical field large model for training. An original weight matrix of the vertical field large model is initialized, and a first adjustment weight matrix is determined based on the original weight matrix and a preset weight matrix adjustment formula.

[0096] The third training subunit 7043 is configured to perform training calculation on the first adjustment weight matrix based on a reinforcement learning method until the first adjustment weight matrix reaches a preset threshold value, to obtain a second adjustment weight matrix. The second adjustment weight matrix is the first adjustment weight matrix adjusted by the reinforcement learning method.

[0097] The third training subunit 7043 includes an acquisition subunit 70431, a fourth processing subunit 70432, and a fifth processing subunit 70433.

[0098] The acquisition subunit 70431 is configured to acquire the weight matrix in the current state of the state space setting, and set the action of the reinforcement learning as the size adjustment of the weight matrix in the current state, wherein the reward function of the size adjustment of the weight matrix is a loss function between the predicted value and the original value of each data on the training data set;

[0099] The fourth processing subunit 70432 is configured to randomly select an action, determine whether the current state corresponding to the action is a terminal state, if not, calculate the reward function value through the reward function, and iterate to the next state until the current state corresponding to the action is the terminal state, and obtain the weight matrix in the final state;

[0100] The fifth processing subunit 70433 is configured to take the weight matrix in the final state as the second adjustment weight matrix.

[0101] The fourth training subunit 7044 is configured to adjust the multi-head self-attention and the feedforward neural network part in the preset vertical field large model based on the second adjustment weight matrix, and obtain the trained vertical field large model.

[0102] The encoding unit 705 is configured to generate a vertical field knowledge base based on the preprocessed data information and the topic word information of the data of all categories, and encode the topic word information of the data of all categories based on a preset heuristic method to obtain a prompt word template of the vertical field large model.

[0103] The encoding unit 705 includes a first encoding subunit 7051, a second encoding subunit 7052, and a third encoding subunit 7053.

[0104] The first encoding subunit 7051 is configured to read, split, and embed the preprocessed data information and the topic word information of the data of all categories to construct a vertical field knowledge base.

[0105] The second encoding subunit 7052 is configured to perform embedding operation on the preset user question, and search the embedded user text vector in the vertical field knowledge base, wherein the correlation degree between the user text vector and the word vector in the vertical field knowledge base is calculated through a preset similarity calculation formula, and the word vector with the maximum correlation degree with the user text vector is output as a relevant text block.

[0106] The third encoding subunit 7053 is configured to process the relevant text block and the user question based on a calculation formula of a preset heuristic algorithm to obtain a prompt word template of the vertical field large model.

[0107] The deployment unit 706 is configured to deploy the trained vertical field large model and the vertical field knowledge base based on a preset deployment scheme, construct an application program interface of the trained vertical field large model, and obtain a deployed vertical field large model.

[0108] It should be noted that, as for the system in the above-mentioned embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method, and will not be described in detail here.

[0109] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. within the spirit and principles of the present application shall be included in the protection scope of the present application.

[0110] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A method for constructing a large language model in a vertical field, characterized by: include: Acquiring data information to be processed, wherein the data information to be processed includes vertical data information of at least one data source; Sending the data information to be processed to a preset data preprocessing model for preprocessing to obtain preprocessed data information; Sending the pre-processed data information to a preset classification model for subject word classification to obtain subject word information of at least two categories of data; Send the keyword information of all categories of data to the preset vertical field big model for reinforcement learning training, and adjust the neural network structure and weight parameters of the vertical field big model to obtain the trained vertical field big model; Generate a vertical domain knowledge base based on the preprocessed data information and the keyword information of all categories of data, and encode the keyword information of all categories of data based on a preset heuristic method to obtain a prompt word template for the vertical domain large model; Deploy the trained vertical domain big model and vertical domain knowledge base based on the preset deployment plan, and build the application interface of the trained vertical domain big model to obtain the deployed vertical domain big model; The pre-processed data information is sent to the preset classification model for subject word classification, including: Searching the pre-processed data information, wherein searching whether the pre-processed data information has preset vocabulary information, and if so, deleting the preset vocabulary information to obtain data information with the preset vocabulary information deleted; Perform keyword analysis on the data information of the preset vocabulary information deleted based on the word frequency analysis method, determine the vocabulary information with a frequency greater than a preset threshold in the data information of the preset vocabulary information deleted, and use it as a keyword; Calling the technical direction corresponding to each data preset in all the data information to be processed, calculating the distance between each technical direction and each keyword according to a preset distance calculation formula, wherein if the distance is less than a preset threshold, classifying the keyword into the category of its corresponding technical direction; The keyword information of all categories of data is sent to a preset vertical field model for reinforcement learning training, and the neural network structure and weight parameters of the vertical field model are adjusted to obtain the trained vertical field model, including: Constructing a vertical domain knowledge tree structure based on the keywords and their corresponding technical direction categories, wherein the first-level nodes of the vertical domain knowledge tree structure are technical directions and the second-level nodes are keywords; Inputting the vertical domain knowledge tree structure as a training data set into a preset vertical domain large model for training, wherein an original weight matrix of the vertical domain large model is initialized, and a first adjusted weight matrix is ​​determined based on the original weight matrix and a preset weight matrix adjustment formula; Performing training calculations on the first adjustment weight matrix based on a reinforcement learning method until the first adjustment weight matrix reaches a preset threshold, thereby obtaining a second adjustment weight matrix, where the second adjustment weight matrix is ​​the first adjustment weight matrix adjusted by the reinforcement learning method; Based on the second adjustment weight matrix, the multi-head self-attention and feedforward neural network parts in the preset vertical field large model are adjusted to obtain the trained vertical field large model.

2. The method for constructing a large language model in a vertical field according to claim 1 is characterized in that , sending the data information to be processed to a preset data preprocessing model for preprocessing, including: Constructing a set of all data information to be processed, and performing deduplication processing on the set according to a preset deduplication formula to obtain a deduplicated text block set; The deduplicated text block set is classified according to a preset classification formula, and the classified text block set is interpolated for missing values ​​to obtain preprocessed data information.

3. The method for constructing a large language model in a vertical field according to claim 1 is characterized in that ,Based on the reinforcement learning method, the first adjustment weight matrix is ​​trained and calculated, including: Get the weight matrix of the current state of the state space setting, and adjust the size of the weight matrix when setting its reinforcement learning action to the current state, where the reward function for adjusting the size of the weight matrix is ​​the loss function between the predicted value and the original value of each data in the training data set; Randomly select an action, determine whether the current state corresponding to the action is the terminal state, and if not, calculate the reward function to obtain the reward function value, and iterate to the next state until the current state corresponding to the action is the terminal state, and obtain the weight matrix in the final state; The weight matrix in the final state is used as the second adjusted weight matrix.

4. A system for constructing a large language model in a vertical field, characterized by: include: an acquiring unit, configured to acquire data information to be processed, wherein the data information to be processed includes vertical data information of at least one data source; A processing unit, configured to send the data information to be processed to a preset data preprocessing model for preprocessing to obtain preprocessed data information; A classification unit is used to send the pre-processed data information to a preset classification model for subject word classification, and obtain subject word information of at least two categories of data; A training unit is used to send the keyword information of all categories of data to a preset vertical field large model for reinforcement learning training, and adjust the neural network structure and weight parameters of the vertical field large model to obtain a trained vertical field large model; The encoding unit is used to generate a vertical domain knowledge base based on the preprocessed data information and the keyword information of all categories of data, and encode the keyword information of all categories of data based on a preset heuristic method to obtain a prompt word template for the vertical domain large model; A deployment unit is used to deploy the trained vertical domain big model and vertical domain knowledge base based on a preset deployment plan, and to build an application program interface for the trained vertical domain big model to obtain a deployed vertical domain big model; Wherein, the classification unit includes: a third processing sub-unit, configured to search the pre-processed data information to determine whether the pre-processed data information contains preset vocabulary information, and if so, to delete the preset vocabulary information to obtain data information with the preset vocabulary information deleted; The first classification subunit is configured to perform keyword analysis on the data information from which the preset vocabulary information is deleted based on a word frequency analysis method, determine vocabulary information having an appearance frequency greater than a preset threshold in the data information from which the preset vocabulary information is deleted, and use the vocabulary information as a keyword; The second classification subunit is configured to call a preset technical direction corresponding to each data in all the data information to be processed, and calculate the distance between each technical direction and each keyword according to a preset distance calculation formula. If the distance is less than a preset threshold, the keyword is classified into the category of the corresponding technical direction; Wherein, the training unit includes: A first training sub-unit is configured to construct a vertical domain knowledge tree structure based on the keywords and their corresponding technical direction categories, wherein the first-level nodes of the vertical domain knowledge tree structure are technical directions and the second-level nodes are keywords; A second training subunit is configured to input the vertical domain knowledge tree structure as a training data set into a preset vertical domain large model for training, wherein an original weight matrix of the vertical domain large model is initialized, and a first adjusted weight matrix is ​​determined based on the original weight matrix and a preset weight matrix adjustment formula; a third training subunit, configured to perform training calculations on the first adjustment weight matrix based on a reinforcement learning method until the first adjustment weight matrix reaches a preset threshold, thereby obtaining a second adjustment weight matrix, where the second adjustment weight matrix is ​​the first adjustment weight matrix adjusted by the reinforcement learning method; The fourth training sub-unit is used to adjust the multi-head self-attention and feedforward neural network parts in the preset vertical field large model based on the second adjustment weight matrix to obtain the trained vertical field large model.

5. The system for constructing a large language model in a vertical field according to claim 4, characterized in that: The processing unit includes: The first processing sub-unit is used to construct a set of all the data information to be processed, and perform deduplication processing on the set according to a preset deduplication formula to obtain a deduplicated text block set; The second processing sub-unit is used to classify the deduplicated text block set according to a preset classification formula, and perform missing value interpolation processing on the classified text block set to obtain preprocessed data information.

6. The system for constructing a large language model in a vertical field according to claim 4, characterized in that: The third training subunit includes: An acquisition subunit is used to obtain the weight matrix of the current state of the state space setting, and adjust the size of the weight matrix when its reinforcement learning action is set to the current state, where the reward function for adjusting the size of the weight matrix is ​​the loss function between the predicted value and the original value of each data in the training data set; a fourth processing subunit, configured to randomly select an action, determine whether the current state corresponding to the action is a terminal state, and if not, calculate using the reward function to obtain a reward function value, and iterate to the next state until the current state corresponding to the action is a terminal state, thereby obtaining a weight matrix in the final state; The fifth processing subunit is configured to use the weight matrix in the final state as a second adjusted weight matrix.

Citation Information

Patent Citations

  • Method and system for improving performance of vertical domain language model

    CN117312545A

  • Method and system for realizing industrial digital intelligence based on artificial intelligence

    CN118228694A