A procurement knowledge retrieval method and system based on large language model
Through the procurement knowledge retrieval method based on large language models, the fine-grained knowledge subbase and routing library structure is used to solve the problems of reduced search accuracy and insufficient information diversity in the existing technology, and efficient and accurate procurement knowledge retrieval is achieved.
Patent Information
- Application Number
- CN202411886148.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-12-20
AI Technical Summary
When faced with large-scale and complex knowledge bases, existing procurement knowledge retrieval technology has problems such as decreased search accuracy, waste of computing resources and insufficient information diversity, which is difficult to meet users' needs for comprehensiveness and multi-perspective answers.
The procurement knowledge retrieval method based on the large language model is adopted. By obtaining a large number of procurement documents and segmenting the content categories, the procurement knowledge is classified and vectorized using the pre-trained large language model, classification labels and routing corpus are generated, and fine-grained knowledge subbases and routing libraries are created to achieve rapid matching and positioning related knowledge.
It improves the accuracy, efficiency and diversity of procurement knowledge retrieval, can quickly locate relevant knowledge subbases, meet users' needs for comprehensiveness and multi-perspective answers, and significantly improves the accuracy and efficiency of searches.
Smart Images

Figure CN119336863B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of procurement data management, and in particular to a procurement knowledge retrieval method and system based on a large language model. Background Art
[0002] With the rapid development of Large Language Models (LLMs), retrieval and recall technologies have become crucial in the field of natural language processing, especially in the vertical field of procurement intelligent consulting (procurement knowledge retrieval), where they play a huge supporting role. Through the Retrieval-Augmented Generation (RAG) technology, large language models in general fields can efficiently and accurately provide specific knowledge support for procurement consulting, thereby meeting specialized application needs.
[0003] The RAG-based question-answering system combines the advantages of knowledge retrieval and large language models, and usually includes the following steps: 1. User input questions: Users ask questions through natural language, such as "What are the total procurement methods?"; 2. Retrieval stage: Use the retrieval model to retrieve relevant content from the knowledge base. The retrieval model is usually implemented through semantic retrieval technology; 3. Information processing: The retrieved content is formatted as model input for the large language model, such as in the form of question-answer pairs or context; 4. Generation stage: The large language model generates and returns answers based on the user's questions and model inputs.
[0004] In a RAG-based question-answering system, the main task of the retrieval stage is to locate content that is highly relevant to the user's question from a huge knowledge base and provide the necessary context for the generation stage. If the retrieval results can accurately cover the information required for the user's question, the large language model in the generation stage can give full play to its language understanding and generation capabilities based on these high-quality model inputs, thereby providing accurate and coherent answers. On the contrary, if the content returned in the retrieval stage is less relevant or noisy, the answer output in the generation stage may deviate from the topic or be difficult to meet user needs, and may even produce misleading answers.
[0005] Therefore, the effect of the retrieval stage directly determines the upper limit performance of the entire question-answering system. Existing retrieval technologies mainly include keyword (sparse vector) retrieval and dense vector retrieval: 1. Keyword retrieval is usually based on inverted index, and retrieval is achieved through keyword matching (such as BM25, TF-IDF). It is simple and efficient to implement, and performs well in scenarios with clear terms, but it has poor results for complex queries such as synonyms and semantic extensions; 2. Dense vector retrieval uses deep learning models to generate semantic embeddings and achieves retrieval through vector similarity (such as cosine similarity). It is good at processing semantic level associations and is suitable for complex queries, but it has high computing resource requirements, relies on specialized indexes (such as HNSW, Faiss), and requires large-scale labeled data for training.
[0006] Since existing retrieval technologies have problems with retrieval accuracy and efficiency, there is a need to optimize the retrieval process. Currently, optimization in the retrieval stage usually focuses on improving the performance of the retriever, such as improving the retrieval algorithm, optimizing vector representation, or designing a more efficient index structure; however, with the widespread application of large language models and the continuous expansion of training data, the size and complexity of the knowledge base are also growing rapidly. This growth has brought new challenges, especially in the procurement field, which are mainly reflected in the following aspects:
[0007] 1. Decreased accuracy of search results: The exponential growth of information volume has led to a significant increase in the proportion of irrelevant and redundant information in the knowledge base. Important procurement knowledge is easily overwhelmed by a large number of similar but irrelevant documents, which reduces the accuracy of retrieval. In the procurement knowledge base of specific application scenarios, there are documents with high duplication and different levels of structure; for example, procurement policies in different regions or departments may be based on the same legal framework, with only a few clauses that differ; many interpretive documents repeatedly emphasize the main content of the original policy, which makes it difficult for the searcher to distinguish between important information and redundant content, and the key information needed by users is often overwhelmed.
[0008] 2. Waste of computing resources: As the size of the knowledge base expands, the retriever needs to perform more keyword matching and vector similarity calculations. Especially in dense vector retrieval, the computational cost of high-dimensional vectors increases exponentially. If a unified search is performed, the retriever needs to process a large amount of irrelevant information, which increases computing resource consumption and reduces matching accuracy.
[0009] 3. Insufficient information diversity: The dominance of redundant information means that the results returned by the search engine are mostly documents with similar content. They lack multi-dimensional or multi-angle information and cannot meet users' needs for comprehensive and multi-perspective answers, which in turn affects procurement efficiency and decision-making quality.
[0010] In summary, the rapid growth of knowledge base size and complexity has brought multiple challenges to the search engine's retrieval of procurement knowledge, such as decreased accuracy, waste of computing resources, and insufficient information diversity. For these problems, a single optimization measure is difficult to achieve a comprehensive breakthrough. Therefore, how to provide a procurement knowledge retrieval method and system based on a large language model to improve the accuracy, efficiency, and diversity of procurement knowledge retrieval has become a technical problem that needs to be solved urgently. Summary of the invention
[0011] The technical problem to be solved by the present invention is to provide a procurement knowledge retrieval method and system based on a large language model, so as to improve the accuracy, efficiency and diversity of procurement knowledge retrieval.
[0012] In a first aspect, the present invention provides a procurement knowledge retrieval method based on a large language model, comprising the following steps:
[0013] Step S1: obtaining a large number of procurement documents, segmenting each procurement document based on content category, and obtaining a number of procurement knowledge;
[0014] Step S2: classify each procurement knowledge by using a pre-trained large language model, obtain a classification label and a procurement knowledge vector corresponding to each procurement knowledge, and generate a routing corpus for each classification label;
[0015] Step S3: creating a knowledge base including several knowledge sub-bases based on each of the classification labels, creating a routing base, storing each of the procurement knowledge and procurement knowledge vectors in the corresponding knowledge sub-base based on the classification labels, and storing each of the routing corpora in the routing base;
[0016] Step S4: obtaining an input search request, verifying the search request, parsing the search request to obtain a search statement, and matching a routing corpus from a routing library based on the search statement;
[0017] Step S5: locating a corresponding knowledge sub-base from the knowledge base based on the classification label corresponding to the routing corpus;
[0018] Step S6: matching procurement knowledge from the knowledge sub-base based on the search statement, generating search results based on the matched procurement knowledge, and displaying the search results;
[0019] Step S7: record the retrieval log in real time, optimize the large language model based on the retrieval log, encrypt the retrieval log into an encrypted log, and store and back up the encrypted log.
[0020] Furthermore, the step S1 is specifically as follows:
[0021] Obtain a large number of procurement documents and build a procurement document set based on each of the procurement documents , d n Indicates the nth purchase document;
[0022] Each procurement document is segmented based on content categories to obtain a knowledge subset including several procurement knowledge. , S i represents the knowledge subset of the i-th procurement document, s im represents the mth procurement knowledge of the i-th procurement document;
[0023] Construct a knowledge set based on each of the knowledge subsets , where n' represents the total number of knowledge subsets.
[0024] Furthermore, in step S2, the large language model is specifically used for:
[0025] Generate classification labels for procurement knowledge based on the input classification prompt words , represents the classification label of the mth procurement knowledge of the i-th procurement document, s im represents the mth procurement knowledge of the i-th procurement document, Indicates classification prompt words;
[0026] Knowledge about purchasing im Vectorize and obtain the procurement knowledge vector , Indicates im The corresponding procurement knowledge vector, Encode() represents the encoding function of the vectorized model;
[0027] Generate and classify labels based on the input question prompts Corresponding routing questions, a question set is constructed based on each of the routing questions: ;
[0028] Where Q represents a set of questions; r im Indicates the classification label The corresponding routing question; L k represents the kth knowledge category, each knowledge category corresponds to a classification label; M() represents the large language model; Indicates question prompt words;
[0029] Each of the routing questions is vectorized to obtain a routing vector , and then obtain the routing corpus including the routing question and the routing vector, Represents r im The corresponding routing vector;
[0030] In step S3, the knowledge sub-base is represented as: ;
[0031] in, represents the knowledge sub-base; s im represents the mth procurement knowledge of the i-th procurement document; Indicates im The corresponding procurement knowledge vector; L k represents the kth knowledge category, and each knowledge category corresponds to a classification label; The knowledge category representing the mth procurement knowledge of the i-th procurement document;
[0032] The routing library is represented as: ;
[0033] in, Represents the routing library; r im Indicates the classification label The corresponding routing question; Represents r im The corresponding routing vector; Q represents the question set.
[0034] Furthermore, the step S4 is specifically as follows:
[0035] The server obtains an input search request carrying an account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data; the MAC value is obtained by performing MAC calculation on the account password, user ID, device ID, timestamp and ciphertext data through a MAC algorithm; the signature data is obtained by signing the MAC value with a private key, and the server stores a public key matching the private key; the ciphertext data is obtained by encrypting the search statement in combination with the RSA algorithm and the 3DES algorithm;
[0036] The server parses the search request to obtain the account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data, verifies the signature data through the public key, and then performs integrity check on the account password, user ID, device ID, timestamp and ciphertext data through the MAC value, then performs timeliness check through the timestamp, performs legality check on the device ID through the preset device management table, and performs correctness check on the account password through the preset user management table. After the check passes, the server matches the mobile phone number from the user management table through the user ID, sends a verification code to the mobile phone number, displays the verification code input rules through the authentication interface, verifies the characters entered in the authentication interface based on the verification code input rules, and verifies that the search statement is obtained by decrypting the ciphertext data in combination with the RSA algorithm and the 3DES algorithm;
[0037] The large language model rewrites the search sentence into a standard query sentence according to the input rewriting prompt word, and then encodes the standard query sentence into a standard query vector: ; ;
[0038] in, represents a standard query statement; M() represents a large language model; q represents a search statement; Indicates rewriting prompt words; Represents a standard query vector; Encode() represents the encoding function of the vectorized model;
[0039] Based on the vector dot product, first similarities between the standard query vector and the routing vectors in each routing corpus in the routing library are calculated respectively, and a first similarity set is constructed based on each of the first similarities;
[0040] Based on the first similarity set, selecting routing questions of N1 routing corpora with the highest first similarity;
[0041] The step S6 is specifically as follows:
[0042] Based on the vector dot product, respectively calculate the second similarity between the standard query vector corresponding to the search statement and each procurement knowledge vector in the located knowledge sub-base, and construct a second similarity set based on each of the second similarities;
[0043] Based on the second similarity set, N2 procurement knowledge with the highest second similarity are selected, search results are generated based on each of the selected procurement knowledge, and the search results are displayed in real time through a visual interface.
[0044] Furthermore, the step S7 is specifically as follows:
[0045] Record in real time at least the search logs including the search request, search statement, search result, search time, search duration and user feedback, and train and optimize the large language model based on the search logs generated during the preset training cycle selection period;
[0046] The retrieval log is converted from plain text into hexadecimal data, the number 8 and the letter B in the hexadecimal data are swapped, and the number 3 and the letter E are swapped to obtain primary encrypted data, the primary encrypted data is encrypted into secondary encrypted data by using the CAST-128 algorithm, each character of the secondary encrypted data is cyclically shifted right by 7 bits to obtain third-level encrypted data, the third-level encrypted data is encrypted into an encrypted log by using the RC6 algorithm, the encrypted log is stored in a specified path, and the encrypted log is backed up in a distributed manner.
[0047] In a second aspect, the present invention provides a procurement knowledge retrieval system based on a large language model, comprising the following modules:
[0048] A procurement document segmentation module is used to obtain a large number of procurement documents, segment each procurement document based on content categories, and obtain a number of procurement knowledge;
[0049] A procurement knowledge classification module is used to classify each procurement knowledge through a pre-trained large language model, obtain a classification label and a procurement knowledge vector corresponding to each procurement knowledge, and generate a routing corpus for each classification label;
[0050] A knowledge organization module, used to create a knowledge base including a plurality of knowledge sub-bases based on each of the classification labels, create a routing base, store each of the procurement knowledge and procurement knowledge vectors in the corresponding knowledge sub-base based on the classification labels, and store each of the routing corpora in the routing base;
[0051] A routing corpus matching module is used to obtain an input search request, verify the search request, parse the search request to obtain a search statement, and match the routing corpus from the routing library based on the search statement;
[0052] A knowledge sub-base locating module, used for locating a corresponding knowledge sub-base from a knowledge base based on the classification label corresponding to the routing corpus;
[0053] A search result generation module, used to match procurement knowledge from the knowledge sub-base based on the search statement, generate search results based on the matched procurement knowledge, and display the search results;
[0054] The retrieval log management module is used to record the retrieval log in real time, optimize the large language model based on the retrieval log, encrypt the retrieval log into an encrypted log, and store and back up the encrypted log.
[0055] Furthermore, the procurement document segmentation module is specifically used for:
[0056] Obtain a large number of procurement documents and build a procurement document set based on each of the procurement documents , d n Indicates the nth purchase document;
[0057] Each procurement document is segmented based on content categories to obtain a knowledge subset including several procurement knowledge. , S i represents the knowledge subset of the i-th procurement document, s im represents the mth procurement knowledge of the i-th procurement document;
[0058] Construct a knowledge set based on each of the knowledge subsets , where n' represents the total number of knowledge subsets.
[0059] Furthermore, in the procurement knowledge classification module, the large language model is specifically used for:
[0060] Generate classification labels for procurement knowledge based on the input classification prompt words , represents the classification label of the mth procurement knowledge of the i-th procurement document, s im represents the mth procurement knowledge of the i-th procurement document, Indicates classification prompt words;
[0061] Knowledge about purchasing im Vectorize and obtain the procurement knowledge vector , Indicates im The corresponding procurement knowledge vector, Encode() represents the encoding function of the vectorized model;
[0062] Generate and classify labels based on the input question prompts Corresponding routing questions, a question set is constructed based on each of the routing questions: ;
[0063] Where Q represents a set of questions; r im Indicates the classification label The corresponding routing question; L k represents the kth knowledge category, each knowledge category corresponds to a classification label; M() represents the large language model; Indicates question prompt words;
[0064] Each of the routing questions is vectorized to obtain a routing vector , and then obtain the routing corpus including the routing question and the routing vector, Represents r im The corresponding routing vector;
[0065] In the knowledge organization module, the knowledge sub-base is represented as: ;
[0066] in, represents the knowledge sub-base; s im represents the mth procurement knowledge of the i-th procurement document; Indicates im The corresponding procurement knowledge vector; L k represents the kth knowledge category, and each knowledge category corresponds to a classification label; The knowledge category representing the mth procurement knowledge of the i-th procurement document;
[0067] The routing library is represented as: ;
[0068] in, Represents the routing library; r im Indicates the classification label The corresponding routing question; Represents r im The corresponding routing vector; Q represents the question set.
[0069] Furthermore, the routing corpus matching module is specifically used for:
[0070] The server obtains an input search request carrying an account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data; the MAC value is obtained by performing MAC calculation on the account password, user ID, device ID, timestamp and ciphertext data through a MAC algorithm; the signature data is obtained by signing the MAC value with a private key, and the server stores a public key matching the private key; the ciphertext data is obtained by encrypting the search statement in combination with the RSA algorithm and the 3DES algorithm;
[0071] The server parses the search request to obtain the account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data, verifies the signature data through the public key, and then performs integrity check on the account password, user ID, device ID, timestamp and ciphertext data through the MAC value, then performs timeliness check through the timestamp, performs legality check on the device ID through the preset device management table, and performs correctness check on the account password through the preset user management table. After the check passes, the server matches the mobile phone number from the user management table through the user ID, sends a verification code to the mobile phone number, displays the verification code input rules through the authentication interface, verifies the characters entered in the authentication interface based on the verification code input rules, and verifies that the search statement is obtained by decrypting the ciphertext data in combination with the RSA algorithm and the 3DES algorithm;
[0072] The large language model rewrites the search sentence into a standard query sentence according to the input rewriting prompt word, and then encodes the standard query sentence into a standard query vector: ; ;
[0073] in, represents a standard query statement; M() represents a large language model; q represents a search statement; Indicates rewriting prompt words; Represents a standard query vector; Encode() represents the encoding function of the vectorized model;
[0074] Based on the vector dot product, first similarities between the standard query vector and the routing vectors in each routing corpus in the routing library are calculated respectively, and a first similarity set is constructed based on each of the first similarities;
[0075] Based on the first similarity set, selecting routing questions of N1 routing corpora with the highest first similarity;
[0076] The search result generation module is specifically used for:
[0077] Based on the vector dot product, respectively calculate the second similarity between the standard query vector corresponding to the search statement and each procurement knowledge vector in the located knowledge sub-base, and construct a second similarity set based on each of the second similarities;
[0078] Based on the second similarity set, N2 procurement knowledge with the highest second similarity are selected, search results are generated based on each of the selected procurement knowledge, and the search results are displayed in real time through a visual interface.
[0079] Furthermore, the retrieval log management module is specifically used for:
[0080] Record in real time at least the search logs including the search request, search statement, search result, search time, search duration and user feedback, and train and optimize the large language model based on the search logs generated during the preset training cycle selection period;
[0081] The retrieval log is converted from plain text into hexadecimal data, the number 8 and the letter B in the hexadecimal data are swapped, and the number 3 and the letter E are swapped to obtain primary encrypted data, the primary encrypted data is encrypted into secondary encrypted data by using the CAST-128 algorithm, each character of the secondary encrypted data is cyclically shifted right by 7 bits to obtain third-level encrypted data, the third-level encrypted data is encrypted into an encrypted log by using the RC6 algorithm, the encrypted log is stored in a specified path, and the encrypted log is backed up in a distributed manner.
[0082] The advantages of the present invention are:
[0083] 1. By acquiring a large number of procurement documents, each procurement document is segmented based on the content category to obtain a number of procurement knowledge, and then each procurement knowledge is classified through a pre-trained large language model to obtain the classification label and procurement knowledge vector corresponding to each procurement knowledge, and a routing corpus of each classification label is generated, and each procurement knowledge and procurement knowledge vector is stored in the corresponding knowledge sub-base based on the classification label, and each routing corpus is stored in the routing base; then the input search request is acquired and verified, and the search request is parsed to obtain the search statement, and the routing corpus is matched from the routing base based on the search statement, and then the corresponding knowledge sub-base is located from the knowledge base based on the classification label corresponding to the routing corpus, and finally the procurement knowledge is matched from the knowledge sub-base based on the search statement, and each procurement knowledge vector is matched based on the matching procurement knowledge vector. The procurement knowledge is generated and displayed based on the search results; that is, the knowledge base is divided into fine-grained parts through classification labels, and the procurement knowledge classified by the large language model is stored in the corresponding knowledge sub-base in the knowledge base, which effectively distinguishes important information from redundant content, and the routing corpus used to locate the knowledge sub-base is stored in the routing base. When the user needs to retrieve procurement knowledge, the routing corpus can be quickly matched based on the search statement, and then the relevant knowledge sub-base can be quickly located based on the routing corpus, and the corresponding procurement knowledge can be quickly retrieved from the knowledge sub-base. There is no need to search the entire knowledge base as traditionally, and different routing corpora can retrieve multi-dimensional procurement knowledge from different knowledge sub-bases, which can meet the user's needs for comprehensiveness and multi-perspective answers, and ultimately greatly improve the accuracy, efficiency and diversity of procurement knowledge retrieval.
[0084] 2. The search request is set to carry account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data; the MAC value is calculated by MAC algorithm on account password, user ID, device ID, timestamp and ciphertext data; the signature data is obtained by signing the MAC value with the private key, and the server stores the public key matching the private key; the ciphertext data is obtained by encrypting the search statement in combination with the RSA algorithm and the 3DES algorithm; the signature data can be subsequently verified by the public key, the integrity can be checked by the MAC value, the timeliness can be checked by the timestamp, the legitimacy can be checked by the device ID, the correctness can be checked by the account password, the verification code can be sent by matching the user ID with the mobile phone number for verification, and the search statement can be encrypted in combination with the RSA algorithm and the 3DES algorithm to prevent the search statement from being stolen and tampered with in plain text. At least 8 security measures (public and private keys, MAC values, timestamps, device IDs, account passwords, verification codes, RSA algorithms, and 3DES algorithms) are taken before and after to avoid performing search operations based on illegal search requests, which greatly improves the security of the search.
[0085] 3. By recording in real time at least the search request, search statement, search result, search time, search duration and user feedback, the search log can be easily traced later.
[0086] 4. The large language model is trained and optimized by selecting the retrieval logs generated during the preset training cycle, further improving the accuracy of procurement knowledge retrieval.
[0087] 5. The retrieval log is converted from plain text to hexadecimal data, the number 8 and the letter B in the hexadecimal data are swapped, and the number 3 and the letter E are swapped to obtain the first-level encrypted data, the first-level encrypted data is encrypted into the second-level encrypted data by the CAST-128 algorithm, each character of the second-level encrypted data is cyclically shifted to the right by 7 bits to obtain the third-level encrypted data, the third-level encrypted data is encrypted into an encrypted log by the RC6 algorithm, the encrypted log is stored in a specified path, and the encrypted log is backed up in a distributed manner; that is, multiple data transformation rules and encryption algorithms are adopted. If the corresponding data transformation rules or encryption algorithms are not known, the encrypted log cannot be cracked. At least 8 security measures are taken before and after (hexadecimal, swapping the number 8 and the letter B, swapping the number 3 and the letter E, CAST-128 algorithm, character cyclic shift direction, character cyclic shift bit number, RC6 algorithm, distributed backup) to prevent the retrieval log from being stolen and tampered with in plain text, greatly improving the security of retrieval log storage. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.
[0089] Figure 1 It is a flow chart of a procurement knowledge retrieval method based on a large language model of the present invention.
[0090] Figure 2 It is a structural diagram of a procurement knowledge retrieval system based on a large language model of the present invention.
[0091] Figure 3 It is a schematic diagram comparing the pretreatment stage of the present invention with the traditional method.
[0092] Figure 4 Schematic diagram of the comparison between the recall stage of the present invention and the traditional method. DETAILED DESCRIPTION
[0093] The technical solution in the embodiments of the present application has the following overall idea: the knowledge base is divided into fine-grained parts through classification labels, and the procurement knowledge classified by the large language model is stored in the corresponding knowledge sub-base in the knowledge base, so as to effectively distinguish important information from redundant content, and the routing corpus used to locate the knowledge sub-base is stored in the routing base. When the user needs to retrieve procurement knowledge, the routing corpus can be quickly matched based on the search statement, and then the relevant knowledge sub-base can be quickly located based on the routing corpus, and the corresponding procurement knowledge can be quickly retrieved from the knowledge sub-base without searching the entire knowledge base as traditionally. Different routing corpora can retrieve multi-dimensional procurement knowledge from different knowledge sub-bases, which can meet the user's needs for comprehensiveness and multi-perspective answers, so as to improve the accuracy, efficiency and diversity of procurement knowledge retrieval.
[0094] Please refer to Figures 1 to 4 As shown, a preferred embodiment of a procurement knowledge retrieval method based on a large language model of the present invention includes the following steps:
[0095] Step S1: obtaining a large number of procurement documents, segmenting each procurement document based on content category, and obtaining a number of procurement knowledge;
[0096] Step S2: classify each procurement knowledge by using the pre-trained large language model, obtain the classification label and procurement knowledge vector corresponding to each procurement knowledge, and generate the routing corpus of each classification label; that is, the present invention utilizes the powerful semantic understanding and generation capabilities of the large language model to automatically classify and vectorize procurement knowledge, which not only saves a lot of manpower and material resources, but also ensures the consistency of procurement knowledge division, and provides an efficient and accurate data foundation for subsequent procurement knowledge routing and procurement knowledge retrieval;
[0097] Step S3: Based on each of the classification labels, a knowledge base including several knowledge sub-bases is created, a routing base is created, each of the procurement knowledge and procurement knowledge vectors is stored in the corresponding knowledge sub-base based on the classification label, and each of the routing corpora is stored in the routing base; dynamic routing of multiple routing corpora is performed through the routing base, which can effectively ensure the diversity of the returned search results, and play a bridge role in connecting user search and knowledge base. The similarity between the search statement input by the user and the vectorized routing corpus is used to dynamically determine the most relevant knowledge sub-base, realize efficient procurement knowledge positioning, and significantly improve the accuracy and efficiency of retrieval;
[0098] Step S4: obtaining an input search request, verifying the search request, parsing the search request to obtain a search statement, and matching a routing corpus from a routing library based on the search statement;
[0099] Step S5: locating a corresponding knowledge sub-base from the knowledge base based on the classification label corresponding to the routing corpus;
[0100] Step S6: matching procurement knowledge from the knowledge sub-base based on the search statement, generating search results based on the matched procurement knowledge, and displaying the search results;
[0101] Step S7: record the retrieval log in real time, optimize the large language model based on the retrieval log, encrypt the retrieval log into an encrypted log, and store and back up the encrypted log.
[0102] The step S1 is specifically as follows:
[0103] Obtain a large number of procurement documents and build a procurement document set based on each of the procurement documents , d n Indicates the nth purchase document;
[0104] Each procurement document is segmented based on content categories to obtain a knowledge subset including several procurement knowledge. , which is convenient for subsequent efficient retrieval, S i represents the knowledge subset of the i-th procurement document, s im represents the mth procurement knowledge of the i-th procurement document;
[0105] Construct a knowledge set based on each of the knowledge subsets Where n' represents the total number of knowledge subsets.
[0106] In step S2, the large language model is specifically used for:
[0107] Generate classification labels for procurement knowledge based on the input classification prompt words , represents the classification label of the mth procurement knowledge of the i-th procurement document, s im represents the mth procurement knowledge of the i-th procurement document, Indicates classification prompt words;
[0108] An example of the classification prompt words is "Please determine the government procurement knowledge category to which the following text belongs based on its content. You can only choose from the following categories: laws and regulations, policy interpretation, procurement process, case analysis."
[0109] Knowledge about purchasing im Vectorize and obtain the procurement knowledge vector , Indicates im The corresponding procurement knowledge vector, Encode() represents the encoding function of the vectorization model, and the vectorization model can be selected as BGE or ACGE;
[0110] Generate and classify labels based on the input question prompts Corresponding routing questions, a question set is constructed based on each of the routing questions: ;
[0111] Where Q represents a set of questions; r im Indicates the classification label The corresponding routing question; L k represents the kth knowledge category, each knowledge category corresponds to a classification label; M() represents the large language model; Indicates question prompt words;
[0112] An example of the question prompt is "Please summarize the key points of the case based on the text fragment of the following case analysis and simulate a user question."
[0113] Each of the routing questions is vectorized to obtain a routing vector , and then obtain the routing corpus including the routing question and the routing vector, which is used to ensure the accuracy, efficiency and diversity of the retrieval, Represents r im The corresponding routing vector;
[0114] In step S3, the knowledge sub-base is represented as: ;
[0115] in, represents the knowledge sub-base; s im represents the mth procurement knowledge of the i-th procurement document; Indicates im The corresponding procurement knowledge vector; L k represents the kth knowledge category, and each knowledge category corresponds to a classification label; The knowledge category representing the mth procurement knowledge of the i-th procurement document;
[0116] The routing library is represented as: ;
[0117] in, Represents the routing library; r im Indicates the classification label The corresponding routing question; Represents r im The corresponding routing vector; Q represents the question set.
[0118] That is, each record in the routing library contains routing questions, routing vectors, and knowledge categories (classification labels). It can efficiently extract the corresponding classification labels from the question vectors with the highest similarity, thereby locating the knowledge sub-library that needs to be retrieved, avoiding the inefficiency and low relevance of full-library retrieval, and providing an accurate retrieval range for procurement knowledge search, thereby improving overall performance.
[0119] The step S4 is specifically as follows:
[0120] The server obtains an input search request carrying an account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data; the MAC value is obtained by performing MAC calculation on the account password, user ID, device ID, timestamp and ciphertext data through a MAC algorithm; the signature data is obtained by signing the MAC value with a private key, and the server stores a public key matching the private key; the ciphertext data is obtained by encrypting the search statement in combination with the RSA algorithm and the 3DES algorithm;
[0121] The server parses the search request to obtain the account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data, verifies the signature data through the public key, and then performs integrity check on the account password, user ID, device ID, timestamp and ciphertext data through the MAC value, then performs timeliness check through the timestamp, performs legality check on the device ID through the preset device management table, and performs correctness check on the account password through the preset user management table. After the check passes, the server matches the mobile phone number from the user management table through the user ID, sends a verification code to the mobile phone number, displays the verification code input rules through the authentication interface, verifies the characters entered in the authentication interface based on the verification code input rules, and verifies that the search statement is obtained by decrypting the ciphertext data in combination with the RSA algorithm and the 3DES algorithm;
[0122] The retrieval request is set to carry the account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data; the MAC value is obtained by MAC calculation of the account password, user ID, device ID, timestamp and ciphertext data through the MAC algorithm; the signature data is obtained by signing the MAC value with the private key, and the server stores the public key matching the private key; the ciphertext data is obtained by encrypting the retrieval statement in combination with the RSA algorithm and the 3DES algorithm; the signature data can be subsequently verified by the public key, the integrity is checked by the MAC value, the timeliness is checked by the timestamp, the legitimacy is checked by the device ID, the correctness is checked by the account password, the verification code is sent by matching the user ID with the mobile phone number for verification, and the retrieval statement is encrypted in combination with the RSA algorithm and the 3DES algorithm to prevent the retrieval statement from being stolen and tampered with in plain text. At least 8 security measures (public and private keys, MAC values, timestamps, device IDs, account passwords, verification codes, RSA algorithms, and 3DES algorithms) are taken before and after to avoid performing retrieval operations based on illegal retrieval requests, which greatly improves the security of retrieval.
[0123] The large language model rewrites the search sentence into a standard query sentence according to the input rewriting prompt word, and then encodes the standard query sentence into a standard query vector: ; ;
[0124] in, represents a standard query statement; M() represents a large language model; q represents a search statement; Indicates rewriting prompt words; Represents a standard query vector; Encode() represents the encoding function of the vectorized model;
[0125] The rewriting prompt word is exemplified as "Please rewrite the following user query into a more standardized form for easier retrieval."
[0126] Based on the vector dot product, first similarities between the standard query vector and the routing vectors in each routing corpus in the routing library are calculated respectively, and a first similarity set is constructed based on each of the first similarities: ;
[0127] ;
[0128] in, represents the first similarity; represents the first similarity set;
[0129] Based on the first similarity set, select N1 routing questions of the routing corpus with the highest first similarity; the value of N1 is preferably 10;
[0130] The step S6 is specifically as follows:
[0131] Based on the vector dot product, the second similarities of the standard query vector corresponding to the search statement and each procurement knowledge vector in the located knowledge sub-base are calculated respectively, and a second similarity set is constructed based on each of the second similarities: ; ;
[0132] in, represents the second similarity; represents a second similarity set;
[0133] Based on the second similarity set, N2 procurement knowledge with the highest second similarity are selected, search results are generated based on each of the selected procurement knowledge, and the search results are displayed in real time through a visual interface.
[0134] The step S7 is specifically as follows:
[0135] Record in real time at least the search logs including the search request, search statement, search result, search time, search duration and user feedback, and train and optimize the large language model based on the search logs generated during the preset training cycle selection period;
[0136] By recording in real time a search log including at least the search request, search statement, search results, search time, search duration and user feedback, it is easy to trace the source later.
[0137] The large language model is trained and optimized by selecting the retrieval logs generated during the preset training cycle, further improving the accuracy of procurement knowledge retrieval.
[0138] The retrieval log is converted from plain text into hexadecimal data, the number 8 and the letter B in the hexadecimal data are swapped, and the number 3 and the letter E are swapped to obtain primary encrypted data, the primary encrypted data is encrypted into secondary encrypted data by using the CAST-128 algorithm, each character of the secondary encrypted data is cyclically shifted right by 7 bits to obtain third-level encrypted data, the third-level encrypted data is encrypted into an encrypted log by using the RC6 algorithm, the encrypted log is stored in a specified path, and the encrypted log is backed up in a distributed manner.
[0139] The retrieval log is converted from plain text to hexadecimal data, the number 8 and the letter B in the hexadecimal data are swapped, and the number 3 and the letter E are swapped to obtain the first-level encrypted data, the first-level encrypted data is encrypted into the second-level encrypted data by the CAST-128 algorithm, each character of the second-level encrypted data is cyclically shifted to the right by 7 bits to obtain the third-level encrypted data, the third-level encrypted data is encrypted into an encrypted log by the RC6 algorithm, the encrypted log is stored in a specified path, and the encrypted log is backed up in a distributed manner; that is, multiple data transformation rules and encryption algorithms are adopted. If the corresponding data transformation rules or encryption algorithms are not known, the encrypted log cannot be cracked. At least 8 security measures are taken before and after (hexadecimal, swapping the number 8 and the letter B, swapping the number 3 and the letter E, CAST-128 algorithm, character cyclic shift direction, character cyclic shift bit number, RC6 algorithm, distributed backup) to prevent the retrieval log from being stolen and tampered with in plain text, greatly improving the security of retrieval log storage.
[0140] A preferred embodiment of a procurement knowledge retrieval system based on a large language model of the present invention includes the following modules:
[0141] A procurement document segmentation module is used to obtain a large number of procurement documents, segment each procurement document based on content categories, and obtain a number of procurement knowledge;
[0142] The procurement knowledge classification module is used to classify each procurement knowledge through a pre-trained large language model, obtain the classification label and procurement knowledge vector corresponding to each procurement knowledge, and generate the routing corpus of each classification label; that is, the present invention uses the powerful semantic understanding and generation capabilities of the large language model to automatically classify and vectorize procurement knowledge, which not only saves a lot of manpower and material resources, but also ensures the consistency of procurement knowledge division, and provides an efficient and accurate data foundation for subsequent procurement knowledge routing and procurement knowledge retrieval;
[0143] The knowledge organization module is used to create a knowledge base including several knowledge sub-bases based on each of the classification labels, create a routing base, store each of the procurement knowledge and procurement knowledge vectors in the corresponding knowledge sub-base based on the classification labels, and store each of the routing corpora in the routing base; the routing base is used to perform dynamic routing of multiple routing corpora, which can effectively ensure the diversity of the returned search results, and play a bridge role in connecting user search and knowledge base. The similarity between the search statement input by the user and the vectorized routing corpus is used to dynamically determine the most relevant knowledge sub-base, realize efficient procurement knowledge positioning, and significantly improve the accuracy and efficiency of the search;
[0144] A routing corpus matching module is used to obtain an input search request, verify the search request, parse the search request to obtain a search statement, and match the routing corpus from the routing library based on the search statement;
[0145] A knowledge sub-base locating module, used for locating a corresponding knowledge sub-base from a knowledge base based on the classification label corresponding to the routing corpus;
[0146] A search result generation module, used to match procurement knowledge from the knowledge sub-base based on the search statement, generate search results based on the matched procurement knowledge, and display the search results;
[0147] The retrieval log management module is used to record the retrieval log in real time, optimize the large language model based on the retrieval log, encrypt the retrieval log into an encrypted log, and store and back up the encrypted log.
[0148] The procurement document segmentation module is specifically used for:
[0149] Obtain a large number of procurement documents and build a procurement document set based on each of the procurement documents , d n Indicates the nth purchase document;
[0150] Each procurement document is segmented based on content categories to obtain a knowledge subset including several procurement knowledge. , which is convenient for subsequent efficient retrieval, S irepresents the knowledge subset of the i-th procurement document, s im represents the mth procurement knowledge of the i-th procurement document;
[0151] Construct a knowledge set based on each of the knowledge subsets , where n' represents the total number of knowledge subsets.
[0152] In the procurement knowledge classification module, the large language model is specifically used for:
[0153] Generate classification labels for procurement knowledge based on the input classification prompt words , represents the classification label of the mth procurement knowledge of the i-th procurement document, s im represents the mth procurement knowledge of the i-th procurement document, Indicates classification prompt words;
[0154] An example of the classification prompt words is "Please determine the government procurement knowledge category to which the following text belongs based on its content. You can only choose from the following categories: laws and regulations, policy interpretation, procurement process, case analysis."
[0155] Knowledge about purchasing im Vectorize and obtain the procurement knowledge vector , Indicates im The corresponding procurement knowledge vector, Encode() represents the encoding function of the vectorization model, and the vectorization model can be selected as BGE or ACGE;
[0156] Generate and classify labels based on the input question prompts Corresponding routing questions, a question set is constructed based on each of the routing questions: ;
[0157] Where Q represents a set of questions; r im Indicates the classification label The corresponding routing question; L k represents the kth knowledge category, each knowledge category corresponds to a classification label; M() represents the large language model; Indicates question prompt words;
[0158] An example of the question prompt is "Please summarize the key points of the case based on the text fragment of the following case analysis and simulate a user question."
[0159] Each of the routing questions is vectorized to obtain a routing vector , and then obtain the routing corpus including the routing question and the routing vector, which is used to ensure the accuracy, efficiency and diversity of the retrieval, Represents rim The corresponding routing vector;
[0160] In the knowledge organization module, the knowledge sub-base is represented as: ;
[0161] in, represents the knowledge sub-base; s im represents the mth procurement knowledge of the i-th procurement document; Indicates im The corresponding procurement knowledge vector; L k represents the kth knowledge category, and each knowledge category corresponds to a classification label; The knowledge category representing the mth procurement knowledge of the i-th procurement document;
[0162] The routing library is represented as: ;
[0163] in, Represents the routing library; r im Indicates the classification label The corresponding routing question; Represents r im The corresponding routing vector; Q represents the question set.
[0164] That is, each record in the routing library contains routing questions, routing vectors, and knowledge categories (classification labels). It can efficiently extract the corresponding classification labels from the question vectors with the highest similarity, thereby locating the knowledge sub-library that needs to be retrieved, avoiding the inefficiency and low relevance of full-library retrieval, and providing an accurate retrieval range for procurement knowledge search, thereby improving overall performance.
[0165] The routing corpus matching module is specifically used for:
[0166] The server obtains an input search request carrying an account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data; the MAC value is obtained by performing MAC calculation on the account password, user ID, device ID, timestamp and ciphertext data through a MAC algorithm; the signature data is obtained by signing the MAC value with a private key, and the server stores a public key matching the private key; the ciphertext data is obtained by encrypting the search statement in combination with the RSA algorithm and the 3DES algorithm;
[0167] The server parses the search request to obtain the account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data, verifies the signature data through the public key, and then performs integrity check on the account password, user ID, device ID, timestamp and ciphertext data through the MAC value, then performs timeliness check through the timestamp, performs legality check on the device ID through the preset device management table, and performs correctness check on the account password through the preset user management table. After the check passes, the server matches the mobile phone number from the user management table through the user ID, sends a verification code to the mobile phone number, displays the verification code input rules through the authentication interface, verifies the characters entered in the authentication interface based on the verification code input rules, and verifies that the search statement is obtained by decrypting the ciphertext data in combination with the RSA algorithm and the 3DES algorithm;
[0168] The retrieval request is set to carry the account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data; the MAC value is obtained by MAC calculation of the account password, user ID, device ID, timestamp and ciphertext data through the MAC algorithm; the signature data is obtained by signing the MAC value with the private key, and the server stores the public key matching the private key; the ciphertext data is obtained by encrypting the retrieval statement in combination with the RSA algorithm and the 3DES algorithm; the signature data can be subsequently verified by the public key, the integrity is checked by the MAC value, the timeliness is checked by the timestamp, the legitimacy is checked by the device ID, the correctness is checked by the account password, the verification code is sent by matching the user ID with the mobile phone number for verification, and the retrieval statement is encrypted in combination with the RSA algorithm and the 3DES algorithm to prevent the retrieval statement from being stolen and tampered with in plain text. At least 8 security measures (public and private keys, MAC values, timestamps, device IDs, account passwords, verification codes, RSA algorithms, and 3DES algorithms) are taken before and after to avoid performing retrieval operations based on illegal retrieval requests, which greatly improves the security of retrieval.
[0169] The large language model rewrites the search sentence into a standard query sentence according to the input rewriting prompt word, and then encodes the standard query sentence into a standard query vector: ; ;
[0170] in, represents a standard query statement; M() represents a large language model; q represents a search statement; Indicates rewriting prompt words; Represents a standard query vector; Encode() represents the encoding function of the vectorized model;
[0171] The rewriting prompt word is exemplified as "Please rewrite the following user query into a more standardized form for easier retrieval."
[0172] Based on the vector dot product, first similarities between the standard query vector and the routing vectors in each routing corpus in the routing library are calculated respectively, and a first similarity set is constructed based on each of the first similarities: ; ;
[0173] in, represents the first similarity; represents the first similarity set;
[0174] Based on the first similarity set, select N1 routing questions of the routing corpus with the highest first similarity; the value of N1 is preferably 10;
[0175] The search result generation module is specifically used for:
[0176] Based on the vector dot product, the second similarities of the standard query vector corresponding to the search statement and each procurement knowledge vector in the located knowledge sub-base are calculated respectively, and a second similarity set is constructed based on each of the second similarities: ; ;
[0177] in, represents the second similarity; represents a second similarity set;
[0178] Based on the second similarity set, N2 procurement knowledge with the highest second similarity are selected, search results are generated based on each of the selected procurement knowledge, and the search results are displayed in real time through a visual interface.
[0179] The retrieval log management module is specifically used for:
[0180] Record in real time at least the search logs including the search request, search statement, search result, search time, search duration and user feedback, and train and optimize the large language model based on the search logs generated during the preset training cycle selection period;
[0181] By recording in real time a search log including at least the search request, search statement, search results, search time, search duration and user feedback, it is easy to trace the source later.
[0182] The large language model is trained and optimized by selecting the retrieval logs generated during the preset training cycle, further improving the accuracy of procurement knowledge retrieval.
[0183] The retrieval log is converted from plain text into hexadecimal data, the number 8 and the letter B in the hexadecimal data are swapped, and the number 3 and the letter E are swapped to obtain primary encrypted data, the primary encrypted data is encrypted into secondary encrypted data by using the CAST-128 algorithm, each character of the secondary encrypted data is cyclically shifted right by 7 bits to obtain third-level encrypted data, the third-level encrypted data is encrypted into an encrypted log by using the RC6 algorithm, the encrypted log is stored in a specified path, and the encrypted log is backed up in a distributed manner.
[0184] The retrieval log is converted from plain text to hexadecimal data, the number 8 and the letter B in the hexadecimal data are swapped, and the number 3 and the letter E are swapped to obtain the first-level encrypted data, the first-level encrypted data is encrypted into the second-level encrypted data by the CAST-128 algorithm, each character of the second-level encrypted data is cyclically shifted to the right by 7 bits to obtain the third-level encrypted data, the third-level encrypted data is encrypted into an encrypted log by the RC6 algorithm, the encrypted log is stored in a specified path, and the encrypted log is backed up in a distributed manner; that is, multiple data transformation rules and encryption algorithms are adopted. If the corresponding data transformation rules or encryption algorithms are not known, the encrypted log cannot be cracked. At least 8 security measures are taken before and after (hexadecimal, swapping the number 8 and the letter B, swapping the number 3 and the letter E, CAST-128 algorithm, character cyclic shift direction, character cyclic shift bit number, RC6 algorithm, distributed backup) to prevent the retrieval log from being stolen and tampered with in plain text, greatly improving the security of retrieval log storage.
[0185] In summary, the advantages of the present invention are:
[0186] 1. By acquiring a large number of procurement documents, each procurement document is segmented based on the content category to obtain a number of procurement knowledge, and then each procurement knowledge is classified through a pre-trained large language model to obtain the classification label and procurement knowledge vector corresponding to each procurement knowledge, and a routing corpus of each classification label is generated, and each procurement knowledge and procurement knowledge vector is stored in the corresponding knowledge sub-base based on the classification label, and each routing corpus is stored in the routing base; then the input search request is acquired and verified, and the search request is parsed to obtain the search statement, and the routing corpus is matched from the routing base based on the search statement, and then the corresponding knowledge sub-base is located from the knowledge base based on the classification label corresponding to the routing corpus, and finally the procurement knowledge is matched from the knowledge sub-base based on the search statement, and each procurement knowledge vector is matched based on the matching procurement knowledge vector. The procurement knowledge is generated and displayed based on the search results; that is, the knowledge base is divided into fine-grained parts through classification labels, and the procurement knowledge classified by the large language model is stored in the corresponding knowledge sub-base in the knowledge base, which effectively distinguishes important information from redundant content, and the routing corpus used to locate the knowledge sub-base is stored in the routing base. When the user needs to retrieve procurement knowledge, the routing corpus can be quickly matched based on the search statement, and then the relevant knowledge sub-base can be quickly located based on the routing corpus, and the corresponding procurement knowledge can be quickly retrieved from the knowledge sub-base. There is no need to search the entire knowledge base as traditionally, and different routing corpora can retrieve multi-dimensional procurement knowledge from different knowledge sub-bases, which can meet the user's needs for comprehensiveness and multi-perspective answers, and ultimately greatly improve the accuracy, efficiency and diversity of procurement knowledge retrieval.
[0187] 2. The search request is set to carry account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data; the MAC value is calculated by MAC algorithm on account password, user ID, device ID, timestamp and ciphertext data; the signature data is obtained by signing the MAC value with the private key, and the server stores the public key matching the private key; the ciphertext data is obtained by encrypting the search statement in combination with the RSA algorithm and the 3DES algorithm; the signature data can be subsequently verified by the public key, the integrity can be checked by the MAC value, the timeliness can be checked by the timestamp, the legitimacy can be checked by the device ID, the correctness can be checked by the account password, the verification code can be sent by matching the user ID with the mobile phone number for verification, and the search statement can be encrypted in combination with the RSA algorithm and the 3DES algorithm to prevent the search statement from being stolen and tampered with in plain text. At least 8 security measures (public and private keys, MAC values, timestamps, device IDs, account passwords, verification codes, RSA algorithms, and 3DES algorithms) are taken before and after to avoid performing search operations based on illegal search requests, which greatly improves the security of the search.
[0188] 3. By recording in real time at least the search request, search statement, search result, search time, search duration and user feedback, the search log can be easily traced later.
[0189] 4. The large language model is trained and optimized by selecting the retrieval logs generated during the preset training cycle, further improving the accuracy of procurement knowledge retrieval.
[0190] 5. The retrieval log is converted from plain text to hexadecimal data, the number 8 and the letter B in the hexadecimal data are swapped, and the number 3 and the letter E are swapped to obtain the first-level encrypted data, the first-level encrypted data is encrypted into the second-level encrypted data by the CAST-128 algorithm, each character of the second-level encrypted data is cyclically shifted to the right by 7 bits to obtain the third-level encrypted data, the third-level encrypted data is encrypted into an encrypted log by the RC6 algorithm, the encrypted log is stored in a specified path, and the encrypted log is backed up in a distributed manner; that is, multiple data transformation rules and encryption algorithms are adopted. If the corresponding data transformation rules or encryption algorithms are not known, the encrypted log cannot be cracked. At least 8 security measures are taken before and after (hexadecimal, swapping the number 8 and the letter B, swapping the number 3 and the letter E, CAST-128 algorithm, character cyclic shift direction, character cyclic shift bit number, RC6 algorithm, distributed backup) to prevent the retrieval log from being stolen and tampered with in plain text, greatly improving the security of retrieval log storage.
[0191] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A procurement knowledge retrieval method based on a large language model, characterized by: The steps include: Step S1: obtaining a large number of procurement documents, segmenting each procurement document based on content category, and obtaining a number of procurement knowledge; Step S2: classify each procurement knowledge by using a pre-trained large language model, obtain a classification label and a procurement knowledge vector corresponding to each procurement knowledge, and generate a routing corpus for each classification label; Step S3: creating a knowledge base including several knowledge sub-bases based on each of the classification labels, creating a routing base, storing each of the procurement knowledge and procurement knowledge vectors in the corresponding knowledge sub-base based on the classification labels, and storing each of the routing corpora in the routing base; Step S4: obtaining an input search request, verifying the search request, parsing the search request to obtain a search statement, and matching a routing corpus from a routing library based on the search statement; Step S5: locating a corresponding knowledge sub-base from the knowledge base based on the classification label corresponding to the routing corpus; Step S6: matching procurement knowledge from the knowledge sub-base based on the search statement, generating search results based on the matched procurement knowledge, and displaying the search results; Step S7: record the retrieval log in real time, optimize the large language model based on the retrieval log, encrypt the retrieval log into an encrypted log, and store and back up the encrypted log; The step S1 is specifically as follows: Obtain a large number of procurement documents, and construct a procurement document set D={d1,d2,…,d n }, d n Indicates the nth purchase document; Each procurement document is segmented based on content categories to obtain a knowledge subset S including several procurement knowledge. i ={s i1 ,s i2 ,…,s im },S i represents the knowledge subset of the i-th procurement document, s im represents the mth procurement knowledge of the i-th procurement document; Construct a knowledge set based on each of the knowledge subsets , where n' represents the total number of knowledge subsets; In step S2, the large language model is specifically used for: Generate classification labels for procurement knowledge based on the input classification prompt words , represents the classification label of the mth procurement knowledge of the i-th procurement document, s im represents the mth procurement knowledge of the i-th procurement document, Indicates classification prompt words; Knowledge about purchasing im Vectorize and obtain the procurement knowledge vector , Indicates im The corresponding procurement knowledge vector, Encode() represents the encoding function of the vectorized model; Generate and classify labels based on the input question prompts Corresponding routing questions, a question set is constructed based on each of the routing questions: ; Where Q represents a set of questions; r im Indicates the classification label The corresponding routing question; L k represents the kth knowledge category, each knowledge category corresponds to a classification label; M() represents the large language model; Indicates question prompt words; Each of the routing questions is vectorized to obtain a routing vector , and then obtain the routing corpus including the routing question and the routing vector, Represents r im The corresponding routing vector; The step S4 is specifically as follows: The server obtains an input search request carrying an account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data; the MAC value is obtained by performing MAC calculation on the account password, user ID, device ID, timestamp and ciphertext data through a MAC algorithm; the signature data is obtained by signing the MAC value with a private key, and the server stores a public key matching the private key; the ciphertext data is obtained by encrypting the search statement in combination with the RSA algorithm and the 3DES algorithm; The server parses the search request to obtain the account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data, verifies the signature data through the public key, and then performs integrity check on the account password, user ID, device ID, timestamp and ciphertext data through the MAC value, then performs timeliness check through the timestamp, performs legality check on the device ID through the preset device management table, and performs correctness check on the account password through the preset user management table. After the check passes, the server matches the mobile phone number from the user management table through the user ID, sends a verification code to the mobile phone number, displays the verification code input rules through the authentication interface, verifies the characters entered in the authentication interface based on the verification code input rules, and verifies that the search statement is obtained by decrypting the ciphertext data in combination with the RSA algorithm and the 3DES algorithm; The large language model rewrites the search sentence into a standard query sentence according to the input rewriting prompt word, and then encodes the standard query sentence into a standard query vector: ; ; in, represents a standard query statement; M() represents a large language model; q represents a search statement; Indicates rewriting prompt words; Represents a standard query vector; Encode() represents the encoding function of the vectorized model; Based on the vector dot product, first similarities between the standard query vector and the routing vectors in each routing corpus in the routing library are calculated respectively, and a first similarity set is constructed based on each of the first similarities; Based on the first similarity set, routing questions of N1 routing corpora with the highest first similarities are selected.
2. The procurement knowledge retrieval method based on a large language model as claimed in claim 1, characterized in that: In step S3, the knowledge sub-base is represented as: ; in, represents the knowledge sub-base; s im represents the mth procurement knowledge of the i-th procurement document; Indicates im The corresponding procurement knowledge vector; L k represents the kth knowledge category, and each knowledge category corresponds to a classification label; Represents the classification label of the mth procurement knowledge of the i-th procurement document; The routing library is represented as: ; in, Represents the routing library; r im Indicates the classification label The corresponding routing question; Represents r im The corresponding routing vector; Q represents the question set.
3. The procurement knowledge retrieval method based on a large language model as claimed in claim 1, characterized in that: The step S6 is specifically as follows: Based on the vector dot product, respectively calculate the second similarity between the standard query vector corresponding to the search statement and each procurement knowledge vector in the located knowledge sub-base, and construct a second similarity set based on each of the second similarities; Based on the second similarity set, N2 procurement knowledge with the highest second similarity are selected, search results are generated based on each of the selected procurement knowledge, and the search results are displayed in real time through a visual interface.
4. The procurement knowledge retrieval method based on a large language model as claimed in claim 1, characterized in that: The step S7 is specifically as follows: Record in real time at least the search logs including the search request, search statement, search result, search time, search duration and user feedback, and train and optimize the large language model based on the search logs generated during the preset training cycle selection period; The retrieval log is converted from plain text into hexadecimal data, the number 8 and the letter B in the hexadecimal data are swapped, and the number 3 and the letter E are swapped to obtain primary encrypted data, the primary encrypted data is encrypted into secondary encrypted data by using the CAST-128 algorithm, each character of the secondary encrypted data is cyclically shifted right by 7 bits to obtain third-level encrypted data, the third-level encrypted data is encrypted into an encrypted log by using the RC6 algorithm, the encrypted log is stored in a specified path, and the encrypted log is backed up in a distributed manner.
5. A procurement knowledge retrieval system based on a large language model, characterized by: Includes the following modules: A procurement document segmentation module is used to obtain a large number of procurement documents, segment each procurement document based on content categories, and obtain a number of procurement knowledge; A procurement knowledge classification module is used to classify each procurement knowledge through a pre-trained large language model, obtain a classification label and a procurement knowledge vector corresponding to each procurement knowledge, and generate a routing corpus for each classification label; A knowledge organization module, used to create a knowledge base including a plurality of knowledge sub-bases based on each of the classification labels, create a routing base, store each of the procurement knowledge and procurement knowledge vectors in the corresponding knowledge sub-base based on the classification labels, and store each of the routing corpora in the routing base; A routing corpus matching module is used to obtain an input search request, verify the search request, parse the search request to obtain a search statement, and match the routing corpus from the routing library based on the search statement; A knowledge sub-base locating module, used for locating a corresponding knowledge sub-base from a knowledge base based on the classification label corresponding to the routing corpus; A search result generation module, used to match procurement knowledge from the knowledge sub-base based on the search statement, generate search results based on the matched procurement knowledge, and display the search results; A retrieval log management module, used for recording retrieval logs in real time, optimizing a large language model based on the retrieval logs, encrypting the retrieval logs into encrypted logs, and storing and backing up the encrypted logs; The procurement document segmentation module is specifically used for: Obtain a large number of procurement documents, and construct a procurement document set D={d1,d2,…,d n }, d n Indicates the nth purchase document; Each procurement document is segmented based on content categories to obtain a knowledge subset S including several procurement knowledge. i ={s i1 ,s i2 ,…,s im },S i represents the knowledge subset of the i-th procurement document, s im represents the mth procurement knowledge of the i-th procurement document; Construct a knowledge set based on each of the knowledge subsets , where n' represents the total number of knowledge subsets; In the procurement knowledge classification module, the large language model is specifically used for: Generate classification labels for procurement knowledge based on the input classification prompt words , represents the classification label of the mth procurement knowledge of the i-th procurement document, s im represents the mth procurement knowledge of the i-th procurement document, Indicates classification prompt words; Knowledge about purchasing im Vectorize and obtain the procurement knowledge vector , Indicates im The corresponding procurement knowledge vector, Encode() represents the encoding function of the vectorized model; Generate and classify labels based on the input question prompts Corresponding routing questions, a question set is constructed based on each of the routing questions: ; Where Q represents a set of questions; r im Indicates the classification label The corresponding routing question; L k represents the kth knowledge category, each knowledge category corresponds to a classification label; M() represents the large language model; Indicates question prompt words; Each of the routing questions is vectorized to obtain a routing vector , and then obtain the routing corpus including the routing question and the routing vector, Represents r im The corresponding routing vector; The routing corpus matching module is specifically used for: The server obtains an input search request carrying an account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data; the MAC value is obtained by performing MAC calculation on the account password, user ID, device ID, timestamp and ciphertext data through a MAC algorithm; the signature data is obtained by signing the MAC value with a private key, and the server stores a public key matching the private key; the ciphertext data is obtained by encrypting the search statement in combination with the RSA algorithm and the 3DES algorithm; The server parses the search request to obtain the account password, user ID, device ID, timestamp, ciphertext data, MAC value and signature data, verifies the signature data through the public key, and then performs integrity check on the account password, user ID, device ID, timestamp and ciphertext data through the MAC value, then performs timeliness check through the timestamp, performs legality check on the device ID through the preset device management table, and performs correctness check on the account password through the preset user management table. After the check passes, the server matches the mobile phone number from the user management table through the user ID, sends a verification code to the mobile phone number, displays the verification code input rules through the authentication interface, verifies the characters entered in the authentication interface based on the verification code input rules, and verifies that the search statement is obtained by decrypting the ciphertext data in combination with the RSA algorithm and the 3DES algorithm; The large language model rewrites the search sentence into a standard query sentence according to the input rewriting prompt word, and then encodes the standard query sentence into a standard query vector: ; ; in, represents a standard query statement; M() represents a large language model; q represents a search statement; Indicates rewriting prompt words; Represents a standard query vector; Encode() represents the encoding function of the vectorized model; Based on the vector dot product, first similarities between the standard query vector and the routing vectors in each routing corpus in the routing library are calculated respectively, and a first similarity set is constructed based on each of the first similarities; Based on the first similarity set, routing questions of N1 routing corpora with the highest first similarities are selected.
6. A procurement knowledge retrieval system based on a large language model as claimed in claim 5, characterized in that: In the knowledge organization module, the knowledge sub-base is represented as: ; in, represents the knowledge sub-base; s im represents the mth procurement knowledge of the i-th procurement document; Indicates im The corresponding procurement knowledge vector; L k represents the kth knowledge category, and each knowledge category corresponds to a classification label; Represents the classification label of the mth procurement knowledge of the i-th procurement document; The routing library is represented as: ; in, Represents the routing library; r im Indicates the classification label The corresponding routing question; Represents r im The corresponding routing vector; Q represents the question set.
7. The procurement knowledge retrieval system based on a large language model as claimed in claim 5, characterized in that: The search result generation module is specifically used for: Based on the vector dot product, respectively calculate the second similarity between the standard query vector corresponding to the search statement and each procurement knowledge vector in the located knowledge sub-base, and construct a second similarity set based on each of the second similarities; Based on the second similarity set, N2 procurement knowledge with the highest second similarity are selected, search results are generated based on each of the selected procurement knowledge, and the search results are displayed in real time through a visual interface.
8. The procurement knowledge retrieval system based on a large language model as claimed in claim 5, characterized in that: The retrieval log management module is specifically used for: Record in real time at least the search logs including the search request, search statement, search result, search time, search duration and user feedback, and train and optimize the large language model based on the search logs generated during the preset training cycle selection period; The retrieval log is converted from plain text into hexadecimal data, the number 8 and the letter B in the hexadecimal data are swapped, and the number 3 and the letter E are swapped to obtain primary encrypted data, the primary encrypted data is encrypted into secondary encrypted data by using the CAST-128 algorithm, each character of the secondary encrypted data is cyclically shifted right by 7 bits to obtain third-level encrypted data, the third-level encrypted data is encrypted into an encrypted log by using the RC6 algorithm, the encrypted log is stored in a specified path, and the encrypted log is backed up in a distributed manner.
Citation Information
Patent Citations
Data processing method and device, equipment and storage medium
CN118520096A
Universal adaptive question answering method and system, storage medium and electronic equipment
CN118643144A