Adaptive memory enhancement method and device based on large language model

By combining semantic vector similarity retrieval and structured attribute matching, the shortcomings of large language models in memory update mechanism are addressed, achieving efficient and accurate memory management and adaptive updates, thus improving the user interaction experience.

CN122132533APending Publication Date: 2026-06-02SHANGHAI ZHIXUE XINGTU ARTIFICIAL INTELLIGENCE TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI ZHIXUE XINGTU ARTIFICIAL INTELLIGENCE TECHNOLOGY CO LTD
Filing Date
2026-02-10
Publication Date
2026-06-02

Smart Images

  • Figure CN122132533A_ABST
    Figure CN122132533A_ABST
Patent Text Reader

Abstract

This invention discloses an adaptive memory enhancement method and apparatus based on a large language model. The method includes receiving user input and preprocessing the input; simultaneously performing semantic vector similarity retrieval and structured attribute matching retrieval on the preprocessed text in a preset memory bank, outputting a candidate memory set; calling a fine-ranking model to sort the matching degree between the preprocessed text and each memory fragment in the candidate memory set from high to low, obtaining the top K high-confidence memory fragments; and injecting the high-confidence memory fragments into the prompt words of an LLM according to a preset template, so that the LLM outputs a response based on the prompt words. This adaptive memory enhancement method based on a large language model driven by dynamic instructions and hybrid fine-ranking solves the problems of inaccurate memory retrieval, untimely updates, and lack of structured management in existing technologies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence and natural language processing technology, specifically to an adaptive memory enhancement method and apparatus based on a large language model. Background Technology

[0002] With the widespread application of Large Language Models (LLM), how to enable the model to "remember" user preferences, historical interaction information, and knowledge of specific domains has become a key challenge. Existing technologies generally have the following problems: (1) Context window limitation and forgetting: Although the context window of LLM is increasing, directly splicing excessively long history will lead to a surge in reasoning costs and distraction, making it difficult for the model to accurately extract key information from massive history. (2) Insufficient retrieval accuracy: Traditional retrieval enhancement generation mainly relies on single semantic representation vector similarity retrieval. When the query statement is semantically ambiguous or there is a need for structured attribute matching, simple vector retrieval is prone to returning irrelevant content (noise), lacking the ability to accurately filter based on attributes, tags, or metadata. (3) Rigid memory update mechanism: Existing memory systems are mostly static storage, which cannot automatically correct memory based on real-time feedback during the dialogue process. Users need to manually operate the underlying storage to update outdated information, lacking the ability to "learn and forget naturally in the dialogue". (4) Single sorting logic: The retrieved fragments are often sorted only by similarity score, without considering the coherence of semantic logic or the priority of specific scenarios, resulting in low quality of prompts input to the model. (5) Lack of structured management: Memory data is often a bunch of unstructured text blocks, lacking hierarchical attributes or classification management. As the amount of data increases, the retrieval efficiency and accuracy decline significantly. Therefore, there is an urgent need for an intelligent system and method that can combine hybrid retrieval strategies, support high-precision sorting, and implicitly trigger memory CRUD operations through natural language dialogue. Summary of the Invention

[0003] The main objective of this invention is to provide an adaptive memory enhancement method based on a large language model to address the shortcomings of related technologies.

[0004] To achieve the above objectives, according to a first aspect of the present invention, an adaptive memory enhancement method based on a large language model is provided, comprising receiving user input and preprocessing the input; simultaneously performing semantic vector similarity retrieval and structured attribute matching retrieval on the preprocessed text in a preset memory bank, and outputting a candidate memory set; calling a fine ranking model to sort the matching degree between the preprocessed text and each memory fragment in the candidate memory set from high to low, obtaining the top K high-confidence memory fragments; and injecting the high-confidence memory fragments into the prompt words of an LLM according to a preset template, so as to output a response based on the prompt words through the LLM.

[0005] Optionally, preprocessing the text includes: determining the memory operation instructions corresponding to the text, wherein the memory operation instructions include add, delete, modify, and query operation types; and performing data operations on the data corresponding to the instructions in a preset memory bank based on the memory operation instructions.

[0006] Optionally, determining the memory operation instruction corresponding to the text includes: parsing the text and determining whether there is a memory change based on the parsing information; if there is a memory change, then generating a memory operation instruction.

[0007] Optionally, parsing the text and determining whether a memory change exists based on the parsed information includes: detecting whether the text contains specified memory operation keywords; analyzing the dialogue context through LLM to determine whether there is an implicit memory change intent; if keyword matching or implicit memory change intent is contained, it is determined that a memory change exists.

[0008] Optionally, performing semantic vector similarity retrieval and structured attribute precise matching retrieval on the preprocessed text simultaneously includes: converting the preprocessed text into a high-dimensional vector using a semantic encoding model, performing vector retrieval in a preset memory bank to retrieve memory fragments that are semantically related to the preprocessed text; extracting key attribute information from the user input based on a preset structured attribute system, and matching memory fragments based on the key attribute information from the preset memory bank; and obtaining a candidate memory set by summarizing the memory fragments.

[0009] According to a second aspect of the present invention, an adaptive memory enhancement device based on a large language model is provided, comprising: a hybrid retrieval unit for receiving user input and preprocessing the input; simultaneously performing semantic vector similarity retrieval and structured attribute matching retrieval on the preprocessed text in a preset memory bank, and outputting a candidate memory set; a fine ranking unit for calling a fine ranking model to sort the matching degree between the preprocessed text and each memory fragment in the candidate memory set from high to low, obtaining the top K high-confidence memory fragments; and an enhancement unit for injecting the high-confidence memory fragments into the prompt words of an LLM according to a preset template, so as to output a response based on the prompt words through the LLM.

[0010] Optionally, preprocessing the text includes: determining the memory operation instructions corresponding to the text, wherein the memory operation instructions include add, delete, modify, and query operation types; and performing data operations on the data corresponding to the instructions in a preset memory bank based on the memory operation instructions. According to a third aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing the computer to perform the method described in any one of the first aspects.

[0011] According to a fourth aspect of the present invention, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to cause the at least one processor to perform the method described in any implementation of the first aspect.

[0012] According to a fifth aspect of the present invention, a computer program product is provided, which, when executed by a processor, implements the method described in any implementation of the first aspect.

[0013] This embodiment presents an adaptive memory enhancement method and apparatus based on a large language model. The method includes receiving user input and preprocessing the input; simultaneously performing semantic vector similarity retrieval and structured attribute matching retrieval on the preprocessed text in a preset memory bank, outputting a candidate memory set; calling a fine-ranking model to sort the matching degree between the preprocessed text and each memory fragment in the candidate memory set from high to low, obtaining the top K high-confidence memory fragments; and injecting the high-confidence memory fragments into the prompt words of the LLM according to a preset template, so that the LLM outputs a response based on the prompt words. This adaptive memory enhancement method based on a large language model driven by dynamic instructions and hybrid fine-ranking solves the problems of inaccurate memory retrieval, untimely updates, and lack of structured management in existing technologies. Attached Figure Description

[0014] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0015] Figure 1 This is a flowchart of the adaptive memory enhancement method based on a large language model according to an embodiment of the present invention; Figures 2-4 This is a schematic diagram illustrating the application of the adaptive memory enhancement method of the present invention in a large language model; Figure 5 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0016] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. 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 should fall within the scope of protection of the present invention.

[0017] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of the invention described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0018] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0019] According to embodiments of the present invention, an adaptive memory enhancement method based on a large language model is provided, such as... Figure 1 As shown, steps 101 to 103 are included below: Step 101: Receive user data and preprocess the text; in the preset memory, perform semantic vector similarity retrieval and structured attribute matching retrieval on the preprocessed text simultaneously, and output candidate memory set.

[0020] In this step, refer to Figure 2 The overall process diagram shows that the system receives natural language queries or dialogue input from users through the application, and then cleans the corresponding text by removing redundant information and correcting grammar.

[0021] As an optional implementation of this embodiment, preprocessing the text includes: determining the memory operation instructions corresponding to the text, wherein the memory operation instructions include add, delete, modify, and query operation types; and performing data operations on the data corresponding to the instructions in a preset memory bank based on the memory operation instructions.

[0022] In this optional implementation, during the multi-turn dialogue loop, the instruction processing leverages the understanding capabilities of a large language model, utilizing pre-defined instruction templates to perform real-time analysis of the user's natural language input. When the system detects that the user's expression contains an intention to change personal information, preferences, or facts (e.g., "information change," "correcting previous statements"), the unstructured dialogue text is converted into standardized structured operation instructions (including operation type, target field, new value, etc.). Subsequently, based on the parsed instructions, the system executes add, delete, and modify operations in real-time through the underlying data interface, thereby achieving dynamic maintenance of the memory without manual intervention.

[0023] As an optional implementation of this embodiment, determining the memory operation instruction corresponding to the text includes: parsing the text and determining whether there is a memory change based on the parsing information; if there is a memory change, then generating a memory operation instruction.

[0024] In the above-mentioned optional implementation methods, based on the cleaned data, a large language model can be used to determine whether it contains a memory modification intent, and a structured memory operation instruction can be output. The structured memory operation instruction can include operation type, target field, and new value information. The operation type includes add, delete, and modify operations. Only when it is determined that a memory state modification intent is contained can the subsequent process continue.

[0025] As an optional implementation of this embodiment, parsing the text and determining whether there is a memory change based on the parsed information includes: detecting whether the text contains specified memory operation keywords; and analyzing the dialogue context through LLM to determine whether there is an implicit memory change intent.

[0026] In this optional implementation, refer to Figure 3 Sequence diagram of memory instruction parsing and execution logic. It can accurately capture user memory addition / modification / deletion requests, rather than ordinary query requests, in the following ways: A pre-set library of keywords for memory operations (such as "remember", "add", "correct", "modify", "forget", "delete", "update") can be used. When a user inputs keywords containing these keywords (such as "remember that I like to drink black tea" or "correct me, I am allergic to mangoes"), intent recognition is triggered.

[0027] Furthermore, for inputs without explicit keywords but implying changes in memory (such as a user saying "I go to work at 8 a.m. every morning" for the first time, or adding "I now go to work at 9 a.m."), LLM analyzes the context of the dialogue to determine whether the user has the intention to "inform about new information" or "correct old information" (i.e., to determine whether there is an intention to modify the memory state).

[0028] After double verification using keyword matching and LLM semantic understanding, it is determined whether the intention to modify the memory has been triggered, and it is classified into three standardized types (directly corresponding to the "operation type" of subsequent structured instructions): New intent: Users inform the system of previously unstored personalized information, preferences, or facts (such as "I like hiking"); Intended purpose of modification: To allow users to correct and supplement existing information (e.g., "The previous statement about the start time was incorrect; it should be 9:00 AM"). Deletion Intent: The user requests the removal of existing memories (e.g., "Forget the phone number I just mentioned").

[0029] Furthermore, once a memory change is detected, the result is ultimately converted into standardized structured instructions to ensure accurate execution of memory storage and index management operations.

[0030] For example, after identifying the specific memory modification intent, based on the construction of a structured memory instruction protocol, the user's natural language input is converted into a format that includes: "operation type (the specific action of memory change, corresponding to three categories: 'add / delete / modify'), target field (extracting the core theme from the user input and matching it with the attribute system: - Input 'Remember I don't drink iced drinks' → target field = beverage preference; - Input 'Correct allergy history to mango' → target field = allergy history), old value (if any, only needs to be extracted for modification / deletion intents, referring to the original data stored in the current memory bank. For example, extracting key facts from the user input: - Add intent: Input 'Remember I like hiking' → new value = like hiking; - Modify intent: Input 'Correct allergy history to mango' → new value = mango), new value (only needs to be extracted for add / modify intents, referring to the new data that the user wants to store. For example, extracting key facts from the user input: - Add intent: Input 'Remember I like hiking' → new value = like hiking; - Modify intent: Input 'Correct allergy history to mango' → new value = mango"), and new value (only needs to be extracted for add / modify intents, referring to the new data that the user wants to store. For example, extracting key facts from the user input: - Add intent: Input 'Remember I like hiking' → new value = like hiking; - Modify intent: Input 'Correct allergy history to mango' → new value = mango") Mango), associated attributes (auxiliary information to ensure the accuracy of command execution, including user ID, timestamp, and source, such as automatically obtained: - User ID: the user identifier bound to the current session; - Timestamp: the current time when the command was generated; - Source: actively provided by the user / extracted from the conversation).

[0031] For example, a new instruction could be defined as follows: {Operation type: New, User ID: XXX, Target field: XXX, New value: XXX, Timestamp: XXX, Source: XXX}; an edit instruction could be defined as follows: {Operation type: Edit, User ID: XXX, Target field: XXX, Old value: XXX, New value: XXX, Timestamp: XXX, Source: XXX}; and a delete instruction could be defined as follows: {Operation type: Delete, User ID: XXX, Target field: XXX, Old value: XXX, Timestamp: XXX, Source: XXX}.

[0032] Further, refer to Figure 4 The diagram illustrates the hybrid retrieval and rearrangement process. Hybrid retrieval is performed in parallel on the preprocessed text. On one hand, the input is vectorized using a semantic encoding model, and semantic vector similarity retrieval is performed in the memory using vector indexes. On the other hand, key attribute information is extracted from the input, and precise matching retrieval is performed based on the structured attribute index using this key attribute information. The results of the two retrieval paths are then merged to obtain a candidate memory set. For example, the vector index stores semantic vectors (such as user preferences and embeddings of historical dialogues) used to store memory fragments, supporting "semantic similarity retrieval"; the structured attribute index stores structured attribute information of memory fragments (such as category tags "professional knowledge / daily affairs", timestamps, user IDs, and the key attribute "allergy history = peanuts"), supporting "precise attribute matching".

[0033] For example, semantic vector retrieval matches memory fragments that are semantically similar to the user's input from the "vector index" of the memory (e.g., if the user asks "my drink preferences", the semantic vector "I don't drink iced drinks" is retrieved); structured attribute retrieval precisely filters data from the "attribute index" of the memory through metadata (e.g., "user ID=XXX" "category=drink preferences").

[0034] When performing matching based on attribute indexes, the data in the memory is pre-managed and stored in an attribute hierarchy. This hierarchical management, for example, uses a hierarchical classification system (such as "domain → subdomain → specific tag") to categorize the memory data. For instance, "user-mentioned 'precautions for diabetes medication'" is categorized as "medical domain → chronic disease → medication knowledge." This solves the "black box storage" problem of unstructured text and provides a foundation for subsequent "domain-adaptive weighting" (such as prioritizing the retrieval of medical-related memories when searching for medical questions). The above hierarchical division is exemplary and can be configured as needed; it is not limited here.

[0035] The above method enables domain-adaptive automatic knowledge classification and weighting during the retrieval phase. When a new memory fragment is stored in the system, its semantic content is analyzed, and it is automatically assigned one or more corresponding attribute category labels (e.g., "general technology," "daily affairs," "professional knowledge," etc.). During the retrieval phase, not only is the semantics of the query content analyzed, but the intent type of the query is also identified simultaneously. If the user's question is determined to belong to a specific category, the retrieval weight of memory fragments under that category label will be automatically increased. This mechanism achieves category-adaptive memory retrieval, ensuring that relevant knowledge memories are prioritized when dealing with professional questions, while personalized memories are prioritized when dealing with casual or daily issues.

[0036] Furthermore, the two search results are merged, and duplicate fragments (such as a memory fragment being hit by both semantic search and attribute search) are automatically removed to generate a candidate memory set that balances semantic relevance and attribute accuracy.

[0037] Therefore, the candidate memory set is a preliminary memory data set that is strongly related to the user's current input, obtained by merging and deduplicating after parallel execution of hybrid retrieval. It contains core information of memory fragments and supporting retrieval data, and serves as the input source for the semantic fine sorting module.

[0038] For example, each candidate is a memory fragment, which includes the original memory fragment stored in the memory bank (e.g., "Don't drink iced drinks," "Diabetics should avoid taking medication on an empty stomach," "Next week's meeting is on Wednesday"), the hierarchical attributes of the memory fragment (e.g., "First-level category = Personalized preferences, Second-level subcategory = Diet," "User ID = U123," "Creation time = 2025-06-10," "Source = User actively informed"), and metadata storage from the memory bank. The memory fragments in the candidate memory set have been filtered through a preliminary threshold. Semantic vector retrieval only retains fragments with a similarity ≥ k (configurable), and structured attribute retrieval only retains fragments that "match the user ID + are related to the core attributes," excluding completely irrelevant noise (e.g., if a user searches for dietary preferences, it will not include memories of the "professional knowledge - law" category). The set can contain different types of memory fragments (personalized preferences, professional knowledge, daily affairs, etc.), but all are related to the current input.

[0039] An example of a hybrid retrieval and re-ranking mechanism based on semantics and tags is as follows: When a user's natural language query request is received, the retrieval service initiates a dual-path recall mechanism: one path performs metadata filtering based on a predefined structured attribute system to quickly locate a subset of memories within the relevant range; the other path uses a semantic encoding model to transform the query into a high-dimensional vector and performs semantic similarity search in the vector index. After the preliminary candidate results from both paths are aggregated, a semantic fine-grained ranking is performed to conduct a deep semantic matching score on the "query-memory fragment" pairs. By calculating fine-grained matching scores, this mechanism can effectively identify and eliminate candidates (noise) that are only close in representational space but have irrelevant or opposite semantics, and finally outputs a memory list strictly ranked by relevance for downstream models to use in generating responses.

[0040] Step 102: Call the fine sorting model to sort the matching degree between the preprocessed text and each memory fragment in the candidate memory set from high to low, and obtain the top K high-confidence memory fragments.

[0041] In this optional implementation, the fine-ranking model is invoked to perform deep semantic scoring on the matching degree between the query and each memory, and the Top-K high-confidence memory fragments are output.

[0042] Step 103: Inject high-confidence memory fragments into the prompts of the LLM according to a preset template, so that the LLM can output a response based on the prompts.

[0043] In this step, the finely sorted core memory fragments are injected into the LLM system instructions or context according to a preset template, generating enhanced cue words containing long-term memories to achieve dynamic context enhancement. A visual interface can be used to display the currently retrieved memory content, fine-sorting results, and memory operation instructions executed in the background in real time, and manual intervention and correction are supported.

[0044] For example, a parallel interactive interface can be constructed, displaying the "natural language dialogue area" and the "memory debugging / status display area" in parallel. Employing an event-driven update mechanism, when a user sends a message, the display area will present the system's internal processing flow in real time, including: 1) the original memory fragments retrieved by the current query and their source; 2) the confidence score calculated by the fine-sorting model, visually demonstrating the basis for the model's "adoption" of a memory; and 3) the memory update operation log triggered by this dialogue (such as adding a piece of knowledge or correcting a preference). This design allows users to instantly confirm the working status of the memory system and verify whether the system has correctly understood and remembered key information.

[0045] In summary, compared with the prior art, the present invention has at least the following beneficial effects: (1) Significantly improved retrieval accuracy: Through the dual guarantee of hybrid retrieval and fine sorting using "semantic vector + structured attributes", the interference of hallucinations and irrelevant contexts is greatly reduced. (2) Memory has self-evolution capability: Without the intervention of the backend administrator, the system can automatically update the memory bank according to the natural language instructions in the dialogue flow, realizing the self-iteration of memory. (3) Structured and interpretable: The introduction of a hierarchical attribute system makes the memory data no longer a black box, but has a categorizable and interpretable structure, which is convenient for debugging and management. (4) Component-based architecture: The retrieval, fine sorting and attribute processing are separated into independent components, which improves the scalability and maintainability of the system. (5) Transparent interaction: The front-end display allows users to intuitively see what the model "remembers" and "remembers", enhancing the user's trust in the intelligent agent system.

[0046] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0047] According to an embodiment of the present invention, an adaptive memory enhancement device based on a large language model is also provided, comprising a hybrid retrieval unit for receiving user input and preprocessing the input; performing semantic vector similarity retrieval and structured attribute matching retrieval simultaneously on the preprocessed text in a preset memory bank, and outputting a candidate memory set; a fine ranking unit for calling a fine ranking model to sort the matching degree between the preprocessed text and each memory fragment in the candidate memory set from high to low, obtaining the top K high-confidence memory fragments; and an enhancement unit for injecting the high-confidence memory fragments into the prompt words of the LLM according to a preset template, so as to output a response based on the prompt words through the LLM.

[0048] As an optional implementation of this embodiment, preprocessing the text includes determining the memory operation instructions corresponding to the text, wherein the memory operation instructions include add, delete, modify, and query operation types; and performing data operations on the data corresponding to the instructions in a preset memory bank based on the memory operation instructions.

[0049] According to embodiments of the present invention, the present invention also provides an electronic device, the electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to implement the methods described in any of the above embodiments.

[0050] According to embodiments of the present invention, the present invention also provides a readable storage medium storing computer instructions that enable a computer to perform the methods described in any of the above embodiments when executed.

[0051] According to embodiments of the present invention, the present invention also provides a computer program product that, when executed by a processor, can implement the methods described in any of the above embodiments.

[0052] Figure 5 A schematic block diagram of an example electronic device 300 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices.

[0053] like Figure 5 As shown, the electronic device 300 includes a computing unit 301, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 302 or a computer program loaded from a storage unit 308 into a random access memory (RAM) 303. The RAM 303 may also store various programs and data required for the operation of the electronic device 300. The computing unit 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0054] Multiple components in electronic device 300 are connected to I / O interface 305, including: input unit 306, such as keyboard, mouse, etc.; output unit 307, such as various types of displays, speakers, etc.; storage unit 308, such as disk, optical disk, etc.; and communication unit 309, such as network card, modem, wireless transceiver, etc. Communication unit 309 allows electronic device 300 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0055] The computing unit 301 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 301 performs the various methods and processes described above, such as the object matching method. For example, in some embodiments, the object matching method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 308. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 300 via ROM 302 and / or communication unit 309. When the computer program is loaded into RAM 303 and executed by the computing unit 301, one or more steps of the methods described above may be performed.

[0056] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0057] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0058] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

Claims

1. An adaptive memory enhancement method based on a large language model, characterized in that, include: Receive user input and preprocess the input; In the pre-defined memory, semantic vector similarity retrieval and structured attribute matching retrieval are performed simultaneously on the pre-processed text, and a candidate memory set is output. The fine ranking model is called to sort the matching degree between the preprocessed text and each memory fragment in the candidate memory set from high to low, and the top K high-confidence memory fragments are obtained. High-confidence memory fragments are injected into the prompts of the LLM according to a preset template, so that the LLM can output a response based on the prompts.

2. The adaptive memory enhancement method based on a large language model according to claim 1, characterized in that, Text preprocessing includes: Determine the memory operation instructions corresponding to the text, wherein the memory operation instructions include add, delete, modify, and query operation types; Data operations are performed on the data corresponding to the instructions in the preset memory bank based on memory operation instructions.

3. The adaptive memory enhancement method based on a large language model according to claim 2, characterized in that, The memory operation instructions corresponding to the text include: The text is parsed, and the parsed information is used to determine whether there is any memory alteration. If a memory change occurs, a memory operation instruction is generated.

4. The adaptive memory enhancement method based on a large language model according to claim 3, characterized in that, The process of parsing the text and determining whether memory changes have occurred based on the parsed information includes: Detect whether the text contains specified memory operation keywords; By analyzing the dialogue context using LLM, we can determine whether there is an implicit intention to alter memory. If the content contains keyword matching or implies an intent to change memory, it is determined that a memory change has occurred.

5. The adaptive memory enhancement method based on a large language model according to claim 1, characterized in that, Performing semantic vector similarity retrieval and structured attribute exact matching retrieval simultaneously on the preprocessed text includes: The preprocessed text is transformed into a high-dimensional vector through a semantic encoding model, and vector retrieval is performed in a pre-set memory to retrieve memory fragments that are semantically related to the preprocessed text. Based on a pre-defined structured attribute system, key attribute information is extracted from user input, and memory fragments are matched from a pre-defined memory bank based on the key attribute information. After summarizing the memory fragments, a candidate memory set is obtained.

6. An adaptive memory enhancement device based on a large language model, characterized in that, include: The hybrid retrieval unit is used to receive user input and preprocess the input; In the pre-defined memory, semantic vector similarity retrieval and structured attribute matching retrieval are performed simultaneously on the pre-processed text, and a candidate memory set is output. The fine sorting unit is used to call the fine sorting model to sort the matching degree between the preprocessed text and each memory fragment in the candidate memory set from high to low, and obtain the top K high-confidence memory fragments. An enhancement unit is used to inject high-confidence memory fragments into the prompts of the LLM according to a preset template, so that the LLM can output a response based on the prompts.

7. The adaptive memory enhancement device based on a large language model according to claim 6, characterized in that, Text preprocessing includes: Determine the memory operation instructions corresponding to the text, wherein the memory operation instructions include add, delete, modify, and query operation types; Based on memory operation instructions, data operations are performed on the data corresponding to the instructions in the preset memory bank.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the method according to any one of claims 1-5.

9. An electronic device, characterized in that, include: At least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to cause the at least one processor to perform the method according to any one of claims 1-5.

10. A computer program product, characterized in that, When executed by a processor, the computer program implements the method described in any one of claims 1-5.