Prompt-parameter collaborative optimization method oriented to electromechanical bidding legal question and answer model

By optimizing the prompt design and sampling parameters and combining it with a dual verification pipeline, the inaccuracy problem of the legal question-and-answer assistant in the field of electromechanical equipment bidding was solved, efficient and accurate legal support was achieved, and the reliability and professionalism of the system in complex environments were ensured.

CN120633599APending Publication Date: 2025-09-12SHANGHAI MECHANICAL & ELECTRICAL EQUIP TENDERING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510778866.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-11
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

The existing legal question-and-answer assistant system in the field of electromechanical equipment bidding has problems such as insufficient prompt design and unreasonable sampling parameters, which leads to inaccurate and unprofessional answers, affecting the reliability of the system and user trust.

Method used

A prompt-parameter collaborative optimization method is adopted for the legal question-answering model of electromechanical bidding and tendering. By optimizing the prompt design and adjusting the sampling parameters, it is ensured that the model generates answers based on accurate legal terms and formats. Combined with a double verification pipeline, the accuracy and professionalism of the answers are improved.

Benefits of technology

It effectively suppresses the model hallucination phenomenon, improves the accuracy and credibility of the answers of the legal question-and-answer assistant for electromechanical equipment bidding and tendering, enhances the adaptability and reliability of the system in complex legal environments, and improves users' trust in the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120633599A_ABST
    Figure CN120633599A_ABST
Patent Text Reader

Abstract

The invention relates to a Prompt-parameter collaborative optimization method for an electromechanical tendering and bidding legal question and answer model. The method comprises the following steps: receiving an electromechanical tendering and bidding field legal question input by a user; the method comprises the following steps: constructing an electromechanical tendering and bidding knowledge base and a legal retrieval program, carrying out correlation sorting on retrieved legal provisions by adopting a BERT-TOP3 algorithm, connecting an API of the electromechanical equipment tendering and bidding knowledge base, verifying the timeliness of the retrieved legal provisions one by one, and constructing an integral layered Prompt structure which comprises legal basis layer embedding, legal provision layer embedding, legal provision layer embedding, legal provision layer embedding and legal provision layer embedding. Embedding a task instruction layer and a dynamic example layer; and performing optimal setting of sampling parameters according to model strategies of parameter coupling adjustment and a confidence feedback mechanism, and realizing quality verification and iterative optimization through a dual verification pipeline. The problem that an existing legal question-answering assistant system is insufficient in accuracy, reliability, specialty and preciseness in the field of electromechanical equipment bidding is solved, and the ability of an electromechanical bidding legal question-answering assistant to understand and apply related legal texts is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an intersection of law and natural language processing, and in particular to a method for collaboratively optimizing precise prompts and sampling parameters for a legal question-answering model in the field of electromechanical equipment bidding. Background Art

[0002] With the increasing complexity of electromechanical equipment bidding projects and increasingly stringent regulations, traditional methods have gradually exposed problems such as inefficiency, error-proneness, and subjectivity. In recent years, the gradual rise of artificial intelligence assistants has brought new opportunities to solve traditional bidding problems.

[0003] The application of AI assistants in the field of electromechanical equipment bidding and tendering offers numerous advantages. Firstly, they can rapidly process large volumes of bidding documents and related legal literature, accurately extracting key information and significantly improving work efficiency. For example, in legal consultation scenarios, AI assistants can quickly retrieve relevant regulations and clauses related to electromechanical equipment bidding and tendering, providing users with timely and accurate legal advice. Secondly, AI assistants can reduce human interference and provide more objective and consistent responses. In the field of judicial assistance, based on the specific legal logic and case library of electromechanical equipment bidding and tendering, AI assistants can provide valuable reference opinions to judges, lawyers, or electromechanical equipment bidding and tendering experts, ensuring the fairness and compliance of legal decisions and bidding and tendering processes.

[0004] However, in practical applications, large language models often exhibit "hallucination" phenomena, resulting in generated responses that may not conform to actual legal provisions or bidding requirements, or even fabricate information or make inappropriate inferences. This phenomenon is primarily due to the following reasons:

[0005] First, the design of the prompts guiding the model's response generation is flawed. Existing prompts often fail to tailor the specific needs of the electromechanical equipment bidding and tendering sector. They don't explicitly require the model to base its responses on accurate legal documents and bidding documents, nor do they strictly limit the scope and format of the responses. This can lead to the model's responses easily deviating from the actual needs of the bidding project, resulting in arbitrary fabrication. For example, in some legal consulting systems, the responses generated by the model may appear reasonable but fail to adhere to relevant bidding regulations or industry standards, misleading users. Second, the sampling parameters used when the model generates text are improperly set. Current sampling parameters fail to fully account for the high accuracy and rigor required in the electromechanical equipment bidding and tendering sector. For example, a high temperature parameter (Temperature) can lead to high randomness in the model's output, resulting in responses that fail to meet legal and industry requirements. Excessively large Top-K or Top-P values ​​can overly broaden the sampling range, increasing the risk of generating inaccurate or unprofessional content. This is particularly critical in electromechanical equipment bidding and tendering, as any inaccurate legal interpretation can have a significant impact on project bidding. These problems have seriously affected the reliability and professionalism of the legal question-and-answer assistant in the field of mechanical and electrical equipment bidding and tendering, and reduced users' trust in the system.

[0006] This application aims to solve the following technical problems existing in the existing legal question-answering assistant system in the field of mechanical and electrical equipment bidding:

[0007] 1. How to implement precise prompt design so that large language models can answer legal questions related to electromechanical equipment bidding based on accurate bidding documents and legal provisions, avoid fabricated information and unreasonable speculation, and ensure the accuracy and reliability of answers.

[0008] 2. How to optimize the sampling parameters when the model generates text to meet the high requirements for professionalism and rigor in the field of electromechanical equipment bidding, reduce the randomness and inaccuracy of the output, and ensure that the legal question-and-answer system provides compliant and accurate legal support during the bidding process. Summary of the Invention

[0009] To address the shortcomings of existing legal question-and-answer assistant systems in the field of electromechanical equipment bidding and tendering, such as inaccuracy, reliability, professionalism, and rigor, a prompt-parameter collaborative optimization method for electromechanical equipment bidding and tendering legal question-and-answer models was proposed. This method optimizes the prompts that guide the model in generating answers and adjusts the output sampling parameters to achieve efficient and accurate question-and-answer results. This method is primarily used in electromechanical equipment bidding and tendering, providing reliable intelligent solutions for legal service scenarios such as legal consultation, judicial assistance, and contract review.

[0010] The technical solution of the present invention is:

[0011] A prompt-parameter collaborative optimization method for a legal question-answering model for electromechanical bidding and tendering includes the following steps:

[0012] Step 1: Question reception and preprocessing

[0013] Receive legal issues in the field of electromechanical bidding and tendering input from users and perform basic pre-processing operations on the issues;

[0014] Step 2: Legal Search and Prompt Construction

[0015] Legal clause retrieval: Based on online data and actual business development, a knowledge base for electromechanical bidding and tendering is constructed, and a supporting legal retrieval program is developed. For pre-processed questions, the legal retrieval program is initiated to retrieve relevant legal provisions from the legal and valid electromechanical bidding and tendering knowledge base. Clause relevance filtering: The BERT-TOP3 algorithm is used to rank the retrieved legal provisions by relevance. Timeliness control: The API of the electromechanical equipment bidding and tendering knowledge base is connected to verify the timeliness of the retrieved legal clauses one by one. Prompt construction: The overall hierarchical prompt structure includes the embedding of the legal basis layer, the task instruction layer, and the dynamic example layer.

[0016] Step 3: Sampling parameter optimization settings

[0017] The sampling parameters are optimized according to the following strategies: Parameter coupling adjustment model: pre-construct a legal field parameter matrix, match the corresponding sampling parameters from the pre-constructed legal field parameter matrix according to the type of legal task in the bidding field to which the question belongs, and configure the parameters Temperature, Top-K, and Top-P to decide how to process the predicted token probability to select a single output token; dynamically adjust the corresponding rule engine according to the actual situation of the problem; Confidence feedback mechanism: Output credibility score: During the generation process, the model synchronously calculates the entropy value of the predicted probability distribution of each token; The entropy value exceeds the threshold to trigger the resampling mechanism; Attach a confidence label to the final answer; For the legal clauses with the highest probability cited by the model with low confidence, a rejection mechanism is adopted.

[0018] Step 4: Quality Verification and Iterative Optimization

[0019] Quality verification and iterative optimization are achieved through a dual verification pipeline, including automatic verification and technical specialist verification. Automatic verification: performs comprehensive and accurate checks on the output to ensure that it meets established standards. Technical specialist verification: performs regular updates to ensure high-quality output of the model within the professional field.

[0020] Furthermore, in Step 1, the preprocessing operations include removing redundant spaces and standardizing punctuation.

[0021] Furthermore, the clause relevance filtering in Step 2 retains only clauses with a cosine similarity greater than 0.7 with the user question; and a maximum number of referenced clauses is set.

[0022] Furthermore, the timeliness control in Step 2 marks the abolished clauses and searches for corresponding new versions of the clauses. If there are any, they are replaced to ensure the timeliness and accuracy of the referenced legal clauses. If not, "Now abolished" is marked after the clause content.

[0023] Furthermore, the specific contents of the Prompt structure are as follows: first, the retrieved content is forcibly inserted into the beginning of the Prompt in a fixed format of "[according to Article X of the XX Law] + clause content"; then, the role of the model is clearly defined as "senior legal advisor" in the Prompt, requiring it to answer strictly in accordance with the provided legal clauses, and constraints are set to prohibit the model from making any form of speculation or creating uncited clause content, and prohibit the use of vague expressions; then, the output format is specified, requiring the model's answer to include three parts: "conclusion + basis clause + applicable analysis", among which the cited legal clauses must be marked with the specific legal clause number; in addition, a dynamic example layer is added to provide examples: embed positive and negative examples similar to the current question; finally, a timeliness statement is added at the end of the Prompt: "The legal documents cited in this answer are updated as of YYYY-MM-DD".

[0024] Furthermore, the dynamic adjustment rule engine in Step 3 is specifically as follows: when it is detected that the question contains ambiguous words, the Temperature is automatically reduced to 0.2, and Top-P = 0.75; if the user question involves the legal document content of multiple different devices, the mixed sampling mode is activated: the first 50% of the generation steps use Temperature = 0.4, and the subsequent steps are reduced to 0.3.

[0025] Furthermore, the output credibility score in Step 3 is specifically as follows: when the entropy value of 5 consecutive tokens exceeds 1.2, the resampling mechanism is triggered to avoid overly vague or inaccurate output; high, medium and low confidence labels are attached to the final answer: the probability of all referenced terms is greater than 0.7, the probability of the existence of a term is between 0.5 and 0.7, and the unreferenced term is detected.

[0026] Furthermore, the refusal to answer mechanism in Step 3 is specifically as follows: Refusal to answer mechanism: If the confidence level of the highest probability legal clause cited by the model is lower than 0.4, the system will forcibly output a prompt: "This question is beyond the coverage of the current legal database. It is recommended to consult a professional lawyer."

[0027] Furthermore, the automatic verification in Step 4 is as follows: First, the validity of the legal clause number is checked, and the rule engine is connected and compared with the current valid legal database in real time. The legal clauses in the output content are matched according to the number; if there is a legal clause number in the output that is not in the database, the abnormal situation is immediately marked and reported; at the same time, the output text is fully scanned through the pre-set sensitive word library, and the expression words with non-deterministic features are located and modified; the number of citations of each clause in the output is automatically counted to ensure that each cited clause appears at least once.

[0028] Furthermore, the technical specialist verification in Step 4 specifically involves: focusing on legal documents related to the bidding and tendering field of electromechanical equipment, establishing a test set containing more than 2,000 annotated samples each month to comprehensively cover the application scenarios that may be involved in the bidding and tendering process in this field; the technical team conducts in-depth analysis of the output results, focusing on evaluating the incidence of model hallucinations, with a target of <2%; and making targeted adjustments and optimizations based on the verification feedback results of the technical specialists. After the adjustments, the model is fully verified again through the dual verification pipeline to continuously improve the quality and performance of the model.

[0029] The beneficial effects of the present invention are:

[0030] This paper provides a method for precise prompt design and sampling parameter collaborative optimization for a legal question-and-answer model for electromechanical equipment bidding. This method combines the latest natural language processing technology with domain knowledge of electromechanical equipment bidding, effectively resolving the hallucination problem of the electromechanical bidding legal question-and-answer model. It improves the electromechanical bidding legal question-and-answer assistant's ability to understand and apply relevant legal texts, while also enhancing the credibility and effectiveness of the generated answers.

[0031] Compared with the prior art, this application has the following significant beneficial effects, and this method plays a key role in the illusion control link of the legal question-and-answer assistant for bidding and tendering of electromechanical equipment:

[0032] 1. Improving the model’s ability to understand and apply legal texts: a key prerequisite

[0033] Throughout the entire process, this method significantly optimizes the answer generation stage of the legal question-and-answer model for electromechanical equipment bidding. Through carefully designed prompts, the model is explicitly required to answer questions based on accurate legal documents and clauses related to electromechanical equipment bidding, and the answer format is standardized, providing a solid foundation for the model to understand and apply legal text information. Embedding the retrieved legal content in the prompt further ensures that the model fully utilizes this key information when answering, avoiding answer errors caused by misunderstandings. This step paves a precise track for the model's answering process, especially for specific legal requirements in the bidding field, preventing the generation of answers that deviate from facts or legal provisions, and is a key starting point for suppressing the generation of hallucinations. Through this method, the model's ability to understand and process bidding legal texts is improved from the source, laying the foundation for subsequent accurate and compliant legal answers.

[0034] 2. Effectively suppress model hallucinations: core control hub

[0035] This method plays a central role in the hallucination control system of a legal Q&A assistant for electromechanical equipment bidding and tendering. The optimized prompt design and reasonable sampling parameter settings work closely together to provide a dual guarantee for strict control over the model generation process. By strictly restricting the model across multiple dimensions, such as task instruction content, answer scope, and format, prompts define clear boundaries for the model's responses, preventing the model from deviating from the legal facts and terms of the bidding process. Sampling parameters, on the other hand, address output randomness. By controlling the randomness in the model generation process, they reduce the generation of inaccurate content and further narrow the scope of the model's output. This synergistic effect of prompts and sampling parameters effectively prevents the model from generating content that is inconsistent with facts or legal provisions, significantly reducing the probability of hallucinations. Its core role is to ensure that the legal Q&A assistant can provide highly reliable and compliant legal answers in the field of electromechanical equipment bidding and tendering, guaranteeing users high-quality legal services.

[0036] 3. Improving the professionalism and rigor of model output: an important quality improvement point

[0037] This method plays an indispensable role in improving the quality of answers provided by the Legal Question and Answer Assistant for Electromechanical Equipment Bidding and Tendering. By requiring the model to use accurate legal terminology and citation formats, and by optimizing sampling parameters to focus the output on vocabulary that meets legal professional requirements, the model ensures that it accurately quotes clauses related to bidding and tendering laws during the answering process, thereby outputting answers that meet legal standards. This not only enhances the professionalism and rigor of the model's answers, but also improves the system's reliability in the field of electromechanical equipment bidding and tendering, and increases users' trust in the system. While effectively suppressing hallucinations, this method provides users with high-quality, reliable legal answers, becoming a key quality assurance link in the service process of the Legal Question and Answer Assistant System for Electromechanical Equipment Bidding and Tendering.

[0038] 4. Enhance the system's adaptability in different legal scenarios: flexible scenario adaptation is key

[0039] This method is the key to achieving flexible adaptation when the legal question-and-answer assistant for electromechanical equipment bidding faces diverse legal scenarios. By dynamically adjusting the sampling parameters, the accuracy and diversity of the output are balanced according to different legal task requirements (such as interpretation of electromechanical equipment bidding documents, contract clause review, compliance analysis, etc.). This dynamic adjustment capability enables this method to adapt to different issues and legal situations in electromechanical equipment bidding, suppress illusions and maintain high-quality output, thereby providing users with accurate and intelligent legal services. Whether it is a review of bidding contracts or complex legal dispute resolution, this method can ensure the efficient and compliant operation of the system, ensure that the various needs of different users in the field of electromechanical equipment bidding are met, and is a key link in the entire system to stably control illusions and accurately respond to various legal issues in a complex legal environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 Schematic diagram of the process of the Prompt-parameter collaborative optimization method of the present invention. DETAILED DESCRIPTION

[0041] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.

[0042] The method of the present invention comprises the following steps:

[0043] Step 1: Question reception and preprocessing

[0044] Receive legal issues in the field of electromechanical bidding and tendering input by users, and perform basic pre-processing operations on the issues, including removing redundant spaces, standardizing punctuation, etc., to ensure the standardization of the issues.

[0045] Step 2: Legal Search and Prompt Construction

[0046] 1. Legal terms retrieval: Based on the information collected from the Internet and the actual business situation, a knowledge base for electromechanical bidding and tendering is constructed, and a supporting legal retrieval program is developed. For the problems after pre-processing, the legal retrieval program is started to retrieve relevant legal provisions from the legal and valid electromechanical bidding and tendering knowledge base.

[0047] 2. Clause relevance filtering: We use the BERT-TOP3 algorithm to sort the retrieved legal provisions by relevance, retaining only those with a cosine similarity greater than 0.7 to the user's question. We also set a maximum number of referenced clauses (e.g., ≤5) to prevent information overload and distraction.

[0048] 3. Timeliness control: Connect to the API of the mechanical and electrical equipment bidding knowledge base to verify the timeliness of the retrieved legal terms one by one, mark the abolished terms, and search for corresponding new versions of the terms. If there are corresponding new versions, replace them to ensure the timeliness and accuracy of the referenced legal terms. If not, mark "now abolished" after the term content.

[0049] 4. Prompt Build

[0050] The overall hierarchical prompt structure includes the legal basis layer embedding, the task instruction layer embedding, and the dynamic example layer embedding. The specific contents are as follows:

[0051] First, the retrieved content is forcibly inserted at the beginning of the prompt in a fixed format: "[Based on Article X of the XX Law] + clause content." This explicitly limits the model to citing only these specific legal provisions, ensuring the accuracy and authority of the legal basis. Then, the prompt clearly defines the model's role as a "senior legal advisor," requiring it to provide answers strictly based on the provided legal provisions to ensure professionalism. Constraints are also set, prohibiting the model from making any assumptions or inventing uncited clauses, and prohibiting the use of vague terms (such as "maybe" or "probably") to ensure the accuracy of the output. Subsequently, the output format is specified, requiring the model's answer to consist of three parts: "conclusion + basis clause + applicable analysis." Citations to legal provisions must be labeled with specific article numbers to ensure a clear correspondence between the clauses and the analysis. Furthermore, a dynamic example layer is added to provide examples: by embedding positive examples (compliant answers) and negative examples (including hallucinatory answers) similar to the current question, the model's understanding of compliance is strengthened. This design aims to improve the model's ability to identify and generate answers that meet legal requirements through comparative analysis.

[0052] Finally, add a timeliness statement at the end of the prompt: "The legal documents cited in this answer are updated as of YYYY-MM-DD (specify the specific year, month, and day information)."

[0053] Step 3: Sampling parameter optimization settings

[0054] Optimize the sampling parameters according to the following strategy:

[0055] (1) Parameter coupling adjustment model

[0056] 1. Pre-build a legal domain parameter matrix. Based on the bidding and tendering legal task type, match the corresponding sampling parameters from the pre-built legal domain parameter matrix. Temperature, Top-K, and Top-P are common parameter configuration settings used to determine how to process the predicted token probabilities to select a single output token. An example parameter matrix is ​​shown below:

[0057] Task Type Temperature Top-K Top-P Compliance review of bidding documents 0.2 15 0.8 Bidding project risk assessment 0.4 20 0.9 Supplier qualification review 0.15 18 0.65

[0058] 2. Dynamically adjust the rule engine: When questions contain ambiguous terms such as "whether" and "can," the system automatically reduces the temperature to 0.2, with a Top-P of 0.75. If a user's question involves legal documents from multiple different devices, a hybrid sampling mode is activated: the first 50% of the generation steps use a temperature of 0.4, and subsequent steps are reduced to 0.3.

[0059] (2) Confidence Feedback Mechanism

[0060] 1. Output Confidence Score: During the generation process, the model synchronously calculates the entropy of the predicted probability distribution for each token. When the entropy of five consecutive tokens exceeds 1.2, a resampling mechanism is triggered to avoid overly ambiguous or inaccurate output. Confidence labels are attached to the final answer: the probability of all referenced terms is greater than 0.7 (high), the probability of a term being present is between 0.5 and 0.7 (medium), and the probability of no reference being detected is low.

[0061] 2. Refusal to Answer Mechanism: If the confidence level of the highest-probability legal clause cited by the model falls below 0.4, the system will force a prompt: "This question is beyond the scope of the current legal database. We recommend consulting a professional lawyer." This mechanism is designed to ensure the quality and legality of responses.

[0062] Step 4: Quality Verification and Iterative Optimization

[0063] Quality verification and iterative optimization are achieved through a dual verification pipeline, including automatic verification and technical specialist verification.

[0064] 1. Automatic verification: Perform a comprehensive and accurate check on the output to ensure it meets the established standards.

[0065] First, the validity of the legal clause numbers is verified. The rule engine is connected and compared with the current legal database in real time. The legal clauses in the output are matched according to the numbers. If a legal clause number in the output is not in the database, the exception is immediately flagged and reported to ensure the accuracy of the reference number.

[0066] The output text is also thoroughly scanned using a pre-set sensitive word library. Non-deterministic expressions, such as "should" and "suggested," are located and modified to ensure clarity and accuracy. The system automatically counts the number of citations for each clause in the output, ensuring that each referenced clause appears at least once. This allows for precise interception and triggers warnings to prevent citation errors or omissions.

[0067] 2. Verification by technical specialists: Regular updates are performed to ensure high-quality output of the model within the professional field.

[0068] Focusing on legal documents related to the bidding and tendering of electromechanical equipment, we create a test set of over 2,000 annotated samples each month, comprehensively covering all possible application scenarios involved in the bidding and tendering process in this field. Our technical team conducts in-depth analysis of the output results, focusing on assessing the model's hallucination rate (targeting <2%). We then make targeted adjustments and optimizations based on verification feedback from technical specialists. After adjustments, we conduct a comprehensive revalidation through a dual validation pipeline to continuously improve the model's quality and performance.

[0069] Scenario example: Mechanical and electrical equipment bidding consultation

[0070] Input question: "Is it legal for the bid security to exceed 2% of the estimated price of the bidding project?"

[0071] System processing flow:

[0072] 1. Legal search: Relevant content was retrieved from the "Implementation Measures for International Tendering and Bidding for Mechanical and Electrical Products (Trial)" (Ministry of Commerce Order No. 1 of 2014), such as Article 23. After screening, three relevant articles were retained.

[0073] 2. Prompt construction: [Role] You are a legal expert in the field of electromechanical equipment bidding and tendering. You must answer strictly in accordance with the following clauses: [Clause 1] Article 23: If the tenderer is required by the tenderee to submit a bid bond, the bid bond shall not exceed 2% of the estimated price of the tendered project. The validity period of the bid bond shall be the same as the validity period of the bid. [Clause 2] Article 44: If a bidder withdraws the submitted bid documents before the bid deadline, the tenderee or tendering agency shall refund the bid bond within 5 days from the date of receipt of the bidder's written withdrawal notice. [Clause 3] Article 77: If the tender documents require the successful bidder to submit a performance bond, the performance bond shall not exceed 10% of the contract amount of the successful bid. [Constraints] It is prohibited to speculate on legal consequences. You must clearly indicate whether it is compliant and the basis. [Question] Is it compliant if the bid bond exceeds 2% of the estimated price of the tendered project?

[0074] 3. Parameter settings: Activate the "Compliance Judgment" dedicated parameter group (Temperature = 0.2, Top-K = 8, Top-P = 0.65).

[0075] 4. Output and verification:

[0076] Compliant answer: "According to Article 23 of the Implementation Measures for International Tendering and Bidding for Mechanical and Electrical Products (Trial Implementation), the bid security shall not exceed 2% of the estimated price of the tendered project. A security deposit exceeding this ratio is not compliant. If a bidder encounters such a situation, they may withdraw their bid by notifying the tenderee in writing before the bid deadline and request the tenderee to return the collected bid security within 5 days."

[0077] Interception case: If the model generates "the bid security exceeds the prescribed ratio, which may result in the tenderer's direct cancellation of the bidder's bidding qualification" (no legal basis), the confidence check will trigger regeneration.

[0078] The above-described embodiment merely represents one embodiment of the present invention. While the description is relatively specific and detailed, it should not be construed as limiting the scope of the patent. It should be noted that a person skilled in the art would be able to make various modifications and improvements without departing from the spirit of the present invention, and these modifications and improvements fall within the scope of protection of the present invention. Therefore, the scope of protection of the patent for this invention shall be determined by the appended claims.

Claims

1. A prompt-parameter collaborative optimization method for the legal question-answering model of electromechanical bidding, characterized by: The following steps are involved: Step 1: Question reception and preprocessing Receive user input of legal issues in the field of electromechanical bidding and perform basic pre-processing operations on the issues; Step 2: Legal search and prompt construction Legal clause retrieval: Based on online data and actual business development, a knowledge base for electromechanical bidding and tendering is constructed, and a supporting legal retrieval program is developed. For pre-processed questions, the legal retrieval program is initiated to retrieve relevant legal provisions from the legal and valid electromechanical bidding and tendering knowledge base. Clause relevance filtering: The BERT-TOP3 algorithm is used to rank the retrieved legal provisions by relevance. Timeliness control: The API of the electromechanical equipment bidding and tendering knowledge base is connected to verify the timeliness of the retrieved legal clauses one by one. Prompt construction: The overall hierarchical prompt structure includes the embedding of the legal basis layer, the task instruction layer, and the dynamic example layer. Step 3: Sampling parameter optimization settings The sampling parameters are optimized according to the following strategies: Parameter coupling adjustment model: pre-construct a legal field parameter matrix, match the corresponding sampling parameters from the pre-constructed legal field parameter matrix according to the type of legal task in the bidding field to which the question belongs, and configure the parameters Temperature, Top-K, and Top-P to decide how to process the predicted token probability to select a single output token; dynamically adjust the corresponding rule engine according to the actual situation of the problem; Confidence feedback mechanism: Output credibility score: During the generation process, the model synchronously calculates the entropy value of the predicted probability distribution of each token; The entropy value exceeds the threshold to trigger the resampling mechanism; Attach a confidence label to the final answer; For the legal clauses with the highest probability cited by the model with low confidence, a rejection mechanism is adopted. Step 4: Quality Verification and Iterative Optimization Quality verification and iterative optimization are achieved through a dual verification pipeline, including automatic verification and technical specialist verification. Automatic verification: performs comprehensive and accurate checks on the output to ensure that it meets established standards. Technical specialist verification: performs regular updates to ensure high-quality output of the model within the professional field.

2. The Prompt-parameter collaborative optimization method for the legal question-answering model for electromechanical bidding according to claim 1 is characterized in that: In Step 1, the preprocessing operations include removing redundant spaces and standardizing punctuation.

3. The Prompt-parameter collaborative optimization method for the legal question-answering model for electromechanical bidding according to claim 1 is characterized in that: In Step 2, the terms relevance filtering is performed to retain only those terms with a cosine similarity greater than 0.7 with the user question; and a maximum number of reference terms is set.

4. The Prompt-parameter collaborative optimization method for the legal question-answering model for electromechanical bidding according to claim 1 is characterized in that: The timeliness control in Step 2 marks the abolished clauses and searches for corresponding new versions of the clauses. If there are new versions, they are replaced to ensure the timeliness and accuracy of the referenced legal clauses. If there are no new versions, "Now abolished" is marked after the clause content.

5. The Prompt-parameter collaborative optimization method for the electromechanical bidding legal question-answering model according to claim 1 is characterized in that: The specific contents of the Prompt structure are as follows: First, the retrieved content is forcibly inserted into the beginning of the Prompt in a fixed format of "[according to Article X of the XX Law] + clause content"; then, the role of the model is clearly defined in the Prompt as "senior legal advisor", requiring it to answer strictly in accordance with the provided legal clauses, and constraints are set to prohibit the model from making any form of speculation or creating uncited clause content, and prohibit the use of vague expressions; then, the output format is specified, requiring the model's answer to include three parts: "conclusion + basis clause + applicability analysis", among which the cited legal clauses must be marked with the specific legal clause number; in addition, a dynamic example layer is added to provide examples: positive and negative examples similar to the current question are embedded; finally, a timeliness statement is added at the end of the Prompt: "The legal documents cited in this answer are updated as of YYYY-MM-DD".

6. The prompt-parameter collaborative optimization method for the electromechanical bidding legal question-answering model according to claim 1 is characterized in that: The dynamic adjustment rule engine in Step 3 is as follows: When it is detected that the question contains ambiguous words, the Temperature is automatically reduced to 0.2, and Top-P = 0.75; if the user question involves the content of legal documents on multiple different devices, a mixed sampling mode is activated: the first 50% of the generation steps use Temperature = 0.4, and the subsequent steps are reduced to 0.

3.

7. The Prompt-parameter collaborative optimization method for the electromechanical bidding legal question-answering model according to claim 1 is characterized in that: The output credibility score in Step 3 is specifically as follows: when the entropy value of 5 consecutive tokens exceeds 1.2, the resampling mechanism is triggered to avoid overly vague or inaccurate output; high, medium and low confidence labels are attached to the final answer: the probability of all referenced terms is greater than 0.7, the probability of the existence of a term is between 0.5 and 0.7, and the unreferenced term is detected.

8. The Prompt-parameter collaborative optimization method for the legal question-answering model for electromechanical bidding according to claim 1 is characterized in that: The specific refusal to answer mechanism in Step 3 is as follows: Refusal to answer mechanism: If the confidence level of the highest probability legal clause cited by the model is lower than 0.4, the system will force output a prompt: "This question is beyond the coverage of the current legal database. It is recommended to consult a professional lawyer." 9. The prompt-parameter collaborative optimization method for the electromechanical bidding legal question-answering model according to claim 1 is characterized in that: The automatic verification in Step 4 is as follows: First, the validity of the legal clause number is verified, and the rule engine is connected and compared with the current valid legal database in real time. The legal clauses in the output content are matched according to the number; if there is a legal clause number in the output that is not in the database, the abnormal situation is immediately marked and reported; at the same time, the output text is fully scanned through the pre-set sensitive word library, and the expression words with non-deterministic features are located and modified; the number of citations of each clause in the output is automatically counted to ensure that each cited clause appears at least once.

10. The Prompt-parameter collaborative optimization method for the electromechanical bidding legal question-answering model according to claim 1 is characterized in that: The technical specialist verification in Step 4 specifically involves: focusing on legal documents related to the bidding and tendering of electromechanical equipment, and creating a test set of 2,000+ labeled samples each month to comprehensively cover the application scenarios that may be involved in the bidding and tendering process in this field. The technical team conducts in-depth analysis of the output results, focusing on assessing the model's hallucination rate, with a goal of <2%. Targeted adjustments and optimizations are then made based on the technical specialist verification feedback. After the adjustments, the model is fully validated again through the double validation pipeline to continuously improve its quality and performance.