Note association recommendation method and system based on abstract retrieval and LLM analysis
By introducing dual fingerprint caching, distributed locks, and exponential backoff retry mechanisms, the high cost and high latency issues in note association recommendation are solved, achieving efficient and personalized note recommendation and improving the system's real-time performance and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-04-10
AI Technical Summary
Existing note association recommendation technologies suffer from high cost, low efficiency, and high latency. They lack an efficient combination of vector retrieval and LLM deep analysis, have unintelligent cache invalidation strategies, suffer from severe duplicate calculations, and lack asynchronous retry and degradation mechanisms, thus failing to meet real-time and user experience requirements.
We adopt a digest-based retrieval and LLM analysis approach, and introduce dual fingerprint caching, distributed locks and exponential backoff retry mechanism. We manage the cache by generating unique identifiers, use distributed locks to control concurrency, and implement asynchronous retry processes to optimize resource utilization and response speed.
It significantly reduces LLM call costs and computing power waste, improves cache hit rate and recommendation accuracy, meets the second-level response requirements of real-time editing scenarios, enhances user experience and system availability, and ensures the real-time and personalized nature of recommendation results.
Smart Images

Figure CN121833936A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of artificial intelligence and natural language processing, and relates to a note association recommendation method and system based on abstract retrieval and LLM analysis. BACKGROUND
[0002] Note association recommendation is a key function of knowledge management systems, aiming to help users discover relevant content in historical notes to facilitate knowledge connection and thought inspiration. Existing technologies usually rely on tag matching, keyword retrieval, vector retrieval, or large language model (LLM) analysis, but these solutions have significant limitations in efficiency, depth, and user experience. The disclosure identifies five mainstream existing technical solutions, each with specific defects, ultimately leading to high cost, long delay, poor recommendation quality, and other problems.
[0003] Currently, the methods commonly used for note association are as follows: (1) Manual tag association: users manually add tags (Tag) when creating notes, and the system recommends relevant notes through tag matching. For example, a user adds a "machine learning" tag to a note, and the system returns all historical notes containing the same tag. (2) Keyword-based retrieval recommendation: keywords are extracted from the current note content, and then the historical note library is searched for notes containing the same keywords. For example, keywords such as "neural network" and "training" are extracted from a note, and notes containing these keywords are returned. (3) Vector retrieval method: an embedding model is used to convert note abstracts into vectors, and relevant notes are retrieved through vector similarity calculation (such as cosine similarity). For example, the current note is vectorized, and the Top-K similar notes are quickly found in the vector database. (4) Direct LLM full analysis method: every time a user edits a note, the current note content and the entire historical note library are used as context to directly call an LLM (such as the GPT series) to generate real-time association recommendations. For example, send hundreds of notes to the LLM for full-text analysis of relevance. (5) Vector retrieval + LLM second-order generation method: first, use vector retrieval to filter Top-K relevant notes, and then send the current note and these K notes to the LLM for in-depth analysis. For example, first use vector retrieval to return the 10 most relevant notes, and then use the LLM to generate detailed recommendation reasons.
[0004] The existing solutions all have their defects, which are as follows: (1) Manual label association method, which relies on user active maintenance: users need to remember and unify label naming, and the label system is easy to be confused in actual use; cannot find potential association: can only match the same label, cannot find semantically related but differently labeled notes; lack of surprise: the recommended results are completely predictable and cannot bring unexpected inspiration to users. (2) Keyword-based search recommendation, which lacks semantic understanding: keyword matching cannot understand deep semantic association; poor recommendation quality: it is easy to return a large number of weakly related notes or miss truly related notes; lack of personalization: the same keywords recommend the same content to all users without considering the personal thinking context of users. (3) Vector retrieval method, which lacks deep analysis in recommendation: only returns a list of similar notes, cannot deeply analyze "why is it related" and "how to associate"; cannot generate natural language prompts: cannot describe the deep association between notes in natural language as humans do; lack of surprise and inspiration: only provides a list of similar notes, cannot dig out potential connections that surprise users. (4) Direct LLM full analysis method, which is unaffordable in Token consumption: users may have hundreds of historical notes, all of which are sent to LLM as context, resulting in huge Token consumption; long response delay: it takes a long time to process a large amount of context, which cannot meet the experience requirements of real-time editing scenarios; high cost: processing all historical notes every time editing is done, which is difficult to afford. (5) Vector retrieval + LLM second-order generation method, which is theoretically feasible, but existing implementations usually lack intelligent caching mechanisms, resulting in: serious repeated calculation: the same user edits the same content multiple times, which repeatedly calls LLM; simple cache invalidation policy: usually only based on time (TTL) invalidation, cannot perceive changes in note content and historical note library.
[0005] Based on the above problems, it can be seen that the main defects of current note association recommendation are: (1) Lack of efficient combination of vector retrieval + LLM deep analysis: existing solutions lack intelligent mechanisms to efficiently combine the two.
[0006] (2) Cache invalidation policy is not intelligent: existing solutions usually only invalidate based on time (TTL), cannot perceive content changes, resulting in outdated or frequently invalidated cache data.
[0007] (3) Serious concurrent repeated calculation: in high-concurrency scenarios, existing systems repeatedly call LLM for the same input, causing a lot of wasted computing power.
[0008] (4) Lack of summary generation and management: existing solutions lack persistent management and incremental update mechanisms for note summaries, resulting in high search delay or inaccurate semantic capture.
[0009] (5) Lack of asynchronous retry and degradation mechanism: when LLM call fails or delay is too high, lack of effective retry and degradation strategy, poor user experience.
[0010] Therefore, it is urgent to provide a note association recommendation method based on abstract retrieval and LLM analysis to solve the problems of note association recommendation in real-time, cost control and intelligence pointed out by the above defects. SUMMARY
[0011] In view of the above problems, the present application provides a note association recommendation method and system based on abstract retrieval and LLM analysis, which improves the cache hit rate and accuracy by introducing double fingerprint cache, distributed lock and exponential backoff retry mechanism, and realizes efficient recommendation of associated notes.
[0012] To achieve the above purpose, the present application provides a note association recommendation method based on abstract retrieval and LLM analysis, comprising: receiving a user request, the user request including a user identifier and a current note content, generating an abstract for the current note content; performing vector retrieval based on the abstract to obtain a list of related note identifiers from a historical note library; generating a unique identifier based on the current note content and the list of related note identifiers; querying the cache using the unique identifier, if the cache hits, returning the recommendation result in the cache; if the cache does not hit, acquiring a distributed lock using the unique identifier; if the distributed lock is acquired successfully, calling a large language model (LLM) to perform deep analysis on the current note and the notes corresponding to the list of related note identifiers, generating a recommendation result and returning it to the user, storing the recommendation result in the cache with the unique identifier, and releasing the distributed lock; if the distributed lock fails to be acquired, an asynchronous retry process is performed.
[0013] As a further improvement of the present application, a unique identifier is generated based on the current note content and the list of related note identifiers; comprising: calculating a first content fingerprint based on the current note content; calculating a second content fingerprint based on the list of related note identifiers; combining the first content fingerprint and the second content fingerprint to generate a unique identifier for cache and distributed lock.
[0014] As a further improvement of the present application, before calculating the second content fingerprint, the list of related note identifiers is sorted to ensure the stability of the fingerprint.
[0015] As a further improvement of the application, the asynchronous retry process adopts an exponential backoff algorithm, and the waiting time is determined by the base waiting time, the number of retries, and a random jitter value.
[0016] As a further improvement of the application, the waiting time calculation formula of the exponential backoff algorithm is: Waiting time = base waiting time * 2^number of retries + random jitter value And set the upper limit of single waiting time.
[0017] As a further improvement of the application, before calling the large language model LLM, the full text of the current note and the corresponding notes of the related note identification list is obtained in parallel to shorten the data preparation time.
[0018] As a further improvement of the application, the asynchronous retry process has a total time limit, and if the time limit is exceeded, the related note list based on vector retrieval is returned.
[0019] As a further improvement of the application, an abstract is generated for the current note content; including: Using structured prompt words to call the large language model LLM to generate an abstract, and persistently storing.
[0020] As a further improvement of the application, vector retrieval is performed based on the abstract, including: Using an embedding model to convert the abstract into a vector, and returning the top-K related note identifiers through vector similarity calculation.
[0021] The application also provides a note association recommendation system based on abstract retrieval and LLM analysis, including: a request receiving module, an abstract management module, an abstract retrieval module, a cache key generation module, a cache access module, a concurrency control module, a deep analysis module, an asynchronous retry module, and a result returning module. The request receiving module is used to: Receive a user request, the user request including a user identifier and a current note content; The abstract management module is used to: Asynchronously generate an abstract for each note, generate an abstract for the current note content, and persistently store all abstracts; The abstract retrieval module is used to: Perform vector retrieval based on the abstract to obtain a related note identifier list from a historical note library; The cache key generation module is used to: Generating a unique identifier based on the current note content and the related note identifier list includes calculating a first content fingerprint of the current note content, sorting the related note identifier list, calculating a second content fingerprint of the related note identifier list, and combining the first content fingerprint and the second content fingerprint to generate the unique identifier. The cache access module is used for: Use the unique identifier to query the cache. If the cache is hit, return the recommended results from the cache. The concurrency control module is used for: If the cache misses, the distributed lock is acquired using the unique identifier. The depth analysis module is used for: If the distributed lock is successfully acquired, the Large Language Model (LLM) is invoked to perform in-depth analysis on the current note and the notes corresponding to the relevant note identifier list, generate recommendation results, and return them to the user. Store the recommendation results in the cache and release the distributed lock; The asynchronous retry module is used for: If acquiring the distributed lock fails, an asynchronous retry process is executed.
[0022] The result return module is used for: The recommended results are returned to the user.
[0023] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention addresses the high cost, low efficiency, and high latency issues of existing note-related recommendation technologies by introducing mechanisms such as dual fingerprint caching, distributed locking, and exponential backoff retries. Compared with existing technologies (such as manual tagging, keyword retrieval, and full LLM analysis), this invention achieves significant progress in terms of intelligence, real-time performance, and resource utilization.
[0024] This invention uses fine-grained distributed locks (such as Redis or ZooKeeper) to ensure that concurrent requests with the same input only call LLM once, significantly reducing LLM call costs and computational waste.
[0025] This invention is based on a smart caching mechanism using dual fingerprints (the fingerprint of the current note content + the fingerprint of the related note list), which enables content-driven failure, reduces redundant calculations, ensures that the recommendation results are both fresh and relevant, avoids the staleness problem of traditional TTL caching, and significantly improves the cache hit rate and result accuracy.
[0026] The exponential backoff retry algorithm and degradation strategy of this invention balance waiting time and cache hit rate, meet the second-level response requirements of real-time editing scenarios, improve user satisfaction and system availability, and significantly improve user experience and response speed.
[0027] The present application avoids deadlocks through the expiration mechanism of the distributed lock, the total waiting time limit prevents thread blocking, and the system can still operate stably when the LLM service fails or has high latency, thereby enhancing the robustness and high availability of the system.
[0028] The present application shortens the data preparation time, reduces the overall load of the system, improves the throughput, and ultimately improves the resource utilization and data processing efficiency through multi-source asynchronous data aggregation (such as parallel acquisition of note full text and user preferences).
[0029] The present application relies on input content and search results through a double-fingerprint mechanism, and any change automatically triggers invalidation, solving the drawbacks of traditional cache invalidation based only on time, ensuring that the recommendation results reflect the changes in the note library in real time, achieving precise cache invalidation, and avoiding outdated data.
[0030] The present application calculates the fingerprint after sorting the related note tag list, eliminating the influence of search order fluctuations, and as long as the related note tag list set remains unchanged, the cache key remains stable, improving the effectiveness of the cache.
[0031] The present application uses a unique identifier for the cache key and the lock key, uses the lock key to implement distributed locking, prevents repeated LLM calls under high concurrency, reduces the waste of computing power from the root, and improves the efficiency of the system.
[0032] The present application provides an intelligent asynchronous retry mechanism by combining exponential backoff algorithm with random jitter, which can prevent the "thundering herd effect", maximize cache hit rate, and control the upper limit of user waiting time.
[0033] The present application adopts a two-stage architecture of abstract search + LLM deep analysis, combined with user preference reordering, not only returns similar notes, but also explains the association reasons in natural language, stimulating the user's innovative thinking. BRIEF DESCRIPTION OF DRAWINGS
[0034] Figure 1 The note association recommendation method based on abstract search and LLM analysis disclosed by an embodiment of the present application is a general flowchart; Figure 2 The note association recommendation system based on abstract search and LLM analysis disclosed by an embodiment of the present application is a general architecture diagram; Figure 3 The flowchart of distributed lock acquisition and release disclosed by an embodiment of the present application is a flowchart of distributed lock acquisition and release; Figure 4 The flowchart of exponential backoff asynchronous retry algorithm disclosed by an embodiment of the present application is a flowchart of exponential backoff asynchronous retry algorithm; Figure 5 The double-layer recommendation reordering architecture diagram disclosed by an embodiment of the present application is a double-layer recommendation reordering architecture diagram; Figure 6A multi-source asynchronous data aggregation schematic diagram is disclosed for an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0036] The present application will be described in further detail below with reference to the drawings: As shown in Figure 1 The note association recommendation method based on abstract retrieval and LLM analysis provided by the present application comprises: S210, receiving a user request, the user request comprising a user identification (user ID) and current note content, and if the current note content has no abstract, generating an abstract for the current note content; The abstract is generated for the current note content; comprising: Using a structured prompt word to call a large language model (LLM) to generate an abstract, and persistently storing the abstract.
[0037] Further, in the present application, a high-quality abstract is asynchronously generated for each note and persistently stored, serving as a basis for subsequent rapid retrieval.
[0038] S220, performing vector retrieval based on the abstract to obtain a relevant note identification list from a historical note library; The vector retrieval based on the abstract comprises: Using an embedding model to convert the abstract into a vector, retrieving the vector database, and returning Top-K relevant note identifications through vector similarity calculation.
[0039] Further, S230, generating a unique identifier based on the current note content and the relevant note identification list; The method comprises: Calculating a first content fingerprint based on the current note content; Calculating a second content fingerprint based on the relevant note identification list; Combining the first content fingerprint and the second content fingerprint to generate a unique identifier for cache and distributed lock; the present application is based on intelligent cache based on double fingerprints, and respectively calculates content fingerprints for the "current note content" and the "retrieved note representation list", combines the content fingerprints into a unique identifier as a cache Key, and realizes content-driven cache automatic invalidation.
[0040] Further, Before calculating the second content fingerprint, the list of related note identifiers is sorted to ensure the stability of the fingerprint. That is, by sorting the retrieved list of related notes (whose order can not be fixed) to generate a stable and unique identifier for caching and locking, it is ensured that even if there is a slight fluctuation in the order of the vector retrieval result, as long as the set of related note identifiers does not change, the calculated fingerprint is the same, avoiding unnecessary cache invalidation and solving the problem of uncertainty in the retrieval result.
[0041] Specifically, to achieve intelligent cache invalidation, the present application proposes a dual fingerprint mechanism. The specific implementation is as follows: / / Calculate the fingerprint of the current note content (Fingerprint) private String calculateCurrentNoteFingerprint(Note currentNote) { String content = currentNote.getTitle() + "|" +currentNote.getContent(); / / Use the preset hash algorithm (in this example, MD5) to generate a fixed-length fingerprint return generateFingerprint(content); } / / Calculate the fingerprint of the related note list private String calculateRelatedNotesFingerprint(List <long>relatedNoteIds) { / / 1. Sort the ID list for result stability Collections.sort(relatedNoteIds); / / 2. Concatenate into a unique string String idsString = relatedNoteIds.stream().map(String::valueOf).collect(Collectors.joining(",")); / / 3. Generate the fingerprint return generateFingerprint(idsString); } / / Unified fingerprint generation method private String generateFingerprint(String input) { try { / / Configurable hash algorithm, e.g., MD5, SHA-256, etc. MessageDigest md = MessageDigest.getInstance("MD5"); byte[] hashBytes = md.digest(input.getBytes(StandardCharsets.UTF_8)); / / Convert to hexadecimal string StringBuilder hexString = new StringBuilder(); for (byte b : hashBytes) { String hex = Integer.toHexString(0xff & b); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } / / Optional: truncate part of the length to shorten the Key return hexString.toString().substring(0, 16); } catch (NoSuchAlgorithmException e) { / / fallback return String.valueOf(input.hashCode()); } } This step aims at the intelligent cache invalidation problem based on search results. The cache identifier is constructed based on "current note content" and "searched relevant note list". The cache Key depends on both "input content" and "search results". Any change will cause the cache to automatically invalidate, realizing content-driven cache automatic invalidation and solving the obsolescence problem of traditional cache.
[0042] S240, using the unique identifier as the cache key to query the cache, if the cache hits, return the recommended results in the cache; S250, as shown in Figure 3 if the cache does not hit, use the unique identifier as the lock key to acquire the distributed lock; Among them, The same lock Key structure as the cache Key is used, that is, the unique identifier, to realize concurrent control of requests with the same input, fundamentally eliminating repeated LLM calls.
[0043] S260, as shown in Figure 3 if the distributed lock is acquired successfully, call the large language model LLM to perform deep analysis on the notes corresponding to the current note and the relevant note identifier list, generate the recommended results and return them to the user, store the recommended results in the cache with the unique identifier, and release the distributed lock; Among them, As shown in Figure 6 Before calling the large language model LLM, the full text of the notes corresponding to the current note and the relevant note identifier list and user preferences are acquired in parallel to construct a structured prompt, so as to shorten the data preparation time.
[0044] Then call the large language model (LLM) API, parse the LLM return result, store the generated result in the cache system with the cache Key, and release the distributed lock.
[0045] Further, as shown in Figure 5 According to the recommended results obtained by deep analysis, combined with user preference type, user historical behavior and user note label, etc. Multi-dimensional factor scoring is performed on the recommended results, and the recommended results are reordered. The reordering strategy includes calculating the comprehensive score according to the time decay factor, theme matching degree, user interaction history and fine degree score. Finally, the top 5 recommended results of the comprehensive score are output, and a personalized screening list is output.
[0046] This step aims at the repeated calculation problem in concurrent scenarios, and uses a distributed lock to ensure that only one request calls LLM at the same time for the same input, and other requests wait and reuse the results.
[0047] S270, if the distributed lock acquisition fails, an asynchronous retry process is performed.
[0048] wherein, As Figure 4 shown, the asynchronous retry process uses an exponential backoff algorithm, and the waiting time is determined by the base waiting time, the number of retries, and a random jitter value.
[0049] Further, The waiting time calculation formula of the exponential backoff algorithm is: Waiting time = base waiting time × 2^number of retries + random jitter value And set the upper limit of the single waiting time.
[0050] Start the exponential backoff retry process. Within the set total time, repeatedly execute step S240 with intervals, if the cache hits during the retry, jump to step S290; If it still doesn't hit after the total time, jump to step S280.
[0051] Specifically, as Figure 4 shown, the present application proposes an exponential backoff retry algorithm with a time limit and random jitter.
[0052] private CompletableFuture <recommendationresult>exponentialBackoffRetry(String cacheKey) { return CompletableFuture.supplyAsync(() -> { int baseWaitTime = 100; / / Base wait time 100ms int maxTotalTime = 30000; / / Maximum total waiting time: 30 seconds long totalWaitTime = 0; for (int i = 0; ; i++) { / / 1. Query Cache RecommendationResult cachedResult = queryCache(cacheKey); if (cachedResult != null) { return cachedResult; / / Returns a successful cache hit. } / / 2. Calculate the next waiting time int exponentialWait = baseWaitTime * (int) Math.pow(2,i); int randomJitter = ThreadLocalRandom.current().nextInt(50); int waitTime = Math.min(exponentialWait + randomJitter, 5000); / / Maximum wait time: 5 seconds per cycle / / 3. Check if the total time has been exceeded. if (totalWaitTime + waitTime > maxTotalTime) { break; / / Timeout, exit the loop } / / 4. Waiting try { Thread.sleep(waitTime); totalWaitTime += waitTime; } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } } / / 5. Retry with timeout, execute fallback return getFallbackContent(); }, asyncExecutor); } This step is for the request that fails to obtain the lock, and the exponential backoff algorithm with a time length upper limit and random jitter is used for retry, which balances the user waiting time and cache hit rate; the knowledge backoff and random jitter strategy, the early retry interval is short, which can quickly hit the cache; the interval is long in the later period, which avoids invalid polling. Random jitter prevents multiple requests from retrying at the same time, avoiding the "thundering herd effect"; the total time length upper limit control: ensures that the user waiting time has a clear upper limit, and immediately degrades after timeout, optimizing the user experience.
[0053] S280, the asynchronous retry process is provided with a total time length upper limit, and if the timeout, the related note list based on vector retrieval is returned.
[0054] Among them, the degradation is executed, and the related note list based on vector retrieval is returned, which does not include the deep analysis of the LLM.
[0055] This step designs an asynchronous retry strategy, which can maximize the cache hit rate and ensure that the user obtains a response within an acceptable time under different LLM call delay conditions.
[0056] S290, the recommended result is returned to the user.
[0057] The two-stage recommendation architecture is set in the application: the first stage quickly screens the candidate notes through the summary vector retrieval, and the second stage sends the full text of the candidate notes into the LLM for deep analysis, realizing the generation of high-quality recommendations.
[0058] As shown in Figure 2 , the application also provides a note association recommendation system based on summary retrieval and LLM analysis, which comprises a request receiving module, a summary management module, a summary retrieval module, a cache key generation module, a cache access module, a concurrency control module, a deep analysis module, an asynchronous retry module and a result returning module. The request receiving module is used to: receive a user request, wherein the user request comprises a user identifier and current note content; The summary management module is used to: generating an abstract for each note, generating an abstract for the current note content, and persisting all abstracts; an abstract retrieval module configured to: perform vector retrieval based on the abstract to obtain a list of relevant note identifiers from a historical note library; a cache key generation module configured to: generate a unique identifier based on the current note content and the list of relevant note identifiers, including computing a first content fingerprint of the current note content, sorting the list of relevant note identifiers, and computing a second content fingerprint of the list of relevant note identifiers, and combining the first content fingerprint and the second content fingerprint to generate the unique identifier; a cache access module configured to: query the cache using the unique identifier, and if the cache hits, return the recommendation result in the cache; a concurrency control module configured to: if the cache misses, acquire a distributed lock using the unique identifier; a deep analysis module configured to: if the acquisition of the distributed lock is successful, invoke a large language model (LLM) to perform deep analysis on the current note and the notes corresponding to the list of relevant note identifiers, generate a recommendation result, and return the recommendation result to the user; store the recommendation result in the cache and release the distributed lock; an asynchronous retry module configured to: if the acquisition of the distributed lock fails, execute an asynchronous retry process.
[0059] a result return module configured to: return the recommendation result to the user Embodiments
[0060] As shown in Figure 2 the application process of the note-related recommendation method and system of the present application includes the following steps: Step S210: request receiving and abstract generation The request receiving module receives a user request containing a user ID and a current note content.
[0061] The abstract management module generates an abstract for the current note (if none).
[0062] Step S220: abstract retrieval The abstract retrieval module vectorizes the current note abstract and retrieves the Top-K most relevant historical note ID list in the vector database, for example, relatedNoteIds = [123, 456, 789, 234, 567].
[0063] Step S230: Construct the unique identification of cache and lock The cache key generation module performs a double fingerprint calculation: Calculate the content fingerprint: Calculate the fingerprint of the current note content currentNoteFingerprint through a preset hash algorithm (such as MD5, SHA-256).
[0064] Calculate the search result fingerprint: To ensure stability, first sort the relatedNoteIds list, then concatenate it into a string, and then calculate the fingerprint relatedNotesFingerprint through a hash algorithm.
[0065] Construct the cache key: "RECOMMENDATION_{userId}_{currentNoteFingerprint}_{relatedNotesFingerprint}" Construct the lock key: "LOCK_{userId}_{currentNoteFingerprint}_{relatedNotesFingerprint}" Step S240: Query the cache The cache access module queries the cache using the cacheKey. If it hits, jump to step S290.
[0066] Step S250: Acquire distributed lock The concurrency control module uses the lockKey to try to acquire a distributed lock. If successful, jump to step S260; if failed, jump to step S270.
[0067] Step S260: Perform deep analysis and write to cache After the deep analysis module successfully acquires the lock, the following operations are performed: Parallelly acquire the full text of the current note and K related historical notes.
[0068] Construct the structured Prompt and call the Large Language Model (LLM) API.
[0069] Parse the LLM return result.
[0070] The cache access module stores the generated result in the cache system with the cacheKey.
[0071] The concurrency control module releases the distributed lock.
[0072] Jump to step S290.
[0073] Step S270: Asynchronous retry The asynchronous retry module starts an exponential backoff retry process. Within a set total time (e.g., 30 seconds), step S240 (querying the cache) is repeatedly re-executed with an interval.
[0074] If the cache is hit during the retry, go to step S290.
[0075] If the cache is not hit after the total time, go to step S280.
[0076] Step S280: Perform Degradation Return the list of relevant historical notes provided by the summary retrieval of step S220, without the deep analysis of the LLM.
[0077] Step S290: Return the Result The result return module returns the recommended result to the user.
[0078] Advantages of the Invention: The invention introduces mechanisms such as dual fingerprint cache, distributed lock, and exponential backoff retry, solving the high cost, low efficiency, and high latency problems in existing note association recommendation technology. Compared with existing technologies (such as manual tagging, keyword retrieval, and full LLM analysis), the invention has made significant progress in intelligence, real-time performance, and resource utilization.
[0079] The invention uses fine-grained distributed locks (such as Redis or ZooKeeper) to ensure that concurrent requests with the same input only call the LLM once, significantly reducing LLM call costs and wasted computing power.
[0080] The invention is based on an intelligent cache mechanism based on dual fingerprints (current note content fingerprint + relevant note list fingerprint), which realizes content-driven invalidation, reduces repeated calculations, ensures that the recommended results are fresh and relevant, avoids the outdated problem of traditional TTL cache, and significantly improves cache hit rate and result accuracy.
[0081] The invention's exponential backoff retry algorithm and degradation strategy balance the waiting time and cache hit rate, meet the second-level response demand in real-time editing scenarios, improve user satisfaction and system availability, and significantly improve user experience and response speed.
[0082] The invention avoids deadlocks through the expiration mechanism of the distributed lock, prevents thread blocking through total waiting time limits, and still runs stably when the LLM service fails or has high latency, enhancing system robustness and high availability.
[0083] The invention shortens data preparation time, reduces overall system load, improves throughput, and ultimately improves resource utilization and data processing efficiency through multi-source asynchronous data aggregation (such as parallel acquisition of note full text and user preferences).
[0084] The application solves the disadvantages of the traditional cache only based on time invalidation by relying on input content and search results through a double fingerprint mechanism, any change automatically triggers invalidation, ensures that the recommended results reflect the changes in the notebook library in real time, realizes accurate cache invalidation, and avoids outdated data.
[0085] The application calculates the fingerprint after sorting the related note mark list, eliminates the influence of search order fluctuations, as long as the set of the related note mark list remains unchanged, the cache key remains stable, and the cache effectiveness is improved.
[0086] The application uses a unique identifier for the cache key and the lock key, uses the lock key to realize distributed locking, prevents repeated LLM calls under high concurrency, reduces the waste of computing power from the root, and improves system efficiency.
[0087] The application provides an intelligent asynchronous retry mechanism by combining the exponential backoff algorithm with random jitter, can prevent the "thundering herd effect", maximize the cache hit rate, and control the upper limit of user waiting at the same time.
[0088] The application adopts a two-stage architecture of abstract search + LLM deep analysis, combines user preference reordering, not only returns similar notes, but also explains the associated reasons in natural language, and stimulates the user's innovative thinking.
[0089] The above is only a preferred embodiment of the application and is not used to limit the application. For those skilled in the art, the application can have various changes and variations. Any modification, equivalent replacement, improvement, etc. within the spirit and principles of the application shall be included in the protection scope of the application.< / recommendationresult> < / long>
Claims
1. Note association recommendation methods based on summary retrieval and LLM analysis, including: Receive a user request, the user request including a user identifier and the current note content, and generate a summary for the current note content; Vector retrieval is performed based on the summary to obtain a list of relevant note identifiers from the historical note database; Generate a unique identifier based on the current note content and the list of related note identifiers; Use the unique identifier to query the cache. If the cache is hit, return the recommended results from the cache. If the cache misses, the distributed lock is acquired using the unique identifier. If the distributed lock is successfully acquired, the Large Language Model (LLM) is invoked to perform in-depth analysis on the current note and the notes corresponding to the related note identifier list, generate recommendation results and return them to the user, store the recommendation results in the cache with the unique identifier, and release the distributed lock. If acquiring the distributed lock fails, an asynchronous retry process is executed.
2. The note association recommendation method based on summary retrieval and LLM analysis according to claim 1, characterized in that: A unique identifier is generated based on the current note content and the list of related note identifiers; including: Calculate the first content fingerprint based on the current note content; Calculate the second content fingerprint based on the aforementioned list of related note identifiers; The first content fingerprint and the second content fingerprint are combined to generate a unique identifier for caching and distributed locks.
3. The note association recommendation method based on summary retrieval and LLM analysis according to claim 2, characterized in that: Before calculating the second content fingerprint, the list of related note identifiers is sorted to ensure the stability of the fingerprint.
4. The note association recommendation method based on summary retrieval and LLM analysis according to claim 1, characterized in that: The asynchronous retry process uses an exponential backoff algorithm, and the waiting time is determined by the base waiting time, the number of retries, and the random jitter value.
5. The note association recommendation method based on summary retrieval and LLM analysis according to claim 4, characterized in that: The formula for calculating the waiting time of the exponential backoff algorithm is as follows: Waiting time = Base waiting time × 2^Number of retries + Random jitter value And set a maximum waiting time for each instance.
6. The note association recommendation method based on summary retrieval and LLM analysis according to claim 1, characterized in that: Before calling the Large Language Model (LLM), the full text of the current note and the corresponding notes in the related note identifier list are obtained in parallel to shorten the data preparation time.
7. The note association recommendation method based on summary retrieval and LLM analysis according to claim 1, characterized in that: The asynchronous retry process has a total time limit. If it times out, it will be downgraded to return the list of relevant notes based on vector retrieval.
8. The note association recommendation method based on summary retrieval and LLM analysis according to claim 1, characterized in that: Generate a summary of the current note content; including: The structured prompt words are used to invoke the large language model LLM to generate a summary, which is then persistently stored.
9. The note association recommendation method based on summary retrieval and LLM analysis according to claim 1, characterized in that: Vector retrieval based on the summary includes: The summary is converted into a vector using an embedding model, and the top-K relevant note identifiers are returned by vector similarity calculation.
10. The present invention also provides a note association recommendation system based on summary retrieval and LLM analysis, implementing the note association recommendation method based on summary retrieval and LLM analysis as described in any one of claims 1 to 9, characterized in that, include: The module includes a request receiving module, a summary management module, a summary retrieval module, a cache key generation module, a cache access module, a concurrency control module, a deep analysis module, an asynchronous retry module, and a result return module. The request receiving module is used for: Receive a user request, the user request including a user identifier and the current note content; The summary management module is used for: A summary is generated asynchronously for each note, a summary is generated for the content of the current note, and all summaries are persistently stored. The abstract retrieval module is used for: Vector retrieval is performed based on the summary to obtain a list of relevant note identifiers from the historical note database; The cache key generation module is used for: Generating a unique identifier based on the current note content and the related note identifier list includes calculating a first content fingerprint of the current note content, sorting the related note identifier list, calculating a second content fingerprint of the related note identifier list, and combining the first content fingerprint and the second content fingerprint to generate the unique identifier. The cache access module is used for: Use the unique identifier to query the cache. If the cache is hit, return the recommended results from the cache. The concurrency control module is used for: If the cache misses, the distributed lock is acquired using the unique identifier. The depth analysis module is used for: If the distributed lock is successfully acquired, the Large Language Model (LLM) is invoked to perform in-depth analysis on the current note and the notes corresponding to the relevant note identifier list, generate recommendation results, and return them to the user. Store the recommendation results in the cache and release the distributed lock; The asynchronous retry module is used for: If acquiring the distributed lock fails, an asynchronous retry process is executed. The result return module is used for: The recommended results are returned to the user.