Search formula generation method and system based on instruction recombination and local feedback optimization

By using instruction reorganization and local feedback optimization, semantic instruction fragments are dynamically assembled, terms are filtered using the longest matching mechanism, a Boolean logic tree is constructed, and closed-loop feedback repair is performed. This solves the problems of low semantic recall, uncertainty of generative models, and inefficiency of holistic instruction input in cross-language retrieval systems, and achieves efficient and accurate cross-language retrieval.

CN122346484APending Publication Date: 2026-07-07NORTHWEST INST OF ECO ENVIRONMENT & RESOURCES CAS

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NORTHWEST INST OF ECO ENVIRONMENT & RESOURCES CAS
Filing Date
2026-06-02
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Existing interdisciplinary retrieval systems suffer from limitations in semantic recall in cross-language scenarios, contradictions between the probabilistic uncertainty of generative large models and the strict syntax of databases, and inefficiencies and maintenance difficulties of holistic command input.

Method used

A method based on instruction reorganization and local feedback optimization is adopted. By dynamically assembling semantic instruction fragments, filtering terms using the longest matching mechanism, constructing a Boolean logic tree, and correcting errors through a closed-loop feedback repair mechanism, local repair is achieved.

Benefits of technology

It significantly reduces interaction overhead and computational resource consumption, solves the problem of semantic drift of compound terms in cross-language scenarios, achieves compatibility between generative models and database syntax, and improves the accuracy and efficiency of retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122346484A_ABST
    Figure CN122346484A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of computer data processing, and discloses a search formula generation method and system based on instruction recombination and local feedback optimization, the search formula generation method comprising the following steps: step S1, dynamic assembly and semantic expansion of instruction segments; step S2, controlled term filtering based on a longest match mechanism; step S3, construction of a Boolean logic tree; and step S4, closed-loop logic repair based on component ID mapping. The application significantly reduces interaction overhead and computing resource consumption, solves the semantic drift problem of composite terms in a cross-language scenario, and realizes the compatibility of the probability of a generative model and the determinacy of a database syntax.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer data processing technology, and in particular to a cross-language retrieval method and system based on instruction reorganization and local feedback optimization. Background Technology

[0002] With the deepening of interdisciplinary research, Boolean logic-based academic database retrieval has become a core means of obtaining scientific research information. However, existing retrieval construction technologies face the following major technical bottlenecks in practical applications: First, the rigid constraints of string matching limit semantic recall. Traditional retrieval systems rely on precise keyword matching or stemming techniques. This approach is limited by the coverage of a pre-defined vocabulary and struggles to automatically handle deep semantic connections across language scenarios. For example, when dealing with the concept of "permafrost degradation," traditional methods typically only map to the literal word "degradation," failing to automatically expand to implicit feature words like "thawing" or "warming" based on mechanistic connections, resulting in significant missed detections in the search results. Second, there is a contradiction between the probabilistic uncertainty of generative large models and the strict syntax of databases. Although large language models (LLMs) have strong semantic association capabilities, they are essentially generative models based on probabilistic prediction and lack hard constraints on domain-specific controlled vocabularies. This makes it easy for models to generate seemingly professional but actually unincluded "pseudo-terms" (i.e., terminology illusions). In addition, professional databases (such as Web of Science) have strict syntactic requirements for the precedence of Boolean logic operators and the nesting level of brackets. When generating long texts, general-purpose LLMs often suffer from distorted logical structures (such as unclosed brackets) due to distracted attention to context, resulting in search queries that cannot be correctly parsed by search engines. Third, the inefficiency and maintenance difficulties of holistic instruction input. Existing technologies, when using large models for assisted generation, typically employ a "holistic prompting" strategy, encapsulating role definitions, expansion rules, and format constraints into a single long text input. This tightly coupled input method has significant drawbacks: on the one hand, long texts easily lead to "instruction observance forgetting" phenomena in the model, ignoring fine-grained constraints (such as compound word retention rules); on the other hand, when the output only has local errors (such as misuse of a single operator), the holistic strategy cannot perform targeted local repairs, requiring adjustment of the entire prompt and re-execution of full generation. This not only significantly increases computational overhead (token consumption) but also leads to instability in the generation process. Summary of the Invention

[0003] The purpose of this invention is to address the technical deficiencies in the existing technology by providing a retrieval-based method and system for generating queries based on instruction reorganization and local feedback optimization.

[0004] The technical solution adopted to achieve the purpose of this invention is: A retrieval expression generation method based on instruction recombination and local feedback optimization includes the following steps: Step S1, Dynamic assembly and semantic expansion of instruction fragments: The source language retrieval request is parsed, multiple independent semantic instruction fragments are indexed and extracted from the discrete instruction pool, dynamically assembled into a structured prompt stream, and the ID corresponding to each semantic instruction fragment is saved. After the structured prompt stream is input into the large language model, at least two candidate semantic augmented texts are obtained in parallel, and the user selects the target semantic augmented text. Step S2, controlled term filtering based on the longest match mechanism: Using a local terminology database, feature extraction is performed on the target semantic augmented text. The longest matching mechanism is used to perform filtering (filtering out non-standard words and illusion words). Based on the matching results, only standardized concepts existing in the local terminology database are retained (excluding generated words that do not match), thus obtaining a set of standardized core concepts. Step S3, Construction of the Boolean logic tree: Map the standardized core concept set to concept groups, construct an initial Boolean logic tree, and generate an initial search expression; Step S4, Closed-loop logic repair based on component ID mapping: The initial search query is checked for compliance using a discrete rule base. When the compliance check is passed, the final search query is output. When an error is detected in a semantic instruction fragment, the target semantic instruction fragment ID is locked, the semantic instruction fragment corresponding to the ID is read and modified in a targeted manner, and then recombined with other semantic instruction fragments. The result is then input into the large language model again to generate a new target semantic augmented text. Steps S2 and S3 are repeated until the compliance check is passed or the preset number of retries is reached.

[0005] In the above technical solution, the source language in step S1 is Chinese or English.

[0006] In the above technical solution, in step S1, the discrete instruction pool includes two dictionaries: one is a simple Chinese-English bilingual dictionary, and the other is a Chinese long-definition dictionary.

[0007] In the above technical solution, in step S1, the semantic instruction fragment includes a first semantic instruction fragment for setting the role, a second semantic instruction fragment for defining the expansion strategy, and a third semantic instruction fragment for defining the output format.

[0008] In the above technical solution, the specific steps of the longest matching mechanism to perform filtering in step S2 are as follows: when multiple candidate terms with nested relationships are detected in the target semantic augmented text, the text region corresponding to the term with the longest character length is locked, and an occupation mark is added to the region to block the repeated matching of short-granular terms.

[0009] In the above technical solution, in step S3, when constructing the initial Boolean logic tree, OR is added between nodes in the same concept group, AND is added between different concept groups, and then the syntax is encapsulated to obtain the initial search expression.

[0010] In the above technical solution, in step S3, during the syntax encapsulation process, field qualifiers or exact match identifiers are automatically added to nodes containing special characters.

[0011] In the above technical solution, in step S4, after the semantic instruction fragments are recombined, they are fed back to the discrete rule base and discrete instruction pool for correction.

[0012] In another aspect, the present invention provides a system for implementing the retrieval expression generation method based on instruction reorganization and local feedback optimization, comprising: Instruction storage and management module: used to maintain a discrete instruction pool, which stores several semantic instruction fragments with unique IDs; Dynamic assembly engine: used to perform step S1; Terminology standardization filtering module: It has a built-in local terminology database containing an inverted index and performs step S2. Logical construction module: Execute step S3; Closed-loop feedback repair module: Execute step S4.

[0013] In another aspect of the present invention, an electronic device includes one or more processors and a memory; the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the retrieval-based generation method based on instruction reorganization and local feedback optimization.

[0014] Compared with the prior art, the beneficial effects of the present invention are: 1. Significantly reduced interaction overhead and computational resource consumption: Unlike existing technologies that require resetting the entire long text prompt to modify a single rule, this invention utilizes an "instruction reorganization and local feedback repair" mechanism. When a generation error is detected, only the corresponding semantic instruction fragment is located and updated (e.g., only the spelling constraint fragment is enhanced), while keeping the rest of the context data unchanged. This mechanism avoids the redundant token consumption caused by full retries, resulting in faster convergence speed for retrieval-based corrections and significantly reducing the cost and latency of calling large language model APIs. 2. This invention addresses the semantic drift problem of compound terms in cross-language scenarios: It innovatively introduces controlled term filtering based on the "Longest Match Mechanism." By locking the text region of long-granular terms (e.g., "Permafrost degradation") and blocking repeated matching of its internal short words (e.g., "Permafrost"), it effectively overcomes the technical defect of general large-scale models that easily and incorrectly decompose compound concepts into independent keywords (A AND B) during word segmentation, ensuring that the generated search terms strictly conform to the academic semantic norms of the specific domain. 3. Achieves compatibility between the probabilistic nature of generative models and the deterministic nature of database syntax: By decoupling unstructured natural language instructions into discrete fragments with unique IDs, and in conjunction with a "compliance detection-closed-loop feedback" mechanism, this invention can automatically correct grammatical structure errors (such as unbalanced bracket levels and missing logical operators) caused by attention distraction in large language models. This allows the system to output executable search expressions that conform to the strict syntactic standards of databases such as Web of Science (high precision) while retaining the powerful semantic association capabilities (high recall) of large language models. Attached Figure Description

[0015] Figure 1 The diagram shown is a flowchart of the method of the present invention. Detailed Implementation

[0016] The present invention will be further described in detail below with reference to specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0017] Example 1 The retrieval generation method of this invention uses two key structured databases: a discrete instruction pool and a local terminology database, as shown below: 1. The Discrete Instruction Fragment Repository differs from existing technologies that store prompts as single long texts. This embodiment constructs a discrete instruction reservoir based on key-value pairs or a relational database. Each record in this repository represents an independent semantic instruction fragment, which includes a first semantic instruction fragment defining the role, a second semantic instruction fragment defining the expansion strategy (semantic expansion path), and a third semantic instruction fragment defining the output format.

[0018] Its data structure is defined as shown in Table 1 below: Table 1: Example of semantic instruction fragment data structure; ; 2. A local domain terminology base containing an inverted index: To support "maximum match filtering" and "automatic synonym grouping," this system maintains an enhanced terminology dictionary (in CSV or SQLite format). Its core feature is the introduction of the Concept_ID field, used to establish cross-language semantic mapping relationships. The data structure is shown in Table 2 below: Table 2: Example of terminology database data structure; ; like Figure 1 As shown, a cross-language retrieval expression generation method based on instruction recombination and local feedback optimization includes the following steps: Step S1: Dynamic assembly and semantic expansion of instruction fragments.

[0019] In response to a user-input source language retrieval request (e.g., "permafrost degradation on the Qinghai-Tibet Plateau"), the system performs the following dynamic assembly steps: Step S11, Semantic parsing and indexing: The system parses the input text and determines the search topic as [Geology / Cryosphere].

[0020] Step S12, Fragment Extraction: The system extracts a set of basic semantic instruction fragments in parallel from the discrete instruction pool using SQL queries or hash indexes, specifically including: First semantic instruction fragment: frag_id=CTX_001 (geology expert role); Second semantic instruction fragment: frag_id=TASK_EXPAND_GEO (mechanism / region expansion strategy); Third semantic instruction fragment: frag_id=FMT_JSON (JSON format constraint).

[0021] Step S13, Serialization Assembly: The system splices the extracted semantic instruction fragments according to the preset topological order of the first semantic instruction fragment [Role] → the second semantic instruction fragment [Task] → the third semantic instruction fragment [Format] to generate the initial structured prompt stream.

[0022] Step S14, State Cache: The system stores the IDs of each semantic instruction fragment currently in use (e.g., ['CTX_001', 'TASK_EXPAND_GEO', 'FMT_JSON']) in memory as index handles for subsequent "surgical" repairs in step S4. This is the technical basis for implementing local feedback.

[0023] Step S15: After the structured prompt stream is input into the large language model LLM, at least two candidate semantic augmented texts are obtained in parallel, and the user selects the target semantic augmented text.

[0024] Step S2, controlled term filtering based on the Longest Match Mechanism.

[0025] To address the issue that general large models often incorrectly segment long compound words (such as "permafrostdegradation") into short words (such as "permafrost") when expanding across languages, this embodiment employs a filtering mechanism based on "occupancy marking".

[0026] The specific processing procedure is as follows: Step s21, Initialization: The system receives the target semantic augmented text $T$ generated by the Large Language Model (LLM) and creates a Boolean mask array Mask with the same length as the text $T$, with all initial values ​​set to False (indicating that all character positions are unoccupied).

[0027] Step s22, term sorting: The system reads the local terminology database and sorts all terms $w_i$ in descending order by character length (term_len) to obtain an ordered list $L_{sorted}$.

[0028] Step s23, Traversal Matching: The system iterates through each term $w_i$ in the sorted list $L_{sorted}$ in turn: (1) Find all occurrences of $w_i$ in the text $T$ (start index $start$, end index $end$); (2) Conflict detection: Check whether the Mask array already contains a True value in the interval $[start,end]$; (3) Locking operation: If all values ​​in the interval are False, the match is considered successful. The system extracts the term $w_i$ and adds it to the core concept set, and marks all bits in the Mask array within the interval $[start,end]$ as True; (4) Masking operation: If a True value already exists in the interval (meaning that the position has been occupied by a longer term), then skip the current term $w_i$.

[0029] Step s24, Output: After the traversal is complete, output the set of all successfully matched standardized core concepts.

[0030] Example of the effect: Regarding the text "...impact of permafrost degradation on...": The algorithm prioritizes matching "permafrost degradation" of length 22 and marks the corresponding position as occupied. Subsequently, when it scans "permafrost" of length 10, it finds that the corresponding position is already occupied and therefore automatically discards it. This mechanism completely eliminates semantic redundancy caused by "partial matching" at the algorithmic level.

[0031] Step S3: Construction of the Boolean logic tree.

[0032] The standardized core concept set obtained in step S2 is mapped to concept groups to construct an initial Boolean logic tree. The first logical operator (OR) is added between nodes in the same concept group, and the second logical operator (AND) is added between different concept groups. Field qualifiers or exact match identifiers are automatically added to nodes containing special characters to generate the initial search expression.

[0033] Step S4: Closed-loop feedback repair process based on component ID mapping.

[0034] This is the core control logic of the system. Unlike existing technologies that blindly rewrite the entire prompt, this embodiment maintains an "error type-semantic instruction fragment mapping table" (as shown in Table 3) to achieve fine-grained modification of the structured input stream: Table 3: Error Type and Semantic Instruction Fragment Mapping Table (Example); ; The specific repair algorithm process is as follows: Step S41, Compliance Check: The system parses the initial search expression generated in step S3. If the parser throws an exception (e.g., ERR_01: unbalanced bracket stack), the system intercepts the error signal.

[0035] Step S42, Addressing and Positioning: The system queries Table 3 and, based on error code ERR_01, identifies the target semantic instruction fragment ID as FMT_SYNTAX.

[0036] Step S43, Surgical Update: The system reads only the original text corresponding to the target semantic instruction fragment ID FMT_SYNTAX from the instruction sequence cached in memory, and generates new instruction content based on repair actions (such as Append). For example, the original content is "Ensure correct syntax.", and the updated content is: "Ensure correct syntax. CRITICAL WARNING: Previous output had unbalanced parentheses. Please verify strictly.". At this point, other segments in the sequence (such as the first semantic instruction segment role definition CTX_001 and the second semantic instruction segment expansion strategy TASK_EXPAND) remain completely consistent at the binary level, without any changes.

[0037] Step S44, Recombination and Retry: The system uses the updated FMT_SYNTAX fragment to reassemble with the other existing fragments, generating a new structured cue stream, which triggers the large language model to generate semantically expanded text again.

[0038] Step S45, Termination Condition: The above loop continues until the detection passes or the preset maximum number of retries (e.g., 3 times) is reached.

[0039] Example 2 A system for implementing the retrieval-based generation method for instruction reorganization and local feedback optimization of Embodiment 1 runs on a computing device including a processor, memory, and a network interface. To achieve "instruction reorganization" and "local feedback," this system constructs two key structured databases in memory: a discrete instruction pool and a local terminology database.

[0040] The system includes: Instruction Storage & Management Module: This module is used to maintain a discrete instruction pool, which stores several semantic instruction fragments with unique identifiers (IDs).

[0041] The Dynamic Assembly Engine responds to user retrieval requests by indexing and extracting multiple corresponding semantic instruction fragments from the discrete instruction pool based on the semantic features of the request. It is also responsible for concatenating the extracted semantic instruction fragments into a structured input stream according to a preset sequence, driving the large language model to generate at least two candidate semantic augmented texts in parallel, and allowing the user to select the target semantic augmented text.

[0042] The Term Standardization & Filtering Module contains a built-in local terminology database with an inverted index and is configured to perform the Longest Match Mechanism on the target semantically augmented text. This module is used to lock the text region of long-granular terms and block duplicate matches of short-granular terms, thereby extracting only the standardized core concepts existing in the controlled local terminology database, resulting in a set of standardized core concepts.

[0043] The Logic Construction Module receives the filtered core concepts, connects nodes of the same concept group using logical OR, connects different concept groups using logical AND, and adds field identifiers and exact match symbols according to the preset rule base to construct the initial search expression.

[0044] Closed-loop Feedback Repair Module: Includes a compliance detection unit and an instruction modification unit.

[0045] Compliance detection unit: used to parse the syntax structure of the initial search query.

[0046] Instruction Modification Unit: When an error is detected, it finds the instruction fragment ID corresponding to the error type, generates a reinforced constraint instruction, and performs a local feedback repair operation. This operation only locates and updates the corresponding instruction data region in the structured input stream, leaving the rest unchanged, and triggers the system's retry generation logic.

[0047] Example 3 An electronic device includes one or more processors and a memory; the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the retrieval generation method based on instruction reorganization and local feedback optimization as described in Embodiment 1.

[0048] The above description is only a preferred embodiment of the present invention. It should be noted that, for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A retrieval query generation method based on instruction recombination and local feedback optimization, characterized in that, Includes the following steps: Step S1, dynamic assembly and semantic expansion of instruction fragments: The source language retrieval request is parsed, multiple independent semantic instruction fragments are indexed and extracted from the discrete instruction pool, dynamically assembled into a structured prompt stream, and the ID corresponding to each semantic instruction fragment is saved. After the structured prompt stream is input into the large language model, at least two candidate semantic augmented texts are obtained in parallel, and the user selects the target semantic augmented text. Step S2, controlled term filtering based on the longest match mechanism: Using a local terminology database, feature extraction is performed on the target semantic augmented text. The longest matching mechanism is used for filtering. Based on the matching results, only standardized concepts existing in the local terminology database are retained to obtain a set of standardized core concepts. Step S3, Construction of the Boolean logic tree: Map the standardized core concept set to concept groups, construct an initial Boolean logic tree, and generate an initial search query; Step S4, Closed-loop logic repair based on component ID mapping: The initial search query is checked for compliance using a discrete rule base. When the compliance check is passed, the final search query is output. When an error is detected in a semantic instruction fragment, the target semantic instruction fragment ID is locked, the semantic instruction fragment corresponding to the ID is read and modified in a targeted manner, and then recombined with other semantic instruction fragments. The result is then input into the large language model again to generate a new target semantic augmented text. Steps S2 and S3 are repeated until the compliance check is passed or the preset number of retries is reached.

2. The retrieval formula generation method based on instruction recombination and local feedback optimization as described in claim 1, characterized in that, In step S1, the source language is Chinese or English.

3. The retrieval formula generation method based on instruction recombination and local feedback optimization as described in claim 1, characterized in that, In step S1, the discrete instruction pool contains two dictionaries: one is a simple Chinese-English bilingual dictionary, and the other is a Chinese long-explanation dictionary.

4. The retrieval formula generation method based on instruction recombination and local feedback optimization as described in claim 1, characterized in that, In step S1, the semantic instruction fragment includes a first semantic instruction fragment for setting the role, a second semantic instruction fragment for defining the expansion strategy, and a third semantic instruction fragment for defining the output format.

5. The retrieval expression generation method based on instruction recombination and local feedback optimization as described in claim 1, characterized in that, In step S2, the specific steps of the longest matching mechanism to perform filtering are as follows: when multiple candidate terms with nested relationships are detected in the target semantic augmented text, the text region corresponding to the term with the longest character length is locked, and an occupation mark is added to the region to block the repeated matching of short-granular terms.

6. The retrieval formula generation method based on instruction recombination and local feedback optimization as described in claim 1, characterized in that, In step S3, when constructing the initial Boolean logic tree, OR is added between nodes in the same concept group, and AND is added between different concept groups. Then, the syntax is encapsulated to obtain the initial search expression.

7. The retrieval formula generation method based on instruction recombination and local feedback optimization as described in claim 1, characterized in that, In step S3, during the syntax encapsulation process, field qualifiers or exact match identifiers are automatically added to nodes containing special characters.

8. The retrieval expression generation method based on instruction recombination and local feedback optimization as described in claim 1, characterized in that, In step S4, after the semantic instruction fragments are recombined, they are fed back to the discrete rule base and discrete instruction pool for correction.

9. A system for implementing the retrieval formula generation method based on instruction reorganization and local feedback optimization as described in claim 1, characterized in that, include: Instruction storage and management module: used to maintain the discrete instruction pool, which stores several semantic instruction fragments with unique IDs; Dynamic assembly engine: used to perform step S1; Terminology standardization filtering module: It has the local professional terminology database built in and executes step S2; Logical construction module: Execute step S3; Closed-loop feedback repair module: Execute step S4.

10. An electronic device, characterized in that, It includes one or more processors and a memory; the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the retrieval generation method based on instruction reorganization and local feedback optimization as described in claim 1.