Language model data retrieval processing method and device, server and storage medium
By building an adaptive architecture in the RAG system and using a distributed ledger to store data verification contracts, the system automatically verifies and repairs the consistency of retrieved data, thus solving the problem of data tampering in the RAG system and achieving efficient and low-cost data repair and defense.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- DEYANG CITY WISDOM HEART INFORMATION TECH CO LTD
- Filing Date
- 2026-04-20
- Publication Date
- 2026-06-23
AI Technical Summary
Traditional Retrieval Augmentation Generative Model (RAG) systems rely on external knowledge bases, making them vulnerable to attacks that could lead to inaccurate or tampered retrieval of document fragments, resulting in system data errors and economic losses. Existing verification and repair measures are both outdated and costly.
An adaptive architecture is built, which stores data and verifies contracts through a distributed ledger, automatically verifies and repairs the consistency of retrieved data, uses a risk decision model to assess the risk level, performs on-chain verification only when the risk is high, and automatically isolates and repairs tampered data.
It achieves high robustness and usability in mission-critical scenarios, reduces system energy consumption, avoids losses caused by data tampering, and enables automated, low-cost data repair.
Smart Images

Figure CN122046376B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of knowledge base integrity verification technology for model systems, and in particular to a method, apparatus, server, and storage medium for processing language model retrieval data. Background Technology
[0002] Traditional Retrieval-Augmented Generation (RAG) systems are artificial intelligence frameworks that combine information retrieval with generative large language models (LLM). They retrieve relevant information from external knowledge bases and input the retrieved document fragments as context into the generative model, thereby generating more accurate and context-relevant answers or content. Therefore, the accuracy and security of the retrieved document fragments are strongly correlated with the quality of the generated answers.
[0003] However, the above process also leads to the defects of RAG's reliance on external knowledge bases. The retrieved document fragments may be inaccurate, or the document fragments retrieved by RAG may be affected by "content poisoning" and "semantic poisoning" attacks. The feature vectors generated based on the retrieved documents may be tampered with, which may not only generate incorrect answers, but also cause system data errors and process bugs, especially in some special fields such as enterprises, institutions and financial systems, resulting in serious economic losses.
[0004] Currently, the industry typically verifies and intervenes manually after persistent and covert attacks output incorrect answers or expose system vulnerabilities, such as intercepting attacks and fixing erroneous data. However, intervention after a problem occurs is somewhat delayed, and the untimely response can still cause economic losses. At the same time, the cost of verification and system repair is too high, making it difficult to deal with persistent and covert attacks. Summary of the Invention
[0005] In view of this, this application provides a method, apparatus, server and storage medium for processing language model retrieval data, constructing an adaptive architecture from automatically verifying the consistency of retrieval data to isolating inconsistent retrieval data, and finally repairing retrieval data, without the need for manual intervention, to complete the repair and replacement of contaminated data, and ensure the long-term health of the knowledge base.
[0006] The first aspect of this application provides a method for processing language model retrieval data, the method comprising:
[0007] Risk assessment of dynamic knowledge vectors retrieved in real time;
[0008] When the risk assessment reaches a preset risk level, a data verification contract is retrieved from a pre-set distributed ledger based on the unique identifier of the dynamic knowledge vector; the data verification contract is generated by performing an encryption process based on the meta-knowledge vector corresponding to the dynamic knowledge vector.
[0009] Verify whether the data verification contract is consistent with the dynamic data contract, wherein the dynamic data contract is generated based on the encryption process performed using dynamic knowledge vectors;
[0010] When the data verification contract is inconsistent with the dynamic data contract, the database interface is called to mark the dynamic knowledge vector as invalid in the database and isolate the dynamic knowledge vector.
[0011] A second aspect of this application provides a processing apparatus for state data in language model retrieval, the apparatus comprising:
[0012] The risk assessment module is used to assess the risks of dynamic knowledge vectors retrieved in real time.
[0013] An adaptive verification engine module is used to retrieve a data verification contract from a pre-set distributed ledger based on the unique identifier of the dynamic knowledge vector when the risk assessment reaches a preset risk level; the data verification contract is generated by performing an encryption process based on the meta-knowledge vector corresponding to the dynamic knowledge vector.
[0014] The adaptive verification engine module is also used to verify whether the data verification contract is consistent with the dynamic data contract, which is generated based on the encryption process performed by the dynamic knowledge vector.
[0015] The automated self-healing engine module is used to call the database interface to mark the dynamic knowledge vector as invalid in the database and isolate the dynamic knowledge vector when the data verification contract is inconsistent with the dynamic data contract.
[0016] A third aspect of this application provides a server, comprising: a processor and a memory, the processor and the memory being connected via a communication bus; wherein the processor is used to call and execute a program stored in the memory; the memory is used to store the program, the program being used to implement the language model retrieval data processing method provided in the first aspect of this application.
[0017] The fourth aspect of this application provides a computer-readable storage medium storing computer-executable instructions for performing a language model retrieval data processing method as provided in the first aspect of this application.
[0018] Compared with existing technologies, this application provides a method, apparatus, server, and storage medium for processing language model retrieval data. Its beneficial effects are: generating indivisible triple vouchers for each knowledge unit, storing triple vouchers in the form of smart contracts through a distributed ledger, obtaining tamper-proof standard documents, and providing a foundation for subsequent automatic verification of the consistency of retrieved knowledge units. The user's retrieval of knowledge units triggers a risk decision-making model to first perceive the system environment. This model, built on a reinforcement learning model, adapts to the constantly changing system environment and determines the risk of knowledge unit tampering under the current system conditions. Only when the predicted risk level reaches a preset risk level is the knowledge unit consistency verification process triggered, saving system energy. Based on the data verification contract of the distributed ledger storage, the model automatically verifies whether the knowledge units stored in the database have been tampered with by verifying the consistency between the data verification contract and the dynamic data contract. If the knowledge units stored in the database have been tampered with, the dynamic knowledge vector is marked as invalid, isolating the dynamic knowledge vector. Simultaneously, the original document ID is parsed from the unit ID, and the slicing and vectorization process is re-executed to generate the correct knowledge unit, thus repairing the knowledge units in the CNC library. This achieves the goal of constructing an adaptive architecture that automatically verifies the consistency of retrieved data, isolates inconsistent retrieved data, and ultimately repairs the retrieved data. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0020] Figure 1 This is a flowchart of the steps of the language model retrieval data processing method proposed in the embodiments of this application;
[0021] Figure 2 This is a flowchart illustrating an example of a language model-based data retrieval processing method for adaptively repairing retrieved data, as described in this application.
[0022] Figure 3 This is an architectural diagram of the language model retrieval data processing device proposed in the embodiments of this application. Detailed Implementation
[0023] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0024] In this application, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0025] To better understand this application, the technical names involved in this application are explained below:
[0026] The language model is an LLM built on the RAG system. The RAG workflow is as follows: It receives user input queries or questions, and extracts the document fragments with the highest similarity to the query or question from the database using a pre-defined retrieval algorithm. These document fragments are then input into the generation model, which calculates and generates appropriate answer text based on the document fragments.
[0027] Reinforcement learning (RL) is an unsupervised learning method in which an agent responds to the state by adopting a decision function, determines the next action, and accumulates rewards based on the response to the next action. Through the interaction between the agent and the environment, the agent learns how to adopt an optimized decision function to maximize long-term cumulative rewards.
[0028] Example 1
[0029] As described in the background section, in the prior art, system and data checks are typically performed after incorrect answers are output or system vulnerabilities are found. The adaptive architecture constructed in this application generates a data verification contract for a trustworthy document during the knowledge base construction or update phase. This data verification contract is stored in a distributed ledger, so that when the RAG system performs a search, it can call the data verification contract stored in the distributed ledger to automatically verify whether the information retrieved in real time is consistent, thus providing a foundation for automatically verifying the consistency of retrieved data.
[0030] Figure 1 This is a flowchart illustrating the steps of the language model retrieval data processing method proposed in this application. Figure 1 The language model retrieval data processing method proposed in this application embodiment includes performing the following steps during the knowledge base construction or update stage:
[0031] S100: Obtain multiple original documents from the knowledge base loaded into the language model, perform slicing for each original document, and generate meta-knowledge units.
[0032] Slicing and generating meta-knowledge units for each original document refers to the process of dividing unstructured long text into a series of continuous, semantically relatively complete text blocks according to specific logical or grammatical boundaries or according to preset capacity limits.
[0033] For example, the original document states, "Employees with a cumulative work experience of 1 year but less than 10 years are entitled to 5 days of annual leave. Personal leave is unpaid and cannot exceed 20 days in total for the whole year." After slicing the original document, we get slice A: "Employees with a cumulative work experience of 1 year but less than 10 years are entitled to 5 days of annual leave" and slice B: "Personal leave is unpaid and cannot exceed 20 days in total for the whole year."
[0034] In one example of this application, the meta-knowledge unit may include slices and descriptive data. For example, the descriptive data of slice A may include: Source: Employee Handbook, pdf, Chapter: Chapter 3 - Leave System, Topic: Annual Leave, Applicable to: Employees with 1-10 years of service, Code P15-2.
[0035] S110: Vectorize each meta-knowledge unit to obtain multiple meta-knowledge vectors.
[0036] If the meta-knowledge unit is a knowledge fragment loaded into the language model, the knowledge unit C can be text, image, etc. The multimodal embedding model E is called to generate the vector V of the knowledge unit C, thus obtaining the meta-knowledge vector of the meta-knowledge unit.
[0037] Multimodal embedding models map data from different modalities (such as text and images) to the same vector space, enabling direct semantic comparison and retrieval. Simultaneously, (C, V) is stored in a database for later retrieval by the RAG system.
[0038] S120: Perform encryption calculation and concatenation calculation on the meta-knowledge units, meta-knowledge vectors, and key metadata corresponding to the same original document to obtain the data verification contract; the key metadata includes the encoding number and version number of the original document.
[0039] An example of the execution step S120 of this application includes:
[0040] Step 1: Perform a hash calculation on the meta-knowledge unit to obtain the content credential Hash(C). The encryption calculation method can also be other certified cryptographic hash functions such as SHA-256, SHA-3 or BLAKE2, which are not limited in this application embodiment.
[0041] Step 2: Perform a hash calculation on the meta-knowledge vector to obtain the vector credential Hash(V).
[0042] Step 3: Calculate the joint certificate. After concatenating the content certificate, vector certificate, and key metadata, perform another joint certificate calculation. The resulting triple certificate hash (joint) serves as the data verification contract. The preferred method for triple certificate calculation is as follows:
[0043] Hash(joint)=Hash(Hash(C)||Hash(V)||Metadata||Timestamp);
[0044] A timestamp is a timestamp generated to record the point in time when data was generated or manipulated.
[0045] The data verification contract generated above tightly binds the content, vector, and its credential information together, making it difficult to separate the content, vector, and credential information, thus preventing data tampering. The credential is recorded in the distributed ledger, and based on the security of the distributed ledger, it provides an immutable "single source of fact" for subsequent deterministic verification.
[0046] S130: Store the data verification contract in a pre-set distributed ledger.
[0047] By invoking a smart contract, the unique identifier of the meta-knowledge unit and the calculated triplet certificate are written into the distributed ledger (DLT) after consensus. The unique identifier can be generated based on information that distinguishes the original document from other documents, such as the encoding number.
[0048] In one example of this application, the content stored in the distributed ledger can be stored locally as a centralized, high-security credential storage for local centralized verification of low-risk content.
[0049] The method of invoking a smart contract to initiate consensus among distributed ledger nodes can adopt any consensus mechanism in the field, and the embodiments of this application are not limited thereto.
[0050] The language model retrieval data processing method proposed in this application, through the technical content proposed in steps S100-S130, completes the initial setting of the distributed ledger storage data verification contract. During the retrieval phase of the RAG system, the language model retrieval data processing method executes the following technical content: when RAG retrieves data, it triggers the verification process. When the risk level is high, it automatically triggers the verification of the retrieved information.
[0051] S140: Conduct a risk assessment on the dynamic knowledge vectors retrieved in real time.
[0052] The RAG system retrieves the Top-K relevant knowledge units from the vector database. Relevant knowledge units refer to multiple real-time knowledge units that have a high degree of matching with the search keywords.
[0053] The multimodal embedding model is invoked to generate dynamic knowledge vectors for real-time knowledge units.
[0054] This application embodiment utilizes a pre-set risk decision-making model to perform risk assessment on the dynamic knowledge vector retrieved in real time.
[0055] Executing S140 can be achieved by running step S1401:
[0056] S1401: A risk decision model is pre-set, which outputs a risk level prediction for the input action to be evaluated based on the current state of the language model; the action to be evaluated is the process of retrieving dynamic knowledge vectors; the risk level includes a verification-free level, a local verification level, and an on-chain strong verification level.
[0057] The risk decision-making model acts as an agent to observe the current environmental state of the language model. Specifically, it can determine the model's environmental state through the following features: user trust score, access frequency, access time, IP reputation score, geographical location risk, device fingerprint, session duration, average daily query volume, data export frequency, number of failed authentications, query pattern deviation, query diversity index, relevant query risk, time relevance, user role matching degree, project relevance, recall number, historical pollution rate, etc.
[0058] The agent responds to the actions of the retrieved dynamic knowledge vector through a decision function. The decision function can be value iteration, policy iteration, Q-learning, SARSA, etc., and the embodiments of this application are not limited thereto.
[0059] The reward includes output check-free level, output local check level, and output chain strong check.
[0060] For example, the risk decision model outputs an L0 (no verification required) level for publicly available data from trusted sources, frequently accessed content that has not been modified recently. For ordinary documents, the risk decision model can compare them with a trusted centralized credential database, outputting an L1 (local verification) level. For highly sensitive data such as financial statements, confidential documents, and core system parameters, or when anomalies are detected or anomalies requiring a higher verification level are identified (e.g., daily query volume > 100 times / day, historical contamination rate > 0.1%), the risk decision model outputs an L2 (strong on-chain verification) level.
[0061] S150: When the risk assessment reaches a preset risk level, a data verification contract is retrieved from a pre-set distributed ledger based on the unique identifier of the dynamic knowledge vector. The data verification contract is generated by performing an encryption process based on the meta-knowledge vector corresponding to the dynamic knowledge vector.
[0062] In one example of this application, execution S150 specifically runs S1501: when the risk level is predicted to be a strong on-chain verification level, data is retrieved from the pre-set distributed ledger to verify the contract based on the unique identifier of the dynamic knowledge vector.
[0063] When the risk assessment does not reach the preset risk level, that is, when the risk level is predicted to be the verification-free level and the local verification level, the RAG environment is determined to be trustworthy, and RAG continues to execute the knowledge unit input generation model, and the generation model calculates and generates appropriate response text.
[0064] After retrieving the data verification contract, the system compares the data verification contract with the contract corresponding to the dynamic knowledge vector to verify whether the dynamic knowledge vector searched in real time is consistent with the meta-knowledge unit. If they are consistent, it is determined that the knowledge unit stored in the database has not been tampered with during the knowledge base construction phase or from the last update to the current time, and the RAG system has not been attacked and is secure. This completes the automatic monitoring of the RAG system and the automatic retrieval of data consistency.
[0065] This application first assesses the risk level through a risk decision-making model, and then performs on-chain verification when the risk level is high. It combines the deterministic security of DLT with intelligent decision-making to build a low-overhead, highly reliable proactive defense and self-healing system. The high-level "deterministic verification" is only initiated when the intelligent decision-making is necessary, saving system energy consumption. Once the verification fails, "automatic repair" is triggered, which greatly improves the robustness and practicality of the RAG system in mission-critical scenarios.
[0066] S160: Verify whether the data verification contract is consistent with the dynamic data contract, wherein the dynamic data contract is generated based on the encryption process performed by the dynamic knowledge vector.
[0067] This application proposes a specific execution method for verifying the consistency between a data verification contract and a dynamic data contract:
[0068] The process of generating dynamic knowledge vectors through encryption can be based on the principle of generating data verification contracts in the knowledge base construction or update phases S100-S120.
[0069] K11: Calculate the content credential Hash'(C) of the real-time knowledge unit, calculate the vector credential Hash'(V) of the dynamic knowledge vector, and then perform a joint credential operation to obtain Hash'(joint).
[0070] K12: Verify whether Hash'(joint) = Hash(joint) is true. If Hash'(joint) = Hash(joint) is true, then the data verification contract is consistent with the dynamic data contract. If Hash'(joint) = Hash(joint) is false, then the data verification contract is inconsistent with the dynamic data contract.
[0071] In one example, the verification results of the dynamic data contract can be written to the log, and after RAG outputs the answer text, the answer text and the user's feedback on the answer text can be written to the log.
[0072] S170: When the data verification contract is inconsistent with the dynamic data contract, the database interface is called to mark the dynamic knowledge vector as invalid in the database and isolate the dynamic knowledge vector.
[0073] If the data verification contract is inconsistent with the dynamic data contract, it can be determined that the database has been attacked and the stored knowledge units have been tampered with since the knowledge base was built or last updated. The data should be intercepted immediately to prevent the contaminated data from affecting the generated results and thus avoid greater losses.
[0074] When the data verification contract is consistent with the dynamic data contract, it can be determined that the stored knowledge units have not been tampered with since the knowledge base was built or last updated, and RAG continues to perform the calculation to generate the answer text.
[0075] In one embodiment of this application, when the data verification contract is inconsistent with the dynamic data contract, steps S201-S205 can be further triggered to achieve the goal of adaptively repairing the retrieved data.
[0076] In another embodiment, S201-S205 (real-time retrieval process) can also be triggered by a periodic deterministic scanning task. Every time a preset time is reached, the periodic scanning task can adopt a full scan method. When facing a very large dataset, an incremental sliding window scan or a priority-based hierarchical scan method can also be adopted to reduce performance overhead.
[0077] S201: Retrieve the target original document corresponding to the dynamic knowledge vector from the secure storage unit according to the unique identifier.
[0078] The original document ID is parsed from the unique identifier (ID) of the dynamic knowledge unit, and the original document is retrieved from the secure storage unit. For example, the secure storage unit could be a trusted object store, a WORM-Write-Once-Read-Many store, etc.
[0079] S202: Perform a slicing and vectorization process on the original document to generate a security knowledge vector.
[0080] S203: Overwrite the meta-knowledge vector with the security knowledge vector in the database and remove the failure marker.
[0081] By overlaying security knowledge vectors onto the meta-knowledge vectors in the database, real-time repair of database data is achieved, thereby restoring the retrieved data.
[0082] For example, the target original document is sliced again to generate knowledge unit C_correct. Vector computation is performed on knowledge unit C' to obtain knowledge vector V_correct. The contaminated data in the vector database is updated with the data pair (C_correct, V_correct) containing the correct knowledge unit, and the failure marker is removed, so that the data pair in the database can be restored to normal service.
[0083] Furthermore, after repairing the knowledge units in the database, a brand new data verification contract is generated for the new correct unit pair, and it is recorded as the latest version on the DLT through a smart contract, forming an auditable repair history.
[0084] S204: Perform an encryption process on the security knowledge vector to generate a secure data verification contract.
[0085] S205: Override the data verification contract in the database with the secure data verification contract.
[0086] For example, calculate the content credential Hash-(C) of the real-time knowledge unit, calculate the vector credential Hash-(V) of the knowledge vector, perform a joint credential operation to obtain the secure data verification contract Hash-(joint), and write Hash-(joint) into the distributed ledger.
[0087] During the execution of this embodiment, log information generated by the RAG system execution program is retrieved and input into the risk decision model. The risk decision model continuously learns from the environment feedback based on the log information to optimize the decision function, ensuring the accuracy of the model output.
[0088] S140 also includes sub-steps:
[0089] S1402: Read the log of the distributed ledger to obtain event records within a specific time period after the risk level prediction.
[0090] S1403: Update the decision function corresponding to the action to be evaluated based on the event record as a reward.
[0091] For example, the execution results can be written to the log. For instance, "using the database interface to invalidate the dynamic knowledge vector in the database" can be written to the log, "overwriting the meta knowledge vector with a security knowledge vector in the database" can be written to the log, and after RAG generates the answer, the information entered by the user for the generated answer can be written to the log.
[0092] The system can retrieve relevant records from the log at preset intervals to generate reward sequences, which are then input into the risk decision-making model. The risk decision-making model records the entire trajectory (s1, a1, s2, a2, ..., sT) from the initial state to the current state. s 1, sT The reward is assigned to each action according to the trajectory sequence, and the reward R in the entire trajectory is updated. After the final reward R is generated, this total reward is used to update each action in the trajectory. The specific update technique can refer to the reinforcement learning optimization method in this field, and the embodiments of this application are not limited.
[0093] Figure 2 This is a flowchart illustrating an example of a language model-based data retrieval processing method for adaptively repairing retrieved data, as described in this application. Figure 2 As shown, the process includes:
[0094] M11 triggers the adaptive repair procedure: triggered when the verification data confirms inconsistency between the contract and the dynamic data contract; or triggered by the periodic deterministic scan task in the background.
[0095] M12 Contamination Data Confirmation: After detecting a hash mismatch, the system immediately queries the vector database via API to find the contaminated order and executes M16 to output a warning.
[0096] M13 Isolate Contamination Unit: Adds an "invalid" mark to the queried contamination unit to achieve instant isolation.
[0097] M14 Source Tracing: Parse the original document ID based on the unit ID, retrieve the original document from a preset, immutable authoritative data source (such as trusted object storage, WORM-Write-Once-Read-Many storage). If the queried data source is available, perform M15 data reconstruction. If the queried data source is unavailable, execute M16 to output a warning and require manual intervention.
[0098] M15 data reconstruction:
[0099] M151 Data Update: Re-execute the slicing and vectorization process to generate correct knowledge unit pairs (C_correct, V_correct) and store them in the database;
[0100] M152 Document Consensus: Generate new triplet documents for new correct unit pairs.
[0101] M153 On-chain Update: Stores the new triplet certificate into the distributed ledger.
[0102] M16 outputs a warning.
[0103] Example 2
[0104] Based on the language model retrieval data processing method provided in Embodiment 1 of this application, correspondingly, Embodiment 2 of this application also provides a language model retrieval data processing apparatus. Figure 3 This is an architectural diagram of the language model retrieval data processing device proposed in the embodiments of this application, such as... Figure 3 As shown, the device includes a service layer, a user layer, a RAG core layer, a storage layer, and a distributed ledger layer:
[0105] The user layer includes: knowledge base management, knowledge unit management, and question query interface.
[0106] The service layer includes: API interface, credential generation module, risk assessment module, adaptive verification engine module, and automated self-healing engine module.
[0107] The core layer of RAG includes: issue handling module, content chunker, retrieval module, generation model, and context validation gateway.
[0108] The storage layer includes: a vector database, versioned storage credentials, and secure storage units.
[0109] The distributed ledger layer includes: node clusters, smart contracts, and consensus mechanisms.
[0110] Among them, the risk assessment module is used to assess the risks of dynamic knowledge vectors retrieved in real time;
[0111] An adaptive verification engine module is used to retrieve a data verification contract from a pre-set distributed ledger based on the unique identifier of the dynamic knowledge vector when the risk assessment reaches a preset risk level; the data verification contract is generated by performing an encryption process based on the meta-knowledge vector corresponding to the dynamic knowledge vector.
[0112] The adaptive verification engine module is also used to verify whether the data verification contract is consistent with the dynamic data contract, which is generated based on the encryption process performed by the dynamic knowledge vector.
[0113] The automated self-healing engine module is used to call the database interface to mark the dynamic knowledge vector as invalid in the database and isolate the dynamic knowledge vector when the data verification contract is inconsistent with the dynamic data contract.
[0114] Optionally, an API interface is encapsulated, which connects to the service layer and the storage layer, and the storage layer is equipped with a secure storage unit;
[0115] The automated self-healing engine module is also used to retrieve the target original document corresponding to the dynamic knowledge vector from the secure storage unit based on the unique identifier;
[0116] The automated self-healing engine module is also used to perform slicing and vectorization processes on the original document to generate a security knowledge vector;
[0117] The automated self-healing engine module is also used to overwrite the meta-knowledge vector with the security knowledge vector in the database and remove the failure marker.
[0118] Optionally, the credential generation module of the RAG core layer can be called through the API interface to obtain multiple original documents loaded into the knowledge base of the language model, and slicing can be performed on each original document to generate meta-knowledge units.
[0119] The voucher generation module is used to vectorize each meta-knowledge unit to obtain multiple meta-knowledge vectors.
[0120] The data verification contract is obtained by performing encrypted calculations and concatenation calculations on the meta-knowledge units, meta-knowledge vectors, and key metadata corresponding to the same original document; the key metadata includes the encoding number and version number of the original document.
[0121] By calling the smart contract, node cluster, and consensus mechanism of the distributed ledger through the API interface, the data verification contract is stored in the pre-set distributed ledger.
[0122] Optionally, the credential generation module is used to perform an encryption process on the security knowledge vector to generate a secure data verification contract;
[0123] An automated self-healing engine module is used to override the data verification contract in the database with the secure data verification contract.
[0124] Optionally, the risk assessment module is further configured to: pre-set a risk decision model, which outputs a risk level prediction for the input action to be evaluated based on the current state of the language model; the action to be evaluated is the process of retrieving dynamic knowledge vectors; the risk level includes a verification-free level, a local verification level, and an on-chain strong verification level; when the risk level is predicted to be an on-chain strong verification level, data is retrieved from the pre-set distributed ledger to verify the contract based on the unique identifier of the dynamic knowledge vector.
[0125] Optionally, the risk assessment module is also used to read the logs of the distributed ledger to obtain event records within a specific time period after the risk level prediction;
[0126] The decision function corresponding to the action to be evaluated is updated based on the event record as a reward.
[0127] The specific principles and execution processes of each unit in the language model retrieval data processing device disclosed in Embodiment 2 of this application can be found in the corresponding parts of the language model retrieval data processing method disclosed in Embodiment 1 of this application, and will not be repeated here.
[0128] Example 3
[0129] Embodiment 3 of this application provides a server, including: a processor and a memory, the processor and the memory being connected via a communication bus; wherein, the processor is used to call and execute a program stored in the memory; the memory is used to store the program, the program being used to implement the language model retrieval data processing method provided in Embodiment 1 of this application.
[0130] Example 4
[0131] Embodiment 4 of this application provides a computer-readable storage medium storing computer-executable instructions for performing a language model retrieval data processing method as provided in Embodiment 1 of this application.
[0132] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computing software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0133] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0134] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for processing data retrieved using a language model, characterized in that, The method includes: Risk assessment of dynamic knowledge vectors retrieved in real time; When the risk assessment reaches a preset risk level, a data verification contract is retrieved from a pre-set distributed ledger based on the unique identifier of the dynamic knowledge vector; the data verification contract is generated by performing an encryption process based on the meta-knowledge vector corresponding to the dynamic knowledge vector. Verify whether the data verification contract is consistent with the dynamic data contract, wherein the dynamic data contract is generated based on the encryption process performed using dynamic knowledge vectors; When the data verification contract is inconsistent with the dynamic data contract, the database interface is called to mark the dynamic knowledge vector as invalid in the database and isolate the dynamic knowledge vector. The process of obtaining the data verification contract includes: Obtain multiple original documents from the knowledge base loaded into the language model, perform slicing for each original document, and generate meta-knowledge units; Each meta-knowledge unit is vectorized to obtain multiple meta-knowledge vectors; The data verification contract is obtained by performing encrypted calculations and concatenation calculations on the meta-knowledge units, meta-knowledge vectors, and key metadata corresponding to the same original document; the key metadata includes the encoding number and version number of the original document. The method further includes: The data verification contract is stored in a pre-set distributed ledger.
2. The method according to claim 1, characterized in that, After isolating the dynamic knowledge vector, the method further includes: The target original document corresponding to the dynamic knowledge vector is retrieved from the secure storage unit based on the unique identifier; The original document is sliced and vectorized to generate a security knowledge vector; The database is then overlaid with the security knowledge vector to cover the meta-knowledge vector, and the failure marker is removed.
3. The method according to claim 2, characterized in that, After performing slicing and vectorization on the original document to generate a security knowledge vector, the method further includes: An encryption process is performed on the security knowledge vector to generate a secure data verification contract; The database is overridden with the secure data verification contract.
4. The method according to claim 1, characterized in that, Risk assessment of dynamic knowledge vectors retrieved in real time includes: A risk decision model is pre-set, which outputs a risk level prediction for the input action to be evaluated based on the current state of the language model; the action to be evaluated is the process of retrieving dynamic knowledge vectors; the risk level includes a verification-free level, a local verification level, and an on-chain strong verification level. When the risk assessment reaches a preset risk level, data is retrieved from a pre-set distributed ledger to verify the contract based on the unique identifier of the dynamic knowledge vector, including: When the risk level is predicted to be a strong on-chain verification level, data is retrieved from the pre-set distributed ledger to verify the contract based on the unique identifier of the dynamic knowledge vector.
5. The method according to claim 4, characterized in that, After the risk decision model outputs a risk level prediction for the input action to be evaluated based on the current state of the language model, the method further includes: Read the logs of the distributed ledger to obtain event records within a specific time period after the risk level prediction; The decision function corresponding to the action to be evaluated is updated based on the event record as a reward.
6. A processing device for retrieving language model data, characterized in that, The device includes: The risk assessment module is used to assess the risks of dynamic knowledge vectors retrieved in real time. An adaptive verification engine module is used to retrieve a data verification contract from a pre-set distributed ledger based on the unique identifier of the dynamic knowledge vector when the risk assessment reaches a preset risk level; the data verification contract is generated by performing an encryption process based on the meta-knowledge vector corresponding to the dynamic knowledge vector. The adaptive verification engine module also includes a background proactive inspection mechanism independent of the real-time retrieval process. The real-time retrieval process includes: according to a preset inspection cycle, fully or incrementally reading the dynamic knowledge vectors stored in the database in the background, and batch retrieving data from the pre-set distributed ledger to verify the contract; The adaptive verification engine module is also used to verify whether the data verification contract is consistent with the dynamic data contract, which is generated based on the encryption process performed by the dynamic knowledge vector. An automated self-healing engine module is used to call a database interface to mark the dynamic knowledge vector as invalid in the database and isolate the dynamic knowledge vector when the data verification contract is inconsistent with the dynamic data contract. The certificate generation module of the RAG core layer calls the certificate generation module of the RAG core layer through the API interface to obtain multiple original documents loaded into the knowledge base of the language model, and performs slicing for each original document to generate meta-knowledge units. The voucher generation module is used to vectorize each meta-knowledge unit to obtain multiple meta-knowledge vectors. The data verification contract is obtained by performing encrypted calculations and concatenation calculations on the meta-knowledge units, meta-knowledge vectors, and key metadata corresponding to the same original document; the key metadata includes the encoding number and version number of the original document. The distributed ledger uses an API interface to call the smart contracts, node clusters, and consensus mechanisms of the distributed ledger, and stores the data verification contract in a pre-set distributed ledger.
7. The apparatus according to claim 6, characterized in that, It is encapsulated with an API interface, which connects to the service layer and the storage layer through the API interface. The storage layer is equipped with a secure storage unit. The automated self-healing engine module is also used to retrieve the target original document corresponding to the dynamic knowledge vector from the secure storage unit based on the unique identifier; The automated self-healing engine module is also used to perform slicing and vectorization processes on the original document to generate a security knowledge vector; The automated self-healing engine module is also used to overwrite the meta-knowledge vector with the security knowledge vector in the database and remove the failure marker.
8. A server, characterized in that, include: A processor and a memory are connected via a communication bus; wherein the processor is used to call and execute a program stored in the memory; The memory is used to store a program for implementing the language model retrieval data processing method as described in any one of claims 1-5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for performing the language model retrieval data processing method as described in any one of claims 1-5.