A hierarchical cache migration method and system for streaming video inference

By encapsulating immutable segments with common signatures, establishing stable logical directories, and appending migration logs, combined with time-limited credit scheduling and patch segment mechanisms, the problem of scattered retrieval and migration of cache pages in streaming video inference caching is solved, achieving efficient cache migration and directory stability.

CN123178306APending Publication Date: 2026-11-27SUZHOU IND PARK IND TECH SCHOOL (SUZHOU IND PARK COMMUNITY TRAINING COLLEGE JIANGSU UNITED VOCATIONAL & TECH COLLEGE SUZHOU IND PARK BRANCH) +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611485753.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-22
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies in streaming multimodal long context inference caches struggle to effectively encapsulate physically distributed but frequently shared cache pages into continuous batch transfer units. They cannot simultaneously meet frame-by-frame deadlines and historical occupancy requirements for each link. During migration, old addresses become unreadable, and recovery requires scanning the entire cache during failures. Changes in shared access relationships lead to a complete rewrite of the entire segment.

Method used

By generating common signatures to encapsulate immutable segments, a stable logical directory and append-only migration log are constructed. Migration task priorities are generated based on time-limited credit scheduling. Immutable segments are transferred in batches across layers and the directory is switched atomically after verification. A patch segment mechanism is adopted to reduce online reordering.

Benefits of technology

It enables continuous batch transmission of cached pages, balancing frame-by-frame deadlines and long-term fairness, keeping old addresses readable during migration, reducing write amplification and foreground pauses, and improving system stability and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178306A_ABST
    Figure CN123178306A_ABST
Patent Text Reader

Abstract

The application discloses a layered cache migration method and system for streaming video inference, an electronic device and a computer readable storage medium, and the method comprises the following steps: S1, counting cache page access association, generating a common signature and encapsulating an immutable segment; S2, constructing a double-account book storage structure, maintaining a stable logical directory and an additional migration log; S3, generating a layered cache migration task based on a deadline credit schedule; S4, performing batch cross-layer transmission of the immutable segment, and performing three-condition joint verification after the transmission is completed; S5, performing atomic switching or transaction rollback based on the verification result; and S6, updating cache data based on a patch segment and a background merging mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of streaming video understanding and reasoning technology, and more specifically, to a hierarchical cache migration method and system for streaming video reasoning, an electronic device, and a computer-readable storage medium. Background Technology

[0002] Streaming multimodal models, when continuously processing video, audio, and user questions, need to read historical key-value states at each attention layer and append new states to the long context inference cache. Edge devices typically have on-chip storage, local main memory, and persistent storage, and servers may also access remote memory via high-speed interconnects. Different layers differ significantly in capacity, bandwidth, access granularity, and fault characteristics. The cache controller must not only determine which layer to place data in but also ensure that the inference thread continuously obtains a consistent address during migration.

[0003] Common solutions include paging-based cache management, model tensors and cache offloading, and cache compression for network transmission. Paging-based management reduces fragmentation by mapping logical blocks to physical blocks; offloading schemes arrange tensors across accelerators, main memory, and disks; cache streaming schemes compress key-value states that need to be transmitted across links. These solutions improve capacity utilization or average throughput, but they still have shortcomings for continuous streaming inference: requests have frame-by-frame deadlines, and optimal average throughput does not equate to each frame being completed on time; cache pages with multiple discrete addresses but frequently retrieved together cannot automatically form batch units; if online reordering directly modifies the directory, read threads may see some new addresses; if there is a lack of independent logs after a migration interruption, the recovery process requires scanning the data layer; and a full rewrite when common access relationships change will amplify write traffic.

[0004] Prior art related to this invention:

[0005] The technical solution of existing technology 1:

[0006] PagedAttention (Woosuk Kwon et al., 2023) borrows from the paging mechanism of operating systems, dividing the logical key-value cache into fixed-size blocks and mapping them to non-contiguous physical memory through a block table. This technique supports sharing cache blocks within and between requests, reduces fragmentation caused by dynamically growing caches, and improves batch processing capacity in large model service systems.

[0007] Disadvantages of existing technology 1:

[0008] This technology focuses on addressing paging and sharing within accelerator memory, with the block table describing the current physical location. It does not publicly disclose a dual-ledger commit protocol for stable directories and migration logs, nor does it form cross-layer immutable segments using common signatures. Moving blocks to main memory or persistent storage would still require additional solutions for transmission duration, partial writes, version switching, and failure rollback.

[0009] Prior art related to this invention:

[0010] Technical solution of existing technology 2:

[0011] Mooncake (Ruoyu Qin et al., 2024) constructs a decoupled large-scale model service architecture centered on key-value caching, separating the pre-filling and decoding stages, and jointly using a central processing unit, dynamic memory, and solid-state memory to form a distributed cache pool. Its scheduler considers service latency targets and system load to improve effective throughput while meeting latency targets.

[0012] Disadvantages of existing technology 2:

[0013] The scheme discloses a hierarchical key-value cache and service latency scheduling, but it does not maintain deductible and replenishable migration credits based on historical link shares, nor does it include shared benefits and recovery costs in the same task priority. It does not disclose the dual ledger consisting of a stable logical directory and an append-only migration log, nor the migration protocol that checks the data by byte count, checksum, and version relationship after batch transfer before atomic switching.

[0014] Prior art related to this invention:

[0015] Technical solution of existing technology three:

[0016] The log-structured merge tree (Patrick O'Neil et al., 1996) is designed for storage indexes with high write loads. It appends updates to newer immutable components first, and then merges multiple components in the background. This structure reduces the overhead of random updates by using sequential writes and hierarchical merging, and is representative of the storage organization method of "immutable base components, incremental components, and background merging".

[0017] The disadvantages of existing technology three:

[0018] This technology discloses the basic idea of ​​adding components and merging the backend, but its object is a database index, not a long context inference cache with frame-by-frame expiration. It does not form batch segments based on page co-signature, does not have two sets of ledgers for stable logical directories and migration logs, and does not have link credit scheduling, atomic switching for version verification after direct storage access, or a protocol for continuously reading old segments in case of failure.

[0019] This invention addresses the hierarchical storage path for streaming multimodal long context inference caches, aiming to solve the following problems: how to encapsulate cache pages with scattered physical addresses but frequently shared retrieval into continuous batch transmission units; how to make migration scheduling consider both frame-by-frame deadlines and historical occupancy of each link simultaneously, avoiding long-term link occupancy by a single high-priority stream; how to maintain the readability of the old address during migration and switch to the new address in one go after transmission is completed; how to roll back based on small logs after power failure, timeout, or verification failure without scanning the entire cache; and how to write only patches when shared retrieval relationships change, reducing full-segment rewriting. Summary of the Invention

[0020] This invention provides a hierarchical cache migration method and system for streaming video inference, an electronic device, and a computer-readable storage medium to solve the technical problems existing in the prior art.

[0021] To achieve the above objectives, this invention provides a hierarchical cache migration method for streaming video inference, applied to a streaming multimodal long context inference cache controller. The cache controller connects an attention execution engine to multi-layered heterogeneous storage, which includes at least two of the following: on-chip storage, local main memory, persistent storage, and remote memory. The method includes the following steps:

[0022] S1: Calculate the access relationships of cached pages, generate a common signature, and encapsulate it into an immutable segment.

[0023] The number of window accesses and the number of times each logical cache page is accessed during the inference process are continuously counted. The page co-access signature is calculated based on the normalized co-access rate. Logical cache pages with similar signatures, compatible lifecycles and total capacity not exceeding the segment limit are encapsulated into immutable segments. The immutable segment contains a segment header, page directory, valid page area and check tail. After being closed, the valid page area is not modified in place.

[0024] S2: Construct a dual-ledger storage structure and maintain a stable logical directory and append-only migration log.

[0025] The stable logical directory only records the version information of segments that have been committed. The inference read thread only reads the active version of the directory. During the migration process, the old version directory remains intact and readable. The append-only migration log writes pre-committed transaction records before data transfer. The transaction records include the old version, new version, source address, destination address, expected transfer bytes, checksum, and transaction status. The log is only appended and does not overwrite the historical records.

[0026] S3: Generate a hierarchical cache migration task based on deadline-based credit scheduling

[0027] The migration task priority is calculated using multi-dimensional indicators such as the remaining time limit of single-frame inference, the current credit of the link, the task link occupancy, the page co-access benefit, and the task failure recovery cost. High-priority tasks are scheduled first. Task execution consumes the corresponding link credit, and the credit is automatically replenished during the link idle period. When the credit is insufficient, the batch size is reduced, a low-load link is replaced, or the migration is postponed.

[0028] S4: Perform immutable segment bulk cross-layer transfer, and perform joint verification of the three conditions after the transfer is completed.

[0029] Generate batch transfer descriptors based on the continuous addresses of immutable segments to complete the batch transfer of data from the source storage level to the target storage level; after the transfer is completed, synchronously verify three check conditions: the actual written bytes are equal to the expected bytes, the target segment check value is consistent with the log record check value, and the new version number is the old version number plus 1;

[0030] S5: Perform atomic switch or transaction rollback based on the verification result.

[0031] If all three verification conditions are met, the active version pointer of the stable logical directory is switched atomically, the log transaction status is updated to committed, and the old segment is delayed in being reclaimed until all old generation read threads exit. If any verification condition is not met, a rollback status is appended to the migration log, uncommitted new segments are released, and the stable logical directory remains unchanged.

[0032] S6: Update cached data based on patch segment and background merging mechanism

[0033] When a page is updated or the signature of the shared page changes, a small patch segment is generated. The logical page address is recorded in the form of a basic immutable segment + patch chain. When the segment effectiveness rate is lower than the preset threshold and the time required for backend merging is less than the current frame time limit, the backend merges the basic segment and the patch segment to generate a new segment version, and reuses steps S3-S5 to complete the new version submission.

[0034] In one embodiment of the present invention, preferably, in step S1, the normalized co-occurrence rate and the co-occurrence signature component are calculated as follows:

[0035] (1)

[0036] in, This represents the number of times the page (p) window is accessed. For cached page k, the total number of accesses within the sliding statistics window. The total number of times page p and page k are retrieved. To normalize the common take rate, For the common signature threshold, when Greater than or equal to At that time, set the associated common signature component for pages p and k.

[0037] In one embodiment of the present invention, preferably, in step S3, the formula for calculating the migration task priority is:

[0038] (2)

[0039] in, For task j, priority To determine the urgency of task access, The remaining frame timeout for the task. For the current credit of the target link, This refers to the resource usage of the task chain. This refers to the number of common-use requests covered in a single migration. The number of pages contained in the migration segment. The cost of mission recovery; , , , These are the weighting coefficients for term, link credit, co-take revenue, and recovery cost, respectively. It is a positive real number.

[0040] In one embodiment of the present invention, preferably, the link credit update formula is as follows after each scheduling period:

[0041] (3)

[0042] in, For the current credit of link m, This is the amount of credit replenishment for this cycle. This represents the actual number of pages transmitted in this cycle.

[0043] To update the link credit value of the m-th transmission link, This is the upper limit of the link credit.

[0044] In one embodiment of the present invention, preferably, in step S6, the background merging trigger condition is:

[0045] (5)

[0046] in, For segment s, efficiency Valid data bytes within the segment. Total bytes of the segment The efficiency threshold, To combine the estimated time, This represents the remaining timeframe for the current frame.

[0047] In one embodiment of the present invention, preferably, a single directory entry in the stable logical directory is fixedly aligned to 64 bytes. The directory entry fields include logical segment identifier, active version, active segment physical address, total segment bytes, segment checksum, status flag, common signature, commit time, and padding bits. The stable logical directory adopts a dual-slot structure, and the active slot pointer is switched through a single atomic write operation.

[0048] In one embodiment of the present invention, preferably, the append-only migration log is aligned to 64 bytes for each transaction record. The transaction record fields include a unique transaction identifier, a logical segment identifier, an old version number, a new version number, an old storage address, a new storage address, an expected transmission byte, a target checksum, a transaction status, and padding bits. During fault recovery, only unclosed transactions in the log that are in the pre-commit state and have no subsequent commit / rollback records are scanned, without the need for a global scan of all cached data.

[0049] In one embodiment of the present invention, preferably, in step S1, when counting access relationships, a sliding window decay mechanism is adopted. After the window expires, the historical access count and co-access count are decayed by a fixed ratio, and the sliding window length is... The value ranges from 8 to 4096 accesses; maximum capacity of a single immutable segment. The value range is 4KB to 8MB.

[0050] In one embodiment of the present invention, preferably, the streaming video reasoning scenario is streaming visual question answering, continuous multimodal video question answering, or real-time video sensing reasoning, and the logical cache page is a key-value cache page corresponding to long contextual attention calculation.

[0051] This invention also provides a hierarchical cache migration system for streaming video inference, deployed on a streaming multimodal long context inference cache controller, connecting an attention execution engine and multi-layer heterogeneous storage, comprising:

[0052] The common-pass signature encapsulation module is used to perform step S1 in the above method, which involves counting cache page access associations, generating a common-pass signature, and encapsulating an immutable segment.

[0053] The dual-ledger storage management module is used to execute step S2 in the above method, build and maintain two sets of ledgers: a stable logical directory and an append-only migration log, so that the old version directory remains readable during the migration.

[0054] The deadline credit scheduling module is used to execute step S3 in the above method, calculate the priority of migration tasks based on multi-dimensional indicators, and dynamically manage the transmission credit of each storage link.

[0055] The batch transmission and three-condition verification module is used to execute step S4 in the above method, complete the cross-layer batch transmission of immutable segments, and synchronously verify the three integrity conditions of transmitted bytes, check value, and version number.

[0056] The atomic switching and rollback module is used to execute step S5 in the above method. When the verification passes, it atomically updates the active version of the directory. When the verification fails, it performs transaction rollback and releases uncommitted data.

[0057] The patch segment background merging module is used to execute step S6 in the above method, generate the patch segment corresponding to the page update, and merge the base segment and patch segment to generate a new version segment when the dual conditions of segment effectiveness and deadline remainder are met.

[0058] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the hierarchical cache migration method for streaming video inference described above.

[0059] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-described hierarchical cache migration method for streaming video inference.

[0060] The present invention has the following beneficial technical effects:

[0061] 1. Shared signatures encapsulate logically dispersed but frequently accessed pages into a contiguous, immutable segment, enabling a single batch transfer to cover multiple subsequent requests. The signature is calculated using a normalized shared rate, reducing common false associations caused by frequently accessed pages.

[0062] 2. Deadline-based credit scheduling considers factors such as near-expiration date, historical link share, shared benefits, and recovery costs. Tasks nearing their expiration date receive higher priority, while tasks that have been continuously occupying links are suppressed due to declining credit, thus balancing frame-by-frame deadlines and long-term fairness.

[0063] 3. A stable logical directory and append-only migration logs separate the read path from the migration status. The old version remains readable during migration, and an atomic switch only occurs after verification. Failure recovery only handles unclosed log transactions, eliminating the need to scan the entire long context inference cache.

[0064] 4. Immutable segments and patch segments reduce fine-grained online reordering. When common access relationships change, small patches are written first, and background merging is only performed when both efficiency and deadline margins are satisfied, which can reduce write amplification and foreground pauses.

[0065] 5. Directory entries, log entries, and segment headers all use a fixed width and alignment layout, which facilitates implementation by the software runtime, direct storage access controller, or dedicated cache management unit. The solution does not depend on a specific model, nor is it limited to the underlying main memory, flash memory, or remote memory. Attached Figure Description

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

[0067] Figure 1 Architecture diagram of a time-limited credit-driven hierarchical cache migration system;

[0068] Figure 2 Data path diagram for commit and rollback during dual-ledger migration;

[0069] Figure 3 Detailed flowchart of the term-based credit-driven hierarchical migration algorithm;

[0070] Figure 4 This is a sequence diagram of directory consistency during the dual-ledger migration. Detailed Implementation

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

[0072] Searches were conducted in publicly available academic databases and public system paper databases using keywords such as "long context inference cache," "pagination attention," "heterogeneous memory offloading," "key-value cache streaming," "cache migration consistency," and "log-based directory." The essential difference between this invention and other retrieved technologies lies in: encapsulating logical pages into immutable segments using shared signatures; employing a stable logical directory and an append-only migration log to form a dual ledger; determining batch transmission order based on deadline margins, link credit, shared benefits, and recovery costs; atomically switching directories only after verifying byte counts, checksums, and version relationships; and writing patch segments to signature changes first, then merging them when the link is idle. The immutable segments ensure continued readability of older versions during transmission, the dual ledger provides a clear basis for commits and rollbacks, and the deadline credit scheduling utilizes the continuous layout of segments to form batch transmissions. All three factors work together to reduce the interference of online reordering on the inference thread.

[0073] First embodiment:

[0074] This invention provides a hierarchical cache migration method for streaming video inference, applied to a streaming multimodal long-context inference cache controller. The cache controller connects an attention execution engine to multi-layered heterogeneous storage, which includes at least two of the following types: on-chip storage, local main memory, persistent storage, and remote memory. The method includes the following steps:

[0075] S1: Calculate the access relationships of cached pages, generate a common signature, and encapsulate it into an immutable segment.

[0076] The number of window accesses and the number of times each logical cache page is accessed during the inference process are continuously counted. The page co-access signature is calculated based on the normalized co-access rate. Logical cache pages with similar signatures, compatible lifecycles and total capacity not exceeding the segment limit are encapsulated into immutable segments. The immutable segment contains a segment header, page directory, valid page area and check tail. After being closed, the valid page area is not modified in place.

[0077] S2: Construct a dual-ledger storage structure and maintain a stable logical directory and append-only migration log.

[0078] The stable logical directory only records the version information of segments that have been committed. The inference read thread only reads the active version of the directory. During the migration process, the old version directory remains intact and readable. The append-only migration log writes pre-committed transaction records before data transfer. The transaction records include the old version, new version, source address, destination address, expected transfer bytes, checksum, and transaction status. The log is only appended and does not overwrite the historical records.

[0079] S3: Generate a hierarchical cache migration task based on deadline-based credit scheduling

[0080] The migration task priority is calculated using multi-dimensional indicators such as the remaining time limit of single-frame inference, the current credit of the link, the task link occupancy, the page co-access benefit, and the task failure recovery cost. High-priority tasks are scheduled first. Task execution consumes the corresponding link credit, and the credit is automatically replenished during the link idle period. When the credit is insufficient, the batch size is reduced, a low-load link is replaced, or the migration is postponed.

[0081] S4: Perform immutable segment bulk cross-layer transfer, and perform joint verification of the three conditions after the transfer is completed.

[0082] Generate batch transfer descriptors based on the continuous addresses of immutable segments to complete the batch transfer of data from the source storage level to the target storage level; after the transfer is completed, synchronously verify three check conditions: the actual written bytes are equal to the expected bytes, the target segment check value is consistent with the log record check value, and the new version number is the old version number plus 1;

[0083] S5: Perform atomic switch or transaction rollback based on the verification result.

[0084] If all three verification conditions are met, the active version pointer of the stable logical directory is switched atomically, the log transaction status is updated to committed, and the old segment is delayed in being reclaimed until all old generation read threads exit. If any verification condition is not met, a rollback status is appended to the migration log, uncommitted new segments are released, and the stable logical directory remains unchanged.

[0085] S6: Update cached data based on patch segment and background merging mechanism

[0086] When a page is updated or the signature of the shared page changes, a small patch segment is generated. The logical page address is recorded in the form of a basic immutable segment + patch chain. When the segment effectiveness rate is lower than the preset threshold and the time required for backend merging is less than the current frame time limit, the backend merges the basic segment and the patch segment to generate a new segment version, and reuses steps S3-S5 to complete the new version submission.

[0087] In one embodiment of the present invention, preferably, in step S1, the normalized co-occurrence rate and the co-occurrence signature component are calculated as follows:

[0088] (1)

[0089] in, This represents the number of times the page (p) window is accessed. For cached page k, the total number of accesses within the sliding statistics window. The total number of times page p and page k are retrieved. To normalize the common take rate, For the common signature threshold, when Greater than or equal to At that time, set the associated common signature component for pages p and k.

[0090] In one embodiment of the present invention, preferably, in step S3, the formula for calculating the migration task priority is:

[0091] (2)

[0092] in, For task j, priority To determine the urgency of task access, The remaining frame timeout for the task. For the current credit of the target link, This refers to the resource usage of the task chain. This refers to the number of common-use requests covered in a single migration. The number of pages contained in the migration segment. The cost of mission recovery; , , , These are the weighting coefficients for term, link credit, co-take revenue, and recovery cost, respectively. It is a positive real number.

[0093] In one embodiment of the present invention, preferably, the link credit update formula is as follows after each scheduling period:

[0094] (3)

[0095] in, For the current credit of link m, This is the amount of credit replenishment for this cycle. This represents the actual number of pages transmitted in this cycle.

[0096] To update the link credit value of the m-th transmission link, This is the upper limit of the link credit.

[0097] In one embodiment of the present invention, preferably, in step S6, the background merging trigger condition is:

[0098] (5)

[0099] in, For segment s, efficiency Valid data bytes within the segment. Total bytes of the segment The efficiency threshold, To combine the estimated time, This represents the remaining timeframe for the current frame.

[0100] In one embodiment of the present invention, preferably, a single directory entry in the stable logical directory is fixedly aligned to 64 bytes. The directory entry fields include logical segment identifier, active version, active segment physical address, total segment bytes, segment checksum, status flag, common signature, commit time, and padding bits. The stable logical directory adopts a dual-slot structure, and the active slot pointer is switched through a single atomic write operation.

[0101] In one embodiment of the present invention, preferably, the append-only migration log is aligned to 64 bytes for each transaction record. The transaction record fields include a unique transaction identifier, a logical segment identifier, an old version number, a new version number, an old storage address, a new storage address, an expected transmission byte, a target checksum, a transaction status, and padding bits. During fault recovery, only unclosed transactions in the log that are in the pre-commit state and have no subsequent commit / rollback records are scanned, without the need for a global scan of all cached data.

[0102] In one embodiment of the present invention, preferably, in step S1, when counting access relationships, a sliding window decay mechanism is adopted. After the window expires, the historical access count and co-access count are decayed by a fixed ratio, and the sliding window length is... The value ranges from 8 to 4096 accesses; maximum capacity of a single immutable segment. The value range is 4KB to 8MB.

[0103] In one embodiment of the present invention, preferably, the streaming video reasoning scenario is streaming visual question answering, continuous multimodal video question answering, or real-time video sensing reasoning, and the logical cache page is a key-value cache page corresponding to long contextual attention calculation.

[0104] This invention also provides a hierarchical cache migration system for streaming video inference, deployed on a streaming multimodal long context inference cache controller, connecting an attention execution engine and multi-layer heterogeneous storage, comprising:

[0105] The common-pass signature encapsulation module is used to perform step S1 in the above method, which involves counting cache page access associations, generating a common-pass signature, and encapsulating an immutable segment.

[0106] The dual-ledger storage management module is used to execute step S2 in the above method, build and maintain two sets of ledgers: a stable logical directory and an append-only migration log, so that the old version directory remains readable during the migration.

[0107] The deadline credit scheduling module is used to execute step S3 in the above method, calculate the priority of migration tasks based on multi-dimensional indicators, and dynamically manage the transmission credit of each storage link.

[0108] The batch transmission and three-condition verification module is used to execute step S4 in the above method, complete the cross-layer batch transmission of immutable segments, and synchronously verify the three integrity conditions of transmitted bytes, check value, and version number.

[0109] The atomic switching and rollback module is used to execute step S5 in the above method. When the verification passes, it atomically updates the active version of the directory. When the verification fails, it performs transaction rollback and releases uncommitted data.

[0110] The patch segment background merging module is used to execute step S6 in the above method, generate the patch segment corresponding to the page update, and merge the base segment and patch segment to generate a new version segment when the dual conditions of segment effectiveness and deadline remainder are met.

[0111] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the hierarchical cache migration method for streaming video inference described above.

[0112] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-described hierarchical cache migration method for streaming video inference.

[0113] Second embodiment:

[0114] This invention is used in streaming video understanding, continuous multimodal question answering, or real-time sensing inference devices. It is deployed within a long-context inference cache controller during model runtime, located between the attention execution engine and on-chip storage, main memory, persistent storage, or remote memory. The system receives cache page write requests, retrieval requests, frame completion deadlines, historical co-fetch counts, link credits, and verification feedback. It outputs hierarchical placement results, batch transfer descriptors, and a logical directory stably visible to the inference thread. Engineering bottlenecks lie in the continuous growth of the cache, inconsistent read / write concurrency, and inconsistent link speeds. This invention separates data movement from directory visibility through immutable segments and version commits.

[0115] Figure 1 In the process, the signature wrapper writes logical pages to immutable segments based on access statistics. The stable logical directory only points to committed segment versions, and the inference thread always reads data through this directory. The deadline credit scheduler generates migration tasks and writes pre-commit records to the append-only migration log, subsequently initiating batch transfers between local cache, main memory, and persistent storage. The verification and atomic switcher, after confirming the new segment's completeness, atomically updates the directory pointer and changes the log status to committed. Signature changes generate patch segments; the background merger only generates new merged versions when both the link and deadline are sufficient.

[0116] Figure 2 This demonstrates a dual-ledger data path. At the start of the migration, the old directory remains unchanged, and the log records the old address, new address, estimated number of bytes, and target version. After batch direct storage access is completed, the validator checks the actual written bytes, segment checksums, and version increment relationships. Only if all conditions pass is the directory switched; if any condition is not met, the log is marked for rollback, and uncommitted new segments are released. Because the old directory has never been partially overwritten, the inference thread can continue reading old segments without waiting for the rollback to complete.

[0117] Module Function Description:

[0118] 1. Co-access Statistics and Signature Module. This module maintains the number of single-page accesses and the number of co-accesses between two pages within a finite window for logical pages. It calculates the normalized co-access rate for candidate page pairs; if the rate exceeds a threshold, the corresponding component is set in both signatures. Pages with identical or similar signatures and compatible lifecycles are written to the same immutable segment. The signature only determines the encapsulation of the new segment and does not move already committed data in place.

[0119] 2. Immutable Segment Encapsulation Module. Each segment consists of a segment header, page directory, valid page area, and checksum tail. Once a segment is committed, its valid page area is no longer modified in place. New cached pages, invalidation flags, and address changes are first written to the patch segment. This structure allows for batch reads and writes at consecutive addresses during a migration and also allows older versions to remain readable during the generation of new versions.

[0120] 3. Deadline-Based Credit Scheduler. Each migration task carries the latest completion time, access urgency, target link, co-opt benefit, number of bytes transferred, and recovery cost. The scheduler derives the remaining time from the frame deadline, uses link credit to represent the share of available transmission in the near future, and measures the number of subsequent requests that can be satisfied in a single migration using co-opt benefit. Task execution consumes credit, which is replenished by time progression and link idleness.

[0121] 4. Stable Logical Directory. This directory, indexed by logical page identifiers, records the current committed version, segment address, segment offset, length, and checksum. Read threads only read the active slots in the directory. Directory entries use either double-slot or generationally-based single pointers, and switching operations are completed with a single atomic write.

[0122] 5. Append-only migration log. A pre-commit record is written to the log before data migration, containing the old version, new version, old address, new address, estimated number of bytes, checksum, and status. After data is written to disk, completion and commit records are appended, without overwriting historical records. Recovery only requires scanning unclosed transactions.

[0123] 6. Checksum and Atomic Switcher. The module compares the transport descriptor, the target segment header, and the log fields. When the actual written bytes equal the expected bytes, the segment checksum matches, and the new version is exactly one generation after the old version, a directory switch command is generated. After the switch, the old segment is released with a delay until all concurrent reader generations have exited.

[0124] 7. Patch Segments and Background Merger. When a common signature changes or individual pages are updated, the system creates a small patch segment and represents the logical object as a base segment plus a patch chain in the directory. The merger only runs when the segment effectiveness is below a threshold and the time required to complete the merge is less than the current deadline. The merge produces a completely new version without modifying the original segment.

[0125] Figure 3 It covers the complete process of common segment statistics, segment encapsulation, migration sorting, credit gating, log pre-commit, batch transmission, verification, and commit or rollback. When the deadline is approaching but the current link credit is insufficient, the scheduler can reduce the single batch size or use a closer level; if no feasible path can complete on time, the task continues to use the old segment and reports the delay status to the frame scheduler, instead of exposing the new address of the incomplete task.

[0126] Figure 4This section explains the visibility when read threads and migration threads run concurrently. During the pre-commit and data copying phases, the active version of the directory remains unchanged. A commit only changes one active slot or generation pointer. If a read thread acquires the old generation before the switch, it can complete its current read and then exit; old segments are not reclaimed until all readers of the old generation have exited.

[0127] Symbols and Variable Definitions

[0128] symbol meaning Scope or unit p, k Logical cache page index positive integer f_p Number of visits within the window of page p non-negative integers f_p,k The number of times page p and k are taken together non-negative integers J_p,k Normalized co-occurrence rate of page pairs 0 to 1 s_p,k Common signature components of page p to page k 0 or 1 tau_c Common signature threshold 0 to 1 j Migration Task Index positive integer m, m(j) Link index, the link used by task j positive integers or mappings A_j Task access urgency 0 to 1 T_j Remaining deadline for the task millisecond C_m Current credit of link m Pages L_j Task link occupancy estimation Pages G_j Number of common requests covered in a single migration frequency B_j Number of pages contained in the migration segment Pages R_j Task recovery cost 0 to 1 P_j Migration Priority real numbers alpha, beta, gamma, lambda Term, credit, co-existing benefits, and recovery cost weighting For non-negative real numbers, alpha is positive. q_m This week's credit replenishment Pages b_m Actual shipment volume for this period Pages C_max Link credit limit Pages E_j Task Submission Permission 0 or 1 W_j、X_j Expected and actual bytes byte crc_dst, crc_log Checksums of target segment and log record Fixed-length unsigned numbers v_old、v_new Old version and new version Dimensionless integers s Immutable segment index positive integer rho_s The effectiveness of segment s 0 to 1 B_s,live、B_s,total Valid bytes and total bytes of segment s byte H_s Merging time millisecond tau_rho Segment efficiency threshold 0 to 1 T_slack Current front-end term remaining balance millisecond

[0129] Core formula:

[0130] The co-occurrence rate of page p and page k and the signature component are determined by the following formula (1):

[0131]

[0132] For migration task j, the scheduling priority is:

[0133]

[0134] After each scheduling cycle, link credits are updated based on the actual transmission volume:

[0135]

[0136] Directory switching permission is only set to 1 if all three checks pass simultaneously:

[0137]

[0138] The conditions for merging segment effectiveness and backend processes are as follows:

[0139]

[0140] Equation (1) uses the intersection-union (IUU) form to avoid high-frequency pages from forming strong associations with all pages simply because they are accessed frequently. In Equation (2), the deadline term increases the priority of tasks nearing their expiration date, the credit term suppresses long-term overuse of the link, the shared benefit term tends to satisfy multiple subsequent requests at once, and the recovery cost term avoids initiating expensive migrations when the risk of failure is high. Equation (3) enables credit to recover during idle time. Equation (4) binds data integrity and version relationships to the same commit. Equation (5) avoids performing background cleanup when deadlines are tight.

[0141] Core mechanism numbering algorithm steps:

[0142] Step S1 (Collect Access Statistics): For each long context inference cache read, update the page access count and the total access count of page pairs within the same retrieval list; when the window expires, the old count is proportionally decayed.

[0143] Step S2 (Generate Common Signature): Calculate the normalized common rate of candidate page pairs according to formula (1). If it exceeds the threshold, set the signature component. Write pages with similar signatures, compatible expected lifecycles, and total bytes not exceeding the segment limit into the same open segment.

[0144] Step S3 (Close Immutable Segment): Write the segment header, logical page directory, valid page area, and checksum tail. Calculate the segment checksum and change the segment status from open to closed. Do not rewrite the valid page area in its original position after closing.

[0145] Step S4 (Forming a migration task): Based on the local capacity level, retrieval request, or background downgrade request, generate a task with clearly defined source level, target level, estimated number of bytes, latest completion time, and recovery cost.

[0146] Step S5 (Priority and Credit Gating): Calculate the priority of candidate tasks according to formula (2) and select the highest one; check whether the credit of the target link covers the minimum batch size of the task. If the credit is insufficient, reduce the batch size, select other links, or postpone execution.

[0147] Step S6 (Pre-commit): Write the transaction identifier, logical segment identifier, old version, new version, old address, new address, estimated number of bytes, checksum, and pre-commit status to the append-only migration log. Data migration only begins after the log is persisted.

[0148] Step S7 (Bulk Transfer): Generate a bulk direct storage access descriptor based on the continuous addresses of the immutable segment, complete the transfer from the source layer to the target layer, and deduct the link credit according to formula (3).

[0149] Step S8 (Verification and Branching): Read the target segment header and log, and calculate the commit permission according to formula (4). If the permission is 1, proceed to step S9; if the permission is 0, append the rollback state to the log, release the uncommitted new segment, and keep the stable directory unchanged.

[0150] Step S9 (Atomic Switch): Write the new version information to the inactive slots of the stable logical directory, and then switch the active slot with a single atomic operation. Append the committed status to the log. The old segment enters the delayed recycling queue, waiting for the old generation readers to exit.

[0151] Step S10 (Patching and Merging): When the page is updated or the signature changes, a patch segment is created without modifying the base segment. The segment validity and time limit are checked according to formula (5). When the conditions are met, a merge segment is generated in the background, and steps S6 to S9 are reused to submit a new version.

[0152] Data structures and bit layout tables:

[0153] The stable logic directory entries are as follows:

[0154] Fields symbol Bit width order Explanation and Alignment Logical segment identifier logical_id 32 1 Table of Contents Event Version active_version 16 2 Monotonically increasing Active segment address active_addr 64 3 Point to committed segment Segment length segment_bytes 32 4 byte Verification Summary segment_crc 32 5 Consistent with the end of the paragraph status flags flags 8 6 Events, patch chains, etc. Collect signatures cofetch_signature 64 7 Expandable to multiple characters Submission time commit_time 32 8 Frame clock filling padding Complete 9 Aligned to 64 bytes

[0155] The valid fields for a directory entry are 32+16+64+32+32+8+64+32=280 bits, or 35 bytes, which are then padded to 64 bytes. In a dual-slot implementation, each of the two 64-byte slots is followed by a separate active slot indicator, which is updated using atomic writes.

[0156] The append-only migration log is recorded as follows:

[0157] Fields symbol Bit width order Explanation and Alignment Transaction ID txn_id 32 1 The only one in the log Logical segment identifier logical_id 32 2 Corresponding directory entry Old version old_version 16 3 Previous version New version new_version 16 4 It should be the old version plus 1. Old address old_addr 64 5 Rollback New address new_addr 64 6 target segment address Expected number of bytes expected_bytes 32 7 Transmission verification Target verification value expected_crc 32 8 Integrity check Transaction status state 8 9 Pre-commit, Commit, or Rollback filling padding Complete 10 Aligned to 64 bytes

[0158] The log record has 32+32+16+16+64+64+32+32+8=296 bits, or 37 bytes, which are then padded to 64 bytes. The recovery program only needs to find transactions in the pre-commit state that have no subsequent commit or rollback records.

[0159] Key technical parameters:

[0160] parameter symbol Recommended range effect Collect statistics window W_c 8 to 4096 visits Controlling signature response speed Common threshold tau_c 0.2 to 0.8 Control the relevance of pages within the same section Upper limit of immutable segments B_max 4KB to several MB Controlling batch size Term weight alpha positive real numbers Increase the priority of tasks nearing their deadline Credit weight beta nonnegative real numbers Balanced link occupancy Shared return weight gamma nonnegative real numbers Encourage batch reuse Recovery Cost Weight lambda nonnegative real numbers Suppressing high-risk migration credit limit C_max Within the link queue capacity Limiting burst volume Efficiency threshold tau_rho 0.3 to 0.8 Triggering background merge

[0161] Third embodiment:

[0162] Taking a streaming visual question-answering device as an example, the page size of the local cache, main memory, and persistent storage is 4096 bytes. A threshold of tau_c = 0.50 is used, and an immutable segment can contain a maximum of 4 pages. Within the window, page A is accessed 8 times, page B is accessed 6 times, and both appear together 5 times; page C is accessed 4 times, and A and C appear together once.

[0163] First, according to equation (1), J_A,B = 5 / (8+6-5) = 5 / 9 = 0.556, which is greater than 0.50. Therefore, the corresponding component of the common signature of A and B is set to 1. J_A,C = 1 / (8+4-1) = 1 / 11 = 0.091, which is less than 0.50. Therefore, C is not encapsulated in the same basic segment as A and B. A, B and the other two pages form segment S1, and C enters segment S2.

[0164] The second step involves triggering three migration tasks based on the capacity level. The weights are alpha = 1, beta = 0.2, gamma = 0.4, and lambda = 0.5. Task J1 has an access urgency of A_J1 = 0.9, a remaining timeout of T_J1 = 3 milliseconds, a link credit of C_m = 4 pages, a link occupation of L_J1 = 2 pages, a total benefit of G_J1 = 3, a segment page count of B_J1 = 4, and a recovery cost of R_J1 = 0.1. According to equation (2), P_J1 = 0.9 / 3 + 0.2 × 4 / 2 + 0.4 × 3 / 4 - 0.5 × 0.1 = 0.95.

[0165] The parameters for task J2 are 0.7, 5 milliseconds, 1 page of credit, 2 pages of usage, 1 instance of revenue, 4 pages, and 0.05, resulting in P_J2 = 0.7 / 5 + 0.2 × 1 / 2 + 0.4 × 1 / 4 - 0.5 × 0.05 = 0.315. The parameters for task J3 are 0.6, 2 milliseconds, 2 pages of credit, 4 pages of usage, 2 instances of revenue, 4 pages, and 0.3, resulting in P_J3 = 0.6 / 2 + 0.2 × 2 / 4 + 0.4 × 2 / 4 - 0.5 × 0.3 = 0.45. Therefore, the scheduling order is J1, J3, J2. Although J3 has a closer deadline, its recovery cost is higher and it requires more link share, thus its priority is lower than J1.

[0166] Third, J1 first transmits the minimum batch of 3 pages. During the scheduling cycle, credits q_m = 2 pages are replenished, and b_m = 3 pages are actually sent. According to formula (3), the new credits C_m_new = 4 + 2 - 3 = 3 pages are obtained. The scheduler retains 1 page of segment tail data for the next batch to avoid consuming more credits than the current batch at once.

[0167] In the fourth step, before migration, the log is written to the old version 6, the new version 7, the old address 0x100000, the new address 0x280000, the expected byte W_J1 = 12288, and the target checksum. The inference read thread continues to read from the old address of the directory version 6 throughout the transfer. After the transfer is complete, the target end reports the actual written byte X_J1 = 12288, the target checksum is the same as the log value, and 7 = 6+1. All three indicators in equation (4) are 1, so E_J1 = 1. The checksum switcher first writes to the inactive directory slot, and then atomically switches the active slot from version 6 to version 7.

[0168] Fifth step: Assuming J3 times out after writing 8192 bytes, and the log is expected to be 16384 bytes, then X_J3 = 8192, which is not equal to W_J3 = 16384, therefore E_J3 = 0. The system appends a rollback state and releases the new address space. The stable directory does not point to this address, and the inference thread continues to read the old segment without waiting for a full disk scan.

[0169] Step 6: After running for a period of time, the total number of bytes in segment S1 is B_s,total = 16384, of which B_s,live = 8192 are still valid, resulting in rho_s = 8192 / 16384 = 0.50. Given an efficiency threshold tau_rho = 0.60, an estimated merge time H_s = 5 milliseconds, and a current deadline slack T_slack = 8 milliseconds, both conditions in equation (5) are satisfied. The background merger generates version 8 from the base segment and patch segment, and then submits it using the same log and directory protocol; if the deadline slack drops to 4 milliseconds, the merge is not initiated.

[0170] This example encompasses common signature, immutable segment formation, time-limited credit sorting, credit deduction, log pre-commit, successful switchover, failure rollback, and background merging. The common signature layout expands the effective coverage of a single batch transfer; the dual ledger ensures that batch transfers do not expose unfinished addresses to the inference thread; and credit updates prevent continuous large-segment migrations from saturating the link for extended periods.

[0171] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of one embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing the present invention.

[0172] Those skilled in the art will understand that the modules in the apparatus of the embodiments can be distributed in the apparatus of the embodiments as described in the embodiments, or they can be located in one or more devices different from this embodiment with corresponding changes. The modules of the above embodiments can be combined into one module, or they can be further divided into multiple sub-modules.

[0173] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A hierarchical cache migration method for streaming video inference, applied to a streaming multimodal long context inference cache controller, wherein the cache controller connects an attention execution engine to a multi-layered heterogeneous storage system, the multi-layered heterogeneous storage system comprising at least two of the following: on-chip storage, local main memory, persistent storage, and remote memory, characterized in that... Includes the following steps: S1: Calculate the access relationships of cached pages, generate a common signature, and encapsulate it into an immutable segment. The number of window accesses and the number of times each logical cache page is accessed during the inference process are continuously counted. The page co-access signature is calculated based on the normalized co-access rate. Logical cache pages with similar signatures, compatible lifecycles and total capacity not exceeding the segment limit are encapsulated into immutable segments. The immutable segment contains a segment header, page directory, valid page area and check tail. After being closed, the valid page area is not modified in place. S2: Construct a dual-ledger storage structure and maintain a stable logical directory and append-only migration log. The stable logic directory only records the version information of segments that have been committed. The inference read thread only reads the active version of the directory. During the migration process, the old version directory remains complete and readable. The append-only migration log writes pre-committed transaction records before data transfer. The transaction records include the old version, new version, source address, destination address, expected bytes to be transferred, checksum, and transaction status. The log is only appended and does not overwrite historical records. S3: Generate a hierarchical cache migration task based on deadline-based credit scheduling The migration task priority is calculated using multi-dimensional indicators such as the remaining time limit of single-frame inference, the current credit of the link, the task link occupancy, the page co-access benefit, and the task failure recovery cost. High-priority tasks are scheduled first. Task execution consumes the corresponding link credit, and the credit is automatically replenished during the link idle period. When the credit is insufficient, the batch size is reduced, a low-load link is replaced, or the migration is postponed. S4: Perform immutable segment bulk cross-layer transfer, and perform joint verification of the three conditions after the transfer is completed. Generate batch transfer descriptors based on the continuous addresses of immutable segments to complete the batch transfer of data from the source storage level to the target storage level; after the transfer is completed, synchronously verify three check conditions: the actual written bytes are equal to the expected bytes, the target segment check value is consistent with the log record check value, and the new version number is the old version number plus 1; S5: Perform atomic switch or transaction rollback based on the verification result. If all three verification conditions are met, the active version pointer of the stable logical directory is switched atomically, the log transaction status is updated to committed, and the old segment is delayed in reclamation until all old generation read threads exit. If any validation condition is not met, a rollback state is appended to the migration log, uncommitted new segments are released, and the stable logical directory remains unchanged from the old version. S6: Update cached data based on patch segment and background merging mechanism When a page is updated or the signature of the shared page changes, a small patch segment is generated. The logical page address is recorded in the form of a basic immutable segment + patch chain. When the segment effectiveness rate is lower than the preset threshold and the time required for backend merging is less than the current frame time limit, the backend merges the basic segment and the patch segment to generate a new segment version, and reuses steps S3-S5 to complete the new version submission.

2. The hierarchical cache migration method for streaming video inference according to claim 1, characterized in that, In step S1, the normalized co-occurrence rate and the co-occurrence signature component are calculated as follows: (1); in, This represents the number of times the page (p) window is accessed. For cached page k, the total number of accesses within the sliding statistics window. The total number of times page p and page k are retrieved. To normalize the common take rate, For the common signature threshold, when Greater than or equal to At that time, set the associated common signature component for pages p and k.

3. The hierarchical cache migration method for streaming video inference according to claim 1, characterized in that, In step S3, the formula for calculating the priority of the migration task is: (2); in, For task j, priority To determine the urgency of task access, The remaining frame timeout for the task. For the current credit of the target link, This refers to the resource usage of the task chain. This refers to the number of common-use requests covered in a single migration. The number of pages contained in the migration segment. The cost of mission recovery; , , , These are the weighting coefficients for term, link credit, co-take revenue, and recovery cost, respectively. It is a positive real number.

4. The hierarchical cache migration method for streaming video inference according to claim 3, characterized in that, At the end of each scheduling cycle, the link credit update formula is: (3); in, For the current credit of link m, This is the amount of credit replenishment for this cycle. This represents the actual number of pages transmitted in this cycle. To update the link credit value of the m-th transmission link, This is the upper limit of the link credit.

5. The hierarchical cache migration method for streaming video inference according to claim 1, characterized in that, In step S6, the background merge trigger condition is: (5); in, For segment s, efficiency Valid data bytes within the segment. Total bytes of the segment The efficiency threshold, To combine the estimated time, This represents the remaining timeframe for the current frame.

6. The hierarchical cache migration method for streaming video inference according to claim 1, characterized in that, Each directory entry in the stable logical directory is fixed to 64 bytes. The directory entry fields include logical segment identifier, active version, active segment physical address, total segment size in bytes, segment checksum, status flag, common signature, commit time, and padding bits. The stable logical directory adopts a dual-slot structure, switching the active slot pointer through a single atomic write operation.

7. The hierarchical cache migration method for streaming video inference according to claim 1, characterized in that, The append-only migration log aligns each transaction record to 64 bytes. The transaction record fields include a unique transaction identifier, logical segment identifier, old version number, new version number, old storage address, new storage address, expected transfer bytes, target checksum, transaction status, and padding bits. During fault recovery, only unclosed transactions in the log that are in the pre-commit state and have no subsequent commit / rollback records are scanned, without the need for a global scan of all cached data.

8. The hierarchical cache migration method for streaming video inference according to claim 1, characterized in that, In step S1, when calculating access relationships, a sliding window decay mechanism is used. After the window expires, the historical access count and co-access count are decayed by a fixed proportion. The sliding window length is... The value ranges from 8 to 4096 visits; Maximum capacity of a single immutable segment The value range is 4KB to 8 MB.

9. The hierarchical cache migration method for streaming video inference according to claim 1, characterized in that, The streaming video inference scenarios include streaming visual question answering, continuous multimodal video question answering, and real-time video sensing inference. The logical cache pages are key-value (KV) cache pages corresponding to long context attention calculations.

10. A hierarchical cache migration system for streaming video inference, deployed on a streaming multimodal long context inference cache controller, connecting an attention execution engine and multi-layer heterogeneous storage, characterized in that, include: The co-access signature encapsulation module is used to perform step S1 in claim 1, which involves statistically analyzing cache page access associations, generating a co-access signature, and encapsulating an immutable segment. The dual-ledger storage management module is used to execute step S2 in claim 1, build and maintain two sets of ledgers: a stable logical directory and an append-only migration log, so that the old version directory remains readable during the migration period; The deadline credit scheduling module is used to execute step S3 in claim 1, calculate the priority of migration tasks based on multi-dimensional indicators, and dynamically manage the transmission credit of each storage link; The batch transmission and three-condition verification module is used to execute step S4 in claim 1, complete the cross-layer batch transmission of immutable segments, and simultaneously verify the three integrity conditions of transmitted bytes, check value, and version number. The atomic switching and rollback module is used to execute step S5 in claim 1, atomically updating the active version of the directory when the verification passes, and performing transaction rollback and releasing uncommitted data when the verification fails. The patch segment background merging module is used to execute step S6 in claim 1, generate the patch segment corresponding to the page update, and merge the basic segment and the patch segment to generate a new version segment when the dual conditions of segment effectiveness and time limit remainder are met.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes a computer program to implement the steps of the hierarchical cache migration method for streaming video inference as described in any one of claims 1-9.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When a computer program is executed by a processor, it implements the steps of the hierarchical cache migration method for streaming video inference as described in any one of claims 1-9.