Text processing method and device based on hybrid expert model, equipment and medium
By matching the professional fields of text and expert models in the mixed expert model and configuring weights, the problem of reduced specialization caused by load balancing activation methods is solved, and the model's interpretation ability and output accuracy are improved.
Patent Information
- Application Number
- CN202411485877.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-18
AI Technical Summary
In the existing hybrid expert model, the load balancing activation method leads to a decrease in the specialization of the expert network, thereby reducing the accuracy and reliability of the model inference output.
By matching the pending text with the professional fields corresponding to n expert models in the mixed expert model, a field matching result is generated, and m expert models are activated based on the result, and their weights are configured to ensure that the activated expert model is best at The domain is adapted to the pending text.
The interpretation ability of hybrid expert models in professional fields is improved, and the operation efficiency and output accuracy of the model are enhanced.
Smart Images

Figure CN119476480A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence technology and financial technology, and in particular to a text processing method, device, equipment and medium based on a hybrid expert model. Background Art
[0002] In the training and reasoning process of large language models, the number of parameters is one of the key factors to improve model performance. The Mixed Experts Model (MoE) activates part of the expert network to complete tasks with the same quality level as the dense model, so it can perform effective training and reasoning with far less computing resources than the dense model, thereby reducing computing resources.
[0003] In the current hybrid expert model, the gating network that determines activation usually uses convolutional neural networks or simple Transformer structures to extract sample features and activate the corresponding expert network. However, due to load balancing, each expert network does not carry knowledge in a professional field as ideally desired. That is, the current activation method based on load balancing has a certain degree of randomness, which will reduce the degree of specialization of the expert network, thereby reducing the accuracy and reliability of the model's reasoning output. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide a text processing method, device, equipment and medium based on a hybrid expert model that can be applied to financial technology or other related fields. Its main purpose is to improve the interpretation ability of the hybrid expert model in professional fields and improve the operating efficiency and output accuracy of the overall model.
[0005] The technical solution of the present invention is as follows:
[0006] A first aspect of the present invention provides a text processing method based on a hybrid expert model, comprising:
[0007] Receive text to be processed from the user;
[0008] Matching the text to be processed with the professional fields corresponding to the n expert models in the hybrid expert model to generate a field matching result;
[0009] Activate m expert models from the n expert models according to the domain matching result and a preset activation strategy, and configure the weights of the currently activated m expert models, where m≤n;
[0010] The text to be processed is input into the currently activated m expert models for text processing to generate the corresponding final output text.
[0011] A second aspect of the present invention provides a text processing device based on a hybrid expert model, comprising:
[0012] A receiving module, used for receiving text to be processed input by a user;
[0013] A domain matching module is used to match the text to be processed with the professional domains corresponding to the n expert models in the hybrid expert model to generate a domain matching result;
[0014] An activation configuration module, used to activate m expert models among n expert models according to the domain matching result and a preset activation strategy, and configure the weights of the currently activated m expert models, where m≤n;
[0015] The text processing module is used to input the text to be processed into the currently activated m expert models for text processing and then generate the corresponding final output text.
[0016] A third aspect of the present invention provides a computer device, comprising at least one processor; and
[0017] a memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned text processing method based on the hybrid expert model.
[0019] A fourth aspect of the present invention provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned text processing method based on the hybrid expert model.
[0020] Beneficial effects: The present invention discloses a text processing method, device, equipment and medium based on a hybrid expert model. Compared with the prior art, the embodiment of the present invention receives a text to be processed input by a user; matches the text to be processed with the professional fields corresponding to n expert models in the hybrid expert model to generate a field matching result; activates m expert models in the n expert models according to a preset activation strategy based on the field matching result, and configures the weights of the currently activated m expert models, where m≤n; inputs the text to be processed into the currently activated m expert models for text processing and generates the corresponding final output text. By matching the text with the professional fields of different expert models, the model most suitable for processing the text is identified, ensuring that the field in which the activated expert model excels is compatible with the text to be processed, thereby improving the interpretation ability of the hybrid expert model in the professional field, and by configuring the weight of the currently activated expert model, the output result can be further optimized according to the output contribution of different expert models, thereby improving the operation efficiency and output accuracy of the overall model. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the scheme in the present invention, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 A schematic diagram of an application environment of a text processing method based on a hybrid expert model provided in an embodiment of the present invention;
[0023] Figure 2 A flow chart of a text processing method based on a hybrid expert model provided by an embodiment of the present invention;
[0024] Figure 3 A flow chart of step S202 in the text processing method based on the hybrid expert model provided in an embodiment of the present invention;
[0025] Figure 4 A flow chart of step S203 in the text processing method based on the hybrid expert model provided in an embodiment of the present invention;
[0026] Figure 5 A flow chart of step S204 in the text processing method based on the hybrid expert model provided in an embodiment of the present invention;
[0027] Figure 6 A schematic diagram of functional modules of a text processing device based on a hybrid expert model provided in an embodiment of the present invention;
[0028] Figure 7 A schematic diagram of the hardware structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. The embodiments of the present invention are described below in conjunction with the accompanying drawings.
[0030] The text processing method based on the hybrid expert model provided by the embodiment of the present invention can be applied in the following aspects: Figure 1In the application environment of FIG. 1 , it includes a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104 and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0031] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (only as examples).
[0032] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0033] The server 105 may be a server that provides various services, such as a background server that provides support for the content browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (for example only). The background server may analyze and process the received data such as the user request, and feed back the processing results (such as web pages, information, or data obtained or generated according to the user request) to the terminal device. The server 105 may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server 105 may also be a server for a distributed system, or a server combined with a blockchain.
[0034] It should be noted that the text processing method based on the hybrid expert model provided in the embodiment of the present application can generally be executed by the first terminal device 101, the second terminal device 102 or the third terminal device 103. Accordingly, the text processing apparatus based on the hybrid expert model provided in the embodiment of the present invention can also be arranged in the first terminal device 101, the second terminal device 102 or the third terminal device 103. Alternatively, the text processing method based on the hybrid expert model provided in the embodiment of the present invention can generally be executed by the server 105. Accordingly, the text processing apparatus based on the hybrid expert model provided in the embodiment of the present invention can generally be arranged in the server 105.
[0035] It should be understood that the numbers of the above terminal devices, networks and servers are only illustrative. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0036] like Figure 2 As shown, the text processing method based on the hybrid expert model provided by the embodiment of the present invention specifically includes the following steps:
[0037] S201: Receive text to be processed input by a user.
[0038] In this embodiment, the user can input the corresponding text to be processed through the front-end interactive interface. The text to be processed can be in text form, file form, voice form or picture form, etc. The system receives the corresponding text to be processed based on the user's input on the front-end interactive interface. It can be understood that if the user inputs in the form of voice or picture or uploads a file, the corresponding text to be processed is obtained through voice-to-text conversion or text recognition, so that the system can receive and understand the text to be processed proposed by the user in natural language, and provide input data for subsequent processing.
[0039] Specifically, the text to be processed input by the user may involve content in one or more professional fields. For example, taking the intelligent question-answering system as an example, the user asks the intelligent question-answering system through the front-end interactive interface: "How do I calculate my insurance compensation amount?" The text to be processed mainly involves the insurance field; or the user may also ask a complex question involving multiple professional fields. For example, the user asks the intelligent question-answering system through the front-end interactive interface: "The latest financial report of Company X shows that its revenue has increased by 30%. What impact does this have on the stock price?" The text to be processed involves the financial field and market analysis field, etc.
[0040] In one embodiment, before step S201, the method further includes:
[0041] Collect application scenario information, and determine n professional fields based on analysis of the application scenario information;
[0042] Corresponding expert models are configured according to the n professional fields to construct the hybrid expert model.
[0043] In this embodiment, when developing and deploying an intelligent system based on a hybrid expert model, application scenario information is first obtained through comprehensive collection of information such as market research information, user feedback information, and industry reports, so as to clarify the application scenario requirements of the model. For example, for a general assistant model, it may cover multiple fields such as law, finance, mathematics, education, medical care, and daily life. For example, financial analysts need to analyze the company's financial reports, legal advisors need to interpret contract terms, educators need to analyze changes in education policies, and investors need to predict market trends, etc. According to these application scenarios, the corresponding n professional fields are determined, namely, the financial field, the legal field, the educational field, the market analysis field, etc. By collecting and analyzing application scenario information, the professional field most relevant to user needs can be determined, laying the foundation for building a hybrid expert model.
[0044] Corresponding to each professional field, a dedicated expert model is configured. Each expert network is designed as an independent neural network structure, which focuses on processing tasks in its corresponding field and has a high degree of professional capabilities. The network structure of the expert model can be customized according to the characteristics of the field, such as adding pre-training layers for specific fields or adjusting the depth and width of the network to optimize performance. For example, in response to the needs in the above example, expert model A can be configured: for the financial field, use algorithms for financial report analysis and stock market prediction; expert model B: for the legal field, use algorithms for natural language processing and contract analysis; expert model C: for the education field, use algorithms for policy analysis and education trend prediction; expert model D: for the market analysis field, use market data analysis and prediction models. These expert models are integrated into a hybrid expert model framework to form a system that can handle multiple tasks. The hybrid expert model constructed by configuring a dedicated expert model for each professional field can improve the efficiency and accuracy of processing tasks in specific fields.
[0045] S202: Match the text to be processed with the professional fields corresponding to the n expert models in the hybrid expert model to generate a field matching result.
[0046] In this embodiment, the hybrid expert model is composed of n expert models and a gating network, and processes data and tasks by combining multiple expert models. In the hybrid expert model, each expert model usually focuses on processing a specific type of data or task, and a gating network is responsible for determining which expert sub-model processes a given input. Different from the existing load-balancing-based activation method, when selecting the expert model to be activated for reasoning output, this embodiment matches the text to be processed with the professional fields corresponding to the n expert models in the hybrid expert model. Specifically, the input text can be matched with the professional fields of the expert model through methods such as keyword matching and semantic analysis. For example, in the above example, the text to be processed "X Company's latest financial report shows that its revenue has increased by 30%. What impact does this have on the stock price?" contains keywords such as "financial report", "revenue", and "stock price", and has a high degree of matching with the professional fields of expert model A (finance) and expert model D (market). Through field matching, the system can identify the expert model that is most suitable for processing the current text, provide accurate basis for subsequent activation and weight configuration, and avoid field uncertainty caused by the randomness of the load-balancing activation method.
[0047] S203 , activating m expert models from the n expert models according to the domain matching result and a preset activation strategy, and configuring weights of the currently activated m expert models, where m≤n.
[0048] In this embodiment, according to the domain matching result, m expert models can be selected and activated from the n expert models according to the preset activation strategy, and corresponding weights are assigned to the currently activated m expert models. It can be understood that n is a positive integer greater than or equal to 2, and m is a positive integer less than or equal to n, that is, at most all expert models are activated to process the text to be processed. Specifically, the preset activation strategy is used to select the activated expert model and configure the weight, which can be flexibly set according to system requirements. For example, if it is necessary to ensure that the professional field of the activated expert model is as compatible as possible with the text to be processed, the m expert models with the highest degree of activation matching can be selected according to the domain matching result, and the weights are configured based on the correlation between the m expert models and the text to be processed. For example, for the text to be processed "Company X's latest financial report shows that its revenue increased by 30%. What impact does this have on the stock price?", the professional field matching degree of expert model A (finance) and expert model D (market) is the highest in the field matching results, so expert model A and expert model D are selected for activation, and the correlation between expert model A and the text to be processed is higher, so the configured weight is higher than that of expert model D. The final preset activation strategy is expert model A (finance)-weight 0.7; expert model D (market)-weight 0.3. The most relevant expert model is activated and the weight is configured. The system can use resources more effectively and improve the accuracy and efficiency of processing.
[0049] Alternatively, if the final output content of the model is required to maintain the relevance to the text to be processed while increasing its diversity as much as possible, the preset activation strategy can also select some expert models with lower matching degrees in the field matching results for activation, and configure a lower weight. Exemplarily, for the text to be processed "I need to know how to invest in stocks.", the professional field matching degree of expert model A (finance) in the field matching results is the highest. At this time, if expert model A is activated alone and the weight is 1, the text to be processed is processed only from the financial field to obtain the corresponding reply. If the reply is more diverse, expert model B (law) and expert model C (education) can be activated on the basis of expert model A (finance), and the weights of the three can be configured as 0.8, 0.1, and 0.1, so that for the text to be processed, not only financial advice can be given, but also legal tips such as legal terms and potential risks, as well as educational resources such as investment and financial management book recommendations, etc. Therefore, moderately activating and configuring the weights of other expert models on the basis of activating the most relevant expert model can also improve the diversity of text processing.
[0050] S204: Input the text to be processed into the currently activated m expert models to perform text processing and generate corresponding final output text.
[0051] In this embodiment, after activating and configuring the weights of m expert models, the text to be processed is input into the currently activated m expert models, and the text to be processed is processed with the current weight configuration. For example, the text to be processed "The latest financial report of X company shows that its revenue has increased by 30%. What impact does this have on the stock price?" is input into the activated expert model A and expert model D. Expert model A will analyze the direct impact of X company's revenue growth on the stock price, and expert model D will predict the market's reaction to this financial report and the possible trend of the stock price. When multiple expert models are activated, due to their independent network structures, the text can be processed in parallel, thereby significantly improving the processing speed. The final output text is generated by combining the processing results of the m expert models, such as a reply to the question text, or a response text to the analysis instruction, etc., and a more accurate and comprehensive final output text is generated by integrating the outputs and weights of multiple expert models.
[0052] In the above embodiment, the present invention discloses a text processing method based on a hybrid expert model, which receives a text to be processed input by a user; matches the text to be processed with the professional fields corresponding to n expert models in the hybrid expert model to generate a field matching result; activates m expert models in the n expert models according to a preset activation strategy based on the field matching result, and configures the weights of the currently activated m expert models, where m≤n; inputs the text to be processed into the currently activated m expert models for text processing and generates the corresponding final output text. By matching the text with the professional fields of different expert models, the model most suitable for processing the text is identified, ensuring that the field in which the activated expert model excels is compatible with the text to be processed, thereby improving the interpretation ability of the hybrid expert model in the professional field, and by configuring the weights of the currently activated expert model, the output result can be further optimized according to the output contribution of different expert models, thereby improving the operation efficiency and output accuracy of the overall model.
[0053] In one embodiment, Figure 3 As shown, step S202 includes:
[0054] S301, performing vector conversion on the text to be processed to generate an input vector of the text to be processed;
[0055] S302: Calculate n domain similarities based on the input vector and n pre-generated professional domain vectors, where the n professional domain vectors correspond to n expert models in the hybrid expert model.
[0056] In this embodiment, when performing domain matching, the text to be processed is first converted into a vector to generate a corresponding input vector. For example, for the text to be processed input by the user: "The stock price of Company X rose by 5% after the financial report was released.", the text can be converted into a vector representation of a fixed dimension through a pre-trained word embedding model (such as Word2Vec, GloVe or BERT). For example, the BERT model can output a vector that encodes the semantic information of the text, thereby converting the text to be processed into an input vector of the corresponding dimension. By converting the text into a vector, qualitative text data can be converted into quantitative numerical data, which is convenient for subsequent calculation and processing.
[0057] After obtaining the input vector of the text to be processed, the similarity is calculated between it and the pre-generated n professional domain vectors, that is, each of the n expert models in the hybrid expert model has a pre-calculated professional domain vector, which represents the semantic features of their respective fields. The similarity between the input vector and the n professional domain vectors is calculated to reflect the degree of domain similarity. The similarity calculation of specific vectors can be performed by a variety of methods, such as calculating Euclidean distance, cosine similarity, Manhattan example, Pearson correlation coefficient, etc. Taking the calculation of cosine similarity as an example, the input vector of the text to be processed is compared with the professional domain vector of the expert model AD to calculate the corresponding similarity score:
[0058] Similarity with expert model A (finance): 0.9;
[0059] Similarity to expert model B (law): 0.3;
[0060] Similarity with expert model C (education): 0.2;
[0061] Similarity to expert model D(market): 0.8.
[0062] By calculating the similarity between the text to be processed and the vectors of each field, the degree of relevance of the text to different fields can be quantified, providing a basis for selecting the most appropriate expert model, so as to help more accurately assign tasks to the most appropriate expert model when activating the expert model, thereby improving the accuracy and efficiency of processing.
[0063] In one embodiment, after step S301, the method further includes:
[0064] The input vector is input into a preset text similarity model for semantic enhancement processing to generate a semantic enhancement vector.
[0065] The step S302 specifically includes: performing similarity calculations on the semantic enhancement vector and n professional field vectors respectively to obtain n field similarities.
[0066] In this embodiment, after generating the input vector of the text to be processed, the input vector is further semantically enhanced by a preset text similarity model such as the SimCSE pre-training model to generate a semantically enhanced vector, which not only contains the semantic information of the original text, but also incorporates additional domain knowledge and semantic association information, that is, contains richer semantic information, so that a richer and more accurate text representation can be obtained, so that the deep semantics of the text can be better reflected in the subsequent similarity calculation. On the basis of semantic enhancement, when n domain similarities are calculated, the semantic enhancement vector and the n professional domain vectors are respectively similarity calculated to obtain n domain similarities, such as calculating Euclidean distance, cosine similarity, Manhattan example, Pearson correlation coefficient, etc. Thus, on the basis of better obtaining the deep semantics of the text, the degree of correlation between it and different fields is accurately quantified by similarity calculation.
[0067] In one embodiment, before step S202, the method further includes:
[0068] Collect text data from n professional fields to form n professional data sets;
[0069] The n professional data sets are respectively input into the pre-trained model for vectorization processing, and a corresponding professional field vector is generated according to the vectorization result of each professional data set.
[0070] In this embodiment, before performing field matching, the corresponding professional field vectors are pre-calculated for the professional fields corresponding to the n expert models in the hybrid expert model. Specifically, text data of n professional fields are first collected to form n professional data sets. For example, in the financial field, financial reports, stock market analysis reports, financial news, etc. of the past few years can be collected; in the legal field, various contract templates, legal documents, court judgments, etc. can be collected; in the education field, education policy documents, academic papers, education news reports, etc. can be collected; in the market analysis field, market research reports, consumer behavior analysis, industry trend forecast articles, etc. can be collected. By collecting and organizing text data in professional fields, a rich and high-quality professional data set is established, which provides a basis for generating professional field vectors.
[0071] For each professional data set, the text is converted into vector form through a pre-trained model to capture the semantic information of the text in each professional data set, and the corresponding professional field vector is generated based on the vectorization result of each professional data set. Specifically, the word vectors of all texts in the professional data set can be averaged to obtain a vector representing the entire professional field; or the word vectors of all texts in the professional data set can be clustered, and then each cluster center is taken as the vector of part of the field, and so on. The generated professional field vectors of n professional fields are stored in the database for subsequent field matching and similarity calculation.
[0072] In one embodiment, Figure 4 As shown, step S203 includes:
[0073] S401, parsing the field matching results to obtain n field similarities;
[0074] S402, sorting the n domain similarities, and selecting the top m domain similarities with the highest value based on the sorting result;
[0075] S403, activating m expert models corresponding to the top m domain similarities, and mapping the top m domain similarities into correlation probability distribution;
[0076] S404: assign corresponding weights to the currently activated m expert models according to the correlation probability distribution.
[0077] In this embodiment, when the expert model is activated, the field matching result is parsed, that is, the similarity between the text and n professional fields is obtained through vectorization processing and similarity calculation. For example, for the text to be processed input by the user: "The stock price of Company X rose by 5% after the financial report was released.", the similarity between the text and n professional fields is obtained after matching:
[0078] Similarity with expert model A (finance): 0.9;
[0079] Similarity to expert model B (law): 0.3;
[0080] Similarity with expert model C (education): 0.2;
[0081] Similarity to expert model D(market): 0.8.
[0082] By analyzing the field matching results, we can clearly understand the similarity between the text to be processed and various professional fields, providing data support for selecting relevant fields.
[0083] These similarity values are then sorted. For example, in the above similarity results, the sorted results are:
[0084] 1. Similarity with expert model A (finance): 0.9;
[0085] 2. Similarity with expert model D (market): 0.8;
[0086] 3. Similarity with expert model B (law): 0.3;
[0087] 4. Similarity with expert model C (education): 0.2.
[0088] Based on the sorting results, the top m domain similarities are selected. For example, if m is 2, the top two domain similarities are selected, and the expert models corresponding to the top two domain similarities, namely, expert model A and expert model D, are activated. By sorting and selecting the highest domain similarity and activating the most relevant expert model, the hybrid expert model can focus on the field that is most relevant to the user input text, ensuring that the most appropriate resources are called to process the user's request, improving the quality and efficiency of the response, and the pertinence and accuracy of text processing.
[0089] Furthermore, after selecting the top m domain similarities to determine the expert model to be activated, the top m domain similarities are also mapped to a correlation probability distribution, and corresponding weights are assigned to the currently activated m expert models based on the correlation probability distribution. For example, the m domain similarities can be standardized by a softmax function to form a correlation probability distribution, ensuring that the sum of the weights is 1, so that after configuring the weights based on the probability distribution, the weight of each expert model reflects its correlation with the input, thereby better optimizing resource allocation and the accuracy of the output results.
[0090] In one embodiment, Figure 5 As shown, step S204 includes:
[0091] S501, inputting the text to be processed into the currently activated m expert models, and performing independent text processing on the text to be processed by the m expert models to obtain m intermediate output texts;
[0092] S502: weightedly merge the m intermediate output texts according to the weights of the corresponding expert models to generate a final output text of the hybrid expert model.
[0093] In this embodiment, after activating m expert models, the text to be processed is input into the currently activated m expert models. The m expert models will perform independent text processing on the text to be processed to obtain m intermediate output texts. For example, for the input text "What impact does the release of X company's new product have on its stock price?", two expert models, namely expert model A (finance) and expert model D (market), are activated. Expert model A analyzes the text and outputs: "The release of new products may attract investors and cause the stock price to rise in the short term." Expert model D analyzes the text and outputs: "The technological innovation of new products may promote the company's long-term development and have a positive impact on the stock price." Through independent processing, each expert model can provide in-depth and efficient analysis of the text to be processed based on its professional field, and the obtained intermediate output text provides a basis for the next step of weighted merging.
[0094] Based on the weights of the currently activated m expert models configured previously, the m intermediate output texts are weighted and merged. For example, if the weight of expert model A is 0.53 and the weight of expert model D is 0.47, the two intermediate output texts are weighted and merged according to the weights to obtain the final output text: "The release of new products may attract investors and cause stock prices to rise in the short term (financial analysis). At the same time, the technological innovation of new products may promote the company's long-term development and have a positive impact on stock prices (market analysis)." The final output text combines the analysis of the two fields of finance and market, providing more comprehensive information, and the weighted merger takes into account the importance of each field, making the final output more in line with user needs. This weighted merging method ensures that the outputs of different expert models can be reasonably integrated according to their relevance and importance, thereby generating high-quality final output text.
[0095] It should be noted that there is not necessarily a certain order between the above-mentioned steps. A person skilled in the art can understand, based on the description of the embodiments of the present invention, that in different embodiments, the above-mentioned steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.
[0096] Further references Figure 6 , as a response to the above Figure 2 The present invention provides an embodiment of a text processing device based on a hybrid expert model. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0097] like Figure 6 As shown, the text processing device 60 based on the hybrid expert model described in this embodiment includes:
[0098] The receiving module 601 is used to receive the text to be processed input by the user;
[0099] A domain matching module 602 is used to match the text to be processed with the professional domains corresponding to the n expert models in the hybrid expert model to generate a domain matching result;
[0100] An activation configuration module 603 is used to activate m expert models from the n expert models according to the domain matching result and a preset activation strategy, and configure the weights of the currently activated m expert models, where m≤n;
[0101] The text processing module 604 is used to input the text to be processed into the currently activated m expert models for text processing and then generate the corresponding final output text.
[0102] The module referred to in the present invention refers to a series of computer program instruction segments that can perform specific functions, which is more suitable for describing the text processing execution process based on the hybrid expert model than a program. For the specific implementation of each module, please refer to the corresponding method embodiment above, which will not be repeated here.
[0103] In one embodiment, the device 60 further includes:
[0104] An application scenario collection module, used to collect application scenario information and determine n professional fields based on analysis of the application scenario information;
[0105] The model configuration module is used to configure corresponding expert models according to the n professional fields to construct the hybrid expert model.
[0106] In one embodiment, the domain matching module 602 includes:
[0107] A vectorization unit, used for performing vector conversion on the text to be processed to generate an input vector of the text to be processed;
[0108] The similarity calculation unit is used to calculate n domain similarities according to the input vector and n pre-generated professional domain vectors, wherein the n professional domain vectors correspond to the n expert models in the hybrid expert model.
[0109] In one embodiment, the domain matching module 602 further includes:
[0110] A semantic enhancement unit, used for inputting the input vector into a preset text similarity model to perform semantic enhancement processing and generate a semantic enhancement vector;
[0111] The similarity calculation unit is specifically used for:
[0112] The similarity between the semantic enhancement vector and n professional field vectors is calculated respectively to obtain n field similarities.
[0113] In one embodiment, the device 60 further includes:
[0114] Professional data collection module, used to collect text data in n professional fields to form n professional data sets;
[0115] The professional data vectorization module is used to input the n professional data sets into the pre-trained model for vectorization processing, and generate corresponding professional field vectors according to the vectorization results of each professional data set.
[0116] In one embodiment, the activation configuration module 603 includes:
[0117] A parsing unit, used to parse the domain matching result and obtain n domain similarities;
[0118] A sorting and selecting unit, used for sorting the n domain similarities and selecting the highest first m domain similarities based on the sorting result;
[0119] An activation mapping unit is used to activate m expert models corresponding to the top m domain similarities, and map the top m domain similarities into a correlation probability distribution;
[0120] The weight configuration unit is used to assign corresponding weights to the currently activated m expert models according to the correlation probability distribution.
[0121] In one embodiment, the text processing module 604 includes:
[0122] A parallel processing unit, used for inputting the text to be processed into the currently activated m expert models, performing independent text processing on the text to be processed through the m expert models, and obtaining m intermediate output texts;
[0123] The weighted output unit is used to weight and merge the m intermediate output texts according to the weights of the corresponding expert models to generate the final output text of the hybrid expert model.
[0124] In the above embodiment, the present invention discloses a text processing device based on a hybrid expert model, which receives a text to be processed input by a user; matches the text to be processed with the professional fields corresponding to n expert models in the hybrid expert model to generate a field matching result; activates m expert models in the n expert models according to a preset activation strategy based on the field matching result, and configures the weights of the currently activated m expert models, where m≤n; inputs the text to be processed into the currently activated m expert models for text processing and generates the corresponding final output text. By matching the text with the professional fields of different expert models, the model most suitable for processing the text is identified, ensuring that the field in which the activated expert model excels is compatible with the text to be processed, thereby improving the interpretation ability of the hybrid expert model in the professional field, and by configuring the weight of the currently activated expert model, the output result can be further optimized according to the output contribution of different expert models, thereby improving the operation efficiency and output accuracy of the overall model.
[0125] Another embodiment of the present invention provides a computer device, such as Figure 7 As shown, the computer device 70 includes:
[0126] One or more processors 701 and memory 702, Figure 7 A processor 701 is used as an example for description. The processor 701 and the memory 702 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.
[0127] Processor 701 is used to complete various control logics of computer device 70, and it can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component or any combination of these components. In addition, processor 701 can also be any traditional processor, microprocessor or state machine. Processor 701 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a DSP and / or any other such configuration.
[0128] The memory 702 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions corresponding to the text processing method based on the hybrid expert model in the embodiment of the present invention. The processor 701 executes various functional applications and data processing of the computer device 70 by running the non-volatile software programs, instructions and units stored in the memory 702, that is, implementing the text processing method based on the hybrid expert model in the above method embodiment.
[0129] The memory 702 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of the computer device 70, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 702 may optionally include a memory remotely arranged relative to the processor 701, and these remote memories may be connected to the computer device 70 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. One or more units are stored in the memory 702, and when executed by one or more processors 701, the steps of the text processing method based on the hybrid expert model in any of the above-mentioned method embodiments are executed.
[0130] In the above embodiment, the present invention discloses a computer device, which receives a text to be processed input by a user; matches the text to be processed with the professional fields corresponding to n expert models in a hybrid expert model to generate a field matching result; activates m expert models in the n expert models according to a preset activation strategy based on the field matching result, and configures the weights of the currently activated m expert models, where m≤n; inputs the text to be processed into the currently activated m expert models for text processing and generates the corresponding final output text. By matching the text with the professional fields of different expert models, the model most suitable for processing the text is identified, ensuring that the field in which the activated expert model excels is compatible with the text to be processed, thereby improving the interpretation ability of the hybrid expert model in the professional field, and by configuring the weights of the currently activated expert model, the output result can be further optimized according to the output contribution of different expert models, thereby improving the operation efficiency and output accuracy of the overall model.
[0131] An embodiment of the present invention provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the steps of the text processing method based on the hybrid expert model in any of the above method embodiments are executed.
[0132] In the above embodiment, the present invention discloses a non-volatile computer-readable storage medium, which receives a text to be processed input by a user; matches the text to be processed with the professional fields corresponding to n expert models in a hybrid expert model to generate a field matching result; activates m expert models in the n expert models according to a preset activation strategy based on the field matching result, and configures the weights of the currently activated m expert models, where m≤n; inputs the text to be processed into the currently activated m expert models for text processing and generates the corresponding final output text. By matching the text with the professional fields of different expert models, the model most suitable for processing the text is identified, ensuring that the field in which the activated expert model excels is compatible with the text to be processed, thereby improving the interpretation ability of the hybrid expert model in the professional field, and by configuring the weights of the currently activated expert model, the output result can be further optimized according to the output contribution of different expert models, thereby improving the operation efficiency and output accuracy of the overall model.
[0133] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0134] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0135] In summary, the method, device, equipment and medium for text processing based on hybrid expert models disclosed in the present invention include: receiving a text to be processed input by a user; matching the text to be processed with the professional fields corresponding to n expert models in the hybrid expert model to generate a field matching result; activating m expert models in the n expert models according to a preset activation strategy based on the field matching result, and configuring the weights of the currently activated m expert models, where m≤n; inputting the text to be processed into the currently activated m expert models for text processing to generate the corresponding final output text. By matching the text with the professional fields of different expert models, the model most suitable for processing the text is identified, ensuring that the field in which the activated expert model excels is compatible with the text to be processed, thereby improving the interpretation ability of the hybrid expert model in the professional field, and by configuring the weights of the currently activated expert model, the output results can be further optimized according to the output contributions of different expert models, thereby improving the operation efficiency and output accuracy of the overall model.
[0136] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium, and the computer program can include the processes of the above-mentioned method embodiments when executed. The storage medium can be a memory, a disk, a floppy disk, a flash memory, an optical storage device, etc.
[0137] It should be noted that if any software tools or components other than those of the Company appear in the embodiments of the present application, they are merely used for illustration and do not represent actual use. It should be understood that the application of the present invention is not limited to the above examples, and that those skilled in the art can make improvements or changes based on the above description, and all such improvements and changes shall fall within the scope of protection of the claims attached to the present invention.
Claims
1. A text processing method based on a hybrid expert model, characterized in that: include: Receive text to be processed from user input; Matching the text to be processed with the professional fields corresponding to the n expert models in the hybrid expert model to generate a field matching result; Activate m expert models from the n expert models according to the domain matching result and a preset activation strategy, and configure the weights of the currently activated m expert models, where m≤n; The text to be processed is input into the currently activated m expert models for text processing to generate the corresponding final output text.
2. The text processing method based on the hybrid expert model according to claim 1 is characterized in that: Before receiving the text to be processed input by the user, the method further includes: Collect application scenario information, and determine n professional fields based on analysis of the application scenario information; Corresponding expert models are configured according to the n professional fields to construct the hybrid expert model.
3. The text processing method based on the hybrid expert model according to claim 1 is characterized in that: The step of matching the text to be processed with the professional fields corresponding to the n expert models in the hybrid expert model to generate a field matching result includes: Performing vector conversion on the text to be processed to generate an input vector of the text to be processed; N domain similarities are calculated based on the input vector and n pre-generated professional domain vectors, and the n professional domain vectors correspond to the n expert models in the hybrid expert model.
4. The text processing method based on the hybrid expert model according to claim 3 is characterized in that: After performing vector conversion on the text to be processed to generate an input vector of the text to be processed, the method further includes: Inputting the input vector into a preset text similarity model for semantic enhancement processing to generate a semantic enhancement vector; The calculating of n domain similarities based on the input vector and the n pre-generated professional domain vectors specifically includes: Similarities are calculated for the semantic enhancement vector and n professional field vectors respectively to obtain n field similarities.
5. The text processing method based on hybrid expert model according to claim 3 is characterized in that: Before matching the text to be processed with the professional fields corresponding to the n expert models in the hybrid expert model and generating a field matching result, the method further includes: Collect text data from n professional fields to form n professional data sets; The n professional data sets are respectively input into the pre-trained model for vectorization processing, and a corresponding professional field vector is generated according to the vectorization result of each professional data set.
6. The text processing method based on hybrid expert model according to claim 1, characterized in that: The method of activating m expert models from n expert models according to the domain matching result and a preset activation strategy, and configuring the weights of the currently activated m expert models, includes: Analyze the field matching results to obtain n field similarities; Sorting the n domain similarities, and selecting the top m domain similarities with the highest values based on the sorting results; Activate m expert models corresponding to the top m domain similarities, and map the top m domain similarities into correlation probability distribution; Corresponding weights are assigned to the currently activated m expert models according to the correlation probability distribution.
7. The text processing method based on hybrid expert model according to claim 1, characterized in that: The step of inputting the text to be processed into the currently activated m expert models for text processing and then generating the corresponding final output text comprises: Inputting the text to be processed into the currently activated m expert models, performing independent text processing on the text to be processed by the m expert models, and obtaining m intermediate output texts; The m intermediate output texts are weighted and merged according to the weights of the corresponding expert models to generate the final output text of the hybrid expert model.
8. A text processing device based on a hybrid expert model, characterized in that: include: A receiving module, used for receiving text to be processed input by a user; A domain matching module is used to match the text to be processed with the professional domains corresponding to the n expert models in the hybrid expert model to generate a domain matching result; An activation configuration module, used to activate m expert models among n expert models according to the domain matching result and a preset activation strategy, and configure the weights of the currently activated m expert models, where m≤n; The text processing module is used to input the text to be processed into the currently activated m expert models for text processing and then generate the corresponding final output text.
9. A computer device, characterized in that: comprising at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the text processing method based on the hybrid expert model as described in any one of claims 1-7.
10. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, enable the one or more processors to execute the text processing method based on the hybrid expert model as described in any one of claims 1-7.
Citation Information
Cited By
Data processing method
CN120234286A
Information processing method and device, equipment, storage medium and program product
CN121614274A