Method, device and storage medium for searching and enhancing authority management
By combining a dual filtering method of semantic relevance and permission scoring, the shortcomings of existing RAG permission management systems in terms of accuracy and computational efficiency are addressed, enabling more refined permission management and resource utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PENG CHENG LAB
- Filing Date
- 2026-01-22
- Publication Date
- 2026-05-29
AI Technical Summary
The existing RAG permission management system is insufficient in terms of accuracy and computational efficiency. Coarse-grained control may lead to excessive information exposure or waste of resources, while fine-grained control is difficult to cope with complex permission policies and waste of computational resources.
By acquiring semantic relevance scores from user query data and document fragments, and combining them with a pre-trained permission determination language model, permission re-determination is performed to achieve refined permission scoring. The system also incorporates dual filtering based on semantic relevance and permission matching to reduce the computational processing of unauthorized documents.
It improves the granularity and computational efficiency of access control, reduces overall computational overhead, and ensures accurate access control and efficient resource utilization.
Smart Images

Figure CN122113180A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of access control technology, and in particular to methods, apparatus, devices and storage media for enhancing access control retrieval. Background Technology
[0002] The Retrieval-augmented Generation (RAG) system achieves precise access control through data layering and isolation, and bitmap indexing technology. It defines types such as super administrators and business roles, and divides permission granularity according to operation and data scope. The core function is to parse user roles during the retrieval phase, filter unauthorized data, ensure the security of sensitive information, and adapt to the data access compliance requirements of various scenarios such as healthcare and finance.
[0003] In related technologies, RAG access control primarily employs two architectures: The first is the front-end gateway mode, which performs coarse-grained user-level control via an independent access service before retrieval, allowing access to the standard process only after approval. The second is the post-filter mode, which performs fine-grained matching and filtering based on document fragment access tags and user attributes after retrieval, using only authorized content to generate answers. However, the first approach, with its "all or nothing" coarse-grained control, may lead to excessive information exposure or improper denial of legitimate access. The second approach may waste computational resources by retrieving a large number of unauthorized documents. Summary of the Invention
[0004] The main objective of this application is to propose a method, apparatus, device, and storage medium for enhanced access control retrieval, thereby improving the granularity of access control and reducing overall computational overhead.
[0005] To achieve the above objectives, a first aspect of this application proposes an enhanced access control retrieval method, comprising: Obtain user query data, obtain user request context based on the user query data, and obtain user semantic vector and query permission representation corresponding to the user request context; Obtain the document semantic vector and document permission vector of each document fragment in the vector database. Perform a preliminary query based on the user semantic vector, the query permission representation, the document semantic vector, and the document permission vector to obtain the semantic relevance score of each document fragment. Determine a preset number of candidate document fragments based on the semantic relevance score. Each candidate document fragment is input into a pre-trained permission determination language model for permission re-determination to obtain the corresponding refined permission score; The target result is determined based on the semantic relevance score, the fine-grained permission score, and the candidate document fragments.
[0006] In some embodiments, obtaining the document permission vector for each document fragment in the vector database includes: If the document fragment includes metadata or tag attributes, extract permission attribute data from the metadata or tag attributes; The document fragment is subjected to a preset information regular expression match to obtain the secret level data; The permission attribute data and the security level data are encoded respectively to obtain permission attribute encoded values and security level encoded values. The document permission vector is obtained by concatenating the permission attribute encoded values and the security level encoded values.
[0007] In some embodiments, the preliminary query to obtain a semantic relevance score for each document fragment based on the user semantic vector, the query permission representation, the document semantic vector, and the document permission vector includes: For each document fragment, the semantic distance is obtained by calculating the vector distance between the user semantic vector and the document semantic vector, and the permission distance is obtained by calculating the vector distance between the query permission representation and the document permission vector. The semantic distance and the permission distance are weighted and summed to obtain the semantic relevance score.
[0008] In some embodiments, the step of inputting at least each of the candidate document fragments into a pre-trained permission-determination large language model for permission re-determination to obtain a corresponding refined permission score includes: Obtain the permission policy of the natural language description corresponding to the candidate document fragment and the original text corresponding to the candidate document fragment; Based on the permission policy, the original text, the user request context, and the preset judgment instruction, permission judgment data corresponding to each candidate document fragment is obtained, and the preset judgment instruction is used to indicate the output permission matching score; The permission determination data is input into the permission determination language model for permission re-determination to obtain the corresponding refined permission score.
[0009] In some embodiments, determining the target result based on the semantic relevance score, the fine-grained permission score, and the candidate document fragments includes: The semantic relevance score and the fine-grained permission score are weighted and summed to obtain the candidate score corresponding to each candidate document fragment; The candidate scores are sorted, and at least one candidate document fragment is selected as the target document based on the sorting result. Based on the user query data and the target document, a generation prompt is obtained. The generation prompt is then input into the generative language model to generate content, thereby obtaining the target result.
[0010] In some embodiments, obtaining the user request context based on the user query data includes: Context data is obtained from the user query data, and the context data includes at least one of user identity attributes, dynamic session information, and environmental network information; The user request context is obtained based on the user query data and the context data.
[0011] In some embodiments, the training process of the permission determination large language model includes at least: Obtain training samples and expert-annotated samples. The training samples include access strategy information, document content, and user context. The labels of the training samples are expected scores. The training samples are input into the permission determination language model for data processing to obtain the prediction score and inference chain description. The loss value is calculated using the expected score and the predicted score. Based on the loss value, the permission determination language model is initially adjusted to obtain the first permission model. The expert-annotated samples are input into the first permission model for data processing. The first permission model is then fine-tuned to obtain the trained permission determination language model.
[0012] To achieve the above objectives, a second aspect of this application provides an enhanced access control retrieval device, comprising: Data acquisition module: used to acquire user query data, obtain user request context based on the user query data, and obtain user semantic vector and query permission representation corresponding to the user request context; Preliminary screening module: used to obtain the document semantic vector and document permission vector of each document fragment in the vector database, perform a preliminary query based on the user semantic vector, the query permission representation, the document semantic vector and the document permission vector to obtain the semantic relevance score of each document fragment, and determine a preset number of candidate document fragments based on the semantic relevance score; Re-screening module: used to input each of the candidate document fragments into a pre-trained permission determination language model for permission re-determination, and obtain the corresponding refined permission score; Result generation module: used to determine the target result based on the semantic relevance score, the fine-grained permission score, and the candidate document fragments.
[0013] To achieve the above objectives, a third aspect of the present application provides an electronic device, the electronic device including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method described in the first aspect.
[0014] To achieve the above objectives, a fourth aspect of the present application provides a storage medium that stores a computer program, which, when executed by a processor, implements the method described in the first aspect.
[0015] The permission control retrieval enhancement method, apparatus, device, and storage medium proposed in this application obtain user query data, obtain the user request context based on the user query data, and obtain the user semantic vector and query permission representation corresponding to the user request context; obtain the document semantic vector and document permission vector of each document fragment in the vector database, perform a preliminary query based on the user semantic vector, query permission representation, document semantic vector, and document permission vector to obtain the semantic relevance score of each document fragment, and determine a preset number of candidate document fragments based on the semantic relevance score; input at least each candidate document fragment into a pre-trained permission judgment large language model for permission re-judgment to obtain the corresponding fine permission score; and determine the target result based on the semantic relevance score, fine permission score, and candidate document fragments. This application combines semantic relevance with permission matching degree to calculate the semantic relevance score of document fragments. In the preliminary query stage, it can not only filter out content that matches the semantics of the user query, but also simultaneously consider the compatibility between user permissions and document permissions, achieving dual precise filtering of permissions and semantics, effectively improving the fineness of permission management. Meanwhile, after the initial query, only a predetermined number of highly semantically relevant candidate document fragments are selected for subsequent processes, rather than including all documents in the processing scope, significantly reducing the scale of content requiring permission determination. The permission re-determination stage only focuses on candidate document fragments, inputting them into a pre-trained permission determination language model to perform refined permission scoring, outputting scoring results that are more in line with the actual scenario, rather than relying on simple permission tag matching. Finally, the target result is determined by combining the semantic relevance score and the refined permission score, which not only ensures the accuracy of permission determination, but also avoids the computational power and memory consumption caused by retrieving a large number of unauthorized documents, significantly reducing the overall computational overhead and achieving a dual optimization of permission management granularity and computational efficiency. Attached Figure Description
[0016] Figure 1 This is a flowchart of the access control and retrieval enhancement method provided in the embodiments of this application.
[0017] Figure 2 This is a schematic diagram of the access control and retrieval enhancement system corresponding to the access control and retrieval enhancement method provided in the embodiments of this application.
[0018] Figure 3 This is a flowchart illustrating the process of obtaining the document permission vector for each document fragment in the vector database, as provided in an embodiment of this application.
[0019] Figure 4 This is a flowchart provided in this application embodiment for obtaining the semantic relevance score of each document fragment through preliminary query based on user semantic vector, query permission representation, document semantic vector and document permission vector.
[0020] Figure 5 This is a flowchart provided in an embodiment of the present application, in which at least each candidate document fragment is input into a pre-trained permission determination language model for permission re-determination to obtain the corresponding refined permission score.
[0021] Figure 6 This is a flowchart of the training process of the permission determination large language model provided in the embodiments of this application.
[0022] Figure 7 This is a flowchart illustrating the target determination result based on semantic relevance score, fine-grained permission score, and candidate document fragments provided in the embodiments of this application.
[0023] Figure 8 This is an overall flowchart of the access control and retrieval enhancement method provided in the embodiments of this application.
[0024] Figure 9 This is a block diagram of the access control and retrieval enhancement device provided in another embodiment of this application.
[0025] Figure 10 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0027] It should be noted that although functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart.
[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0029] First, let's analyze some of the terms used in this application: Artificial Intelligence (AI) is a new branch of computer science that studies, develops, and applies theories, methods, technologies, and systems to simulate, extend, and expand human intelligence. It aims to understand the essence of intelligence and produce intelligent machines that can react in a way similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. AI can simulate the information processes of human consciousness and thought. Furthermore, AI utilizes digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceiving the environment, acquiring knowledge, and using that knowledge to achieve optimal results.
[0030] The Retrieval-augmented Generation (RAG) system achieves precise access control through data layering and isolation, and bitmap indexing technology. It defines types such as super administrators and business roles, and divides permission granularity according to operation and data scope. The core function is to parse user roles during the retrieval phase, filter unauthorized data, ensure the security of sensitive information, and adapt to the data access compliance requirements of various scenarios such as healthcare and finance.
[0031] In related technologies, RAG (Research Authority) permission management mainly has two architectures: The first is the front-end gateway mode, which performs coarse-grained user-level control through an independent permission service before retrieval. Only after this control is approved can the standard process begin. The specific workflow includes: a user submits a natural language query to the system, and the request is first sent to an independent permission management service. This service verifies the user's identity (e.g., via a token) and makes a judgment based on a predefined, usually static, rule base (e.g., Access Control Lists (ACLs) or Role-Based Access Control (RBAC) policies). The granularity of the judgment is usually "whether the user has permission to access the entire knowledge base" or "whether the user has permission to access a specific knowledge category." If the user's permissions are not met, the request is directly rejected, and an "Access Denied" error message is returned, terminating the process. If the user's permissions are met, the request is allowed and enters the standard RAG process. The allowed request undergoes query encoding, vector similarity retrieval, and finally, the large language model generates the answer, which is then returned to the user.
[0032] The second approach is post-filtering. After retrieval, fine-grained matching and filtering are performed based on the permission tags of document fragments and user attributes. Only content that the user is authorized to access is used to generate the answer. The specific process includes: the user submits a query, which directly enters the retrieval module of the RAG system. Based on vector similarity, the system retrieves the Top-K most relevant candidate document fragments from the knowledge base. The system checks the permission tag information attached to each candidate document fragment and precisely matches it with the current user's attributes. Based on the matching results, all document fragments that the user is not authorized to access (i.e., fragments where the user attributes and document tags do not match) are eliminated. The remaining document fragments after filtering are used as context and fed into the generation model to obtain the final answer.
[0033] However, both of these methods rely on hard-coded static rules or tags for permission matching, failing to understand the deeper semantics of permission policies, document content, and user context. For example, when faced with complex policies like "This document is only accessible to core project members during the project execution period," which require logical reasoning based on dynamic states across multiple dimensions, accurate and flexible judgments are impossible. The first method, employing a coarse-grained "all or nothing" control, may lead to overexposure of information or undue denial of legitimate access; while the second method's filtering is refined to the document level, it struggles to handle the sensitivity differences between different paragraphs within the same document. Furthermore, both methods treat permission determination as a pre- or post-filtering step independent of semantic retrieval, resulting in a disconnect between permission judgment and content semantics. This separation can not only affect the relevance of search results due to premature filtering but also waste computational resources by retrieving a large number of related documents that the user lacks permission to access. Moreover, under both methods, any adjustment to the permission policy or any expansion of the business scenario requires technical personnel to manually modify rules, update tags, or re-tagged documents. This highly manual approach not only has high maintenance costs and low iteration efficiency, but is also prone to oversights, making it difficult for the system to respond quickly to dynamic changes in business needs.
[0034] Based on this, embodiments of this application provide a method, apparatus, device, and storage medium for enhanced access control retrieval. The method involves acquiring user query data, obtaining the user request context based on the user query data, and acquiring the user semantic vector and query permission representation corresponding to the user request context. It also involves acquiring the document semantic vector and document permission vector for each document fragment in a vector database, performing a preliminary query based on the user semantic vector, query permission representation, document semantic vector, and document permission vector to obtain a semantic relevance score for each document fragment, and determining a preset number of candidate document fragments based on the semantic relevance score. At least one candidate document fragment is input into a pre-trained permission determination language model for permission re-determination to obtain a corresponding refined permission score. Finally, the target result is determined based on the semantic relevance score, the refined permission score, and the candidate document fragments. This application combines semantic relevance with permission matching to calculate the semantic relevance score of document fragments. In the preliminary query stage, it can not only filter out content that semantically matches the user query but also simultaneously consider the compatibility between user permissions and document permissions, achieving dual precise filtering of permissions and semantics, effectively improving the granularity of access control. Meanwhile, after the initial query, only a predetermined number of highly semantically relevant candidate document fragments are selected for subsequent processes, rather than including all documents in the processing scope, significantly reducing the scale of content requiring permission determination. The permission re-determination stage only focuses on candidate document fragments, inputting them into a pre-trained permission determination language model to perform refined permission scoring, outputting scoring results that are more in line with the actual scenario, rather than relying on simple permission tag matching. Finally, the target result is determined by combining the semantic relevance score and the refined permission score, which not only ensures the accuracy of permission determination, but also avoids the computational power and memory consumption caused by retrieving a large number of unauthorized documents, significantly reducing the overall computational overhead and achieving a dual optimization of permission management granularity and computational efficiency.
[0035] This application provides a method, apparatus, device, and storage medium for enhanced access control retrieval, which are described in detail through the following embodiments. First, the method for enhanced access control retrieval in this application is described.
[0036] This application's embodiments can acquire and process relevant data based on artificial intelligence (AI) technology. AI is the theory, methods, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can react in a way similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess perception, reasoning, and decision-making capabilities.
[0037] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0038] The permission control and retrieval enhancement method provided in this application relates to the field of permission management technology. This method can be applied to a terminal, a server, or a computer program running on either the terminal or the server. For example, the computer program can be a native program or software module in an operating system; it can be a native application (APP), i.e., a program that needs to be installed in the operating system to run, such as a client that supports permission control and retrieval enhancement, i.e., a program that only needs to be downloaded to a browser environment to run; or it can be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of application, module, or plugin. The terminal communicates with the server via a network. This permission control and retrieval enhancement method can be executed by the terminal or the server, or by the terminal and the server working together.
[0039] In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, or smartwatch, etc. Additionally, the terminal can also be a smart in-vehicle device. This smart in-vehicle device applies the access control and retrieval enhancement method of this embodiment to provide related services and improve the driving experience. The server can be an independent server, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms; it can also be a service node in a blockchain system, where the service nodes in the blockchain system form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). The terminal and the server can be connected via Bluetooth, Universal Serial Bus (USB), or a network, etc., and this embodiment does not impose any limitations.
[0040] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0041] The following describes the permission control and retrieval enhancement method in the embodiments of this application.
[0042] Figure 1 This is an optional flowchart of the access control and retrieval enhancement method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps 110 to 140. It is also understood that this embodiment... Figure 1 The order of steps 110 to 140 is not specifically limited. The order of steps can be adjusted or some steps can be reduced or added according to actual needs.
[0043] Step 110: Obtain user query data, obtain the user request context based on the user query data, and obtain the user semantic vector and query permission representation corresponding to the user request context.
[0044] In one embodiment, reference is made to Figure 2 , Figure 2 This is a schematic diagram of the permission control retrieval enhancement system corresponding to the permission control retrieval enhancement method provided in this application embodiment, including: a request receiving and context building module, a permission-aware retrieval device, an intelligent permission determination module, a fusion timing module, and a generator.
[0045] The request receiving and context construction module serves as the system entry point. It receives user query data and obtains the user request context based on the query data. Specifically, this includes: retrieving context data from the user query data, which includes at least one of user identity attributes, dynamic session information, and environmental network information; and obtaining the user request context based on the user query data and the context data. The context data can be actively collected or provided by the user.
[0046] The request receiving and context construction module serves as the system entry point, directly connected to the user terminal. It is responsible for receiving the user's raw text query as user query data and constructing a comprehensive user request context based on this data. The specific process is as follows: Key context data is extracted from the user query data. Data can be supplemented through either proactive collection or user-provided supplementation, ensuring the richness and completeness of the context information. This context data includes at least three categories: user identity attributes (such as user ID, department, role, security level, and other core identity information), dynamic session information (such as the current task type, historical session records, access time, and other real-time interaction data), and environmental network information (such as the trustworthiness of the accessing device, network location, and other environment-related data). Then, the received raw user query data and the collected context data are structurally integrated, redundant information is removed, and key data is correlated to form a user request context containing "query intent + user profile + interaction background + environmental characteristics." Finally, the raw query and the constructed user request context are packaged and synchronously sent to the downstream permission-aware retrieval system for subsequent precise processing.
[0047] In one embodiment, reference is made to Figure 2 The permission-aware retrieval system, as the core module for permission control during the retrieval phase, is directly connected to the vector knowledge base. It performs approximate nearest neighbor search through a joint mechanism of semantic matching and permission constraints, performing preliminary permission pruning during the retrieval process, filtering out unauthorized document fragments, significantly reducing the amount of invalid data processed by downstream modules, and balancing retrieval accuracy and processing efficiency. The core of this module lies in its deep coupling of the retrieval system with the permission system. Unlike related technologies that only focus on semantic matching, this system places permission verification at the forefront of the retrieval process.
[0048] When constructing a vector knowledge base, for each document in the vector database, each document contains a corresponding document fragment. For each document fragment, a document semantic vector and a document permission vector are generated. The document permission vector is a fixed-length numeric vector encoding document access rules, essentially a document's "permission fingerprint," facilitating rapid matching and verification with user permissions later. (Refer to...) Figure 3 , Figure 3 This is a flowchart of obtaining the document permission vector of each document fragment in the vector database according to an embodiment of this application, which specifically includes the following steps: Step 310: If the document fragment includes metadata or tag attributes, extract the permission attribute data from the metadata or tag attributes.
[0049] In one embodiment, a combination of automatic extraction, rule supplementation, and manual collaboration is used to collect permission attribute data from document fragments, ensuring that permission rules are comprehensive and accurate. Automatic extraction is prioritized. If a document fragment contains metadata or tag attributes, core permission attribute data is directly extracted from it. This includes key rules such as accessible departments (e.g., R&D, Marketing, Finance), associated business projects (e.g., Project A, Project B), access approval requirements (e.g., whether approval is required, approval stages), and data ownership, forming a basic set of permission attributes. If a document fragment lacks metadata or tag attributes, the system's predefined permission rule library is activated, automatically matching permission attributes according to business scenarios and data types. For example, for financial industry documents, the "customer privacy data" permission tag is associated by default; for project documents, the access permissions of the corresponding project group are automatically bound. For complex scenarios with ambiguous permission rules or special data types, such as cross-departmental collaborative documents or documents containing multi-dimensional sensitive information, a large language model is used for deep analysis of the document content. Simultaneously, security auditors are involved to precisely define permission attribute boundaries and supplement special permission constraints, such as access restricted to specific positions or time limits, ensuring the accuracy of permission attribute data.
[0050] Step 320: Perform pre-defined information regular expression matching on the document fragment to obtain the secret level data.
[0051] In one embodiment, for document fragments, regular expression matching is used to perform regular expression matching on preset information to achieve automated and refined determination of secret level data, wherein the preset information may be sensitive information. The specific process is as follows: The system employs regular expression matching to perform sensitive information matching. It has a built-in component covering various types of sensitive content, including personal privacy (such as ID card numbers, mobile phone numbers, bank card numbers), core business data (such as revenue data, technology patents), and classified information (such as internal procedures, unpublished plans). The system scans and matches each sentence of the entire document fragment. If sensitive information is matched, a security level is configured according to the degree of sensitivity. For example, if core privacy data such as ID card numbers or bank card numbers are matched, it is directly classified as "Confidential"; if ordinary business statistics are matched, it is classified as "Internal"; if no sensitive information is matched, it is initially classified as "Public" by default. The initial classification result is then calibrated and optimized based on predefined security level rules for the business scenario. For example, for corporate strategic planning documents, even if no explicit sensitive information is matched, the classification is still upgraded to "Confidential" according to the rules; for documents intended for external communication, the "Internal" level is downgraded to "Public". The system also supports user-defined rules to adapt to the security level determination needs of specific business scenarios, ultimately determining the security level of the document fragment. It is understood that the above preset information is only an example and does not represent a limitation.
[0052] Step 330: Encode the permission attribute data and the security level data respectively to obtain the permission attribute encoded value and the security level encoded value. Concatenate the permission attribute encoded value and the security level encoded value to obtain the document permission vector.
[0053] In one embodiment, the permission attribute data and security level data obtained above are encoded using an encoding method adapted to different data types, converting the permission attribute data and security level data into numerical vectors, and then forming a complete document permission vector through ordered concatenation.
[0054] For permission attribute data, a differentiated encoding strategy is adopted for different types of permission attributes. For example, list-type attributes (such as accessible departments, associated projects) use multi-hot encoding. For instance, if the entire company's departments are set as [R&D Department, Marketing Department, Finance Department, Human Resources Department], and a document is accessible only to the R&D and Marketing departments, then the department attribute is encoded as [1,1,0,0]; if all departments are allowed access, then it is encoded as [1,1,1,1]. Boolean-type attributes (such as whether approval is required) use binary encoding, with "yes" encoded as 1 and "no" encoded as 0. Time-sensitive attributes (such as access validity period) use timestamp encoding, converting the start and end times of the validity period into corresponding digital stamps to ensure the computability of the time dimension. After encoding, the encoding results of all permission attributes are integrated to form a unified format of permission attribute encoding values.
[0055] For secret level data, a numerical coding method is used for ordered level attributes such as public, internal, and confidential. The data is mapped to fixed values according to the level, such as public = 0.0, internal = 0.5, confidential = 1.0, and top secret = 1.5. This ensures that the difference in level can be intuitively reflected by the size of the numerical value, and generates secret level code values.
[0056] Finally, the permission attribute codes and security level codes can be sequentially concatenated according to the preset order of list-type attribute codes, boolean-type attribute codes, time-sensitive attribute codes, and security level codes to form a standardized document permission vector of fixed length. For example, if the permission attribute code of a document is [1,1,0,0,1] (department [1,1,0,0] + whether approval is required [1]), and the security level code is [0.5], then the final document permission vector is [1,1,0,0,1,0.5]. After generation, it is bound to the document semantic vector of the document fragment and stored in the vector knowledge base.
[0057] In one embodiment, after receiving the user request context, a user semantic vector corresponding to the user request context needs to be generated. This user semantic vector is generated in the same way as the document semantic vector, and the vector dimensions are also the same. Additionally, a query permission representation corresponding to the user request context is generated. This query permission representation is a vector with the exact same dimensions as the document permission vector, representing the current user's permission characteristics. Specifically, based on the user information provided by the request receiving and context construction module, such as user department = R&D department, user security level = internal, current project = project A, etc., it can be mapped into a numeric vector using a lightweight encoder or the same encoding rules described above. For example, the generated query permission representation is [1,0,0,0.5,1,0].
[0058] Step 120: Obtain the document semantic vector and document permission vector of each document fragment in the vector database. Perform a preliminary query based on the user semantic vector, query permission representation, document semantic vector and document permission vector to obtain the semantic relevance score of each document fragment, and determine a preset number of candidate document fragments based on the semantic relevance score.
[0059] In one embodiment, each document fragment in the vector database needs to be matched against the user query data. Therefore, refer to... Figure 4 , Figure 4 This is a flowchart provided in this application embodiment for obtaining the semantic relevance score of each document fragment through preliminary querying based on user semantic vectors, query permission representations, document semantic vectors, and document permission vectors. The flowchart specifically includes the following steps: Step 410: For each document fragment, calculate the vector distance between the user semantic vector and the document semantic vector to obtain the semantic distance, and calculate the vector distance between the query permission representation and the document permission vector to obtain the permission distance.
[0060] In one embodiment, semantic distance is first calculated. The similarity calculation, such as cosine distance or Euclidean distance, is performed between the user semantic vector generated from the user query data and the document semantic vector corresponding to each document fragment. The smaller the semantic distance, the higher the match between the user's query intent and the document fragment content. Next, permission distance is calculated. The query permission representation generated from the permission attributes in the user request context is extracted and compared with the document permission vector of each document fragment. The same distance metric as the semantic distance can be used to calculate the permission distance. The smaller the permission distance, the higher the fit between the user's permissions and the document access rules.
[0061] Understandably, these two distance calculation processes are executed independently to ensure the accuracy of their respective results, and all calculations are performed efficiently in the vector database, which can meet the needs of rapid processing of massive candidate document fragments.
[0062] Step 420: Perform a weighted summation of the semantic distance and the permission distance to obtain the semantic relevance score.
[0063] In one embodiment, a joint distance metric mechanism is used to integrate semantic distance and permission distance. The semantic relevance score of each document fragment is obtained by weighted summation, and the initial pruning of the retrieval stage is completed at the same time.
[0064] The weighted calculation process is expressed as: semantic relevance score = semantic distance + λ * permission distance. Here, an adjustable weight coefficient λ is introduced to flexibly control the strictness of permission constraints. The larger the value of λ, the higher the proportion of permission distance in the joint score, and the stricter the permission constraints. The value of λ can be dynamically adjusted according to the business scenario. For example, the value of λ in sensitive industries such as finance and healthcare is higher than that in ordinary office scenarios.
[0065] After calculating the semantic relevance score of each document fragment to the user's query data, preliminary pruning and filtering are performed. All document fragments are sorted according to their semantic relevance scores, and a predetermined number (e.g., Top-K) of the best-scoring fragments are selected as candidate fragments. This filters out a large number of semantically related but clearly mismatched documents from the retrieval source. Examples include a user's department not matching the document's accessible department, or a user's security level being lower than the document's confidentiality level. For ambiguous permission conditions requiring deep reasoning, such as "whether it is within the project's validity period" or "whether the user is a relevant collaborator," these are not included in this pruning logic and will be left for refined judgment in subsequent modules. This reduces the downstream processing pressure while ensuring the accuracy and comprehensiveness of the pruning.
[0066] As can be seen, this embodiment introduces permission judgment in the vector retrieval stage, and synchronously stores the document semantic vector and document permission vector for each document fragment in the vector knowledge base; during retrieval, the corresponding query permission representation is generated based on the user request context; and an approximate nearest neighbor search is performed by using a joint distance metric that combines semantic distance and permission distance, thereby realizing coarse-grained permission pruning in the first stage. This can filter out a large amount of content that is not authorized to be accessed at the retrieval source, significantly improving the system processing efficiency.
[0067] Step 130: Input each candidate document fragment into the pre-trained permission determination language model for permission re-determination to obtain the corresponding refined permission score.
[0068] In one embodiment, reference is made to Figure 2 Candidate document fragments form a candidate document set, and a refined permission scoring process is performed using an intelligent permission determination module. (Refer to...) Figure 5 , Figure 5This application provides a flowchart of at least the following steps: inputting each candidate document fragment into a pre-trained large language model for permission determination to re-determine permissions and obtain a corresponding refined permission score. Step 510: Obtain the permission policy of the natural language description corresponding to the candidate document fragment and the original text corresponding to the candidate document fragment.
[0069] In one embodiment, the access rules bound to each candidate document fragment are first defined. These rules, presented in natural language, clearly define core information such as the access subject, access conditions, and permission boundaries. For example, "This technical document is only accessible to full-time employees of the R&D department and within the validity period of Project A," or "Fragments containing customer privacy data require approval from the department head before access." Then, the complete original text of the document fragment is extracted, including the main text, supplementary descriptions, data tables, and all other information, ensuring that the permission determination language model can fully understand the core content and sensitivity of the document. After both types of data collection are completed, the data is associated and stored according to the unique identifier of the document fragment, ensuring the accuracy of data correspondence.
[0070] Step 520: Obtain permission determination data for each candidate document fragment based on the permission policy, the original text, the user request context, and the preset determination instructions.
[0071] In one embodiment, the permission policy, the original text of the candidate document fragment, the user request context, and the preset judgment instructions are integrated in a logical order to form well-organized permission judgment data. This ensures that the permission judgment language model can quickly capture key information. Here, the preset judgment instructions are used to indicate the output permission matching score. For example, the permission judgment data could be: "Based on the above permission policy, document content, and user context, determine whether the user has access rights to this document fragment, and output a permission matching score between 0.0 and 1.0, where a higher score indicates a higher matching degree." The resulting structured prompt text serves as the permission judgment data, containing complete judgment criteria and a clear output format, thus improving the model's inference accuracy.
[0072] In one embodiment, an example of permission determination data could be: "You are a professional permission assessment expert system. Please perform a permission matching analysis based on the following permission assessment data:" [Permission Policy] {Permission policy described in natural language for each candidate document fragment} [Document Content] {The original text corresponding to the candidate document fragment} [User Request Context] Identity Attributes: {Department / Role / Security Level in User Identity Attributes}; Dynamic Session Information: {Task Type / Session History / Access Time in Dynamic Session Information}; Environmental Network Information: {Device Trustworthiness / Network Location in Environmental Network Information} [Preset Judgment Instruction] Please output a permission matching score of 0.0-1.0 and briefly explain the reasoning logic. Specifically, it should include the following points: 1. Analyze the key permission conditions in the permission policy; 2. Compare the degree of matching between the user request context and the permission policy requirements; 3. Consider the influence of dynamic session information and environmental network information; 4. Give a comprehensive permission matching score.
[0073] Output format: {"score":X.XX,"reasoning":"brief explanation of the reasoning"} Step 530: Input the permission determination data into the permission determination language model for permission re-determination to obtain the corresponding refined permission score.
[0074] In one embodiment, reference is made to Figure 2 The permission determination language model understands the rules of permission policies based on permission determination data, analyzes the content of the original document text, and interprets the context of user requests. It performs multi-dimensional comprehensive reasoning, focusing on judging fuzzy permission conditions, such as "whether the user is within the project validity period," "whether they are a relevant collaborator," and "whether approval requirements are met," to accurately match user permissions with document access rules. After the model's reasoning is completed, its output is parsed to extract a permission matching score that conforms to a preset format. This score serves as a fine-grained permission score for the candidate document fragment. For example, the score range can be 0.0-1.0, with a higher score indicating stronger compliance of the user's access to the document fragment.
[0075] The refined permission score obtained from the above process will be combined with the previous semantic relevance score to ensure that only document content that is "semantically matched and fully compliant with permissions" is returned to the user. Taking structured permission determination data containing permission policies, document content, and user request context as input, and using deep reasoning through a large permission determination language model, refined permission scores are output, achieving permission determination based on deep semantic understanding.
[0076] In one embodiment, reference is made to Figure 6 , Figure 6 This is a flowchart of the training process of the permission determination large language model provided in the embodiments of this application, which includes at least the following steps: Step 610: Obtain training samples and expert-annotated samples.
[0077] In one embodiment, the training samples include access policy information, document content, and user context, and the label for the training samples is the expected score. First, based on a large number of permission policy templates, such as confidentiality agreements and data classification protection guidelines, a diverse range of training samples are automatically generated using a basic large language model. Each sample contains access policy information, document content, user context, and a corresponding expected score, simulating scenarios where different users access documents of different sensitivity levels, such as authorized employees and unauthorized visitors. Then, real access records, including users, documents, and access decisions, are extracted from the system's historical access logs. Implicit access policies are deduced by experts or based on rules and added to the samples, forming training samples that fit real-world application scenarios. Finally, all training samples are organized into a four-tuple format of [access policy information, document content, user context, expected score], where the expected score ranges from 0.0 to 1.0, used to indicate the degree of matching between user permissions and document access rules.
[0078] Meanwhile, for edge security cases with ambiguous permission rules and complex scenarios, such as cross-departmental collaborative permission determination and dynamic time-limited permission verification, security experts directly write samples as expert-annotated samples, clarifying access policy information, document content, user context, and accurately annotating expected scores and judgment logic to form high-value expert-annotated samples, ensuring the model's learning effect on complex scenarios.
[0079] Step 620: Input the training samples into the large language model for permission determination and process the data to obtain the prediction score and inference chain description.
[0080] In one embodiment, the processed training samples are batch-input into an initial permission-determination language model for joint training data processing combining the main task and auxiliary tasks. The main task is permission score prediction. Based on access policy information, document content, and user context in the samples, the model performs a regression task to accurately predict a permission matching score between 0.0 and 1.0, i.e., the predicted score. The auxiliary task is inference chain description generation, which forces the model to generate a concise and clear inference chain description along with the predicted score, such as "The user belongs to the R&D department and is within the project's validity period, but the security level does not meet the document confidentiality requirements, therefore the predicted score is 0.7." It can be understood that the auxiliary task, as a regularization method, forces the model to perform logical reasoning rather than simple data fitting, improving the accuracy and robustness of the main task. After the model processing is complete, the predicted score and inference chain description for each training sample are output simultaneously, providing a two-way reference for subsequent model adjustments.
[0081] Step 630: Calculate the loss value using the expected score and the predicted score, and make preliminary adjustments to the large language model for permission determination based on the loss value to obtain the first permission model.
[0082] In one embodiment, mean squared error (MSE) is used as the loss function to calculate the loss value between the expected score and the predicted score of the training samples, quantifying the degree of deviation between the model's prediction and the actual annotation. Then, the model parameters are optimized based on backpropagation of the loss value, focusing on correcting the judgment logic of scenarios with large deviations. The model is iteratively trained until the loss value converges to a preset threshold, completing the initial model tuning and obtaining a first permission model with basic permission judgment capabilities.
[0083] Step 640: Input the expert-annotated samples into the first permission model for data processing, fine-tune the first permission model, and obtain the trained permission judgment large language model.
[0084] In one embodiment, fine-tuning is performed using expert-annotated samples as the core, and a continuous learning mechanism is established to ensure the model adapts to actual application needs. Expert-annotated samples are input into the first permission model in a command-following manner, allowing the model to learn the precise judgment logic of experts, calibrating the model's permission judgment standards for complex scenarios, and making its output more consistent with actual security specifications. Based on the expected score of the expert-annotated samples and the predicted score output by the model, the loss value is recalculated, and the model parameters are adjusted accordingly to obtain a well-trained permission judgment language model, further improving the accuracy and reliability of the model's judgment.
[0085] As can be seen, the training process in this embodiment utilizes a basic large language model to automatically generate massive synthetic training data based on permission policy templates, and adopts a multi-task training paradigm that combines "main task (permission scoring regression) + auxiliary task (inference chain description generation)" to improve the model's reasoning ability and robustness, making it adaptable to permission determination requirements in complex scenarios.
[0086] In one embodiment, after the initial training of the model is completed, a continuous learning interface can be reserved to collect incremental data such as user feedback (e.g., "permission determination is accurate / inaccurate") and administrator correction instructions. The model can be incrementally trained regularly so that it can dynamically adapt to the updates of access policies and changes in application scenarios, and finally form a mature and stable permission determination language model.
[0087] In one embodiment, for systems with extremely large knowledge bases or highly complex permission determination dimensions, a multi-expert permission determination model integration architecture can be used to replace the large language model for permission determination. The system deploys specialized expert models according to permission determination dimensions, such as a "confidentiality level determination model" focusing on data confidentiality level verification, a "project relevance determination model" for project collaboration scenarios, and an "organizational relationship determination model" adapted to cross-departmental collaboration. Each expert model outputs a specific score and reasoning explanation for a particular permission dimension. The subsequent fusion and ranking module uses a weighted fusion or voting mechanism to synthesize the outputs of all expert models to generate a final, refined permission score. This improves the accuracy of permission determination in complex scenarios and enhances the interpretability of the determination results, adapting to highly complex permission management needs.
[0088] Step 140: Determine the target result based on semantic relevance score, fine-grained permission score and candidate document fragments.
[0089] In one embodiment, reference is made to Figure 7 , Figure 7 This is a flowchart illustrating the process of determining the target result based on semantic relevance score, fine-grained permission score, and candidate document fragments, as provided in this application embodiment. The flowchart specifically includes the following steps: Step 710: Perform a weighted summation of the semantic relevance score and the fine-grained permission score to obtain the candidate score corresponding to each candidate document fragment.
[0090] In one embodiment, the semantic relevance score output by the permission-aware retrieval tool and the fine-grained permission score output by the permission-determining large language model are extracted. A configurable weight parameter β (0≤β≤1) is introduced to balance the importance of semantic matching and permission compliance. For scenarios with extremely high security requirements (such as finance and healthcare), a smaller β can be set to allow permission factors to dominate the score; for ordinary scenarios, β can be appropriately increased to balance semantic relevance and permission compliance. Then, the score is calculated according to the preset formula "candidate score = β × semantic relevance score + (1-β) × fine-grained permission score".
[0091] In other words, this embodiment integrates semantic relevance scores and fine-grained permission scores through a configurable strategy to obtain candidate scores, and re-sorts and filters candidate document fragments based on the candidate scores. The overall architecture achieves deep and efficient coupling between permission control and semantic retrieval processes, ensuring the semantic matching degree and permission compliance of the output results.
[0092] Step 720: Sort the candidate scores and select at least one candidate document fragment as the target document based on the sorting results.
[0093] In one embodiment, candidate document fragments are sorted in descending order of their candidate scores, with higher-scoring fragments indicating better overall performance in both semantic matching and permission compliance. Then, a preset Top-N selection quantity is used based on actual business needs, and the top N candidate document fragments in the sorted results are selected as the target documents. Thus, this two-stage permission-aware sorting mechanism, combining coarse and fine judgment in retrieval, filters out unauthorized documents at the source and selects high-quality content through refined scoring, achieving an optimal balance between system throughput and response speed while ensuring data security.
[0094] Step 730: Based on the user query data and the target document, obtain generation prompts, input the generation prompts into the generation language model to generate content, and obtain the target result.
[0095] In one embodiment, reference is made to Figure 2 The generator combines the target document with the user query, and outputs natural language results that meet the user's needs through a generative language model. First, the user query data and the selected target document are structurally integrated, redundant information is removed, and a complete generation prompt containing the user query and authorized document fragments is constructed to ensure that the generative language model can accurately obtain the query intent and compliance reference. Then, the generation prompt is input into a preset generative language model, such as GPT or Deepseek. The model provides a targeted answer to the user query data, generating natural, fluent, and accurate target results, which are finally returned to the user. This satisfies the user's query needs while ensuring the permission compliance and information security of the output content.
[0096] In one embodiment, for a RAG system that uses knowledge graphs to enhance retrieval capabilities, the access control mechanism can be further decentralized to the entity level to achieve more granular access control. During the knowledge graph construction phase, the system not only extracts entities and relationships from documents but also attaches a structured access attribute vector to each entity node. For example, the access attribute vector could be: accessible_departments:["R&D Department","Marketing Department"], confidential_level:0.8, valid_period:["2024-01-01","2024-12-31"], etc., which are stored together with entity attributes and relationship data. During the retrieval phase, after mining entities and knowledge subgraphs related to the user query using graph traversal technology, the access control module calls the access control language model to accurately match and semantically reason with the user request context and the access attribute vectors of each entity node in the subgraph. Access control is then filtered or scored on entities and relationships, such as removing unauthorized entity nodes and reducing the weight of relationships with low access matching. It enables entity-level permission control across documents and links, and is especially suitable for query scenarios that require deep relational reasoning, further improving the granularity of permission control.
[0097] In one embodiment, reference is made to Figure 8 , Figure 8 This is an overall flowchart of the access control retrieval enhancement method provided in this application embodiment. First, the user submits a natural language query to the system, which serves as the user query data and triggers the access control retrieval enhancement process. The system receives the request and constructs a user request context. It receives the user's natural language query data, automatically collects or associates the user's context data (including user identity attributes, assigned role, current task, environmental network information, etc.), and performs structured integration based on the user query data and context data to form a complete user request context. Simultaneously, it generates the user semantic vector and query permission representation corresponding to the user request context. Then, access control-aware retrieval and candidate document fragment filtering are performed. The system retrieves the document semantic vector and document permission vector for each document fragment from the vector database. For each document fragment, it calculates the vector distance between the user semantic vector and the document semantic vector to obtain the semantic distance, and calculates the vector distance between the query permission representation and the document permission vector to obtain the permission distance. The semantic distance and permission distance are weighted and summed to obtain the semantic relevance score for each document fragment. Based on the semantic relevance score, a preset number of Top-K candidate document fragments are selected, and the semantic relevance score for each fragment is obtained simultaneously, achieving the first stage of coarse-grained access control pruning.
[0098] Next, a loop for determining permissions for candidate document fragments is initiated. Using the top-K candidate document fragments selected through screening as the processing objects, a cyclical process of re-determining permissions for each fragment is started, enabling fine-grained permission control. During this process, for the currently pending candidate document fragment, the system dynamically constructs permission determination data. This data contains three core pieces of information: the original text corresponding to the candidate document fragment, the permission policy described in natural language for the candidate document fragment, and the complete user request context. Simultaneously, preset determination instructions are embedded to indicate the output permission matching score. Then, the permission determination language model is invoked. The constructed permission determination data is input into the pre-trained permission determination language model, which outputs a fine-grained permission score. The permission determination language model performs deep inference based on the permission determination data and outputs the fine-grained permission score corresponding to the candidate document fragment, completing the second stage of fine-grained permission determination.
[0099] Next, the permission determination loop terminates, checking whether all candidate document fragments have undergone permission re-determination and output refined permission scores. If there are unprocessed candidate document fragments, processing continues; if all candidate document fragments have been processed, the loop terminates and proceeds to the next step.
[0100] Next comes score fusion and candidate document fragment re-ranking. For each candidate document fragment, its semantic relevance score and fine-grained permission score are weighted and summed according to a preset formula to obtain the candidate score for each fragment. All candidate document fragments are then sorted in descending order based on their scores. Finally, the target result is generated. The top-N candidate document fragments with the highest rankings are selected as the target documents. Based on the user query data and the target documents, a generation suggestion is constructed. This suggestion is then input into a generative language model to generate the content, yielding the target result. The generated target result is returned to the user, completing the entire closed-loop process.
[0101] The following are some specific application scenarios of the embodiments of this application.
[0102] In dynamic permission scenarios, when an employee who has left a project attempts to query the technical details of their original project, the relevant technology makes judgments based on static role tags. Since "left a project" is usually not configured as a specific tag rule, it often incorrectly allows unauthorized access. However, the embodiments of this application can use multi-dimensional background and context information to allow the large model to understand the dynamic state of "currently not in the project," thereby directly denying the access request. In context-aware scenarios, if an executive uses an unauthorized device in a public place to query the company's core strategic documents, the relevant technology cannot incorporate environmental factors such as "device trustworthiness" and "network location" into permission judgments, requiring a large number of complex rule configurations to achieve such control. The embodiments of this application can use environmental information such as device and location as context, significantly reducing the permission score during permission judgment, or directly denying access in such high-risk scenarios. In scenarios where access is based on the "work requirement" principle: When finance personnel query sensitive M&A information unrelated to their current task, existing technologies only allow access based on role permissions, failing to determine the relevance of the access intent to the task, potentially leading to the leakage of irrelevant sensitive information. This application's embodiment combines personnel background with the "current task" context to determine irrelevant information as "non-essential access," returning only task-related content to the user. In scenarios involving fuzzy policy interpretation: Faced with document policies that restrict access to "core relevant personnel only," existing technologies cannot clearly define the judgment conditions through rules because "core relevant personnel" is a vague concept. This application's embodiment can intelligently infer whether a user belongs to "core relevant personnel" based on multi-dimensional background information, achieving accurate judgment without configuring complex and extensive rules. In scenarios preventing zero results: When interns with restricted permissions query company technical issues, existing technologies typically perform a full search followed by filtering, easily resulting in empty results due to the intern's permission restrictions. This application's embodiment uses permission-aware retrieval to directly filter the most relevant content within the intern's permission scope and returns appropriate technical answers based on the sensitivity and core nature of the content, ensuring that users obtain effective information while adhering to permissions.
[0103] Therefore, to address the core shortcomings of rigid, coarse-grained, and disconnected access control rules from semantic understanding in related technologies, this application constructs an intelligent, fine-grained, and efficient access-aware retrieval enhanced generation (RAG) system. This system achieves deep integration of access control and semantic retrieval, improving the accuracy of access management and system efficiency. Specifically, access judgment is upgraded from a mechanical judgment based on static rule matching to a deep semantic understanding and reasoning mechanism based on a dedicated access judgment large language model. This access judgment large language model, as the intelligent decision-making core of the system, can parse complex access control policies described in natural language, combine the original text content of document fragments with the dynamic user request context, and achieve context-aware, interpretable, and refined access scoring. This breaks through the expressive limitations of traditional rule engines and adapts to access control needs in complex scenarios. Furthermore, access control is reconstructed from peripheral components independent of the core retrieval process (such as "pre-gateway" and "post-filter") into a core "access-aware ranking" process deeply intertwined with semantic retrieval. This improvement breaks down the barriers between permission processing and semantic processing, making permission judgment no longer an independent filtering step, but a key factor directly affecting the ranking of search results, achieving seamless integration of permission control and information retrieval processes. Furthermore, it couples the retrieval engine with permissions. During the vector knowledge base construction phase, each document fragment simultaneously stores both a document semantic vector and a document permission vector. During the retrieval phase, a query permission representation is generated based on the user request context, and an approximate nearest neighbor search is performed using a joint distance metric of "semantic distance + permission distance," achieving preliminary permission pruning during the retrieval phase. This approach concentrates the computationally expensive fine-grained judgment process of the large language model on a set of high-value candidate document fragments that have undergone coarse screening, forming a two-stage permission control process of "coarse screening - fine judgment." This significantly reduces the overall computational overhead of the system while ensuring fine-grained permission control.
[0104] The technical solution provided in this application involves acquiring user query data, obtaining the user request context based on the user query data, and acquiring the user semantic vector and query permission representation corresponding to the user request context; acquiring the document semantic vector and document permission vector of each document fragment in the vector database; performing a preliminary query based on the user semantic vector, query permission representation, document semantic vector, and document permission vector to obtain the semantic relevance score of each document fragment; determining a preset number of candidate document fragments based on the semantic relevance score; inputting at least one candidate document fragment into a pre-trained permission determination language model for permission re-determination to obtain the corresponding refined permission score; and determining the target result based on the semantic relevance score, refined permission score, and candidate document fragments. This application combines semantic relevance with permission matching degree to calculate the semantic relevance score of document fragments. In the preliminary query stage, it can not only filter out content that matches the user query semantics but also simultaneously consider the compatibility between user permissions and document permissions, achieving dual precise filtering of permissions and semantics, effectively improving the granularity of permission management. Furthermore, after the preliminary query is completed, only a preset number of highly semantically relevant candidate document fragments are selected for subsequent processes, rather than including all documents in the processing scope, significantly reducing the scale of content requiring permission determination. The permission re-determination process focuses solely on candidate document fragments, inputting them into a pre-trained permission-determination language model to perform refined permission scoring. This outputs scores that better reflect real-world scenarios, rather than relying on simple permission tag matching. Ultimately, the target result is determined by combining semantic relevance scores with the refined permission scores. This approach ensures the accuracy of permission determination while avoiding the computational and memory consumption caused by retrieving a large number of unauthorized documents, significantly reducing overall computational overhead and achieving a dual optimization of permission management granularity and computational efficiency.
[0105] This application also provides an access control and search enhancement device, which can implement the above-described access control and search enhancement method, see reference. Figure 9 The device includes: Data acquisition module 910: Used to acquire user query data, obtain user request context based on user query data, and obtain user semantic vector and query permission representation corresponding to user request context.
[0106] Preliminary screening module 920: Used to obtain the document semantic vector and document permission vector of each document fragment in the vector database. Based on the user semantic vector, query permission representation, document semantic vector and document permission vector, a preliminary query is performed to obtain the semantic relevance score of each document fragment, and a preset number of candidate document fragments are determined based on the semantic relevance score.
[0107] Re-screening module 930: Used to input at least each candidate document fragment into a pre-trained permission determination language model for permission re-determination, and obtain the corresponding refined permission score.
[0108] Result generation module 940: used to determine the target result based on semantic relevance score, fine-grained permission score and candidate document fragments.
[0109] The specific implementation of the access control retrieval enhancement device in this embodiment is basically the same as the specific implementation of the access control retrieval enhancement method described above, and will not be repeated here.
[0110] This application also provides an electronic device, including: At least one memory; At least one processor; At least one program; The program is stored in a memory, and the processor executes the at least one program to implement the access control and retrieval enhancement method described above. The electronic device can be any smart terminal, including mobile phones, tablets, personal digital assistants (PDAs), and in-vehicle computers.
[0111] Please see Figure 10 , Figure 10 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 1001 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 1002 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1002 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1002 and is called and executed by the processor 1001 using the permission control retrieval enhancement method of the embodiments of this application. Input / output interface 1003 is used to implement information input and output; The communication interface 1004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 1005 transmits information between various components of the device (e.g., processor 1001, memory 1002, input / output interface 1003, and communication interface 1004); The processor 1001, memory 1002, input / output interface 1003 and communication interface 1004 are connected to each other within the device via bus 1005.
[0112] This application embodiment also provides a storage medium that stores a computer program. When the computer program is executed by a processor, it implements the above-described enhanced access control and retrieval method.
[0113] Memory, as a non-transitory storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0114] The permission control retrieval enhancement method, apparatus, device, and storage medium proposed in this application obtain user query data, obtain the user request context based on the user query data, and obtain the user semantic vector and query permission representation corresponding to the user request context; obtain the document semantic vector and document permission vector of each document fragment in the vector database, perform a preliminary query based on the user semantic vector, query permission representation, document semantic vector, and document permission vector to obtain the semantic relevance score of each document fragment, and determine a preset number of candidate document fragments based on the semantic relevance score; input at least each candidate document fragment into a pre-trained permission judgment large language model for permission re-judgment to obtain the corresponding fine permission score; and determine the target result based on the semantic relevance score, fine permission score, and candidate document fragments. This application combines semantic relevance with permission matching degree to calculate the semantic relevance score of document fragments. In the preliminary query stage, it can not only filter out content that matches the semantics of the user query, but also simultaneously consider the compatibility between user permissions and document permissions, achieving dual precise filtering of permissions and semantics, effectively improving the fineness of permission management. Meanwhile, after the initial query, only a predetermined number of highly semantically relevant candidate document fragments are selected for subsequent processes, rather than including all documents in the processing scope, significantly reducing the scale of content requiring permission determination. The permission re-determination stage only focuses on candidate document fragments, inputting them into a pre-trained permission determination language model to perform refined permission scoring, outputting scoring results that are more in line with the actual scenario, rather than relying on simple permission tag matching. Finally, the target result is determined by combining the semantic relevance score and the refined permission score, which not only ensures the accuracy of permission determination, but also avoids the computational power and memory consumption caused by retrieving a large number of unauthorized documents, significantly reducing the overall computational overhead and achieving a dual optimization of permission management granularity and computational efficiency.
[0115] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0116] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0117] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0118] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0119] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0120] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0121] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0122] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0123] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0124] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0125] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A method for enhancing access control and retrieval, characterized in that, include: Obtain user query data, obtain user request context based on the user query data, and obtain user semantic vector and query permission representation corresponding to the user request context; Obtain the document semantic vector and document permission vector of each document fragment in the vector database. Perform a preliminary query based on the user semantic vector, the query permission representation, the document semantic vector, and the document permission vector to obtain the semantic relevance score of each document fragment. Determine a preset number of candidate document fragments based on the semantic relevance score. Each candidate document fragment is input into a pre-trained permission determination language model for permission re-determination to obtain the corresponding refined permission score; The target result is determined based on the semantic relevance score, the fine-grained permission score, and the candidate document fragments.
2. The access control and retrieval enhancement method according to claim 1, characterized in that, Retrieve the document permission vector for each document fragment in the vector database, including: If the document fragment includes metadata or tag attributes, extract permission attribute data from the metadata or tag attributes; The document fragment is subjected to a preset information regular expression match to obtain the secret level data; The permission attribute data and the security level data are encoded respectively to obtain permission attribute encoded values and security level encoded values. The document permission vector is obtained by concatenating the permission attribute encoded values and the security level encoded values.
3. The access control and retrieval enhancement method according to claim 1, characterized in that, The preliminary query based on the user semantic vector, the query permission representation, the document semantic vector, and the document permission vector to obtain the semantic relevance score of each document fragment includes: For each document fragment, the semantic distance is obtained by calculating the vector distance between the user semantic vector and the document semantic vector, and the permission distance is obtained by calculating the vector distance between the query permission representation and the document permission vector. The semantic distance and the permission distance are weighted and summed to obtain the semantic relevance score.
4. The access control and retrieval enhancement method according to claim 1, characterized in that, The step of inputting at least each of the candidate document fragments into a pre-trained permission-determination language model for permission re-determination to obtain the corresponding refined permission score includes: Obtain the permission policy of the natural language description corresponding to the candidate document fragment and the original text corresponding to the candidate document fragment; Based on the permission policy, the original text, the user request context, and the preset judgment instruction, permission judgment data corresponding to each candidate document fragment is obtained, and the preset judgment instruction is used to indicate the output permission matching score; The permission determination data is input into the permission determination language model for permission re-determination to obtain the corresponding refined permission score.
5. The access control and retrieval enhancement method according to claim 1, characterized in that, The determination of the target result based on the semantic relevance score, the fine-grained permission score, and the candidate document fragments includes: The semantic relevance score and the fine-grained permission score are weighted and summed to obtain the candidate score corresponding to each candidate document fragment; The candidate scores are sorted, and at least one candidate document fragment is selected as the target document based on the sorting result. Based on the user query data and the target document, a generation prompt is obtained. The generation prompt is then input into the generative language model to generate content, thereby obtaining the target result.
6. The enhanced access control retrieval method according to claim 1, characterized in that, The process of obtaining the user request context based on the user query data includes: Context data is obtained from the user query data, and the context data includes at least one of user identity attributes, dynamic session information, and environmental network information; The user request context is obtained based on the user query data and the context data.
7. The access control and retrieval enhancement method according to claim 1, characterized in that, The training process of the permission determination large language model includes at least the following: Obtain training samples and expert-annotated samples. The training samples include access strategy information, document content, and user context. The labels of the training samples are expected scores. The training samples are input into the permission determination language model for data processing to obtain the prediction score and inference chain description. The loss value is calculated using the expected score and the predicted score. Based on the loss value, the permission determination language model is initially adjusted to obtain the first permission model. The expert-annotated samples are input into the first permission model for data processing. The first permission model is then fine-tuned to obtain the trained permission determination language model.
8. A permission control and retrieval enhancement device, characterized in that, include: Data acquisition module: used to acquire user query data, obtain user request context based on the user query data, and obtain user semantic vector and query permission representation corresponding to the user request context; Preliminary screening module: used to obtain the document semantic vector and document permission vector of each document fragment in the vector database, perform a preliminary query based on the user semantic vector, the query permission representation, the document semantic vector and the document permission vector to obtain the semantic relevance score of each document fragment, and determine a preset number of candidate document fragments based on the semantic relevance score; Re-screening module: used to input each of the candidate document fragments into a pre-trained permission determination language model for permission re-determination, and obtain the corresponding refined permission score; Result generation module: used to determine the target result based on the semantic relevance score, the fine-grained permission score, and the candidate document fragments.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the access control retrieval enhancement method according to any one of claims 1 to 7.
10. A storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the access control retrieval enhancement method as described in any one of claims 1 to 7.