← Latest papers
🤖 AI

Task-Aware Structured Memory for Dynamic Multi-modal In-Context Learning

The paper introduces TASM, a training-free framework for dynamic multi-modal in-context learning that overcomes context window and KV cache limitations by employing task-vector guided compression, semantics-aware token merging via bipartite graph matching, and a hierarchical memory structure to enable efficient, query-adaptive retrieval without disrupting semantic integrity.

Original authors: Zhirui Chen, Ziwei Chen, Ling Shao

Published 2026-06-11
📖 4 min read☕ Coffee break read

Original authors: Zhirui Chen, Ziwei Chen, Ling Shao

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to teach a very smart robot (a Multi-modal Large Language Model) how to do a new job by showing it thousands of examples. This is called "In-Context Learning." The robot looks at your examples and tries to guess the answer to your new question.

However, there's a big problem: The robot has a very short-term memory (a "context window"). If you show it too many examples, it runs out of space, gets overwhelmed, and slows down to a crawl. It's like trying to read a library of books in one sitting; eventually, you just can't hold all the information in your head.

Existing solutions try to fix this by being "ruthless editors." They look at the examples and delete the ones they think are boring or unimportant. But this paper argues that these editors are too clumsy. They often throw away crucial details, especially in pictures, breaking the spatial relationships (like where things are located) and leaving the robot confused.

Enter TASM (Task-Aware Structured Memory).

The authors propose a new, smarter way to manage the robot's memory. Instead of just deleting things, TASM organizes and compresses them. Here is how it works, using simple analogies:

1. The "Task Compass" (Task-Vector Guided Compression)

The Problem: Old methods decide what to keep based on what the specific example said. It's like a librarian who only keeps books that mention a specific word from a previous conversation, ignoring the rest of the story. This creates bias.
The TASM Solution: TASM first figures out the "direction" of the job. Imagine you are teaching a robot to identify cats. TASM creates a "Compass" that points toward "Cat-ness."

  • Instead of looking at individual examples, it looks at the transformation from a question to an answer.
  • It keeps the information that aligns with this "Compass" (the general logic of the task) and discards the noise that doesn't fit.
  • Result: The robot remembers the essence of the task, not just the specific details of the examples it saw.

2. The "Merging Mosaic" (Semantics-Aware Token Merging)

The Problem: Pictures are made of tiny patches (tokens). Old methods use "Hard Pruning," which is like taking a mosaic picture and smashing the tiles you don't like. If you smash the tiles that form the edge of a cat's ear, the picture of the cat is ruined.
The TASM Solution: TASM uses "Soft Merging." Instead of smashing tiles, it glues similar, less important tiles together.

  • It treats the image like a puzzle. If two small patches are next to each other and look similar, it combines them into one slightly larger, denser patch.
  • Result: The picture is smaller (compressed), but the shape and structure of the image remain intact. The robot can still "see" where things are.

3. The "Smart Filing Cabinet" (Dynamic Retrieval)

The Problem: Once you compress the memory, it becomes static. If the robot gets a tricky question later, it can't go back and get the details it threw away earlier. It's like throwing away a file folder because it looked boring, only to realize you needed it for a specific question later.
The TASM Solution: TASM builds a two-tier memory system:

  • Core Memory: A small, fast, high-speed desk where the most important, compressed info lives.
  • Latent Bank: A huge, slow, deep storage room (like a basement) where the rest of the details are kept.
  • The Trigger: TASM has a "surprise detector." If the robot gets a question that feels different or confusing (a high "Jensen-Shannon divergence"), it knows it needs more info. It then quickly runs to the basement (Latent Bank) to fetch the specific details it needs for that question.
  • Result: The robot stays fast most of the time but can instantly access deep details when the situation demands it.

The Results

The paper claims that TASM is a game-changer because:

  • It saves massive space: It can reduce memory usage by up to 85% (fitting a library into a backpack).
  • It keeps the robot smart: Unlike other methods that make the robot worse at spatial tasks (like finding an object in an image) or time-based tasks (like understanding a video), TASM keeps the robot's performance nearly as good as if it had seen all the examples without compression.
  • It works without retraining: You don't need to teach the robot new things; you just give it this new memory management system.

In short, TASM stops the robot from "forgetting" important details by organizing its memory like a well-structured library rather than a pile of shredded paper.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →