A knowledge base retrieval adaptation method and system based on tooling fixture design

By constructing a 3D hybrid index for tooling and fixture design and fine-tuning with LoRA low-rank adaptation, the problems of inaccurate retrieval and high cost of manual annotation in tooling and fixture design are solved, achieving efficient design case retrieval and self-optimization of the knowledge base.

CN123138301APending Publication Date: 2026-11-20SHANGHAI YIZHUOYING INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611386891.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-08
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In the field of tooling and fixture design, existing technologies have problems such as the inability to retrieve synonyms and mismatches of heteronyms when using pre-trained embedding models for retrieval. In addition, manual annotation is costly and difficult to continuously adapt.

Method used

A three-dimensional hybrid index is constructed by multi-source document chunking, and learning samples are constructed by combining user behavior records. The general pre-trained embedding model is fine-tuned through LoRA low-rank adaptation, and the retrieval fusion weights are dynamically configured to achieve the fusion of vector, full-text and structured retrieval.

Benefits of technology

It improved the retrieval recall rate of candidate design cases, achieved domain adaptation without manual annotation costs, and the knowledge base self-optimizes as it is used over time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123138301A_ABST
    Figure CN123138301A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of tooling fixture design retrieval. Specifically, it is a kind of knowledge base retrieval adaptation method and system based on tooling fixture design, first build a three-dimensional hybrid knowledge base containing vector, full text, structured index and divide document type; When retrieving, dynamically configure the fusion weight according to the design task type, and execute multi-channel hybrid retrieval; At the same time, collect historical retrieval-adoptive behavior records, automatically construct three-level comparison samples of direct-adoptive positive examples, modified-adoptive soft positive examples and confirmed-exposure non-adoptive hard negative examples, and perform weighted LoRA low-rank fine-tuning on general embedding model and merge weights. The present application automatically constructs training samples using the unique interactive behavior signals in the tooling design scene, realizes the field adaptation of embedding model with zero manual annotation cost, combines three-dimensional hybrid retrieval with task adaptive weight configuration, significantly improves the knowledge retrieval accuracy in the field of tooling fixture design, and forms a closed-loop mechanism for sustainable optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of tooling and fixture design retrieval technology, specifically to a knowledge base retrieval and adaptation method and system based on tooling and fixture design. Background Technology

[0002] Tooling and fixture design is a highly specialized niche field. In AI-assisted design scenarios, it is necessary to retrieve relevant information from knowledge sources such as historical design cases, engineering rules, and standard part specifications to support design decisions. Existing technologies have significant shortcomings: directly using pre-trained embedding models to generate uniform embedding vectors for all design documents and storing them in a vector index, then returning Top-K results by sorting by cosine similarity during retrieval, results in weak understanding of domain terminology and inaccurate semantic vector representations of tooling-related terms, such as corner tubes, pressure blocks, gun changing discs, and positioning pins, leading to the inability to retrieve synonyms and mismatches of antonyms. Furthermore, the existing path to adapt the embedding model to the tooling domain is to manually annotate professional retrieval data and then fine-tune the model, but annotation costs are high, judgment criteria vary from person to person, and continuous investment is required as design cases accumulate, which is unsustainable in actual engineering. Therefore, there is an urgent need for a method for constructing a RAG knowledge base for the tooling and fixture design field that can automatically construct training samples and complete the adaptation of the domain embedding model with zero manual annotation cost. Summary of the Invention

[0003] The purpose of this invention is to provide a knowledge base retrieval and adaptation method and system based on tooling and fixture design to solve the problems mentioned in the background art.

[0004] To address the aforementioned technical problems, this invention provides the following technical solution: a knowledge base retrieval and adaptation method based on tooling fixture design, with the following specific steps: We collect multi-source design documents in the field of tooling and fixture design and perform text segmentation processing. Each document block is labeled with the corresponding document type tag, and vector index, full-text index, and structured index are constructed to form a three-dimensional hybrid index knowledge base. Before intelligent query expansion, identify the task type identifier of the current design task, dynamically configure the retrieval fusion weights corresponding to each document type according to the task type, and simultaneously perform vector retrieval, full-text retrieval and structured exact matching on the user query information. Calculate the final score according to the fusion weights and sort and output the candidate design cases. The system acquires retrieval and adoption records from historical design tasks, including retrieved and displayed candidate design cases, corresponding user query information, and the adoption status of engineers for each candidate design case. The adoption status includes three states: direct adoption, adoption after modification, and non-adoption. Learning training samples are automatically constructed using the user query information and the engineers' adoption status for each candidate design case, including positive example pairs, soft positive example pairs, and hard negative example pairs. These pairs correspond to the engineers' direct adoption, adoption after modification, and non-adoption states for each candidate design case. The general pre-trained embedding model is fine-tuned using LoRA low-rank adaptation based on the learning training samples, with the loss weight for hard negative example pairs being greater than that for soft positive example pairs. The fine-tuned LoRA low-rank adaptation weights are then merged back into the general pre-trained embedding model to obtain an embedding model adapted to the tooling and fixture domain. The embedding model is used to vectorize user query information and candidate design cases, calculate vector similarity, and output the final design case.

[0005] Furthermore, the specific method for calculating the final score based on the fusion weights and sorting and outputting the candidate design cases is as follows: Collect multi-source documents in the field of tooling and fixture design, including historical gripper design cases, engineering rule documents, standard specification tables, and records of failed cases; extract and segment the collected multi-source documents, retaining 500 to 1500 Chinese characters in each segment; historical gripper design cases include BOM lists and design specifications, and engineering rule documents include the 3-2-1 positioning principle and JDS / BST / PLP process standards; Each document block is assigned a document type tag, and a total of 9 types are defined: historical design case, engineering rule, standard part specification, scenario solution mapping relationship, framework routing pattern, failure case and solution, part parameter and calculation formula, assembly solution and process. A three-dimensional hybrid retrieval system is constructed, comprising vector index, full-text index, and structured index. The fusion weights of each retrieval channel are configured differently according to document type. The final retrieval score is calculated using the following formula: Final Score = α × Vector Similarity Score + β × Full-Text Search Score + γ × Structured Exact Match Score; where α, β, and γ are the fusion weights of vector retrieval, full-text search, and structured exact match, respectively. Different weight ratios are adopted for different document types. For example, documents of standard parts specifications have a higher γ weight, while documents of historical design cases have a higher α weight.

[0006] Specifically, the calculation process and vector source for the vector similarity score are as follows: During the knowledge base construction phase, an embedding model is used to encode the segmented text of each document block, generating a 1024-dimensional dense floating-point vector as the document embedding vector. This document embedding vector, along with its document type label and document block identifier, is then written into the vector index of the vector database. The vector database is implemented using a pgvector extension of the PostgreSQL database, and the vector index is organized according to the vector similarity retrieval method. During the retrieval phase, the same embedding model used to generate the document embedding vector is used to process the user's query information. Real-time encoding generates query embedding vectors with the same dimension as document embedding vectors. Query embedding vectors and document embedding vectors must be generated by the same embedding model to ensure they reside in the same semantic vector space. Subsequently, the cosine similarity between the query embedding vector and the document embedding vector of each candidate document block is calculated one by one. The formula is: Cosine similarity = (Dot product of query embedding vector and document embedding vector) / (Product of L2 norm of query embedding vector and L2 norm of document embedding vector). The cosine similarity value ranges from -1 to 1. After linear normalization to the interval of 0 to 1, it is used as the vector similarity score in the fusion calculation.

[0007] The calculation process for the full-text search score is as follows: During the knowledge base construction phase, Chinese word segmentation is performed on the text of each document block to generate a full-text search vector. Specifically, in the PostgreSQL database, the `to_tsvector` function is used to convert the text blocks into `tsvector` type full-text search vectors according to the Chinese word segmentation configuration, and a GIN inverted index is built on the full-text search vectors to form a full-text index. During the retrieval phase, the same Chinese word segmentation is performed on the user query information, and the segmentation results are converted into `tsquery` type full-text search query statements using the `plainto_tsquery` function. Then, the full-text search query statements are matched with the full-text search vectors of each document block using the `@@` matching operation. Document blocks with true matching results are considered to have matched the query keywords and constitute a full-text search candidate set. For each document block in the full-text search candidate set, the BM25 algorithm is used to calculate its relevance score to the user query information. The BM25 score is calculated based on the following: Sum of Components: Component = IDF(qi) × tf(qi,D) × (k1+1) / (tf(qi,D) + k1 × (1-b + b × |D| / avgdl)), where qi is the i-th keyword in the query statement, tf(qi,D) is the term frequency of keyword qi in document block D, |D| is the length of document block D after segmentation, avgdl is the average length of all document blocks in the knowledge base after segmentation, k1 is the term frequency saturation parameter, with a value range of 1.2 to 2.0, b The document length normalization parameter ranges from 0.5 to 0.75. IDF(qi) is the inverse document frequency of keyword qi, and its calculation formula is: IDF(qi)=ln((Nn(qi)+0.5) / (n(qi)+0.5)+1), where N is the total number of document blocks in the knowledge base and n(qi) is the number of document blocks containing keyword qi. The BM25 score is normalized to the range of 0 to 1 within the current batch of search candidate sets according to the maximum value, and then used as the full-text search score in the fusion calculation.

[0008] The calculation process for the structured exact match score is as follows: In the knowledge base construction phase, for document blocks of standard part specification type, structured fields are parsed and extracted from their block text. These structured fields include brand, model, cylinder bore, stroke, load, and cross-sectional dimensions. The extracted structured fields are stored in a relational data table and a structured index is created. In the retrieval phase, structured query conditions are first identified from the user query information. These conditions include brand name, cylinder bore range, stroke range, and load range. Then, the structured query conditions are converted into SQL exact condition query statements and executed. The SQL exact condition query statement takes the form: SELECT document block identifier FROM label The standard specification data table uses the statement `WHERE cylinder bore BETWEEN 50 AND 80 AND stroke greater than or equal to 100`. By executing this SQL exact match query on a structured index, a set of document blocks that satisfy the structured query conditions is returned. For each document block in this set, its structured exact match score is assigned according to the degree to which the conditions are met: document blocks that satisfy all structured query conditions are assigned a value of 1; document blocks that do not satisfy any structured query conditions are assigned a value of 0; document blocks that only satisfy some structured query conditions are assigned a value proportional to the number of satisfied conditions out of the total number of structured query conditions; for other types of document blocks that do not contain structured fields, their structured exact match score is directly set to 0.

[0009] Before calculating the final score based on the fusion weights, the vector similarity score, full-text search score, and structured exact match score are all normalized to the range of 0 to 1. Then, the scores of each candidate document block are obtained by weighted summation according to the fusion weights α, β, and γ corresponding to the current design task type, ensuring that the score scales of different retrieval channels are comparable. Subsequently, candidate design cases are output in descending order of final score.

[0010] Furthermore, the specific method for automatically constructing learning training samples by combining user query information with engineers' adoption status of each candidate design case is as follows: The user query information is paired with the retrieved design cases that were directly adopted by engineers to form positive example pairs, with the retrieved design cases that were modified and adopted to form soft positive example pairs, and with the retrieved but not adopted design cases to form hard negative example pairs; wherein, the loss weight of the soft positive example pairs is less than the loss weight of the hard negative example pairs, the loss weight of the soft positive example pairs is between 0.3 and 0.7, and the loss weight of the hard negative example pairs is 1; The revised criteria for acceptance are that the engineer has adjusted the design parameters based on the candidate cases and saved the revised parameter version; The determination of whether a candidate design case is retrieved but not adopted is based on the exposure confirmation principle. That is, after a candidate design case is retrieved and displayed, if the engineer experiences any of the following situations within a predetermined time window of 48 hours, it will be determined as not adopted, thus eliminating exposure bias: selecting other design cases, modifying the query and re-searching without using the candidate design case, or abandoning the design scheme corresponding to the candidate case within the time window.

[0011] Furthermore, the specific method for fine-tuning the general pre-trained embedding model using LoRA low-rank adaptation based on the training samples is as follows: LoRA low-rank adaptation fine-tuning is applied to the embedding layer of the general embedding model. The training parameters are configured with LoRA rank r equal to 16, the number of trainable parameters is less than 1% of the total parameters of the model, the loss function is the weighted InfoNCE contrastive loss function, the learning rate is 1e-4 to 5e-4, the batch size is 32, the training epochs are 2 to 5, and the training hardware only requires a single 24GB GPU. Significant domain adaptation effect can be obtained when the training data reaches more than 500 sets of contrastive sample pairs.

[0012] Specifically, BGE-M3 was selected as the general embedding model for LoRA low-rank adaptation fine-tuning. BGE-M3 is a multilingual pre-trained embedding model based on a Transformer encoder, which outputs a 1024-dimensional dense embedding vector and supports a maximum input sequence length of 8192 tokens. The complete implementation solution for LoRA low-rank adaptation fine-tuning of BGE-M3 includes four steps: training data organization, LoRA adapter injection, training configuration and training process, and weight merging and deployment.

[0013] (1) Training data organization: The automatically constructed positive pairs, soft positive pairs, and hard negative pairs are organized into contrastive learning training samples. Each training data consists of a user query information text and its corresponding positive document block text, soft positive document block text, and several hard negative document block texts. Each text is encoded into a token sequence by a token segmenter and truncated to within 8192 tokens. The document blocks corresponding to other user query information in the same batch are also used as negative samples in the batch for contrastive calculation.

[0014] (2) LoRA adapter injection: Load the pre-trained weights of BGE-M3 and freeze all original parameters. Inject LoRA low-rank decomposition matrix next to the self-attention QKV projection matrix and the feedforward network FFN linear mapping matrix of each layer of the Transformer encoder. The injection method is as follows: Let the original weight matrix to be adapted be W with a dimension of d×k. Introduce a dimension reduction matrix A and a dimension increase matrix B. The dimension reduction matrix A has a dimension of r×k and is randomly initialized with a Gaussian distribution. The dimension increase matrix B has a dimension of d×r and is initialized with all zeros. During forward computation, the output of this layer changes from Wx to Wx+B·A·x, where x is the input vector of this layer. During training, only the parameters of the dimension reduction matrix A and the dimension increase matrix B are updated, and the original weight matrix W is kept frozen. The LoRA rank r is 16, and the implementation range is 8 to 32. The LoRA scaling factor is 32. After injection, the number of trainable parameters is less than 1% of the total number of model parameters.

[0015] (3) Training configuration and training process: The loss function is the weighted InfoNCE contrastive loss. For each user query in the batch, the numerator is the exponential term of the cosine similarity with the positive example document block after scaling by the temperature coefficient, and the denominator is the sum of the exponential terms of the cosine similarity with the positive, soft positive, and hard negative example document blocks after scaling by the temperature coefficient. The negative logarithm is used to form the contrastive loss of the query. The soft positive example term is weighted by a loss weight of 0.3 to 0.7, and the hard negative example term is weighted by a loss weight of 1. The temperature coefficient is 0.02. The batch loss is obtained by averaging the contrastive losses of all queries in the batch. The optimizer is AdamW, with a learning rate scheduling strategy of linear warm-up and cosine decay. The weight decay is 0.01. bfloat16 mixed precision training is used. The learning rate is 1e-4 to 5e-4. The batch size is 32. The training rounds are 2 to 5. The training hardware only requires a single 24GB GPU.

[0016] (4) Weight merging and deployment: After training, for each adapted weight matrix, the LoRA increment matrix is ​​added to the original weight matrix to obtain the merged weight. That is, the merged weight is equal to the original weight matrix W plus the product of the ascending dimension matrix B and the descending dimension matrix A. All merged weights are exported as a complete model file and directly replace the original general embedding model for online inference. The merged model is completely consistent with the network structure of the original BGE-M3 and does not introduce additional computational delay during inference. When the merged embedding model is deployed online, the document embedding vectors of all document blocks in the knowledge base are re-encoded by the model and the vector index is updated. The query embedding vector of the user query information is also encoded by the model in real time, thereby ensuring that the query embedding vector and the document embedding vector are from the same source and located in the same semantic vector space.

[0017] Furthermore, the specific method for merging the fine-tuned LoRA low-rank adaptation weights back into the general pre-trained embedding model to obtain an embedding model adapted to the tooling and fixture domain is as follows: The weights of the LoRA adapter are merged back into the weights of the original general embedding model. The merged model does not introduce additional computational delay during inference and directly replaces the original general embedding model. The merged model significantly improves the terminology vector representation in the tooling design field. At the same time, the general re-ranking model is simultaneously fine-tuned using the same samples and the binary cross-entropy loss function, which improves the accuracy of the relevance judgment of tooling design documents in the re-ranking stage.

[0018] Specifically, as a concrete implementation of the general reranking model, bge-reranker-v2-m3 is selected as the general reranking model to perform synchronous LoRA fine-tuning. bge-reranker-v2-m3 is a cross-encoder reranking model based on the XLM-RoBERTa architecture Transformer encoder, consisting of an encoder and a relevance classification head set at the encoder output. The input is a text pair composed of query text and document text concatenated together, and the output is the relevance score of the text pair. The complete implementation scheme for LoRA fine-tuning includes four steps: training sample construction, LoRA adapter injection, training configuration and training process, and weight merging and deployment.

[0019] (1) Training sample construction: Reuse the same three-level contrast samples as the fine-tuning of the embedding model, organize each sample into a text pair consisting of user query information text and document block text, and assign labels according to the adoption status: the label of positive example pairs is 1, the label of hard negative example pairs is 0, and soft positive example pairs adopt soft labels with values ​​of 0.3 to 0.7. The soft label values ​​are consistent with the loss weight of soft positive example pairs.

[0020] (2) LoRA adapter injection: Load the pre-trained weights of bge-reranker-v2-m3 and freeze all original parameters. Inject the LoRA low-rank decomposition matrix, which is the same as the fine-tuning method of the embedded model, into the self-attention QKV projection matrix and the feedforward network FFN linear mapping matrix of each layer of the encoder. That is, the low-rank bypass is composed of the dimension reduction matrix A initialized with Gaussian distribution and the dimension increase matrix B initialized with all zeros. During forward calculation, the output of this layer changes from Wx to Wx+B·A·x. Only the parameters of the LoRA low-rank decomposition matrix are updated during training. The LoRA rank r is 16, and the implementation range is 8 to 32. The number of trainable parameters is less than 1% of the total number of model parameters.

[0021] (3) Training configuration and training process: Input text pairs into the model, take the score output by the relevance classification head and map it to the relevance probability of 0 to 1 through the sigmoid function. The loss function adopts the binary cross-entropy loss. The loss is calculated according to the label and relevance probability of each text pair. Soft positive pairs participate in the loss calculation according to their soft labels. The optimizer adopts AdamW, the learning rate is 1e-5 to 5e-5, the batch size is 16, the training rounds are 2 to 3, and bfloat16 mixed precision training is adopted. The training hardware and the fine-tuning of the embedded model share a single 24GB GPU.

[0022] (4) Weight merging and deployment: After training, the LoRA increment matrix is ​​merged back into the original weights to obtain the merged re-ranking model and export it as a complete model file. The merged re-ranking model is deployed in the re-ranking stage of the retrieval link: first, the candidate design cases are recalled by the fusion ranking of the three channels of vector retrieval, full text retrieval and structured exact matching. Then, the merged re-ranking model calculates the relevance probability of the text pairs formed by the user query information and each candidate design case. The candidate design cases are re-ranked from high to low according to the relevance probability and output. The merged re-ranking model does not introduce additional computational delay during inference, thereby improving the accuracy of the relevance judgment of the tooling design documents in the re-ranking stage.

[0023] Furthermore, the specific method for calculating vector similarity and outputting the final design case is as follows: User query information is encoded using a domain-adapted embedding model to generate query embedding vectors of a unified dimension; the document embedding vectors corresponding to each candidate design case are dense embedding vectors that are pre-generated using the same embedding model and stored in the vector database during the knowledge base construction phase. Calculate the cosine similarity value between the query embedding vector and the document embedding vector of each candidate design case, and use it as the basic similarity score for the vector retrieval channel; The basic similarity score of vector retrieval, the keyword matching score of full-text retrieval, and the condition matching score of structured retrieval are weighted and summed according to the fusion weight coefficient corresponding to the current design task type to obtain the final comprehensive retrieval score of each candidate design case. All candidate design cases are sorted from highest to lowest according to the final comprehensive search score, and a predetermined number of the top-ranked candidate design cases are selected as the final search results.

[0024] A knowledge base retrieval and adaptation system based on tooling fixture design includes a behavior record collection module, a comparison sample construction module, a low-rank fine-tuning module, a weight merging module, and a domain adaptation retrieval module; The behavior record collection module is used to acquire the retrieval-adoption behavior records of the retrieval system in historical design tasks; The comparison sample construction module is used to automatically construct comparison learning training samples of positive pairs, soft positive pairs, and hard negative pairs according to the adoption status. The low-rank fine-tuning module is used to perform LoRA low-rank adaptation fine-tuning on a general pre-trained embedding model using three-level contrast samples. The weight merging module is used to merge the LoRA adaptation weights back into the original embedding model to obtain the domain-adapted embedding model. The domain-adapted retrieval module is used to perform retrieval and output results using the domain-adapted embedded model.

[0025] Compared with the prior art, the beneficial effects achieved by the present invention are: the present invention improves the recall rate of candidate design case retrieval by combining behavior signal-driven domain fine-tuning with hard negative example contrast learning, three-dimensional hybrid retrieval, and task adaptive weight configuration. This invention enables the framework to generate a task-first retrieval routing mode by combining document type layering with task type-driven retrieval fusion weight configuration, verifies task-first retrieval failure cases, and realizes differentiated intelligent retrieval for different design tasks. This invention automatically mines and generates training data based on users' daily operational behaviors, eliminating the need for additional manual annotation costs. The knowledge base continuously optimizes itself as usage time increases. Attached Figure Description

[0026] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart illustrating the steps of a knowledge base retrieval and adaptation method based on tooling and fixture design according to the present invention. Figure 2 This invention relates to a knowledge base retrieval adaptation method based on tooling fixture design, which uses a task type and document type retrieval fusion weight configuration strategy diagram. Detailed Implementation

[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0028] like Figure 1As shown, the overall system architecture of the present invention is divided into three stages: knowledge base construction, hybrid retrieval, and domain fine-tuning. The three stages proceed sequentially and output the final retrieval results. The domain fine-tuning stage forms a feedback optimization closed loop for the knowledge base construction and retrieval stages. like Figure 2 The document type retrieval weight configurations for the nine task types shown demonstrate the differentiated needs of different design tasks for different types of knowledge. The present invention provides a technical solution: The system has collected and structured 50 sets of historical gripper design cases, 30 engineering rule documents, 200 standard part specification records, and 15 failure case records, and stored them in the knowledge base after being classified and labeled by document type and constructed with a three-dimensional index; The system identifies the current task and determines its document type retrieval weight configuration as follows: mapping has the highest weight, followed by case, and then spec. Based on this, the system sets the fusion weight parameters: vector retrieval alpha equals 0.4, full-text retrieval beta equals 0.3, and structured exact matching gamma equals 0.3.

[0029] The user query was for: 3 sets of clamping points for the side panel, 2 points per set, and recommended clamping units. The system simultaneously performed three types of searches: vector search returned the embedding similarity scores of the top 50 candidate documents; full-text search used "side panel," "clamping unit," and "3 sets" as keywords for BM25 matching; and structured search retrieved cylinder models that met the "cylinder diameter 50 to 80 mm" specification from the standard specification table. The top 5 results after fusion and sorting were: Case 42: Side panel CLAMP-TUNKERS-50-100 solution score 0.92; Case 17: Similar workpiece CLAMP-SMC-40-80 solution score 0.85; Specification table TUNKERS-V50 series score 0.79; Case 56: Side panel improved solution score 0.73; Rule document PLP-3.2 score 0.68. After collecting 200 sets of user interaction data, the system automatically constructed comparison samples. A hard negative example: Case 56 was returned and displayed in the Top-5 multiple searches, but the engineers ultimately chose the solution for Case 42 within the 48-hour time window and did not continue using Case 56. Case 56 was marked as a hard negative example relative to the query "recommendation of side panel clamping units". Using 500 sets of comparison samples, including positive examples, soft positive examples, and hard negative examples, LoRA fine-tuning was performed on a general embedding model, namely BGE-M3, on a single 24GB GPU, with training taking approximately 2 hours. After fine-tuning, the weights were merged, and the original embedding model was replaced.

[0030] After fine-tuning, the cosine similarity between the tooling terms "octagonal tube" and "octagonal profile" improved, and the retrieval recall rate of the top five candidate design cases also improved.

[0031] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0032] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A knowledge base retrieval and adaptation method based on tooling and fixture design, characterized in that: We collect multi-source design documents in the field of tooling and fixture design and perform text segmentation processing. We label each document block with the corresponding document type tag and build a three-dimensional hybrid index knowledge base consisting of vector index, full-text index and structured index. Identify the task type identifier of the current design task, dynamically configure the retrieval fusion weights corresponding to each document type according to the task type, simultaneously perform vector retrieval, full-text retrieval and structured exact matching on the user query information, calculate the final score according to the fusion weights and sort and output the candidate design cases; Retrieve retrieval and adoption records from historical design tasks, including the candidate design cases that were retrieved and displayed, the corresponding user query information, and the adoption status of each candidate design case by engineers; Automatically construct learning training samples by combining user query information with the engineers' adoption status of each candidate design case; Based on the training samples, the general pre-trained embedding model is fine-tuned using LoRA low-rank adaptation. The LoRA low-rank adaptation weights obtained from the fine-tuning are then merged back into the general pre-trained embedding model to obtain an embedding model adapted to the tooling and fixture domain. The embedding model is used to vectorize user query information and candidate design cases, calculate vector similarity, and output the final design case.

2. The knowledge base retrieval and adaptation method based on tooling and fixture design according to claim 1, characterized in that: The specific method for calculating the final score and sorting and outputting candidate design cases according to the fusion weight is as follows: Collect multi-source documents in the field of tooling and fixture design, including historical gripper design cases, engineering rule documents, standard specification tables, and failure case records; extract text and segment the collected multi-source documents, and assign document type tags to each document block; During the construction of the three-dimensional hybrid index knowledge base, each text block is encoded using an embedding model to generate a document embedding vector, and user query information is encoded in real time to generate a query embedding vector with the same dimension as the document embedding vector. For each document block, Chinese word segmentation is performed on the segmented text to generate a full-text search vector. During the retrieval phase, the same Chinese word segmentation is performed on the user query information, and the full-text search query statement is transformed. Then, a matching operation is performed with the full-text search vector of each document block. The document blocks with true matching results are those that have matched the query keywords and constitute a full-text search candidate set. For document blocks of standard part specification type, structured fields are parsed and extracted from their block text, structured query conditions are identified based on user query information, SQL precise condition query statements are converted and executed, and a set of document blocks that meet the structured query conditions is returned. The fusion weights of each retrieval channel are configured differently according to document type. The final retrieval score is calculated according to the following formula: Final score = α × Vector similarity score + β × Full-text search score + γ × Structured exact match score; where α, β, and γ are the fusion weights of vector retrieval, full-text search, and structured exact match, respectively, and different weight ratios are adopted for different document types. Wherein, the vector similarity score = (dot product of query embedding vector and document embedding vector) / (product of L2 norm of query embedding vector and L2 norm of document embedding vector). The full-text search score is the sum of the following components corresponding to all keywords in the query: Component = IDF(qi) × tf(qi,D) × (k1+1) / (tf(qi,D) + k1 × (1-b + b × |D| / avgdl)), where qi represents the i-th keyword in the query, tf(qi,D) is the term frequency of keyword qi in document block D, |D| is the length of document block D after word segmentation, avgdl is the average length of all document blocks in the knowledge base after word segmentation, k1 is the term frequency saturation parameter, b is the document length normalization parameter, IDF(qi) is the inverse document frequency of keyword qi, IDF(qi) = ln((Nn(qi)+0.5) / (n(qi)+0.5)+1), where N is the total number of document blocks in the knowledge base, and n(qi) is the number of document blocks containing keyword qi; after normalization to the range of 0 to 1 based on the maximum value within the candidate set of this batch of searches, it is used as the full-text search score; The structured exact match score is assigned based on the degree to which the conditions are met: a document block that meets all structured query conditions is assigned a value of 1, a document block that does not meet any structured query conditions is assigned a value of 0, and a document block that meets only some structured query conditions is assigned a value based on the proportion of the number of conditions met to the total number of structured query conditions; for other types of document blocks that do not contain structured fields, their structured exact match score is directly set to 0.

3. The knowledge base retrieval and adaptation method based on tooling and fixture design according to claim 2, characterized in that: The specific method for automatically constructing training samples by combining user query information with engineers' adoption status of each candidate design case is as follows: The user query information is paired with the retrieved design cases that were directly adopted by engineers to form positive example pairs, with the retrieved design cases that were modified and adopted to form soft positive example pairs, and with the retrieved but not adopted design cases to form hard negative example pairs; among them, the loss weight of soft positive example pairs is less than the loss weight of hard negative example pairs. The revised criteria for acceptance are that the engineer has adjusted the design parameters based on the candidate cases and saved the revised parameter version; If a candidate design case is retrieved but not adopted, it is considered not adopted if the engineer falls under any of the following circumstances within a predetermined time window after the candidate design case is retrieved and displayed: selecting another design case, modifying the query and re-searching without using the candidate design case, or abandoning the design scheme corresponding to the candidate design case within the time window.

4. The knowledge base retrieval and adaptation method based on tooling fixture design according to claim 3, characterized in that: The specific method for fine-tuning the general pre-trained embedding model using LoRA low-rank adaptation based on the training samples is as follows: LoRA low-rank adaptation fine-tuning is applied to the embedding layer of the general embedding model. The training parameters are configured such that the LoRA rank r is equal to 16, the number of trainable parameters is less than 1% of the total parameters of the model, the loss function is the weighted InfoNCE contrastive loss function, and the learning rate is 1e-4 to 5e-4.

5. The knowledge base retrieval and adaptation method based on tooling fixture design according to claim 4, characterized in that: The specific method for merging the fine-tuned LoRA low-rank adaptation weights back into the general pre-trained embedding model to obtain an embedding model adapted to the tooling and fixture domain is as follows: The weights of the LoRA adapter are merged back into the weights of the original general embedding model. The merged model does not introduce additional computational delay during inference and directly replaces the original general embedding model. At the same time, the general re-ranking model is simultaneously fine-tuned using the same samples and the binary cross-entropy loss function.

6. The knowledge base retrieval and adaptation method based on tooling fixture design according to claim 5, characterized in that: The specific method for calculating vector similarity and outputting the final design case is as follows: User query information is encoded using a domain-adapted embedding model to generate query embedding vectors of a unified dimension; the document embedding vectors corresponding to each candidate design case are dense embedding vectors that are pre-generated using the same embedding model and stored in the vector database during the knowledge base construction phase. Calculate the cosine similarity value between the query embedding vector and the document embedding vector of each candidate design case, and use it as the basic similarity score for the vector retrieval channel; The basic similarity score of vector retrieval, the keyword matching score of full-text retrieval, and the condition matching score of structured retrieval are weighted and summed according to the fusion weight coefficient corresponding to the current design task type to obtain the final comprehensive retrieval score of each candidate design case. All candidate design cases are sorted from highest to lowest according to the final comprehensive search score, and a predetermined number of the top-ranked candidate design cases are selected as the final search results.

7. A knowledge base retrieval and adaptation system based on tooling and fixture design, characterized in that: The system includes a behavior record collection module, a comparison sample construction module, a low-rank fine-tuning module, a weight merging module, and a domain-adaptive retrieval module; The behavior record collection module is used to acquire the retrieval-adoption behavior records of the retrieval system in historical design tasks; The comparison sample construction module is used to automatically construct comparison learning training samples of positive pairs, soft positive pairs, and hard negative pairs according to the adoption status. The low-rank fine-tuning module is used to perform LoRA low-rank adaptation fine-tuning on a general pre-trained embedding model using three-level contrast samples. The weight merging module is used to merge the LoRA adaptation weights back into the original embedding model to obtain the domain-adapted embedding model. The domain-adapted retrieval module is used to perform retrieval and output results using the domain-adapted embedded model.

8. A computer device, characterized in that: It includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The device stores a computer program that, when executed by a processor, causes the processor to perform the steps of the method as described in any one of claims 1 to 6.