Data processing method and system
Patent Information
- Application Number
- CN202410171970.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-06
- Publication Date
- 2024-08-23
AI Technical Summary
In the cloud deployment of small and medium-sized enterprises, the input and output of large language models are plain text, which leads to the risk of leakage of sensitive business data and user privacy data, and it is difficult to meet the demanding requirements of the execution environment.
By processing the target input data into word vector data, sending it to the server where the target large language model is deployed for processing, and decoding the output on the client, ensuring that the input and output of the large language model are non-plaintext word vector data to avoid Data leakage, while using pre-trained models and knowledge bases for fine-tuning training to generate target knowledge bases to improve data security.
It effectively avoids the leakage of business sensitive data and user privacy data, improves data security, and improves the application flexibility and security of large language models through non-plaintext processing.
Smart Images

Figure CN118536501A
Abstract
Description
Technical Field
[0001] The present application relates to the field of information security technology, and in particular to a data processing method and system. Background Art
[0002] The Large Language Model (LLM) is a deep learning model trained on massive text data. It can not only generate natural language text, but also deeply understand the meaning of the text and handle various natural language tasks. It has been widely used in various fields, such as business, education, culture and entertainment.
[0003] The reasoning process of large language models generally has extremely stringent requirements on the execution environment. Most small and medium-sized enterprises cannot meet existing application needs due to the difficulty in purchasing an execution environment that meets the requirements. Therefore, the cloud deployment and leasing business of large language models has become an important cloud business. However, since the large language model itself has obvious consistency and homogeneity, small and medium-sized enterprises, as custodians, usually choose pre-trained models from several classic models. Its hyper-participation embedding module is transparent, and the input and output are in natural language. In order to domain the pre-trained model, it is necessary to deploy a plaintext knowledge base on the custodian. Therefore, for the custodian, the user's input, output, and knowledge base are almost transparent, which is easy to cause the leakage of business sensitive data and user privacy data. Summary of the invention
[0004] An embodiment of the present application provides a data processing method, including: in response to a client obtaining target input data, processing the target input data into first word vector data and sending it to a server deployed with a target large language model, wherein the target large language model is trained with knowledge base vector data provided by the client; using the target large language model to output second word vector data based on the first word vector data; and decoding the second word vector data fed back by the server and outputting first response information.
[0005] In some embodiments, the target large language model is used to output the second word vector data based on the first word vector data, including at least one of the following: inputting the first word vector data into a target knowledge base to obtain third word vector data matching the first word vector data, processing the first word vector data and the third word vector data into fourth word vector data and inputting them into the target large language model to output the second word vector data, wherein the target knowledge base is deployed in a target electronic device capable of communicating with the client; inputting the first word vector data into the target knowledge base to obtain third word vector data matching the first word vector data, The third word vector data is sent to the server, so that the server processes the first word vector data and the third word vector data into fourth word vector data and then inputs the fourth word vector data into the target large language model to output the second word vector data, wherein the target knowledge base is deployed in a target electronic device capable of communicating with the client; the first word vector data is input into the target knowledge base deployed on the server to obtain the third word vector data matching the first word vector data, and the server processes the first word vector data and the third word vector data into fourth word vector data and then inputs the fourth word vector data into the target large language model to output the second word vector data.
[0006] In some embodiments, the target knowledge base is obtained in the following manner: word embedding is performed on knowledge items and index information in the original knowledge base respectively to obtain a target knowledge base consisting of knowledge item vectors and index vectors with signature data.
[0007] In some embodiments, processing the target input data into first word vector data includes: performing word segmentation on the target input data and identifying the attributes of each word obtained after the word segmentation; using a first word embedding model to process a first word with a first attribute in the words into a first attribute word vector of a target dimension; using a second word embedding model to process a second word with a second attribute in the words into a second attribute word vector of a target dimension; and fusing the first attribute word vector and the second attribute word vector to obtain the first word vector data.
[0008] In some embodiments, a second word having a second attribute among the words is processed into a second attribute word vector of a target dimension using a second word embedding model, including: for each of the second words, using the second word embedding model, a preset number of target words that meet the first attribute are selected from a preset vocabulary according to a preset selection rule; for each of the word vectors of the target words, data of one dimension are selected respectively, and a second attribute word vector corresponding to the second word is generated based on the selected data of each dimension.
[0009] In some embodiments, the outputting of the first response information after decoding the second word vector data fed back by the server includes: using the target decoding algorithm deployed on the client to restore the second word vector data fed back by the server into at least one of text data, voice data or image data, and outputting it as the first response information through the corresponding output component of the client.
[0010] In some embodiments, the outputting of the first response information after decoding the second word vector data fed back by the server also includes: obtaining third word vector data and its signature data matching the first word vector data from the target knowledge base; using the signature data to perform an integrity check on the third word vector data, and after passing the integrity check, decoding the third word vector data into at least one of text data, voice data or image data, so as to output it as the second response information through the corresponding output component of the client; wherein the target knowledge base is deployed on the server or the target electronic device, and the first response information and the second response information are output through different output components, or displayed in different display areas of the client.
[0011] In some embodiments, it also includes: based on the identification information of the target operator, sending the first word vector data to a server with an authority level corresponding to the identification information, so as to generate target response information using a target large language model deployed on the server that matches the authority level; and / or, upon obtaining a feedback operation of the target operator for the first response information and / or the second response information, sending the first response information and / or the second response information to other large language models different from the target large language model, so as to output a third response information, wherein the matching degree between the third response information and the target input data is higher than the matching degree between the first response and the target input data.
[0012] An embodiment of the present application also proposes a data processing method, which is applied to a server, and the method includes: after obtaining first word vector data sent by a client and processed based on target input data, using a deployed target large language model to generate second word vector data based on the first word vector data, and the target large language model is trained with knowledge base vector data provided by the client; feeding the second word vector data back to the client for decoding processing to output a first response information at the client.
[0013] An embodiment of the present application also proposes a data processing system, including a client and a server, wherein, after obtaining target input data, the client processes the target input data into first word vector data and sends it to the server; the server is deployed with a target large language model trained with knowledge base vector data provided by the client, so as to output second word vector data based on the first word vector data; after obtaining the second word vector data fed back by the server, the client decodes it and outputs a first response information. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0015] Figure 1 This is a flow chart of a data processing method in an embodiment of the present application;
[0016] Figure 2 This is a flowchart of processing target input data into first word vector data in an embodiment of the present application;
[0017] Figure 3 A flowchart of processing a second word into a second attribute word vector in an embodiment of the present application;
[0018] Figure 4 This is a flow chart of outputting first response information in one embodiment of the present application;
[0019] Figure 5 This is a flow chart of outputting second response information in another embodiment of the present application;
[0020] Figure 6 This is a flow chart of a data processing method in another embodiment of the present application;
[0021] Figure 7 This is a schematic diagram of the principle of obtaining the first word vector data in an embodiment of the present application;
[0022] Figure 8 A schematic diagram of the principle of generating a target knowledge base in an embodiment of the present application;
[0023] Fig. 9 This is a schematic diagram of the principle of a data processing method in an embodiment of the present application;
[0024] Fig.10 This is a schematic diagram of the principle of a data processing method in another embodiment of the present application;
[0025] Fig.11 This is a schematic diagram of the principle of a data processing method in another embodiment of the present application;
[0026] Fig.12 This is a schematic diagram showing the effects of the first response information and the second response information in one embodiment of the present application;
[0027] Fig.13 This is a structural block diagram of a data processing system in an embodiment of the present application. DETAILED DESCRIPTION
[0028] Various aspects and features of the present application are described herein with reference to the accompanying drawings.
[0029] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.
[0030] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0031] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.
[0032] It should also be understood that although the present application has been described with reference to some specific examples, those skilled in the art will be able to readily implement many other equivalent forms of the present application.
[0033] The above and other aspects, features and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.
[0034] Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments applied for are merely examples of the present application, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that obscure the present application. Therefore, the specific structural and functional details applied for herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present application in a variety of ways with substantially any suitable detailed structure.
[0035] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present application.
[0036] A data processing method in an embodiment of the present application, after the client obtains target input data, it first processes the target input data into first word vector data and then sends it to the server, then outputs second word vector data based on the first word vector data through a target large language model deployed on the server, and finally decodes the second word vector data fed back by the server and outputs a first response information. Since the input and output of the target large language model are both non-plaintext word vector data, the server only works at the word vector level, thereby avoiding the leakage of the client's business sensitive data and user privacy data.
[0037] like Figure 1 As shown, the method comprises the following steps:
[0038] Step S101, in response to the client obtaining target input data, the target input data is processed into first word vector data and sent to a server deployed with a target large language model, wherein the target large language model is trained with the knowledge base vector data provided by the client.
[0039] In this embodiment, the target input data can be input to the client by a user or other electronic device, and the type of the target input data can be one or more of text data, image data, and voice data. The client pre-fine-tunes the pre-trained large language model based on the knowledge base vector data, and deploys the trained target large language model to the server. The input and output of the target large language model are both word vector data, wherein the algorithm corresponding to the fine-tuning training can select P-tuning, LoRa, etc., which is not limited in this application. After the client obtains the target input data, it first processes the target input data into the first word vector data, which can be a word vector sequence, and then inputs the first word vector data into the server, which processes the first word vector data based on the target large language model.
[0040] Optionally, the client may process the target input data based on the word embedding module in the pre-trained large language model. The pre-trained large language model may be based on the existing large language models, such as ChatGLM, LLaMa2, etc., to obtain the first word vector data. Alternatively, in order to avoid leakage of sensitive data, the client may process the sensitive data and non-sensitive data in the target input data separately. For the non-sensitive data, the target input data is processed based on the word embedding module in the pre-trained large language model. For the sensitive data, the client performs word embedding processing based on the preset word embedding module to obtain the first word vector data. In addition, the knowledge base vector data is also generated by word embedding processing of the data in the original knowledge base based on the word embedding module in the pre-trained large language model and the preset word embedding module.
[0041] Optionally, the server can be a cloud server or an edge device in an edge network.
[0042] Step S102: Use the target large language model to output second word vector data based on the first word vector data.
[0043] After sending the first word vector data to the server, the server inputs the first word vector data as a prompt word into the target large language model, and the target large language model outputs the second word vector data.
[0044] Step S103: decode the second word vector data fed back by the server and output a first response message.
[0045] The server feeds back the second word vector data to the client. Since the second word vector data is a word vector, the client needs to decode the second word vector data to obtain the corresponding first response information as plain text, which is then fed back by the client to the user or other corresponding electronic devices to complete the processing of the target input data.
[0046] Optionally, the client may output the first response information in the conversation box, or may output it separately in the form of an OSD pop-up window, or in the form of voice playback, or in the form of graphics, text, animation, etc., which is not limited in this embodiment of the present application.
[0047] In the data processing method in the embodiment of the present application, after the client obtains the target input data, the target input data is first processed into first word vector data and then sent to the server, and then the target large language model deployed on the server outputs the second word vector data based on the first word vector data, and finally the second word vector data fed back by the server is decoded and the first response information is output. Since the input and output of the target large language model are both non-plaintext word vector data, the server only works at the word vector level. Therefore, when the client calls the large language model deployed on the server for data processing, the leakage of business sensitive data and user privacy data is avoided, thereby improving data security.
[0048] In some embodiments of the present application, outputting second word vector data based on the first word vector data using the target large language model includes at least one of the following:
[0049] Inputting the first word vector data into a target knowledge base to obtain third word vector data matching the first word vector data, processing the first word vector data and the third word vector data into fourth word vector data and then inputting the fourth word vector data into the target large language model to output the second word vector data, wherein the target knowledge base is deployed in a target electronic device capable of communicating with the client;
[0050] Input the first word vector data into a target knowledge base to obtain third word vector data matching the first word vector data, send the third word vector data to the server, use the server to process the first word vector data and the third word vector data into fourth word vector data, and then input the fourth word vector data into the target large language model, and output the second word vector data, wherein the target knowledge base is deployed in a target electronic device capable of communicating with the client;
[0051] The first word vector data is input into the target knowledge base deployed on the server to obtain third word vector data matching the first word vector data, and the first word vector data and the third word vector data are processed into fourth word vector data by the server and then input into the target large language model, and the second word vector data is output.
[0052] In this embodiment, the large language model may have fantasy defects or hallucinations when it lacks understanding of the real world, data training deviations, or limitations of the algorithm itself. The fantasy defects or hallucinations may cause the content generated by the model to be inconsistent with the actual situation or to have logical errors. These errors may manifest as semantic incoherence, inaccurate information, or even meaningless text. When the target large language model is used to output the second word vector data based on the first word vector data, in order to prevent the fantasy defects or hallucinations of the target large language model, it is necessary to combine the first word vector data with the word vector data in the target knowledge base in advance, such as splicing and fusion, and use the combined data as the input of the target large language model to constrain the target large language model based on the knowledge in the target knowledge base. The following situations can be performed according to the deployment location of the target knowledge base and the generation location of the fourth word vector data.
[0053] Case 1: The target knowledge base is deployed in the target electronic device that can communicate with the client, such as Fig. 9 As shown, the client 10 first inputs the first word vector data into the target knowledge base 40 in the target electronic device 50, and the target electronic device 50 returns the acquired third word vector data matching the first word vector data to the client 10. The client 10 processes the first word vector data and the third word vector data into fourth word vector data, for example, concatenating the first word vector data and the third word vector data to obtain the fourth word vector data. The client 10 sends the obtained fourth word vector data to the target large language model 30 in the server 20, and the target large language model 30 outputs the second word vector data.
[0054] Among them, the third word vector data corresponds to the knowledge item related to the target input data. For example, the target input data corresponding to the first word vector data is: I have been feeling unwell recently. Do I have AIDS? Then the knowledge item corresponding to the third word vector data can be: relevant knowledge about the early manifestations of AIDS. The first word vector data and the third word vector data are concatenated to obtain the fourth word vector data. For example, in the fourth word vector data, the third word vector data representing the knowledge item (relevant knowledge about the early manifestations of AIDS) is in front, and the first word vector data representing the target input data (I have been feeling unwell recently. Do I have AIDS?) is in the back.
[0055] The target knowledge base 40 includes multiple knowledge item vectors. After the first word vector data is input into the target knowledge base 40, the vector distance or similarity between the first word vector data and each knowledge item is determined based on a preset distance algorithm or a preset similarity algorithm, and the knowledge item vector corresponding to the minimum vector distance or the highest similarity is used as the third word vector data.
[0056] Optionally, the preset distance algorithm may be, for example, a Euclidean distance algorithm, a Manhattan distance algorithm, a cosine distance algorithm, etc., and the preset similarity algorithm may be, for example, a cosine similarity, a Pearson correlation coefficient, a Jaccard similarity coefficient, etc.
[0057] Case 2: The target knowledge base is deployed in the target electronic device that can communicate with the client, such as Fig.10 As shown, the client 10 first inputs the first word vector data into the target knowledge base 40 and the server 20 in the target electronic device 50, and the target electronic device 50 returns the acquired third word vector data matching the first word vector data to the client 10, and the client 10 sends the third word vector data to the server 20, and the server 20 processes the first word vector data and the third word vector data into fourth word vector data, for example, concatenating the first word vector data and the third word vector data to obtain the fourth word vector data, and the server 20 sends the obtained fourth word vector data to the target large language model 30, and the target large language model 30 outputs the second word vector data.
[0058] Case 3: The target knowledge base is deployed in the server, such as Fig.11 As shown, the client 10 first inputs the first word vector data into the target knowledge base 40 in the server 20, and the server 20 obtains the third word vector data matching the first word vector data. Then, the server 20 processes the first word vector data and the third word vector data into fourth word vector data, for example, the first word vector data and the third word vector data are concatenated to obtain the fourth word vector data. The server 20 sends the obtained fourth word vector data to the target large language model 30, and the target large language model 30 outputs the second word vector data.
[0059] This embodiment can deploy the target knowledge base at different locations, and can generate word vector data for input into the target large language model at different locations, thereby improving flexibility.
[0060] In some embodiments of the present application, the target knowledge base can be deployed in the target electronic device and the server at the same time, and the client can select a suitable target knowledge base to process the first word vector data according to the network communication quality or the status of the target electronic device and the server. For example, if the network communication quality between the client and the target electronic device is better than the network communication quality between the client and the server, the client can select the target knowledge base in the target electronic device to process the first word vector data. Alternatively, if the target electronic device is in a faulty state or the network communication quality between it is poor or the network communication quality between the client and the server is better than the network communication quality between the client and the target electronic device, the client selects the target knowledge base in the server to process the first word vector data. In addition, if the client has sufficient processing performance or resource configuration, the target knowledge base can also be deployed locally, and the client directly uses the local target knowledge base to process the first word vector data.
[0061] In some embodiments of the present application, the target knowledge base is obtained based on the following method:
[0062] The knowledge items and index information in the original knowledge base are word-embedded respectively to obtain a target knowledge base consisting of knowledge item vectors and index vectors with signature data.
[0063] In this embodiment, the original knowledge base stores knowledge items (Value) and index information (Key) in a Key-Value mode, such as Figure 8 As shown, word embedding is performed on the index information in the original knowledge base to obtain an index vector, and word embedding is performed on the knowledge items in the original knowledge base to obtain a knowledge item vector, wherein the word embedding processing can be performed based on the word embedding module in the pre-trained large language model, or based on the aforementioned preset word embedding module. Finally, the obtained index vector and knowledge item vector are associated to generate a target knowledge base. Since the data in the target knowledge base are all vector data, the server can avoid directly obtaining plaintext data from the target knowledge base, further improving data security.
[0064] Optionally, word embedding processing may be performed only on knowledge items in the original knowledge base, and the obtained knowledge item vectors may be associated with index information in the original knowledge base to generate a target knowledge base, thereby improving the generation efficiency of the target knowledge base.
[0065] In some embodiments of the present application, the target input data is processed into first word vector data, such as Figure 2As shown, the following steps are included:
[0066] Step S1011, performing word segmentation processing on the target input data, and identifying the attributes of each word obtained after the word segmentation processing.
[0067] In this embodiment, if the target input data is text data, word segmentation is directly performed on the text data. If the target data is non-text data, the target input data is first converted into text data based on a text recognition algorithm, and then the converted text data is subjected to word segmentation. Alternatively, for target input data formed by speech fragments of multiple words, each speech fragment can be processed based on a speech recognition algorithm to obtain corresponding words to complete the word segmentation.
[0068] Identify the attributes of each word obtained after word segmentation, where the attributes of each word can be divided into a first attribute and a second attribute. For example, the first attribute can correspond to a non-sensitive word, and the second attribute can correspond to a sensitive word. For example, if the target input data is: I have been feeling unwell recently, do I have AIDS? Then the word "AIDS" is a sensitive word, and its attribute is the second attribute, and "I" and "body" are non-sensitive words, and their attributes are the first attribute. It can be understood that the words in the embodiments of the present application represent single words.
[0069] In some embodiments, identifying the attributes of each word obtained after word segmentation processing includes: establishing a sensitive word library including multiple sensitive words; if the current word exists in the sensitive word library, determining that the attribute of the current word is a second attribute; if the current word does not exist in the sensitive word library, determining that the current word belongs to the second attribute.
[0070] In some embodiments, identifying the attributes of each word obtained after word segmentation processing includes: establishing a sensitive word library including multiple sensitive words; if the current word exists in the sensitive word library and the text feature after the current word meets the preset text feature of the current word, determining that the attribute of the current word is the second attribute; if the current word does not exist in the sensitive word library, or the current word exists in the sensitive word library and the text feature does not meet the preset text feature, determining that the attribute of the current word is the first attribute. For example, if the current word is an ID card, if the text feature after the current word meets the feature of the ID card number, the attribute of the current word is the second attribute, and if the text feature after the current word does not meet the feature of the ID card number, the attribute of the current word is the first attribute.
[0071] Step S1012: Using the first word embedding model, process the first word with the first attribute in the words into a first attribute word vector of the target dimension.
[0072] The first word embedding model can be a word embedding module in the aforementioned pre-trained large language model. If the attribute of the word is the first attribute, the word is embedded based on the first word embedding model to generate a first attribute word vector of the target dimension. In this embodiment, the target dimension represents the number of dimensions, for example, it can be 128 dimensions.
[0073] Step S1013, using a second word embedding model to process a second word with a second attribute in the words into a second attribute word vector of a target dimension.
[0074] The second word embedding module can perform desensitization processing on the word. If the attribute of the word is the second attribute, the word is processed into a second attribute word vector based on the second word embedding model.
[0075] Step S1014: fuse the first attribute word vector and the second attribute word vector to obtain the first word vector data.
[0076] After obtaining the first attribute word vector and the second attribute word vector, the two are fused to obtain the first word vector data. Optionally, the fusion process can be direct splicing or superposition, or can be weighted fusion of the two based on preset weights.
[0077] Optionally, the first word embedding model and / or the second word embedding model is encapsulated in a browser plug-in or a JavaScript script, and the client can perform corresponding word embedding processing by calling the browser plug-in or the JavaScript script.
[0078] By performing word segmentation on the target input data and generating word vectors with different attributes for each word after the word segmentation according to different attributes, desensitized first word vector data is obtained, thereby further improving the data security of the first word vector data.
[0079] In some embodiments of the present application, a second word having a second attribute in the word is processed into a second attribute word vector of the target dimension using a second word embedding model, such as Figure 3 As shown, the following steps are included:
[0080] Step S31: for each of the second words, using the second word embedding model, select a preset number of target words that meet the first attribute from a preset word library according to a preset selection rule.
[0081] The first attribute may correspond to a non-sensitive word, and the preset word library includes multiple non-sensitive words. For each second word, a second attribute word vector corresponding to the second word is determined by selecting multiple target words from the preset word library. Specifically, using the second word embedding model, a preset number of target words are selected from the preset word library according to a preset selection rule, and the preset number corresponds to the number of dimensions in the target dimension.
[0082] In some embodiments of the present application, the preset selection rule includes:
[0083] Determine the word sequence number corresponding to the current second word, the randomly generated character string, and the dimension to be determined;
[0084] Concatenate the word sequence number, the character string and the dimension to be determined, and determine a hash function of the concatenation result;
[0085] A modulo operation is performed on the hash function and the number of words in the preset vocabulary, and a target word to be selected is determined based on a result of the modulo operation.
[0086] In this embodiment, the target word is pseudo-randomly selected from the preset word library by the word sequence number corresponding to the current second word, the randomly generated string, the dimension to be determined, and the number of words in the preset word library. Specifically, the word sequence number corresponding to the current second word, the randomly generated string, and the dimension to be determined are first determined, for example, the string can be a 128-bit string, and then the word sequence number, the string, and the dimension to be determined are concatenated, and a hash operation is performed on the concatenated result to determine the hash function of the concatenated result, and finally a modulo operation is performed on the hash function and the number of words to determine the target word to be selected, thereby realizing efficient pseudo-random selection of the target word from the preset word library.
[0087] The preset selection rule can be expressed by formula 1, which is:
[0088] P i = hash(k||key||i)%N;
[0089] Among them, P i represents the word ID selected from the preset vocabulary, i represents the dimension to be determined, that is, the i-th dimension, k represents the sequence number of the second word, key represents a randomly generated string, N represents the number of words in the preset vocabulary, % represents a modulo operation, and hash represents a hash function.
[0090] Optionally, a hash function can be found based on sha1 / sha256 / md5.
[0091] Step S32: for each word vector of the target word, select data of one dimension respectively, and generate a second attribute word vector corresponding to the second word based on the selected data of each dimension.
[0092] In this embodiment, the first word embedding model can be used to determine the word vector of each target word, the number of dimensions of the word vector is the target dimension, and for each target word vector, data of one dimension is selected respectively, and the second attribute word vector corresponding to the second word is generated by obtaining the data of each dimension. In the specific application scenario of this application, the second attribute word vector can be expressed by formula 2, which is:
[0093] Vec k =Vec(1,P1),…,Vec(i,P i ),…,Vec(n,P n );
[0094] Among them, Vec k represents the second attribute word vector of the kth second word, i represents the dimension to be determined, that is, the i-th dimension, n represents the target dimension, P i Indicates the word ID selected from the preset word library.
[0095] By pseudo-randomly selecting multiple target words from a preset vocabulary and determining a second attribute word vector corresponding to the second word, desensitization processing of the second word is achieved, further improving data security.
[0096] For example, in the specific application scenario of this application, Figure 7 As shown in the figure, the generation process of the first word vector data can be: for each word after word segmentation, first determine whether the word is a sensitive word. If it is a non-sensitive word, then process the word into a first attribute vector based on the first word embedding model. The dimension of the first attribute vector is n, and n is generally 128. If it is a sensitive word, then process the word into a second attribute vector based on the second word embedding model, that is, Vec k =Vec(1,P1),…,Vec(i,P i ),…,Vec(n,P n ), and finally the first attribute vector and the second attribute vector are fused to generate the first word vector data.
[0097] In some embodiments of the present application, the second word vector data fed back by the server is decoded and then the first response information is output, such as Figure 4 As shown, the following steps are included:
[0098] Step S1031, using the target decoding algorithm deployed on the client, the second word vector data fed back by the server is restored into at least one of text data, voice data or image data, so as to be output as the first response information through the corresponding output component of the client.
[0099] In this embodiment, the target decoding algorithm is deployed on the client, and the target decoding algorithm is associated with the word embedding model that processes the target input data into the first word vector data. Fig. 9 - As shown in FIG. 11, after the client 10 obtains the second word vector data fed back by the server 20, the client 10 decodes the second word vector data using the target decoding algorithm, and restores the second word vector data into at least one of text data, voice data or image data. Then, the client outputs at least one of the text data, voice data or image data as the first response information in the corresponding output component. For example, the output component may be a display screen, a speaker, a projection component, etc. of the user terminal, and the user terminal may be a computer, a headset, a smart watch, a smart bracelet, smart glasses, a VR device, etc.
[0100] In this embodiment, the client decodes the second word vector data by using a target decoding algorithm, and outputs the decoded plaintext data in a corresponding form, thereby achieving a more intuitive display of the first response information and improving the user experience.
[0101] In some embodiments of the present application, the second word vector data fed back by the server is decoded and then the first response information is output, such as Figure 5 As shown, the following steps are also included:
[0102] Step S1032, obtaining third word vector data and its signature data that match the first word vector data from the target knowledge base.
[0103] In this embodiment, Fig. 9 , 10 As shown, the target knowledge base 40 is deployed in the target electronic device 50. Fig.11 As shown, the target knowledge base 40 is deployed on the server 20. The client 10 inputs the first word vector data into the target knowledge base 40, and the target knowledge base 40 outputs the third word vector data matching the first word vector data and its signature data to the client 10, and the signature data is used to verify the integrity of the third word vector data.
[0104] Step S1033, use the signature data to perform integrity check on the third word vector data, and after passing the integrity check, decode the third word vector data into at least one of text data, voice data or image data, so as to output it as second response information through the corresponding output component of the client.
[0105] The second response information may be knowledge entry data corresponding to the first response information, which is used to enable the user to understand the first response information more accurately and comprehensively. The client 10 first uses the signature data to perform an integrity check on the third word vector data. After the integrity check, the third word vector data is decoded into at least one of text data, voice data or image data using the target decoding algorithm. After that, the client 10 outputs at least one of the text data, voice data or image data as the second response information in the corresponding output component. For example, the output component may be a display screen, a speaker, a projection component, etc. of a user terminal, and the user terminal may be a computer, a headset, a smart watch, a smart bracelet, smart glasses, a VR device, etc.
[0106] In this embodiment, in order to enable the user to clearly distinguish the first response information from the second response information, the first response information and the second response information are output through different output components, or displayed and output in different display areas of the client. For example, the first response information is output on the display screen and the second response information is output on the speaker, or the first response information is displayed in the first area and the second response information is displayed in a text box inside or outside the first area.
[0107] In this embodiment, the second response information is outputted simultaneously with the first response information, so that the authority of the first response information can be intuitively reminded, thereby improving the user experience.
[0108] Optionally, if the third word vector data fails the integrity check, indicating that the third word vector data is incomplete, the second response information may not be generated and output, and a prompt message indicating that the second response information verification failed may be issued. Alternatively, the second response information may be generated and output, and a prompt message indicating that the second response information verification failed may be issued.
[0109] In some embodiments of the present application, the method further includes:
[0110] Based on the identification information of the target operator, the first word vector data is sent to a server of a permission level corresponding to the identification information, so as to generate target response information by using a target large language model deployed on the server that matches the permission level;
[0111] and / or,
[0112] When a feedback operation of the target operator is obtained in response to the first response information and / or the second response information, the first response information and / or the second response information is sent to other large language models different from the target large language model to output third response information, wherein the matching degree between the third response information and the target input data is higher than the matching degree between the first response and the target input data.
[0113] In this embodiment, the target operator has a corresponding authority level. The higher the authority level of the target operator, the more accurate the result of the target large language model that can be called, and the faster the output result. The target operator can only call the target large language model that matches its own authority level. When the client obtains the target input data, the identification information of the target operator and the authority level corresponding to the identification information can be obtained at the same time, and then the first word vector data is sent to the server of the authority level corresponding to the identification information, and the target response information is generated using the target large language model that matches the authority level of the identification information. The target response information may include the aforementioned first response information, or the first response information and the second response information. By sending the first word vector data to the target large language model of the authority level corresponding to the target operator's identification information for data processing, the data processing needs of different users can be met, and the user experience is improved.
[0114] In addition, if a feedback operation of the target operator on the first response information and / or the second response information is received, the first response information and / or the second response information is sent to other large language models different from the target large language model. The other large language model can be a large language model with a higher domain matching degree. The other large language model outputs the third response information. The matching degree between the third response information and the target input data is higher than the matching degree between the first response and the target input data. The first response information and / or the second response information can be optimized according to the feedback operation of the target operator, thereby improving the user experience.
[0115] The feedback operation may be, for example, that the satisfaction with the first response information and / or the second response information is lower than a preset satisfaction, or an instruction to further query the first response information and / or the second response information, etc. In addition, if an instruction to further query the first response information and / or the second response information is detected, and the target operator does not have the authority to conduct further query, a prompt message to activate membership or upgrade the authority level may also be sent to the target operator.
[0116] The following is combined with the specific application scenarios of this application and Fig. 9 -11 describes the data processing method in the embodiment of the present application.
[0117] Suppose the target input data received by the client is Q; I have been feeling unwell recently, do I have AIDS?
[0118] In one case, if Fig. 9As shown, the client 10 processes Q into the first word vector data, and sends the first word vector data to the server 20 and the target knowledge base 40 deployed in the target electronic device 50. The target knowledge base 40 returns the third word vector data and signature data to the client 10. The client 10 splices the first word vector data and the third word vector data into the fourth word vector data, and sends the fourth word vector data to the target large language model 30 deployed on the server 20. The server 20 sends the second word vector data output by the target large language model 30 to the client 10. The client 10 decodes the second word vector data and obtains the first response information: In view of your symptoms, the possibility that you are infected with AIDS is very small, but it is recommended that you go to the hospital for further confirmation. The client 10 performs an integrity check on the third word vector data based on the signature data. After the check passes, the third word vector data is decoded to obtain the second response information: relevant knowledge about the early manifestations of AIDS. The client displays the first response information and the second response information in different display areas, such as Fig.12 shown.
[0119] In another case, if Fig.10 As shown, the client 10 processes Q into the first word vector data, and sends the first word vector data to the server 20 and the target knowledge base 40 deployed in the target electronic device 50. The target knowledge base 40 returns the third word vector data and signature data to the client 10. The client 10 sends the first word vector data and the third word vector data to the server 20. The server 20 splices the first word vector data and the third word vector data into the fourth word vector data. The server 20 sends the fourth word vector data to the target large language model 30. The server 20 sends the second word vector data output by the target large language model 30 to the client 10. The client 10 decodes the second word vector data and obtains the first response information: In view of your symptoms, the possibility of you being infected with AIDS is very small, but it is recommended that you go to the hospital for further confirmation. The client 10 performs an integrity check on the third word vector data based on the signature data. After the check passes, the third word vector data is decoded to obtain the second response information: relevant knowledge about the early manifestations of AIDS. The client displays the first response information and the second response information in different display areas, such as Fig.12 shown.
[0120] In another case, if Fig.11As shown, the client 10 processes Q into the first word vector data, and sends the first word vector data to the server 20 and the target knowledge base 40 deployed in the server 20. The server returns the third word vector data and signature data output by the target knowledge base 40 to the client 10. The server 20 splices the first word vector data and the third word vector data into the fourth word vector data. The server 20 sends the fourth word vector data to the target large language model 30. Then the server 20 outputs the second word vector data from the target large language model 30 and sends it to the client 10. The client 10 decodes the second word vector data and obtains the first response information: In view of your symptoms, the possibility of you being infected with AIDS is very small, but it is recommended that you go to the hospital for further confirmation. The client 10 performs an integrity check on the third word vector data based on the signature data. After the check passes, the client 10 decodes the third word vector data and obtains the second response information: relevant knowledge about the early manifestations of AIDS. The client displays the first response information and the second response information in different display areas, such as Fig.12 shown.
[0121] The present application also proposes a data processing method, which is applied to a server, such as Figure 6 As shown, the method comprises the following steps:
[0122] Step S201, after obtaining the first word vector data sent by the client and processed based on the target input data, generate the second word vector data based on the first word vector data using the deployed target large language model, and the target large language model is trained with the knowledge base vector data provided by the client.
[0123] In this embodiment, the target input data can be input to the client by a user or other electronic device, and the type of the target input data can be one or more of text data, image data, and voice data. The client pre-fine-tunes the pre-trained large language model based on the knowledge base vector data, and deploys the trained target large language model to the server. The input and output of the target large language model are both word vector data, wherein the algorithm corresponding to the fine-tuning training can select P-tuning, LoRa, etc., which is not limited in this application. After the client obtains the target input data, it first processes the target input data into the first word vector data, which can be a word vector sequence, and then inputs the first word vector data into the server, which processes the first word vector data based on the target large language model.
[0124] Optionally, the client may process the target input data based on the word embedding module in the pre-trained large language model. The pre-trained large language model may be based on the existing large language models, such as ChatGLM, LLaMa2, etc., to obtain the first word vector data. Alternatively, in order to avoid leakage of sensitive data, the client may process the sensitive data and non-sensitive data in the target input data separately. For the non-sensitive data, the target input data is processed based on the word embedding module in the pre-trained large language model. For the sensitive data, the client performs word embedding processing based on the preset word embedding module to obtain the first word vector data. In addition, the knowledge base vector data is also generated by word embedding processing of the data in the original knowledge base based on the word embedding module in the pre-trained large language model and the preset word embedding module.
[0125] Optionally, the server can be a cloud server or an edge device in an edge network.
[0126] After the client sends the first word vector data to the server, the server inputs the first word vector data as a prompt word into the target large language model, and the target large language model outputs the second word vector data.
[0127] Step S202, feeding back the second word vector data to the client for decoding processing to output first response information on the client.
[0128] The server feeds back the second word vector data to the client. Since the second word vector data is a word vector, the client needs to decode the second word vector data to obtain the corresponding first response information as plain text, which is then fed back by the client to the user or other corresponding electronic devices to complete the processing of the target input data.
[0129] Optionally, the client may output the first response information in the conversation box, or may output it separately in the form of an OSD pop-up window, or in the form of voice playback, or in the form of graphics, text, animation, etc., which is not limited in this embodiment of the present application.
[0130] For other embodiments of the data processing method in the embodiments of the present application, reference may be made to the descriptions of the various embodiments of the data processing method with the client as the execution subject, which will not be repeated here.
[0131] In the data processing method in the embodiment of the present application, after the client obtains the target input data, the target input data is first processed into first word vector data and then sent to the server, and then the target large language model deployed on the server outputs the second word vector data based on the first word vector data, and finally the second word vector data fed back by the server is decoded and the first response information is output. Since the input and output of the target large language model are both non-plaintext word vector data, the server only works at the word vector level. Therefore, when the client calls the large language model deployed on the server for data processing, the leakage of business sensitive data and user privacy data is avoided, thereby improving data security.
[0132] The present application also proposes a data processing system, such as Fig.13 As shown, it includes a client and a server, where:
[0133] After obtaining the target input data, the client processes the target input data into first word vector data and sends it to the server;
[0134] The server is deployed with a target large language model trained with the knowledge base vector data provided by the client, so as to output second word vector data based on the first word vector data;
[0135] After obtaining the second word vector data fed back by the server, the client decodes the second word vector data and outputs first response information.
[0136] The present application also provides a client, including:
[0137] A processing module, configured to, in response to a client obtaining target input data, process the target input data into first word vector data and send the first word vector data to a server deployed with a target large language model, wherein the target large language model is trained with knowledge base vector data provided by the client;
[0138] An output module, configured to output second word vector data based on the first word vector data using the target large language model;
[0139] A decoding module is used to decode the second word vector data fed back by the server and output a first response information.
[0140] The present application also provides a server, including:
[0141] A generation module, configured to generate second word vector data based on the first word vector data after obtaining the first word vector data sent by the client and processed based on the target input data, using the deployed target large language model, wherein the target large language model is trained with the knowledge base vector data provided by the client;
[0142] A feedback module is used to feed back the second word vector data to the client for decoding processing so as to output first response information on the client.
[0143] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.
Claims
1. A data processing method, comprising: In response to the client obtaining target input data, the target input data is processed into first word vector data and sent to a server deployed with a target large language model, where the target large language model is trained with the knowledge base vector data provided by the client; Outputting second word vector data based on the first word vector data using the target large language model; The second word vector data fed back by the server is decoded and then the first response information is output.
2. The method according to claim 1, wherein: Outputting second word vector data based on the first word vector data using the target large language model includes at least one of the following: Inputting the first word vector data into a target knowledge base to obtain third word vector data matching the first word vector data, processing the first word vector data and the third word vector data into fourth word vector data and then inputting the fourth word vector data into the target large language model to output the second word vector data, wherein the target knowledge base is deployed in a target electronic device capable of communicating with the client; Input the first word vector data into a target knowledge base to obtain third word vector data matching the first word vector data, send the third word vector data to the server, use the server to process the first word vector data and the third word vector data into fourth word vector data, and then input the fourth word vector data into the target large language model, and output the second word vector data, wherein the target knowledge base is deployed in a target electronic device capable of communicating with the client; The first word vector data is input into the target knowledge base deployed on the server to obtain third word vector data matching the first word vector data, the first word vector data and the third word vector data are processed into fourth word vector data by the server and then input into the target large language model, and the second word vector data is output.
3. The method according to claim 2, wherein: The target knowledge base is obtained based on the following method: The knowledge items and index information in the original knowledge base are word-embedded respectively to obtain a target knowledge base consisting of knowledge item vectors and index vectors with signature data.
4. The method according to claim 1 or 2, wherein: Processing the target input data into first word vector data includes: Performing word segmentation processing on the target input data, and identifying the attributes of each word obtained after the word segmentation processing; Processing a first word having a first attribute among the words into a first attribute word vector of a target dimension by using a first word embedding model; Processing a second word having a second attribute in the words into a second attribute word vector of a target dimension by using a second word embedding model; The first attribute word vector and the second attribute word vector are fused to obtain the first word vector data.
5. The method according to claim 4, wherein: Processing a second word having a second attribute in the words into a second attribute word vector of a target dimension by using a second word embedding model includes: For each of the second words, using the second word embedding model, select a preset number of target words that meet the first attribute from a preset word library according to a preset selection rule; For each of the word vectors of the target word, data of one dimension is selected respectively, and a second attribute word vector corresponding to the second word is generated based on the selected data of each dimension.
6. According to the method of claim 1, the step of decoding the second word vector data fed back by the server and outputting the first response information comprises: The second word vector data fed back by the server is restored into at least one of text data, voice data or image data using a target decoding algorithm deployed on the client, so as to be output as the first response information through a corresponding output component of the client.
7. The method according to claim 6, wherein the step of decoding the second word vector data fed back by the server and outputting the first response information further comprises: Obtaining third word vector data and signature data thereof that match the first word vector data from a target knowledge base; Performing an integrity check on the third word vector data using the signature data, and decoding the third word vector data into at least one of text data, voice data, or image data after passing the integrity check, so as to output the data through a corresponding output component of the client as second response information; The target knowledge base is deployed on the server or the target electronic device, and the first response information and the second response information are output through different output components, or displayed in different display areas of the client.
8. The method according to claim 1, further comprising: Based on the identification information of the target operator, the first word vector data is sent to a server of a permission level corresponding to the identification information, so as to generate target response information by using a target large language model deployed on the server that matches the permission level; and / or, When a feedback operation of the target operator is obtained in response to the first response information and / or the second response information, the first response information and / or the second response information is sent to other large language models different from the target large language model to output third response information, wherein the matching degree between the third response information and the target input data is higher than the matching degree between the first response and the target input data.
9. A data processing method, applied to a server, comprising: After obtaining the first word vector data sent by the client and processed based on the target input data, generating the second word vector data based on the first word vector data using the deployed target large language model, wherein the target large language model is trained with the knowledge base vector data provided by the client; The second word vector data is fed back to the client for decoding processing to output first response information on the client.
10. A data processing system, comprising a client and a server, wherein: After obtaining the target input data, the client processes the target input data into first word vector data and sends it to the server; The server is deployed with a target large language model trained with the knowledge base vector data provided by the client, so as to output second word vector data based on the first word vector data; After obtaining the second word vector data fed back by the server, the client decodes the second word vector data and outputs first response information.
Citation Information
Cited By
Statement text processing method and device, equipment and storage medium
CN119357341A
Natural language processing method and device, equipment, storage medium and program product
CN119578402A
Data processing method and device and electronic equipment
CN121235115A
Information processing method and apparatus, computing device cluster, and storage medium
WO2026066240A1
