Large language model processing method and device introducing dense vector retriever

By introducing dense vector searcher and updating dense vector databases in large language models, the problem of difficult time maintaining large language models during knowledge update and iteration is solved, and the model timeliness is maintained without periodic fine-tuning is achieved. Sexual effect.

CN119398193AActive Publication Date: 2025-02-07BEIJING DP TECH CO LTD

Patent Information

Application Number
CN202411486178.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2025-02-07
Estimated Expiration
2044-10-23

AI Technical Summary

Technical Problem

Existing large language models are difficult to maintain timeliness when updating and iterations of knowledge, and periodic fine-tuning consumes a lot of computing power and storage resources, increasing maintenance costs.

Method used

Introduce a dense vector searcher, combine it with a large language model, and achieve update iteration of knowledge by updating a dense vector database, and perform supplementary fine-tuning if necessary.

Benefits of technology

Maintain the timeliness of the model without periodic fine-tuning, reduce maintenance costs, improve the economic value of the model, and ensure the best real-time performance of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119398193A_ABST
    Figure CN119398193A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a processing method and device for a large language model introducing a dense vector retriever. The method comprises the steps that a class of large language models serve as a first large language model; initializing a dense vector database based on a directional text corpus set used by the first large language model in corresponding directional NLP task fine tuning; adding a dense vector retriever and a feature fusion module in the first large language model to form a second large language model, and training the second large language model; after the training is finished, the second large language model processes the directional NLP task by taking the dense vector database as a reference; and regularly updating the dense vector database, regularly performing primary evaluation on the second large language model based on the latest dense vector database, and performing primary fine adjustment on the second large language model when the current evaluation is unqualified. According to the invention, the timeliness of the model can be ensured, the maintenance cost of the model can be reduced, and the economic value of the model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a processing method and device for a large language model introducing a dense vector retriever. Background Art

[0002] Large Language Models (LLMs) based on the Transformer model architecture include the BERT series, BART series, GPT series, and T5 series. Such large language models are widely used in a variety of natural language processing (NLP) tasks, such as machine translation tasks and intelligent question-answering tasks. The conventional training phase of such large language models is divided into two steps: 1) the pre-training phase, in which the model's ability to understand natural language and generate text is trained through massive text corpora; 2) the fine-tuning phase, in which the task processing performance of the model is improved by specifying targeted text corpora for NLP tasks (machine translation tasks, intelligent question-answering tasks, etc.). After completing the above two stages of training, the model parameters will be solidified once, and subsequent user tasks will be processed based on the solidified model parameters.

[0003] In actual applications, we found that the relevant knowledge of some NLP tasks will be updated and iterated over time. For example, in the machine translation task scenario, the interpretation of some words will be updated over time, and in the intelligent question-answering task scenario, the standard answers / options of some questions will change over time. In this case, such large language models will not output the latest interpretation text or answer text if they only process the corresponding machine translation tasks or intelligent question-answering tasks based on the previously solidified model parameters. At present, the conventional solution to the timeliness problem of such models is to periodically fine-tune such large language models based on the latest directional text corpus. However, we know that the parameter magnitude of any large language model is huge, and each fine-tuning will consume a lot of computing resources and each fine-tuning will take a long time. After each fine-tuning, additional storage resources must be added to store the new version of the parameter set output by the fine-tuning. In other words, the defects of this periodic model fine-tuning mechanism are obvious: it cannot ensure that the model is always available, and it will bring continuous computing power / storage resource loss, which will undoubtedly increase the maintenance cost of the model and reduce the economic value of the model. Therefore, how to solve / improve the timeliness of the model without periodic fine-tuning has become a technical problem that needs to be solved urgently. Summary of the invention

[0004] The purpose of the present invention is to address the defects of the prior art and provide a processing method, device, electronic device and computer-readable storage medium for a large language model that introduces a dense vector searcher. The present invention uses a large language model that is implemented based on the Transformer model architecture and has completed pre-training and fine-tuning of a type of directional NLP task (such as machine translation task, intelligent question and answer task) as the corresponding first large language model; and uses the directional text corpus used by the first large language model in the fine-tuning of the corresponding directional NLP task as the corresponding first data set; and initializes the corresponding dense vector database based on the first data set; and adds a dense vector retriever and a feature fusion module to the first large language model to form a corresponding second large language model; and performs model training on the second large language model based on the first data set; and after the model training is completed, the second large language model processes the directional NLP task with reference to the dense vector database; and regularly updates the dense vector database; and regularly performs a task processing performance evaluation on the second large language model based on the latest dense vector database to obtain the corresponding evaluation result of the current time, and when the evaluation result of the current time is unqualified, a model training data set is constructed based on the dense vector database to obtain the corresponding second data set, and the second large language model is fine-tuned based on the second data set, and after the fine-tuning is completed, the second large language model continues to process the directional NLP task with reference to the dense vector database. The present invention realizes knowledge updating and iteration by updating a dense vector database, and solves / improves the timeliness problem of the large language model by introducing a dense vector retriever capable of performing information query on the dense vector database into the large language model; the present invention can not only maintain the timeliness of the model without periodic fine-tuning, but also timely perform supplementary fine-tuning on the model when it is found that the timeliness of the model decreases; the present invention can achieve the purpose of reducing maintenance costs and improving the economic value of the model while ensuring that the model has the best real-time performance.

[0005] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present invention provides a processing method for a large language model that introduces a dense vector searcher, the method comprising:

[0006] A large language model based on the Transformer model architecture and having completed pre-training and fine-tuning for a type of directional NLP task is used as the corresponding first large language model; the directional NLP task includes at least a machine translation task and an intelligent question-answering task;

[0007] Using the directional text corpus used by the first large language model in fine-tuning the corresponding directional NLP task as the corresponding first data set; and initializing the corresponding dense vector database based on the first data set;

[0008] Adding a dense vector retriever and a feature fusion module to the first language model to form a corresponding second language model; and performing model training on the second language model based on the first data set;

[0009] After the model training is completed, the second largest language model processes the directional NLP task with reference to the dense vector database; and the dense vector database is regularly updated; and the second largest language model is regularly evaluated for task processing performance based on the latest dense vector database to obtain the corresponding evaluation result of the time, and when the evaluation result of the time is unqualified, a model training data set is constructed based on the dense vector database to obtain the corresponding second data set, and the second largest language model is fine-tuned based on the second data set, and after the fine-tuning is completed, the second largest language model continues to process the directional NLP task with reference to the dense vector database; the evaluation result of the time includes qualified and unqualified.

[0010] Preferably, the first data set includes a plurality of first data records; the first data record includes a first target text and a first label text; when the directional NLP task is a machine translation task, the first target text and the first label text are respectively corresponding to the translation target text and the interpretation label text; when the directional NLP task is an intelligent question-answering task, the first target text and the first label text are respectively corresponding to the question target text and the answer label text;

[0011] The dense vector database includes a first vector database and a first text database; the first vector database is implemented based on a type of vector database, and the first text database is implemented based on a type of relational database; the vector database includes at least a Faiss or Annoy database; the relational database includes at least a SQL database and a MySQL database;

[0012] The first vector database is used to store a plurality of first vector data records; the first vector data record comprises a first vector identification field and a first dense vector field; the first dense vector field is used to store a feature vector of a text in a dense vector format;

[0013] The first text database is used to store multiple first text data records; the first text data record includes a first text identification field, a first text field, a second text field, a second vector identification field, a third vector identification field and a first update field; the first text identification field is a unique identifier of the current text data record; when the directional NLP task is a machine translation task, the first and second text fields are the corresponding translation target text and the latest interpretation label text, respectively; when the directional NLP task is an intelligent question-and-answer task, the first and second text fields are the corresponding question text and the latest answer label text, respectively; the first and second text fields correspond to one of the first vector data records in the first vector database respectively; the second vector identification field matches the first vector identification field of the first vector data record corresponding to the first text field; the third vector identification field matches the first vector identification field of the first vector data record corresponding to the second text field; the first update field is the latest creation / update time of the current text data record;

[0014] The second data set includes multiple second data records; the second data record includes a second target text and a second label text; when the directional NLP task is a machine translation task, the second target text and the second label text are the corresponding translation target text and interpretation label text respectively; when the directional NLP task is an intelligent question and answer task, the second target text and the second label text are the corresponding question target text and answer label text respectively.

[0015] Preferably, the first large language model is used to perform corresponding NLP task text generation processing according to the first task text input by the model and output the corresponding first generated text;

[0016] The model framework of the first language model at least includes a preprocessing module, an embedding encoding module, a feature extraction module and a text generation module;

[0017] The connection relationship of each model component of the first large language model is as follows: the input end of the preprocessing module is used to receive the first task text, and the output end is connected to the input end of the embedded coding module; the output end of the embedded coding module is connected to the input end of the feature extraction module; the output end of the feature extraction module is connected to the input end of the text generation module;

[0018] The preprocessing module of the first large language model is used to perform word segmentation, stop word removal and part-of-speech tagging on the first task text to obtain a corresponding first word segmentation sequence and send it to the embedded coding module;

[0019] The embedding coding module of the first large language model is used to perform word embedding coding and word position coding on the first word segmentation sequence to obtain a corresponding first embedding coding vector and send it to the feature extraction module;

[0020] The feature extraction module of the first language model is implemented based on the Transformer model Encoder or Decoder component structure; the feature extraction module is used to perform deep learning on the associated features of each segmented text and other segmented texts in the first task text according to the first embedded coding vector to obtain a corresponding first feature vector and send it to the text generation module;

[0021] The text generation module of the first large language model is implemented based on a type of text generator model; the text generation module is used to perform text feature decoding and text generation processing according to the first feature vector and output the corresponding first generated text.

[0022] Preferably, the second largest language model is used to use the dense vector database as a task reference knowledge base and perform corresponding NLP task text generation processing according to the second task text input by the model and output the corresponding second generated text;

[0023] The model framework of the second largest language model includes the preprocessing module, the embedded coding module, the feature extraction module, the dense vector retriever, the feature fusion module and the text generation module; the dense vector retriever is connected to the dense vector database;

[0024] The connection relationship of each model component of the second large language model is as follows: the input end of the preprocessing module is used to receive the second task text, and the output end is connected to the input end of the embedded coding module; the output end of the embedded coding module is connected to the input end of the feature extraction module; the output end of the feature extraction module is respectively connected to the input end of the dense vector retriever and the first input end of the feature fusion module; the output end of the dense vector retriever is connected to the second input end of the feature fusion module; the output end of the feature fusion module is connected to the input end of the text generation module;

[0025] The preprocessing module of the second largest language model is used to perform word segmentation, stop word removal and part-of-speech tagging on the second task text to obtain a corresponding second word segmentation sequence and send it to the embedded coding module;

[0026] The embedding coding module of the second largest language model is used to perform word embedding coding and word position coding on the second word segmentation sequence to obtain a corresponding second embedding coding vector and send it to the feature extraction module;

[0027] The feature extraction module of the second large language model is used to perform deep learning on the associated features of each segmented text and other segmented texts in the second task text according to the second embedded coding vector to obtain a corresponding second feature vector and send it to the dense vector retriever and the feature fusion module respectively;

[0028] The dense vector retriever of the second largest language model is used to perform dense vector conversion on the second feature vector in a dense vector format to obtain a corresponding first conversion vector; and to query the first vector data records in the first vector database whose vector feature similarity between the first dense vector field and the first conversion vector exceeds a preset first similarity threshold; and to count the total number of records of the first vector data records obtained by the query to obtain a corresponding first total number A; and to identify whether the first total number A is zero; if the first total number A is zero, the corresponding first reference record sequence is set to empty; if the first total number A is not zero, the vector feature similarity between the first dense vector field and the second feature vector of each of the first vector data records queried this time is used as the corresponding first correlation coefficient, and the A first vector data records are sequentially sorted in descending order of the first correlation coefficient to form a corresponding first record sequence, and the second vector identification field in the first text database is correlated with the first The third vector identification field of the first text data record that matches each of the first vector identification fields of a record sequence is extracted as the corresponding first identification, and the first dense vector field of the first vector data record that matches each of the first identification fields in the first vector database is extracted as the corresponding first reference dense vector, and each of the first reference dense vectors is converted into a corresponding first reference feature vector in a text feature vector format to obtain a corresponding first reference feature vector, and each of the first reference feature vectors and the corresponding first correlation coefficient is used to form a corresponding first reference record, and A first reference records are sequentially sorted in descending order of the first correlation coefficient to form a corresponding first reference record sequence; and the obtained first reference record sequence is sent to the feature fusion module; wherein the dense vector conversion method from the text feature vector format to the dense vector format is inverse to the text feature vector conversion method from the dense vector format to the text feature vector format;

[0029] The feature fusion module of the second largest language model is used to identify whether the first reference record sequence is empty; if the first reference record sequence is empty, the second feature vector is used as the corresponding first fused feature vector; if the first reference record sequence is not empty, the preset feature fusion mode is identified; if the feature fusion mode is the first mode, the A first reference feature vectors of the first reference record sequence are sequentially vector-joined in descending order of the first correlation coefficients to obtain the corresponding first concatenated feature vector, and the second feature vector and the first concatenated feature vector are sequentially vector-joined and the obtained concatenated vector is used as the corresponding first fused feature vector; if the feature fusion mode is the second mode, the A first correlation coefficients of the first reference record sequence are normalized and calculated to obtain the corresponding A normalized correlation coefficients, and the inner product calculation result of each normalized correlation coefficient and the corresponding first reference feature vector is used as the corresponding first weighted feature vector, and the mean vector calculation of the obtained A first weighted feature vectors is performed to obtain the corresponding first average feature vector, and The second feature vector and the first average feature vector are sequentially concatenated and the obtained concatenated vector is used as the corresponding first fused feature vector; if the feature fusion mode is the third mode, the attention weights of the second feature vector and each of the first reference feature vectors of the first reference record sequence are predicted based on a class of neural network models to obtain the corresponding first attention weights, and the obtained A first attention weights are normalized to obtain the corresponding A normalized attention weights, and the inner product calculation result of each normalized attention weight and the corresponding first reference feature vector is used as the corresponding first attention feature vector, and the mean vector calculation is performed on the obtained A first attention feature vectors to obtain the corresponding second average feature vector, and the second feature vector and the second average feature vector are sequentially concatenated and the obtained concatenated vector is used as the corresponding first fused feature vector; and the obtained first fused feature vector is sent to the text generation module; the feature fusion mode includes the first, second and third modes; the neural network model includes at least an MLP model and a CNN model;

[0030] The text generation module of the second largest language model is used to perform text feature decoding and text generation processing according to the first fused feature vector and output the corresponding first generated text.

[0031] Preferably, the initializing a corresponding dense vector database based on the first data set specifically includes:

[0032] Step 51, based on a class of the vector database, an empty database is initialized as the corresponding first vector database; and based on a class of the relational database, an empty database is initialized as the corresponding first text database; and the preprocessing module, the embedded coding module and the feature extraction module of the first large language model form a corresponding first encoder;

[0033] Step 52, perform a round of traversal on all the first data records of the first data set; and in this round of traversal, take the first data record currently traversed as the corresponding current record; and take the first target text and the first label text of the current record as the corresponding current target text and current label text; and input the current target text and the current label text into the first encoder respectively for corresponding text preprocessing, embedded coding processing and feature extraction processing to obtain the corresponding current target text feature vector and current label text feature vector; and perform dense vector conversion on the current target text feature vector and the current label text feature vector in dense vector format to obtain the corresponding current target text dense vector and current label text dense vector; and create two new first vector data records in the first vector database as the corresponding first and second newly created records; and assign a unique record identifier to each of the first and second newly created records as the corresponding first and second newly created records. Create an identifier; and set the first vector identification field and the first dense vector field of the first newly created record to the corresponding first newly created identifier and the current target text dense vector; and set the first vector identification field and the first dense vector field of the second newly created record to the corresponding second newly created identifier and the current label text dense vector; and create a new first vector data record in the first text database as the corresponding third newly created record; and assign a unique record identifier to each of the third newly created records as the corresponding third newly created identifier; and use the current time as the corresponding first time; and set the first text identification field, the first text field, the second text field, the second vector identification field, the third vector identification field and the first update field of the third newly created record to the corresponding third newly created identifier, the current target text, the current label text, the first newly created identifier, the second newly created identifier and the first time.

[0034] Preferably, the performing model training on the second language model based on the first data set specifically includes:

[0035] Step 61, performing sub-dataset segmentation processing on the first data set according to a preset first segmentation ratio to obtain a corresponding first training set and a first evaluation set;

[0036] Wherein, both the first training set and the first evaluation set are composed of a plurality of the first data records; the ratio of the total number of records in the first training set to the total number of records in the first evaluation set satisfies the first segmentation ratio;

[0037] Step 62, extracting the first first data record of the first training set as the corresponding current training record;

[0038] Step 63, inputting the first target text of the current training record into the second largest language model for processing and using the generated text output by the model as the corresponding first predicted text;

[0039] Step 64, bringing the first predicted text and the first label text of the current training record into a preset first model loss function; and identifying the preset feature fusion mode; if the feature fusion mode is the first or second mode, then based on the preset first model optimizer, a round of modulation is performed on the model parameters of the text generation module of the second largest language model in the direction of minimizing the first model loss function; if the feature fusion mode is the third mode, then based on the preset second model optimizer, a round of modulation is performed on the model parameters of the feature fusion module and the text generation module of the second largest language model in the direction of minimizing the first model loss function;

[0040] Wherein, the first model loss function is implemented based on the maximum likelihood loss function; the first and second model optimizers at least include an SGD optimizer and an ADAM optimizer;

[0041] Step 65, identifying whether the current training record is the last first data record of the first training set; if so, going to step 66; if not, extracting the next first data record of the first training set as the new current training record and returning to step 63;

[0042] Step 66, perform a round of traversal on all the first data records of the first evaluation set; and in this round of traversal, use the first data record currently traversed as the corresponding current evaluation record; and input the first target text of the current evaluation record into the second large language model for processing and use the generated text output by the model as the corresponding second predicted text; and form a corresponding first prediction-label pair by the second predicted text and the first label text of the current training record; and at the end of this round of traversal, bring all the obtained first prediction-label pairs into the preset first model evaluation function to calculate and obtain the corresponding first evaluation value;

[0043] Wherein, the first model evaluation function includes at least a MAE function and an MSE function;

[0044] Step 67, identifying whether the first evaluation value meets the preset first evaluation value range; if not, returning to step 62 to continue training; if satisfied, stopping training and confirming the end of model training.

[0045] Preferably, the processing of the directional NLP task by the second largest language model with reference to the dense vector database specifically includes:

[0046] Receive a task text input by a user as the corresponding current task text; input the current task text into the second largest language model, and the second largest language model uses the dense vector database as a task reference knowledge base and performs corresponding NLP task text generation processing according to the current task text input by the model; and feed back the generated text output by the model as the corresponding current generated text to the user.

[0047] Preferably, the periodic data update process of the dense vector database specifically includes:

[0048] Step 81, regularly collecting big data of the text corpus of the directional NLP task through multiple big data collection channels at a preset first time frequency to obtain a corresponding first collection data set; and performing text noise reduction, deduplication, compliance inspection and correctness inspection on each first collection record of the first collection data set based on manual or other machine model screening methods; and forming a corresponding second encoder by the preprocessing module, the embedded coding module and the feature extraction module of the second large language model;

[0049] Among them, the multiple big data collection channels at least include public text corpora, public network text resources, and public technical standards / textbooks / documents / magazines / journals / paper resources in various fields; the first collection data set includes multiple first collection records; the first collection record includes a first collection target text and a first collection label text; when the directional NLP task is a machine translation task, the first collection target text and the first collection label text are the corresponding translation target text and interpretation label text respectively; when the directional NLP task is an intelligent question-answering task, the first collection target text and the first collection label text are the corresponding question target text and answer label text respectively;

[0050] Step 82, taking the first first acquisition record of the first acquisition data set as the corresponding current acquisition record;

[0051] Step 83, taking the first acquisition target text and the first acquisition label text of the current acquisition record as the corresponding current acquisition target text and the current acquisition label text; and inputting the current acquisition target text and the current acquisition label text into the second encoder respectively for corresponding text preprocessing, embedded coding processing and feature extraction processing to obtain the corresponding current target text feature vector and current label text feature vector; and performing dense vector conversion on the current target text feature vector and the current label text feature vector in dense vector format to obtain the corresponding current target text dense vector and current label text dense vector;

[0052] Step 84, query the first vector data record in the first vector database of the dense vector database for which the vector feature approximation between the first dense vector field and the current target text dense vector is the largest, and use the first vector data record obtained by the query as the corresponding first query record; and use the vector feature approximation between the first dense vector field of the first query record and the current target text dense vector as the corresponding first target approximation; and use the first text data record in which the second vector identification field in the first text database matches the first vector identification field of the first query record as the corresponding second query record; and record the first vector data record in which the first dense vector field in the first vector database matches the third vector identification field of the second query record as the corresponding third query record; and calculate the vector feature approximation between the first dense vector field of the third query record and the current label text dense vector to obtain the corresponding first label approximation;

[0053] Step 85, identifying the first target similarity and the first label similarity; if the first target similarity exceeds a preset second similarity threshold and the first label similarity does not exceed the second similarity threshold, go to step 86; if the first target similarity does not exceed the second similarity threshold, go to step 87; if both the first target similarity and the first label similarity exceed the second similarity threshold, go to step 88;

[0054] Wherein, the second similarity threshold>the first similarity threshold;

[0055] Step 86, update the second text field of the second query record to the corresponding current collected label text; update the first update field of the second query record to the corresponding current time; update the first dense vector field of the third query record to the corresponding current label text dense vector; and go to step 88;

[0056] Step 87, adding two of the first vector data records as the corresponding first newly added record and the second newly added record in the first vector database; and adding one of the first text data records as the corresponding third newly added record in the first text database; and assigning a unique record identifier to each of the first, second and third newly added records as the corresponding first newly added identifier, second newly added identifier and third newly added identifier; and using the current time as the corresponding first newly added time; and setting the first vector identification field and the first dense vector field of the first newly added record to the corresponding first newly added identifier and the current target text dense vector; and setting the first vector identification field and the first dense vector field of the second newly added record to the corresponding second newly added identifier and the current label text dense vector; and setting the first text identification field, the first text field, the second text field, the second vector identification field, the third vector identification field and the first update field of the third newly added record to the corresponding third newly added identifier, the current acquisition target text, the current acquisition label text, the first newly added identifier, the second newly added identifier and the first newly added time;

[0057] Step 88, identifying whether the current acquisition record is the last of the first acquisition record of the first acquisition data set; if not, extracting the next first acquisition record of the first acquisition data set as the new current acquisition record and returning to step 83; if so, confirming that the data update process is complete.

[0058] Preferably, the periodically performing a task processing performance evaluation on the second largest language model based on the latest dense vector database to obtain a corresponding evaluation result at that time specifically includes:

[0059] Step 91, regularly taking the current time as the corresponding first end time according to a preset second time frequency, and taking the time obtained by subtracting a preset first duration from the first end time as the corresponding first start time, and the first start time and the first end time form a corresponding first recent time period; and extracting all the first text data records whose first update fields satisfy the first recent time period in the first text database of the dense vector database to form a corresponding first record set;

[0060] Step 92, perform a round of traversal on all the first text data records of the first record set; and in this round of traversal, use the first text data record currently traversed as the corresponding current evaluation record; and extract the first text field and the second text field of the current evaluation record as the corresponding current task text and current label text; and input the current task text into the second largest language model for processing and use the generated text output by the model as the corresponding current predicted text; and form a corresponding second prediction-label pair with the current predicted text and the current label text; and at the end of this round of traversal, bring all the obtained second prediction-label pairs into the preset second model evaluation function to calculate and obtain the corresponding second evaluation value;

[0061] Wherein, the second model evaluation function includes at least a MAE function and an MSE function;

[0062] Step 93, identifying whether the second evaluation value satisfies a preset second evaluation value range; if so, setting the corresponding evaluation result of the time as qualified; if not, setting the corresponding evaluation result of the time as unqualified.

[0063] Preferably, when the evaluation result is unqualified, constructing a model training data set based on the dense vector database to obtain a corresponding second data set specifically includes:

[0064] When the evaluation result is unqualified, a round of traversal is performed on all the first text data records of the first record set; and in this round of traversal, the first text data record currently traversed is used as the corresponding current record; and the first text field and the second text field of the current record are extracted as the corresponding second target text and the second label text to form a corresponding second data record; and at the end of this round of traversal, all the obtained second data records form the corresponding second data set.

[0065] Preferably, fine-tuning the second language model based on the second data set specifically includes:

[0066] Step 111, performing sub-dataset segmentation processing on the second data set according to a preset second segmentation ratio to obtain a corresponding second training set and a second evaluation set;

[0067] Wherein, both the second training set and the second evaluation set are composed of a plurality of the second data records; the ratio of the total number of records in the second training set to the total number of records in the second evaluation set satisfies the second segmentation ratio;

[0068] Step 112, extracting the first second data record of the second training set as the corresponding current training record;

[0069] Step 113, inputting the second target text of the current training record into the second largest language model for processing and using the generated text output by the model as the corresponding third predicted text;

[0070] Step 114, bringing the third predicted text and the second label text of the current training record into the first model loss function; and fine-tuning the model parameters of the text generation module of the second language model in a direction that minimizes the first model loss function based on a preset third model optimizer;

[0071] Wherein, the third model optimizer includes at least an SGD optimizer and an ADAM optimizer;

[0072] Step 115, identifying whether the current training record is the last second data record of the second training set; if so, going to step 116; if not, extracting the next second data record of the second training set as the new current training record and returning to step 113;

[0073] Step 116, perform a round of traversal on all the second data records of the second evaluation set; and in this round of traversal, use the second data record currently traversed as the corresponding current evaluation record; and input the second target text of the current evaluation record into the second large language model for processing and use the generated text output by the model as the corresponding fourth predicted text; and form a corresponding third prediction-label pair by the fourth predicted text and the second label text of the current training record; and at the end of this round of traversal, bring all the obtained third prediction-label pairs into the preset third model evaluation function to calculate and obtain the corresponding third evaluation value;

[0074] Wherein, the third model evaluation function includes at least a MAE function and an MSE function;

[0075] Step 117, identifying whether the third evaluation value meets the preset third evaluation value range; if not, returning to step 112 to continue training; if satisfied, stopping training and confirming the end of this fine-tuning.

[0076] A second aspect of an embodiment of the present invention provides a device for implementing the processing method of a large language model introduced into a dense vector searcher as described in the first aspect, the device comprising: a large language model selection module, a dense vector database preparation module, a large language model transformation and training module, and a transformation model application module;

[0077] The large language model selection module is used to use a large language model that is implemented based on the Transformer model architecture and has completed pre-training and fine-tuning of a type of directional NLP task as the corresponding first large language model; the directional NLP task includes at least a machine translation task and an intelligent question-answering task;

[0078] The dense vector database preparation module is used to use the directional text corpus used by the first large language model in the fine-tuning of the corresponding directional NLP task as the corresponding first data set; and initialize the corresponding dense vector database based on the first data set;

[0079] The large language model transformation and training module is used to add a dense vector retriever and a feature fusion module to the first large language model to form a corresponding second large language model; and perform model training on the second large language model based on the first data set;

[0080] The modified model application module is used to, after the model training is completed, use the second largest language model to process the directional NLP task with reference to the dense vector database; and regularly update the data of the dense vector database; and regularly perform a task processing performance evaluation on the second largest language model based on the latest dense vector database to obtain the corresponding evaluation result of the time, and when the evaluation result of the time is unqualified, construct a model training data set based on the dense vector database to obtain the corresponding second data set, and fine-tune the second largest language model based on the second data set, and continue to use the second largest language model to process the directional NLP task with reference to the dense vector database after the fine-tuning is completed; the evaluation result of the time includes qualified and unqualified.

[0081] A third aspect of an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a transceiver;

[0082] The processor is used to be coupled to the memory, read and execute instructions in the memory, so as to implement the method steps described in the first aspect above;

[0083] The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

[0084] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed by a computer, the computer executes the instructions of the method described in the first aspect above.

[0085] The embodiments of the present invention provide a processing method, device, electronic device and computer-readable storage medium for a large language model that introduces a dense vector retriever. As can be seen from the above content, the embodiments of the present invention use a large language model that is implemented based on the Transformer model architecture and has completed pre-training and fine-tuning of a type of directional NLP task (such as machine translation task, intelligent question-answering task) as the corresponding first large language model; and use the directional text corpus used by the first large language model in fine-tuning the corresponding directional NLP task as the corresponding first data set; and initialize the corresponding dense vector database based on the first data set; and add a dense vector retriever and a feature fusion module to the first large language model to form a corresponding second large language model; and perform model training on the second large language model based on the first data set. training; and after the model training is completed, the second largest language model uses the dense vector database as a reference to process the directional NLP task; and the dense vector database is regularly updated; and the second largest language model is regularly evaluated for task processing performance based on the latest dense vector database to obtain the corresponding evaluation result of the current time, and when the evaluation result of the current time is unqualified, the model training data set is constructed based on the dense vector database to obtain the corresponding second data set, and the second largest language model is fine-tuned based on the second data set, and after the fine-tuning is completed, the second largest language model continues to process the directional NLP task with the dense vector database as a reference. The embodiment of the present invention realizes the update and iteration of knowledge by updating the dense vector database, and solves / improves the timeliness problem of the large language model by introducing a dense vector retriever that can query the dense vector database into the large language model; the embodiment of the present invention can not only maintain the timeliness of the model without periodic fine-tuning, but also timely supplement the fine-tuning of the model when it is found that the timeliness of the model is reduced; the embodiment of the present invention not only ensures the best real-time performance of the model, but also reduces the maintenance cost of the model and improves the economic value of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0086] Figure 1 A schematic diagram of a processing method for a large language model that introduces a dense vector retriever provided in the first embodiment of the present invention;

[0087] Figure 2 A module structure diagram of the first language model before introducing a dense vector retriever provided in the first embodiment of the present invention;

[0088] Figure 3 A module structure diagram of the second largest language model after the dense vector retriever is introduced according to the first embodiment of the present invention;

[0089] Figure 4 A module structure diagram of a processing device for a large language model that introduces a dense vector searcher provided in the second embodiment of the present invention;

[0090] Figure 5 A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0091] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0092] Embodiment 1 of the present invention provides a method for processing a large language model by introducing a dense vector searcher, such as Figure 1 A schematic diagram of a processing method for a large language model introducing a dense vector searcher provided in the first embodiment of the present invention is shown. The method mainly includes the following steps:

[0093] Step 1: Take a large language model that is implemented based on the Transformer model architecture and has completed pre-training and fine-tuning for a type of targeted NLP task as the corresponding first large language model.

[0094] Here, the directional NLP task of the embodiment of the present invention includes at least a machine translation task and an intelligent question-answering task. The first large language model of the embodiment of the present invention includes at least a BERT series model, a BART series model, a GPT series model, a T5 series model, etc.; the first large language model is used to generate the corresponding NLP task text according to the first task text input by the model and output the corresponding first generated text.

[0095] like Figure 2 As shown in the module structure diagram of the first largest language model before introducing the dense vector retriever provided in the first embodiment of the present invention, the model framework of the first largest language model in the embodiment of the present invention includes at least a preprocessing module, an embedded coding module, a feature extraction module and a text generation module.

[0096] like Figure 2 As shown, the connection relationship between the model components of the first large language model is: the input end of the preprocessing module is used to receive the first task text, and the output end is connected to the input end of the embedded coding module; the output end of the embedded coding module is connected to the input end of the feature extraction module; the output end of the feature extraction module is connected to the input end of the text generation module.

[0097] The functions of each model component of the first large language model are as follows: 1) The preprocessing module is used to perform word segmentation, stop word removal and part-of-speech tagging on the first task text to obtain the corresponding first word segmentation sequence and send it to the embedded coding module; 2) The embedded coding module is used to perform word embedding coding and word position coding on the first word segmentation sequence to obtain the corresponding first embedded coding vector and send it to the feature extraction module; 3) The feature extraction module is implemented based on the Transformer model Encoder or Decoder component structure; the feature extraction module is used to perform deep learning on the associated features of each word segmentation text and other word segmentation texts in the first task text according to the first embedded coding vector to obtain the corresponding first feature vector and send it to the text generation module; 4) The text generation module is implemented based on a class of text generator models; the text generation module is used to perform text feature decoding and text generation processing according to the first feature vector and output the corresponding first generated text.

[0098] Step 2: using the directional text corpus used by the first large language model in fine-tuning the corresponding directional NLP task as the corresponding first data set; and initializing the corresponding dense vector database based on the first data set;

[0099] Specifically, it includes: step 21, taking the directional text corpus used by the first large language model in fine-tuning the corresponding directional NLP task as the corresponding first data set;

[0100] Here, the first data set of the embodiment of the present invention includes multiple first data records; the first data record includes a first target text and a first label text; when the directional NLP task is a machine translation task, the first target text and the first label text are the corresponding translation target text and the interpretation label text respectively; when the directional NLP task is an intelligent question-answering task, the first target text and the first label text are the corresponding question target text and the answer label text respectively;

[0101] Step 22, initializing a corresponding dense vector database based on the first data set;

[0102] The dense vector database includes a first vector database and a first text database; the first vector database is implemented based on a class of vector databases, and the first text database is implemented based on a class of relational databases.

[0103] The first vector database is used to store a plurality of first vector data records; the first vector data record includes a first vector identification field and a first dense vector field; the first dense vector field is used to store a feature vector of a text in a dense vector format;

[0104] The first text database is used to store multiple first text data records; the first text data record includes a first text identification field, a first text field, a second text field, a second vector identification field, a third vector identification field and a first update field; the first text identification field is a unique identifier of the current text data record; when the directional NLP task is a machine translation task, the first and second text fields are the corresponding translation target text and the latest interpretation label text, respectively; when the directional NLP task is an intelligent question and answer task, the first and second text fields are the corresponding question text and the latest answer label text, respectively; the first and second text fields correspond to a first vector data record in the first vector database respectively; the second vector identification field matches the first vector identification field of the first vector data record corresponding to the first text field; the third vector identification field matches the first vector identification field of the first vector data record corresponding to the second text field; the first update field is the latest creation / update time of the current text data record;

[0105] The current step 22 specifically includes:

[0106] Step 221, based on a type of vector database, an empty database is initialized as a corresponding first vector database; based on a type of relational database, an empty database is initialized as a corresponding first text database; and a corresponding first encoder is formed by a preprocessing module, an embedded coding module and a feature extraction module of a first large language model;

[0107] Here, in the embodiment of the present invention, the type of vector database includes at least Faiss or Annoy database; the type of relational database includes at least SQL database and MySQL database;

[0108] Step 222, perform a round of traversal on all first data records of the first data set; and in this round of traversal, use the first data record currently traversed as the corresponding current record; and use the first target text and the first label text of the current record as the corresponding current target text and the current label text; and input the current target text and the current label text into the first encoder respectively for corresponding text preprocessing, embedded coding processing and feature extraction processing to obtain the corresponding current target text feature vector and current label text feature vector; and according to the dense vector (Dense Vector) format is used to perform dense vector conversion on the current target text feature vector and the current label text feature vector to obtain the corresponding current target text dense vector and current label text dense vector; and two first vector data records are newly created in the first vector database as the corresponding first and second newly created records; and a unique record identifier is assigned to each of the first and second newly created records as the corresponding first and second newly created identifiers; and the first vector identification field and the first dense vector field of the first newly created record are set to the corresponding first newly created identifier and the current target text dense vector; and the first vector identification field and the first dense vector field of the second newly created record are set to the corresponding second newly created identifier and the current label text dense vector; and a first vector data record is newly created in the first text database as the corresponding third newly created record; and a unique record identifier is assigned to each of the third newly created records as the corresponding third newly created identifier; and the current time is used as the corresponding first time; and the first text identification field, the first text field, the second text field, the second vector identification field, the third vector identification field and the first update field of the third newly created record are set to the corresponding third newly created identifier, the current target text, the current label text, the first newly created identifier, the second newly created identifier and the first time.

[0109] Here, the dense vector conversion method from the text feature vector format to the dense vector format in the embodiment of the present invention corresponds to a vector conversion / projection function A, and the text feature vector conversion method from the dense vector format to the text feature vector format corresponds to another vector conversion / projection function A. - , and these two transformations are inverse to each other, namely, vector transformation / projection functions A and A - are inverses of each other; and these two vector transformation / projection functions A, A - The specific function form of can be configured according to actual application requirements. The embodiment of the present invention does not limit the specific function forms of these two vector conversion / projection functions;

[0110] Step 3, adding a dense vector retriever and a feature fusion module to the first language model to form a corresponding second language model; and performing model training on the second language model based on the first data set;

[0111] Specifically, it includes: step 31, adding a dense vector retriever and a feature fusion module to the first language model to form a corresponding second language model;

[0112] Here, the second largest language model of the embodiment of the present invention is used to use the dense vector database as the task reference knowledge base and perform corresponding NLP task text generation processing according to the second task text input by the model and output the corresponding second generated text;

[0113] like Figure 3 As shown in the module structure diagram of the second language model after the dense vector retriever is introduced in the first embodiment of the present invention, the model framework of the second language model, which adds the dense vector retriever and the feature fusion module on the basis of the first language model, includes a preprocessing module, an embedded coding module, a feature extraction module, a dense vector retriever, a feature fusion module and a text generation module; wherein the internal dense vector retriever is connected to the external dense vector database;

[0114] The connection relationship of each model component of the second language model is as follows: the input end of the preprocessing module is used to receive the second task text, and the output end is connected to the input end of the embedding coding module; the output end of the embedding coding module is connected to the input end of the feature extraction module; the output end of the feature extraction module is respectively connected to the input end of the dense vector retriever and the first input end of the feature fusion module; the output end of the dense vector retriever is connected to the second input end of the feature fusion module; the output end of the feature fusion module is connected to the input end of the text generation module;

[0115] The functions of each model component of the second largest language model are as follows:

[0116] 1) The preprocessing module is used to perform word segmentation, stop word removal and part-of-speech tagging on the second task text to obtain a corresponding second word segmentation sequence and send it to the embedding coding module;

[0117] 2) The embedding coding module is used to perform word embedding coding and word position coding on the second word segmentation sequence to obtain a corresponding second embedding coding vector and send it to the feature extraction module;

[0118] 3) The feature extraction module is used to perform deep learning on the associated features of each segmented text and other segmented texts in the second task text according to the second embedded coding vector to obtain the corresponding second feature vector and send it to the dense vector retriever and the feature fusion module respectively;

[0119] 4) The dense vector retriever is used to perform dense vector conversion on the second feature vector in a dense vector format to obtain a corresponding first conversion vector; and query the first vector data record in the first vector database whose vector feature similarity between the first dense vector field and the first conversion vector exceeds a preset first similarity threshold; and count the total number of records of the first vector data records obtained by the query to obtain a corresponding first total number A; and identify whether the first total number A is zero; if the first total number A is zero, set the corresponding first reference record sequence to empty; if the first total number A is not zero, use the vector feature similarity between the first dense vector field of each first vector data record queried this time and the second feature vector as the corresponding first correlation coefficient, and sort the A first vector data records in descending order of the first correlation coefficient to form a corresponding first record. sequence, and extract the third vector identification field of the first text data record whose second vector identification field in the first text database matches each first vector identification field of the first record sequence as the corresponding first identification, and extract the first dense vector field of the first vector data record whose first vector identification field in the first vector database matches each first identification as the corresponding first reference dense vector, and perform corresponding text feature vector conversion on each first reference dense vector in a text feature vector format to obtain a corresponding first reference feature vector, and form a corresponding first reference record from each first reference feature vector and the corresponding first correlation coefficient, and sort A first reference records in order from high to low according to the first correlation coefficient to form a corresponding first reference record sequence; and send the obtained first reference record sequence to the feature fusion module;

[0120] Here, the first similarity threshold is a preset threshold parameter; the algorithm used to calculate the vector feature similarity in the embodiment of the present invention may be a cosine similarity algorithm or an inner product similarity algorithm;

[0121] 5) The feature fusion module is used to identify whether the first reference record sequence is empty; if the first reference record sequence is empty, the second feature vector is used as the corresponding first fused feature vector; if the first reference record sequence is not empty, the preset feature fusion mode is identified; if the feature fusion mode is the first mode, the A first reference feature vectors of the first reference record sequence are sequentially vector-joined in descending order of the first correlation coefficient to obtain the corresponding first concatenated feature vector, and the second feature vector and the first concatenated feature vector are sequentially vector-joined and the obtained concatenated vector is used as the corresponding first fused feature vector; if the feature fusion mode is the second mode, the A first correlation coefficients of the first reference record sequence are normalized and calculated to obtain the corresponding A normalized correlation coefficients, and the inner product calculation result of each normalized correlation coefficient and its corresponding first reference feature vector is used as the corresponding first weighted feature vector, and the obtained A first weighted feature vectors are averaged. The corresponding first average feature vector is obtained by calculation, and the second feature vector and the first average feature vector are sequentially concatenated and the obtained concatenated vector is used as the corresponding first fused feature vector; if the feature fusion mode is the third mode, the attention weights of the second feature vector and each first reference feature vector of the first reference record sequence are predicted based on a class of neural network models to obtain the corresponding first attention weights, and the obtained A first attention weights are normalized to obtain the corresponding A normalized attention weights, and the inner product calculation result of each normalized attention weight and the corresponding first reference feature vector is used as the corresponding first attention feature vector, and the obtained A first attention feature vectors are averaged to obtain the corresponding second average feature vector, and the second feature vector and the second average feature vector are sequentially concatenated and the obtained concatenated vector is used as the corresponding first fused feature vector; and the obtained first fused feature vector is sent to the text generation module;

[0122] Here, the feature fusion mode includes the first, second and third modes; the neural network model includes at least an MLP model and a CNN model;

[0123] 6) The text generation module is used to perform text feature decoding and text generation processing according to the first fused feature vector and output the corresponding first generated text;

[0124] Step 32, performing model training on the second largest language model based on the first data set;

[0125] Specifically, it includes: step 321, performing sub-dataset segmentation processing on the first data set according to a preset first segmentation ratio to obtain a corresponding first training set and a first evaluation set;

[0126] The first segmentation ratio is a preset ratio parameter, such as 8:2; the first training set and the first evaluation set are both composed of a plurality of first data records; the ratio of the total number of records in the first training set to the total number of records in the first evaluation set satisfies the first segmentation ratio;

[0127] Step 322, extracting the first first data record of the first training set as the corresponding current training record;

[0128] Step 323, inputting the first target text of the current training record into the second largest language model for processing and using the generated text output by the model as the corresponding first predicted text;

[0129] Step 324, bringing the first predicted text and the first label text of the current training record into a preset first model loss function; and identifying a preset feature fusion mode; if the feature fusion mode is the first or second mode, then based on the preset first model optimizer, a round of modulation is performed on the model parameters of the text generation module of the second largest language model in a direction that minimizes the first model loss function; if the feature fusion mode is the third mode, then based on the preset second model optimizer, a round of modulation is performed on the model parameters of the feature fusion module and the text generation module of the second largest language model in a direction that minimizes the first model loss function;

[0130] Wherein, the first model loss function is implemented based on the maximum likelihood loss function; the first and second model optimizers at least include an SGD optimizer and an ADAM optimizer;

[0131] Step 325, identifying whether the current training record is the last first data record of the first training set; if so, going to step 326; if not, extracting the next first data record of the first training set as the new current training record and returning to step 323;

[0132] Step 326, perform a round of traversal on all first data records of the first evaluation set; and in this round of traversal, use the first data record currently traversed as the corresponding current evaluation record; and input the first target text of the current evaluation record into the second largest language model for processing and use the generated text output by the model as the corresponding second predicted text; and form a corresponding first prediction-label pair by the second predicted text and the first label text of the current training record; and at the end of this round of traversal, bring all the obtained first prediction-label pairs into the preset first model evaluation function to calculate and obtain the corresponding first evaluation value;

[0133] Wherein, the first model evaluation function includes at least a MAE function and an MSE function;

[0134] Step 327, identifying whether the first evaluation value meets the preset first evaluation value range; if not, returning to step 322 to continue training; if satisfied, stopping training and confirming the end of model training.

[0135] Here, the first evaluation value range is a preset evaluation value range.

[0136] Step 4, after the model training is completed, the second largest language model uses the dense vector database as a reference to process the directional NLP task; and the dense vector database is regularly updated; and the second largest language model is regularly evaluated for task processing performance based on the latest dense vector database to obtain the corresponding evaluation result of the current time, and when the evaluation result of the current time is unqualified, the model training data set is constructed based on the dense vector database to obtain the corresponding second data set, and the second largest language model is fine-tuned based on the second data set, and after the fine-tuning is completed, the second largest language model continues to process the directional NLP task with the dense vector database as a reference;

[0137] Specifically, the method comprises: step 41, after the model training is completed, the second largest language model processes the directional NLP task with reference to the dense vector database;

[0138] Specifically, it includes: receiving the task text input by the user as the corresponding current task text; inputting the current task text into the second largest language model, and the second largest language model uses the dense vector database as the task reference knowledge base and performs corresponding NLP task text generation processing according to the current task text input by the model; and feeding back the generated text output by the model as the corresponding current generated text to the user;

[0139] Step 42, and regularly update the dense vector database;

[0140] Specifically, the method comprises: step 421, regularly collecting big data of the text corpus of the directional NLP task through multiple big data collection channels at a preset first time frequency to obtain a corresponding first collection data set; performing text noise reduction, deduplication, compliance inspection and correctness inspection on each first collection record of the first collection data set based on manual or other machine model screening methods; and forming a corresponding second encoder by a preprocessing module, an embedded coding module and a feature extraction module of a second large language model;

[0141] Wherein, the first time frequency is a preset time frequency parameter;

[0142] Multiple big data collection channels include at least public text corpora, public online text resources, and public technical standards / textbooks / documents / magazines / journals / paper resources in various fields;

[0143] The first acquisition data set includes a plurality of first acquisition records; the first acquisition record includes a first acquisition target text and a first acquisition label text; when the directional NLP task is a machine translation task, the first acquisition target text and the first acquisition label text are the corresponding translation target text and interpretation label text respectively; when the directional NLP task is an intelligent question-answering task, the first acquisition target text and the first acquisition label text are the corresponding question target text and answer label text respectively;

[0144] Step 422, taking the first first acquisition record of the first acquisition data set as the corresponding current acquisition record;

[0145] Step 423, taking the first acquisition target text and the first acquisition label text of the current acquisition record as the corresponding current acquisition target text and the current acquisition label text; and inputting the current acquisition target text and the current acquisition label text into the second encoder respectively for corresponding text preprocessing, embedded coding processing and feature extraction processing to obtain the corresponding current target text feature vector and the current label text feature vector; and performing dense vector conversion on the current target text feature vector and the current label text feature vector in a dense vector format to obtain the corresponding current target text dense vector and the current label text dense vector;

[0146] Step 424, query the first vector data record whose first dense vector field in the first vector database of the dense vector database has the largest vector feature approximation with the current target text dense vector and use the first vector data record obtained by the query as the corresponding first query record; use the vector feature approximation between the first dense vector field of the first query record and the current target text dense vector as the corresponding first target approximation; use the first text data record whose second vector identification field in the first text database matches the first vector identification field of the first query record as the corresponding second query record; and record the first vector data record whose first dense vector field in the first vector database matches the third vector identification field of the second query record as the corresponding third query record; and calculate the vector feature approximation between the first dense vector field of the third query record and the current label text dense vector to obtain the corresponding first label approximation;

[0147] Step 425, identifying the first target proximity and the first label proximity; if the first target proximity exceeds a preset second proximity threshold and the first label proximity does not exceed the second proximity threshold, go to step 426; if the first target proximity does not exceed the second proximity threshold, go to step 427; if both the first target proximity and the first label proximity exceed the second proximity threshold, go to step 428;

[0148] Here, the second similarity threshold is a preset threshold parameter, and the second similarity threshold> the first similarity threshold. Under normal circumstances, the second similarity threshold is set to a similarity threshold close to 1 by default; the first target similarity exceeds the second similarity threshold, and the first label similarity does not exceed the second similarity threshold, indicating that the translation / question text that is highly similar (or even identical) to the current collected target text already exists in the dense vector database, but the corresponding translation / answer label text has been updated, so it is necessary to go to 426 to update the record field related to the label text; the first target similarity does not exceed the second similarity threshold, indicating that the translation / question text corresponding to the current collected target text has not appeared in the dense vector database, so it is necessary to go to 427 to create a new record; the first target similarity and the first label similarity both exceed the second similarity threshold, indicating that the translation / question text that is highly similar (or even identical) to the current collected target text already exists in the dense vector database, and the corresponding translation / answer label text has not been updated, so no update / creation operation will be performed on the dense vector database at this time, and it will only go to 428 to determine whether to jump to the next collected record for processing;

[0149] Step 426, update the second text field of the second query record to the corresponding current collected label text; update the first update field of the second query record to the corresponding current time; update the first dense vector field of the third query record to the corresponding current label text dense vector; and go to step 428;

[0150] Step 427, add two first vector data records in the first vector database as the corresponding first newly added record and the second newly added record; and add a first text data record in the first text database as the corresponding third newly added record; and assign a unique record identifier to each of the first, second and third newly added records as the corresponding first newly added identifier, second newly added identifier and third newly added identifier; and use the current time as the corresponding first newly added time; and set the first vector identification field and the first dense vector field of the first newly added record to the corresponding first newly added identifier and the current target text dense vector; and set the first vector identification field and the first dense vector field of the second newly added record to the corresponding second newly added identifier and the current label text dense vector; and set the first text identification field, the first text field, the second text field, the second vector identification field, the third vector identification field and the first update field of the third newly added record to the corresponding third newly added identifier, the current collected target text, the current collected label text, the first newly added identifier, the second newly added identifier and the first newly added time;

[0151] Step 428, identifying whether the current acquisition record is the last first acquisition record of the first acquisition data set; if not, extracting the next first acquisition record of the first acquisition data set as the new current acquisition record and returning to step 423; if yes, confirming that the data update process is finished;

[0152] Step 43, regularly perform a task processing performance evaluation on the second largest language model based on the latest dense vector database to obtain the corresponding evaluation result of the current time, and when the evaluation result of the current time is unqualified, construct a model training data set based on the dense vector database to obtain the corresponding second data set, and fine-tune the second largest language model based on the second data set, and after the fine-tuning is completed, continue to use the second largest language model to process the directional NLP task with reference to the dense vector database;

[0153] Specifically, the method includes: step 431, and regularly performing a task processing performance evaluation on the second largest language model based on the latest dense vector database to obtain a corresponding evaluation result;

[0154] Specifically, it includes: step 4311, regularly taking the current time as the corresponding first end time according to the preset second time frequency, and taking the time obtained by subtracting a preset first duration from the first end time as the corresponding first start time, and forming the corresponding first most recent time period by the first start time and the first end time; and extracting all first text data records whose first update fields in the first text database of the dense vector database meet the first most recent time period to form a corresponding first record set;

[0155] Here, the second time frequency is a preset time frequency parameter;

[0156] Step 4312, perform a round of traversal on all first text data records of the first record set; and in this round of traversal, use the currently traversed first text data record as the corresponding current evaluation record; and extract the first text field and the second text field of the current evaluation record as the corresponding current task text and the current label text; and input the current task text into the second largest language model for processing and use the generated text output by the model as the corresponding current predicted text; and form a corresponding second prediction-label pair from the current predicted text and the current label text; and at the end of this round of traversal, bring all the obtained second prediction-label pairs into the preset second model evaluation function to calculate and obtain the corresponding second evaluation value;

[0157] Wherein, the second model evaluation function includes at least a MAE function and an MSE function;

[0158] Step 4313, identifying whether the second evaluation value meets the preset second evaluation value range; if so, setting the corresponding evaluation result of the current time as qualified; if not, setting the corresponding evaluation result of the current time as unqualified;

[0159] Here, the second evaluation value range is a preset evaluation value range; the evaluation result includes qualified and unqualified;

[0160] Step 432, when the evaluation result is unqualified, a model training data set is constructed based on the dense vector database to obtain a corresponding second data set;

[0161] The second data set includes a plurality of second data records; the second data record includes a second target text and a second label text; when the directional NLP task is a machine translation task, the second target text and the second label text are the corresponding translation target text and interpretation label text respectively; when the directional NLP task is an intelligent question-answering task, the second target text and the second label text are the corresponding question target text and answer label text respectively;

[0162] Specifically, it includes: when the evaluation result is unqualified, performing a round of traversal on all first text data records of the first record set; and in this round of traversal, taking the first text data record currently traversed as the corresponding current record; and extracting the first text field and the second text field of the current record as the corresponding second target text and the second label text to form a corresponding second data record; and at the end of this round of traversal, all the obtained second data records form a corresponding second data set;

[0163] Step 433, fine-tuning the second largest language model based on the second data set;

[0164] Specifically, it includes: step 4331, performing sub-dataset segmentation processing on the second data set according to a preset second segmentation ratio to obtain a corresponding second training set and a second evaluation set;

[0165] The second segmentation ratio is a preset ratio parameter, such as 8:2; the second training set and the second evaluation set are both composed of a plurality of second data records; the ratio of the total number of records in the second training set to the total number of records in the second evaluation set satisfies the second segmentation ratio;

[0166] Step 4332, extracting the first second data record of the second training set as the corresponding current training record;

[0167] Step 4333, inputting the second target text of the current training record into the second largest language model for processing and using the generated text output by the model as the corresponding third predicted text;

[0168] Step 4334, bringing the third predicted text and the second label text of the current training record into the first model loss function; and based on the preset third model optimizer, performing a round of fine-tuning on the model parameters of the text generation module of the second largest language model in the direction of minimizing the first model loss function;

[0169] Wherein, the third model optimizer includes at least an SGD optimizer and an ADAM optimizer;

[0170] Step 4335, identifying whether the current training record is the last second data record of the second training set; if so, going to step 4336; if not, extracting the next second data record of the second training set as the new current training record and returning to step 4333;

[0171] Step 4336, perform a round of traversal on all second data records of the second evaluation set; and in this round of traversal, use the second data record currently traversed as the corresponding current evaluation record; and input the second target text of the current evaluation record into the second largest language model for processing and use the generated text output by the model as the corresponding fourth predicted text; and form a corresponding third prediction-label pair by the fourth predicted text and the second label text of the current training record; and at the end of this round of traversal, bring all the obtained third prediction-label pairs into the preset third model evaluation function to calculate and obtain the corresponding third evaluation value;

[0172] Wherein, the third model evaluation function includes at least a MAE function and an MSE function;

[0173] Step 4337, identifying whether the third evaluation value meets the preset third evaluation value range; if not, returning to step 4332 to continue training; if satisfied, stopping training and confirming the end of this fine-tuning;

[0174] Here, the third evaluation value range is a preset evaluation value range;

[0175] Step 434, after the fine-tuning is completed, the second largest language model continues to process the directional NLP task with reference to the dense vector database;

[0176] Specifically, it includes: receiving the task text input by the user as the corresponding current task text; inputting the current task text into the second largest language model, and the second largest language model uses the latest dense vector database as the task reference knowledge base and performs corresponding NLP task text generation processing according to the current task text input by the model; and feeds back the generated text output by the model as the corresponding current generated text to the user.

[0177] Figure 4The module structure diagram of a processing device for a large language model that introduces a dense vector searcher provided in the second embodiment of the present invention, the device is a terminal device or server that implements the aforementioned method embodiment, and can also be a device that enables the aforementioned terminal device or server to implement the aforementioned method embodiment, for example, the device can be a device or chip system of the aforementioned terminal device or server. Figure 4 As shown, the device includes: a large language model selection module 201, a dense vector database preparation module 202, a large language model transformation and training module 203 and a transformation model application module 204.

[0178] The large language model selection module 201 is used to use a large language model that is implemented based on the Transformer model architecture and has completed pre-training and fine-tuning for a type of targeted NLP task as the corresponding first large language model; the targeted NLP task includes at least a machine translation task and an intelligent question-answering task.

[0179] The dense vector database preparation module 202 is used to use the directional text corpus used by the first large language model in the fine-tuning of the corresponding directional NLP task as the corresponding first data set; and initialize the corresponding dense vector database based on the first data set.

[0180] The large language model transformation and training module 203 is used to add a dense vector retriever and a feature fusion module to the first large language model to form a corresponding second large language model; and perform model training on the second large language model based on the first data set.

[0181] The modified model application module 204 is used to, after the model training is completed, use the second largest language model to process the directional NLP task with the dense vector database as a reference; and regularly update the dense vector database; and regularly perform a task processing performance evaluation on the second largest language model based on the latest dense vector database to obtain the corresponding evaluation result of the time, and when the evaluation result of the time is unqualified, construct a model training data set based on the dense vector database to obtain the corresponding second data set, and fine-tune the second largest language model based on the second data set, and continue to use the second largest language model to process the directional NLP task with the dense vector database as a reference after the fine-tuning is completed; the evaluation result of the time includes qualified and unqualified.

[0182] An embodiment of the present invention provides a processing device for a large language model that introduces a dense vector retriever, which can execute the method steps in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here.

[0183] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the large language model selection module can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the above-mentioned module is determined. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0184] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital signal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0185] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the above method embodiments are generated. The above computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above-mentioned computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the above-mentioned computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, Bluetooth, microwave, etc.) methods. The above-mentioned computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The above-mentioned available medium can be a magnetic medium (such as a floppy disk, a hard disk, a tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

[0186] Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. The electronic device may be a terminal device or a server for implementing the method of the aforementioned embodiment, or may be a terminal device or a server for implementing the method of the aforementioned embodiment connected to the aforementioned terminal device or server. Figure 5 As shown, the electronic device may include: a processor 301 (such as a CPU), a memory 302, and a transceiver 303; the transceiver 303 is coupled to the processor 301, and the processor 301 controls the transceiver 303. Various instructions may be stored in the memory 302 to complete various processing functions and implement the processing steps described in the aforementioned embodiment method. Preferably, the electronic device involved in the embodiment of the present invention also includes: a power supply 304, a system bus 305 and a communication port 306. The system bus 305 is used to realize the communication connection between components. The above-mentioned communication port 306 is used for connecting and communicating between the electronic device and other peripherals.

[0187] exist Figure 5The system bus 305 mentioned in the figure can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used to realize the communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM), and may also include non-volatile memory (Non-Volatile Memory), such as at least one disk storage.

[0188] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (Network Processor, NP), a graphics processing unit (Graphics Processing Unit, GPU), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0189] It should be noted that an embodiment of the present invention further provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the method and processing process provided in the above embodiments.

[0190] The embodiments of the present invention provide a processing method, device, electronic device and computer-readable storage medium for a large language model that introduces a dense vector retriever. As can be seen from the above content, the embodiments of the present invention use a large language model that is implemented based on the Transformer model architecture and has completed pre-training and fine-tuning of a type of directional NLP task (such as machine translation task, intelligent question-answering task) as the corresponding first large language model; and use the directional text corpus used by the first large language model in fine-tuning the corresponding directional NLP task as the corresponding first data set; and initialize the corresponding dense vector database based on the first data set; and add a dense vector retriever and a feature fusion module to the first large language model to form a corresponding second large language model; and perform model training on the second large language model based on the first data set. training; and after the model training is completed, the second largest language model uses the dense vector database as a reference to process the directional NLP task; and the dense vector database is regularly updated; and the second largest language model is regularly evaluated for task processing performance based on the latest dense vector database to obtain the corresponding evaluation result of the current time, and when the evaluation result of the current time is unqualified, the model training data set is constructed based on the dense vector database to obtain the corresponding second data set, and the second largest language model is fine-tuned based on the second data set, and after the fine-tuning is completed, the second largest language model continues to process the directional NLP task with the dense vector database as a reference. The embodiment of the present invention realizes the update and iteration of knowledge by updating the dense vector database, and solves / improves the timeliness problem of the large language model by introducing a dense vector retriever that can query the dense vector database into the large language model; the embodiment of the present invention can not only maintain the timeliness of the model without periodic fine-tuning, but also timely supplement the fine-tuning of the model when it is found that the timeliness of the model is reduced; the embodiment of the present invention not only ensures the best real-time performance of the model, but also reduces the maintenance cost of the model and improves the economic value of the model.

[0191] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0192] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for processing a large language model by introducing a dense vector retriever, characterized in that: The method comprises: A large language model based on the Transformer model architecture and having completed pre-training and fine-tuning for a type of directional NLP task is used as the corresponding first large language model; the directional NLP task includes at least a machine translation task and an intelligent question-answering task; Using the directional text corpus used by the first large language model in fine-tuning the corresponding directional NLP task as the corresponding first data set; and initializing the corresponding dense vector database based on the first data set; Adding a dense vector retriever and a feature fusion module to the first language model to form a corresponding second language model; and performing model training on the second language model based on the first data set; After the model training is completed, the second largest language model processes the directional NLP task with reference to the dense vector database; and the dense vector database is regularly updated; and the second largest language model is regularly evaluated for task processing performance based on the latest dense vector database to obtain the corresponding evaluation result of the time, and when the evaluation result of the time is unqualified, a model training data set is constructed based on the dense vector database to obtain the corresponding second data set, and the second largest language model is fine-tuned based on the second data set, and after the fine-tuning is completed, the second largest language model continues to process the directional NLP task with reference to the dense vector database; the evaluation result of the time includes qualified and unqualified.

2. The method for processing a large language model by introducing a dense vector searcher according to claim 1, characterized in that: The first data set includes a plurality of first data records; the first data record includes a first target text and a first label text; when the directional NLP task is a machine translation task, the first target text and the first label text are respectively corresponding translation target text and interpretation label text; when the directional NLP task is an intelligent question-answering task, the first target text and the first label text are respectively corresponding question target text and answer label text; The dense vector database includes a first vector database and a first text database; the first vector database is implemented based on a type of vector database, and the first text database is implemented based on a type of relational database; the vector database includes at least Faiss or Annoy database; the relational database includes at least SQL database and MySQL database; The first vector database is used to store a plurality of first vector data records; the first vector data record comprises a first vector identification field and a first dense vector field; the first dense vector field is used to store a feature vector of a text in a dense vector format; The first text database is used to store multiple first text data records; the first text data record includes a first text identification field, a first text field, a second text field, a second vector identification field, a third vector identification field and a first update field; the first text identification field is a unique identifier of the current text data record; when the directional NLP task is a machine translation task, the first and second text fields are the corresponding translation target text and the latest interpretation label text, respectively; when the directional NLP task is an intelligent question-and-answer task, the first and second text fields are the corresponding question text and the latest answer label text, respectively; the first and second text fields correspond to one of the first vector data records in the first vector database respectively; the second vector identification field matches the first vector identification field of the first vector data record corresponding to the first text field; the third vector identification field matches the first vector identification field of the first vector data record corresponding to the second text field; the first update field is the latest creation / update time of the current text data record; The second data set includes multiple second data records; the second data record includes a second target text and a second label text; when the directional NLP task is a machine translation task, the second target text and the second label text are the corresponding translation target text and interpretation label text respectively; when the directional NLP task is an intelligent question and answer task, the second target text and the second label text are the corresponding question target text and answer label text respectively.

3. The method for processing a large language model using a dense vector searcher according to claim 2, The first language model is used to perform corresponding NLP task text generation processing according to the first task text input by the model and output the corresponding first generated text; The model framework of the first language model at least includes a preprocessing module, an embedding encoding module, a feature extraction module and a text generation module; The connection relationship of each model component of the first large language model is as follows: the input end of the preprocessing module is used to receive the first task text, and the output end is connected to the input end of the embedded coding module; the output end of the embedded coding module is connected to the input end of the feature extraction module; the output end of the feature extraction module is connected to the input end of the text generation module; The preprocessing module of the first large language model is used to perform word segmentation, stop word removal and part-of-speech tagging on the first task text to obtain a corresponding first word segmentation sequence and send it to the embedded coding module; The embedding coding module of the first large language model is used to perform word embedding coding and word position coding on the first word segmentation sequence to obtain a corresponding first embedding coding vector and send it to the feature extraction module; The feature extraction module of the first language model is implemented based on the Transformer model Encoder or Decoder component structure; the feature extraction module is used to perform deep learning on the associated features of each segmented text and other segmented texts in the first task text according to the first embedded coding vector to obtain a corresponding first feature vector and send it to the text generation module; The text generation module of the first large language model is implemented based on a type of text generator model; the text generation module is used to perform text feature decoding and text generation processing according to the first feature vector and output the corresponding first generated text.

4. The method for processing a large language model using a dense vector searcher according to claim 3, The second largest language model is used to use the dense vector database as a task reference knowledge base and perform corresponding NLP task text generation processing according to the second task text input by the model and output the corresponding second generated text; The model framework of the second largest language model includes the preprocessing module, the embedded coding module, the feature extraction module, the dense vector retriever, the feature fusion module and the text generation module; the dense vector retriever is connected to the dense vector database; The connection relationship of each model component of the second large language model is as follows: the input end of the preprocessing module is used to receive the second task text, and the output end is connected to the input end of the embedded coding module; the output end of the embedded coding module is connected to the input end of the feature extraction module; the output end of the feature extraction module is respectively connected to the input end of the dense vector retriever and the first input end of the feature fusion module; the output end of the dense vector retriever is connected to the second input end of the feature fusion module; the output end of the feature fusion module is connected to the input end of the text generation module; The preprocessing module of the second largest language model is used to perform word segmentation, stop word removal and part-of-speech tagging on the second task text to obtain a corresponding second word segmentation sequence and send it to the embedded coding module; The embedding coding module of the second largest language model is used to perform word embedding coding and word position coding on the second word segmentation sequence to obtain a corresponding second embedding coding vector and send it to the feature extraction module; The feature extraction module of the second large language model is used to perform deep learning on the associated features of each segmented text and other segmented texts in the second task text according to the second embedded coding vector to obtain a corresponding second feature vector and send it to the dense vector retriever and the feature fusion module respectively; The dense vector retriever of the second largest language model is used to perform dense vector conversion on the second feature vector in a dense vector format to obtain a corresponding first conversion vector; and query the first vector data records in the first vector database whose vector feature similarity between the first dense vector field and the first conversion vector exceeds a preset first similarity threshold; and count the total number of the first vector data records obtained by the query to obtain a corresponding first total number A; and identifying whether the first total number A is zero; If the first total number A is zero, the corresponding first reference record sequence is set to empty; if the first total number A is not zero, the vector feature approximation between the first dense vector field and the second feature vector of each first vector data record queried this time is used as the corresponding first correlation coefficient, and the A first vector data records are sequentially sorted in descending order of the first correlation coefficient to form a corresponding first record sequence, and the third vector identification field of the first text data record whose second vector identification field in the first text database matches each first vector identification field of the first record sequence is extracted as the corresponding first identification, and the first vector identification field in the first vector database that matches each first identification is extracted as the corresponding first identification. The first dense vector field of the first vector data record is extracted as the corresponding first reference dense vector, and each of the first reference dense vectors is converted into a corresponding text feature vector in a text feature vector format to obtain a corresponding first reference feature vector, and each of the first reference feature vectors and the corresponding first correlation coefficient constitutes a corresponding first reference record, and A first reference records are sequentially sorted in descending order of the first correlation coefficient to form a corresponding first reference record sequence; and the obtained first reference record sequence is sent to the feature fusion module; wherein the dense vector conversion method from the text feature vector format to the dense vector format is inverse to the text feature vector conversion method from the dense vector format to the text feature vector format; The feature fusion module of the second largest language model is used to identify whether the first reference record sequence is empty; if the first reference record sequence is empty, the second feature vector is used as the corresponding first fused feature vector; if the first reference record sequence is not empty, the preset feature fusion mode is identified; if the feature fusion mode is the first mode, the A first reference feature vectors of the first reference record sequence are sequentially vector-joined in descending order of the first correlation coefficients to obtain the corresponding first concatenated feature vector, and the second feature vector and the first concatenated feature vector are sequentially vector-joined and the obtained concatenated vector is used as the corresponding first fused feature vector; if the feature fusion mode is the second mode, the A first correlation coefficients of the first reference record sequence are normalized and calculated to obtain the corresponding A normalized correlation coefficients, and the inner product calculation result of each normalized correlation coefficient and the corresponding first reference feature vector is used as the corresponding first weighted feature vector, and the mean vector calculation of the obtained A first weighted feature vectors is performed to obtain the corresponding first average feature vector, and The second feature vector and the first average feature vector are sequentially concatenated and the obtained concatenated vector is used as the corresponding first fused feature vector; if the feature fusion mode is the third mode, the attention weights of the second feature vector and each of the first reference feature vectors of the first reference record sequence are predicted based on a class of neural network models to obtain the corresponding first attention weights, and the obtained A first attention weights are normalized to obtain the corresponding A normalized attention weights, and the inner product calculation result of each normalized attention weight and the corresponding first reference feature vector is used as the corresponding first attention feature vector, and the mean vector calculation is performed on the obtained A first attention feature vectors to obtain the corresponding second average feature vector, and the second feature vector and the second average feature vector are sequentially concatenated and the obtained concatenated vector is used as the corresponding first fused feature vector; and the obtained first fused feature vector is sent to the text generation module; the feature fusion mode includes the first, second and third modes; the neural network model includes at least an MLP model and a CNN model; The text generation module of the second largest language model is used to perform text feature decoding and text generation processing according to the first fused feature vector and output the corresponding first generated text.

5. The method for processing a large language model by introducing a dense vector searcher according to claim 3, characterized in that: Initializing the corresponding dense vector database based on the first data set specifically includes: Step 51, based on a class of the vector database, an empty database is initialized as the corresponding first vector database; and based on a class of the relational database, an empty database is initialized as the corresponding first text database; and the preprocessing module, the embedded coding module and the feature extraction module of the first large language model form a corresponding first encoder; Step 52, perform a round of traversal on all the first data records of the first data set; and in this round of traversal, take the first data record currently traversed as the corresponding current record; and take the first target text and the first label text of the current record as the corresponding current target text and current label text; and input the current target text and the current label text into the first encoder respectively for corresponding text preprocessing, embedded coding processing and feature extraction processing to obtain the corresponding current target text feature vector and current label text feature vector; and perform dense vector conversion on the current target text feature vector and the current label text feature vector in dense vector format to obtain the corresponding current target text dense vector and current label text dense vector; and create two new first vector data records in the first vector database as the corresponding first and second newly created records; and assign a unique record identifier to each of the first and second newly created records as the corresponding first and second newly created records. Create an identifier; and set the first vector identification field and the first dense vector field of the first newly created record to the corresponding first newly created identifier and the current target text dense vector; and set the first vector identification field and the first dense vector field of the second newly created record to the corresponding second newly created identifier and the current label text dense vector; and create a new first vector data record in the first text database as the corresponding third newly created record; and assign a unique record identifier to each of the third newly created records as the corresponding third newly created identifier; and use the current time as the corresponding first time; and set the first text identification field, the first text field, the second text field, the second vector identification field, the third vector identification field and the first update field of the third newly created record to the corresponding third newly created identifier, the current target text, the current label text, the first newly created identifier, the second newly created identifier and the first time.

6. The method for processing a large language model by introducing a dense vector searcher according to claim 4, characterized in that: The performing model training on the second language model based on the first data set specifically includes: Step 61, performing sub-dataset segmentation processing on the first data set according to a preset first segmentation ratio to obtain a corresponding first training set and a first evaluation set; Wherein, both the first training set and the first evaluation set are composed of a plurality of the first data records; the ratio of the total number of records in the first training set to the total number of records in the first evaluation set satisfies the first segmentation ratio; Step 62, extracting the first first data record of the first training set as the corresponding current training record; Step 63, inputting the first target text of the current training record into the second large language model for processing and using the generated text output by the model as the corresponding first predicted text; Step 64, bringing the first predicted text and the first label text of the current training record into a preset first model loss function; and identifying the preset feature fusion mode; if the feature fusion mode is the first or second mode, then based on the preset first model optimizer, a round of modulation is performed on the model parameters of the text generation module of the second largest language model in the direction of minimizing the first model loss function; if the feature fusion mode is the third mode, then based on the preset second model optimizer, a round of modulation is performed on the model parameters of the feature fusion module and the text generation module of the second largest language model in the direction of minimizing the first model loss function; Wherein, the first model loss function is implemented based on the maximum likelihood loss function; the first and second model optimizers at least include an SGD optimizer and an ADAM optimizer; Step 65, identifying whether the current training record is the last first data record of the first training set; if so, going to step 66; if not, extracting the next first data record of the first training set as the new current training record and returning to step 63; Step 66, perform a round of traversal on all the first data records of the first evaluation set; and in this round of traversal, use the first data record currently traversed as the corresponding current evaluation record; and input the first target text of the current evaluation record into the second large language model for processing and use the generated text output by the model as the corresponding second predicted text; and form a corresponding first prediction-label pair by the second predicted text and the first label text of the current training record; and at the end of this round of traversal, bring all the obtained first prediction-label pairs into the preset first model evaluation function to calculate and obtain the corresponding first evaluation value; Wherein, the first model evaluation function includes at least a MAE function and an MSE function; Step 67, identifying whether the first evaluation value meets the preset first evaluation value range; if not, returning to step 62 to continue training; if satisfied, stopping training and confirming the end of model training.

7. The method for processing a large language model by introducing a dense vector searcher according to claim 4, characterized in that: The processing of the directional NLP task by the second largest language model with reference to the dense vector database specifically includes: Receive a task text input by a user as the corresponding current task text; input the current task text into the second largest language model, and the second largest language model uses the dense vector database as a task reference knowledge base and performs corresponding NLP task text generation processing according to the current task text input by the model; and feed back the generated text output by the model as the corresponding current generated text to the user.

8. The method for processing a large language model by introducing a dense vector searcher according to claim 4, characterized in that: The periodically updating the dense vector database specifically includes: Step 81, regularly collecting big data of the text corpus of the directional NLP task through multiple big data collection channels at a preset first time frequency to obtain a corresponding first collection data set; and performing text noise reduction, deduplication, compliance inspection and correctness inspection on each first collection record of the first collection data set based on manual or other machine model screening methods; and forming a corresponding second encoder by the preprocessing module, the embedded coding module and the feature extraction module of the second large language model; Among them, the multiple big data collection channels at least include public text corpora, public network text resources, and public technical standards / textbooks / documents / magazines / journals / paper resources in various fields; the first collection data set includes multiple first collection records; the first collection record includes a first collection target text and a first collection label text; when the directional NLP task is a machine translation task, the first collection target text and the first collection label text are the corresponding translation target text and interpretation label text respectively; when the directional NLP task is an intelligent question-answering task, the first collection target text and the first collection label text are the corresponding question target text and answer label text respectively; Step 82, taking the first first acquisition record of the first acquisition data set as the corresponding current acquisition record; Step 83, taking the first acquisition target text and the first acquisition label text of the current acquisition record as the corresponding current acquisition target text and the current acquisition label text; and inputting the current acquisition target text and the current acquisition label text into the second encoder respectively for corresponding text preprocessing, embedded coding processing and feature extraction processing to obtain the corresponding current target text feature vector and current label text feature vector; and performing dense vector conversion on the current target text feature vector and the current label text feature vector in dense vector format to obtain the corresponding current target text dense vector and current label text dense vector; Step 84, query the first vector data record in the first vector database of the dense vector database for which the vector feature approximation between the first dense vector field and the current target text dense vector is the largest, and use the first vector data record obtained by the query as the corresponding first query record; and use the vector feature approximation between the first dense vector field of the first query record and the current target text dense vector as the corresponding first target approximation; and use the first text data record in which the second vector identification field in the first text database matches the first vector identification field of the first query record as the corresponding second query record; and record the first vector data record in which the first dense vector field in the first vector database matches the third vector identification field of the second query record as the corresponding third query record; and calculate the vector feature approximation between the first dense vector field of the third query record and the current label text dense vector to obtain the corresponding first label approximation; Step 85, identifying the first target similarity and the first label similarity; if the first target similarity exceeds a preset second similarity threshold and the first label similarity does not exceed the second similarity threshold, go to step 86; if the first target similarity does not exceed the second similarity threshold, go to step 87; if both the first target similarity and the first label similarity exceed the second similarity threshold, go to step 88; Wherein, the second similarity threshold>the first similarity threshold; Step 86, update the second text field of the second query record to the corresponding current collected label text; update the first update field of the second query record to the corresponding current time; update the first dense vector field of the third query record to the corresponding current label text dense vector; and go to step 88; Step 87, adding two of the first vector data records as the corresponding first newly added record and the second newly added record in the first vector database; and adding one of the first text data records as the corresponding third newly added record in the first text database; and assigning a unique record identifier to each of the first, second and third newly added records as the corresponding first newly added identifier, second newly added identifier and third newly added identifier; and using the current time as the corresponding first newly added time; and setting the first vector identification field and the first dense vector field of the first newly added record to the corresponding first newly added identifier and the current target text dense vector; and setting the first vector identification field and the first dense vector field of the second newly added record to the corresponding second newly added identifier and the current label text dense vector; and setting the first text identification field, the first text field, the second text field, the second vector identification field, the third vector identification field and the first update field of the third newly added record to the corresponding third newly added identifier, the current acquisition target text, the current acquisition label text, the first newly added identifier, the second newly added identifier and the first newly added time; Step 88, identifying whether the current acquisition record is the last of the first acquisition record of the first acquisition data set; if not, extracting the next first acquisition record of the first acquisition data set as the new current acquisition record and returning to step 83; if so, confirming that the data update process is complete.

9. The method for processing a large language model by introducing a dense vector searcher according to claim 4, characterized in that: The periodically performing a task processing performance evaluation on the second largest language model based on the latest dense vector database to obtain a corresponding evaluation result at that time specifically includes: Step 91, regularly taking the current time as the corresponding first end time according to a preset second time frequency, and taking the time obtained by subtracting a preset first duration from the first end time as the corresponding first start time, and the first start time and the first end time form a corresponding first recent time period; and extracting all the first text data records whose first update fields satisfy the first recent time period in the first text database of the dense vector database to form a corresponding first record set; Step 92, perform a round of traversal on all the first text data records of the first record set; and in this round of traversal, use the first text data record currently traversed as the corresponding current evaluation record; and extract the first text field and the second text field of the current evaluation record as the corresponding current task text and current label text; and input the current task text into the second largest language model for processing and use the generated text output by the model as the corresponding current predicted text; and form a corresponding second prediction-label pair with the current predicted text and the current label text; and at the end of this round of traversal, bring all the obtained second prediction-label pairs into the preset second model evaluation function to calculate and obtain the corresponding second evaluation value; Wherein, the second model evaluation function includes at least a MAE function and an MSE function; Step 93, identifying whether the second evaluation value satisfies a preset second evaluation value range; if so, setting the corresponding evaluation result of the time as qualified; if not, setting the corresponding evaluation result of the time as unqualified.

10. The method for processing a large language model by introducing a dense vector searcher according to claim 9, characterized in that: When the evaluation result is unqualified, constructing a model training data set based on the dense vector database to obtain a corresponding second data set specifically includes: When the evaluation result is unqualified, a round of traversal is performed on all the first text data records of the first record set; and in this round of traversal, the first text data record currently traversed is used as the corresponding current record; and the first text field and the second text field of the current record are extracted as the corresponding second target text and the second label text to form a corresponding second data record; and at the end of this round of traversal, all the obtained second data records form the corresponding second data set.

11. The method for processing a large language model by introducing a dense vector searcher according to claim 6, characterized in that: The fine-tuning of the second language model based on the second data set specifically includes: Step 111, performing sub-dataset segmentation processing on the second data set according to a preset second segmentation ratio to obtain a corresponding second training set and a second evaluation set; Wherein, both the second training set and the second evaluation set are composed of a plurality of the second data records; the ratio of the total number of records in the second training set to the total number of records in the second evaluation set satisfies the second segmentation ratio; Step 112, extracting the first second data record of the second training set as the corresponding current training record; Step 113, inputting the second target text of the current training record into the second largest language model for processing and using the generated text output by the model as the corresponding third predicted text; Step 114, bringing the third predicted text and the second label text of the current training record into the first model loss function; and fine-tuning the model parameters of the text generation module of the second language model in a direction that minimizes the first model loss function based on a preset third model optimizer; Wherein, the third model optimizer includes at least an SGD optimizer and an ADAM optimizer; Step 115, identifying whether the current training record is the last second data record of the second training set; if so, going to step 116; if not, extracting the next second data record of the second training set as the new current training record and returning to step 113; Step 116, perform a round of traversal on all the second data records of the second evaluation set; and in this round of traversal, use the second data record currently traversed as the corresponding current evaluation record; and input the second target text of the current evaluation record into the second large language model for processing and use the generated text output by the model as the corresponding fourth predicted text; and form a corresponding third prediction-label pair by the fourth predicted text and the second label text of the current training record; and at the end of this round of traversal, bring all the obtained third prediction-label pairs into the preset third model evaluation function to calculate and obtain the corresponding third evaluation value; Wherein, the third model evaluation function includes at least a MAE function and an MSE function; Step 117, identifying whether the third evaluation value meets the preset third evaluation value range; if not, returning to step 112 to continue training; if satisfied, stopping training and confirming the end of this fine-tuning.

12. A device for executing the method for processing a large language model by introducing a dense vector searcher according to any one of claims 1 to 11, characterized in that: The device comprises: a large language model selection module, a dense vector database preparation module, a large language model transformation and training module, and a transformation model application module; The large language model selection module is used to use a large language model that is implemented based on the Transformer model architecture and has completed pre-training and fine-tuning of a type of directional NLP task as the corresponding first large language model; the directional NLP task includes at least a machine translation task and an intelligent question-answering task; The dense vector database preparation module is used to use the directional text corpus used by the first large language model in the fine-tuning of the corresponding directional NLP task as the corresponding first data set; and initialize the corresponding dense vector database based on the first data set; The large language model transformation and training module is used to add a dense vector retriever and a feature fusion module to the first large language model to form a corresponding second large language model; and perform model training on the second large language model based on the first data set; The modified model application module is used to, after the model training is completed, use the second largest language model to process the directional NLP task with reference to the dense vector database; and regularly update the data of the dense vector database; and regularly perform a task processing performance evaluation on the second largest language model based on the latest dense vector database to obtain the corresponding evaluation result of the time, and when the evaluation result of the time is unqualified, construct a model training data set based on the dense vector database to obtain the corresponding second data set, and fine-tune the second largest language model based on the second data set, and continue to use the second largest language model to process the directional NLP task with reference to the dense vector database after the fine-tuning is completed; the evaluation result of the time includes qualified and unqualified.

13. An electronic device, characterized in that: include: memory, processors, and transceivers; The processor is used to couple with the memory, read and execute instructions in the memory, so as to implement the method according to any one of claims 1 to 11; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a computer, the computer is enabled to execute the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Intelligent legal question and answer method based on retrieval enhanced language model

    CN118277538A

  • Word embedding data processing method and device, electronic equipment and storage medium

    CN118673110A

  • Method and apparatus for automatically generating inference questions and answers

    WO2021184311A1

Cited By

  • Dense retrieval method and device combining large language model and pseudo query technology

    CN120256573A

  • Processing method and device of dense encoder realized based on large language model

    CN120353916A

  • A processing method and device of a dense encoder based on a large language model

    CN120353916B