SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2609.02780 · September 2026

ShallowStream: Index Shallow then Answer Deep for Streaming Video Understanding

Jun Yu, Fan Liu, Qiang Huang, Ke Yang, Jitai Hao, Di Yan

arXiv · PDF · Open in the Atlas

Code that ran

10 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 10 failures of our instrument; 0 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2609.02780.json · badge: /api/ran/2609.02780.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
CURRENTF/ShallowStream canonical (classifier label)
classifier basis: census
10 ran · 0 no recorded run
FunctionStatusWhere it lives
evidence_retrieval_backend Ran
ran; our contract draft was wrong, not the code
CURRENTF/ShallowStream/src/shallowstream/evidence_retrieval.py
code served (permissive licence) · get_code("1707680e670a3467")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from typing import Any, Mapping

# Test case 1: default backend (shallow)
config_default = {}
ARGS = {
    'config': config_default
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
expand_temporal_neighbors Ran
ran; our contract draft was wrong, not the code
CURRENTF/ShallowStream/src/shallowstream/common.py
code served (permissive licence) · get_code("fb334b5b18dbdbf5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# Based on the function signature and implementation, we need:
# - seed_ids: an Iterable[int] of seed item IDs
# - candidate_ids: an Iterable[int] of valid candidate IDs
# - previous: int (number of previous temporal neighbors to include)
# - following: int (number of following temporal neighbors to include)
# - previous_stride: int (stride for previous neighbors)
# - following_stride: int (stride for following neighbors)

# The function expands a set of seed IDs by adding temporal neighbors
# within a valid candidate set, respecting strides.

torch.manual_seed(0)

# Create realistic test data:
# Let's say we have a temporal sequence with IDs 1-20
candidate_ids = list(range(1, 21))  # IDs 1 through 20

# Seed IDs (a subset of candidates)
seed_ids = [5, 10, 15]

# Parameters for temporal expansion
previous = 3          # Look back up to 3 steps
following = 2         # Look forward up to 2 steps
previous_stride = 1   # Step size going backward
following_stride = 1  # Step size going forward

ARGS = {
    "seed_ids": seed_ids,
    "candidate_ids": candidate_ids,
    "previous": previous,
    "following": following,
    "previous_stride": previous_stride,
    "following_stride": following_stride,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_active_attn_implementation Ran
ran; our contract draft was wrong, not the code
CURRENTF/ShallowStream/src/shallowstream/common.py
code served (permissive licence) · get_code("2bb3ac0a55e32d84")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from typing import Any, Dict

# Create a minimal config class with _attn_implementation attribute
class MinimalConfig:
    def __init__(self, attn_impl: str = None, has_text_config: bool = False):
        if attn_impl:
            self._attn_implementation = attn_impl
        self.text_config = MinimalConfig(attn_impl="flash_attention_2") if has_text_config else None

# Create minimal model classes that match the function's expectations
class MinimalLanguageModel(nn.Module):
    def __init__(self, with_config: bool = True, attn_impl: str = None):
        super().__init__()
        if with_config:
            self.config = MinimalConfig(attn_impl=attn_impl)

class MinimalModelCore(nn.Module):
    def __init__(self, with_config: bool = True, attn_impl: str = None):
        super().__init__()
        if with_config:
            self.config = MinimalConfig(attn_impl=attn_impl)
        self.language_model = None

class MinimalWrapper(nn.Module):
    def __init__(self, attn_impl: str = "sdpa"):
        super().__init__()
        self.language_model = MinimalLanguageModel(with_config=True, attn_impl=attn_impl)
        self.model = MinimalModelCore(with_config=True, attn_impl=attn_impl)
        self.config = MinimalConfig(attn_impl=attn_impl, has_text_config=True)

# Test case 1: Model with language_model.config containing _attn_implementation
model_with_attn = MinimalWrapper(attn_impl="flash_attention_2")

# Test case 2: None model (should return empty string)
model_none = None

# Test case 3: Simple model with just config.attn_implementation
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        config = MinimalConfig()
        config.attn_implementation = "eager"
        self.config = config

simple_model = SimpleModel()

ARGS = {
    "model": model_with_attn
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
query_source_label Ran
ran; our contract draft was wrong, not the code
CURRENTF/ShallowStream/src/shallowstream/task_gate.py
code served (permissive licence) · get_code("95c5b5fcdd2339cf")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# The function query_source_label takes two string parameters
# and returns a string based on conditional logic
# No complex objects, models, or tensors are needed

ARGS = {
    'source': 'question_text',
    'representation': 'embedding'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
resolve_evidence_query Ran
ran; our contract draft was wrong, not the code
CURRENTF/ShallowStream/src/shallowstream/evidence_retrieval.py
code served (permissive licence) · get_code("b12bd86017bd02b9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from typing import Any, Mapping

# Define the config as a simple dict
config = {
    'evidence_retrieval_query_source': 'question_text'
}

# Define the full_prompt and question_text strings
full_prompt = "What is the capital of France? Paris is a major city in Europe."
question_text = "What is the capital of France?"

# Construct the ARGS dictionary with all parameters
ARGS = {
    'config': config,
    'full_prompt': full_prompt,
    'question_text': question_text
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
resolve_task_gate_input Ran
ran; our contract draft was wrong, not the code
CURRENTF/ShallowStream/src/shallowstream/task_gate.py
code served (permissive licence) · get_code("b5c30a0496536e69")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from typing import Any, Dict, Mapping, Sequence, Tuple

# Set seed for reproducibility
torch.manual_seed(0)

# Create a minimal config dict that will be used as the Mapping[str, Any] parameter
config = {
    'task_gate_input_source': 'full_prompt'
}

# Create the question_text argument
question_text = "What is the capital of France?"

# Create the full_prompt argument
full_prompt = "Please answer the following question: What is the capital of France? Provide a detailed response."

# Construct ARGS dict with all parameters
ARGS = {
    'config': config,
    'question_text': question_text,
    'full_prompt': full_prompt
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
score_history_attention_layers Ran
ran; our contract draft was wrong, not the code
CURRENTF/ShallowStream/src/shallowstream/history_decay_gate.py
code served (permissive licence) · get_code("4d1f81e427cd525e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import math
import statistics
from typing import Any, Mapping

# Construct valid arguments for score_history_attention_layers

# layer_masses: A mapping from layer indices (int) to attention masses (float)
# We need at least 2 layers, with finite non-negative masses
layer_masses = {
    0: 0.5,
    1: 1.2,
    2: 2.8,
    3: 5.1
}

# variant: One of the supported variants
variant = 'linear_slope'

# threshold: A finite float value
threshold = 0.0

ARGS = {
    'layer_masses': layer_masses,
    'variant': variant,
    'threshold': threshold
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
select_temporal_retrieval_ids Ran
ran; our contract draft was wrong, not the code
CURRENTF/ShallowStream/src/shallowstream/common.py
code served (permissive licence) · get_code("21748ee34ea16431")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# Set seed for reproducibility
torch.manual_seed(0)

# Define arguments for select_temporal_retrieval_ids
ARGS = {
    'seed_ids': [1, 3, 5],
    'ranked_ids': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
    'candidate_ids': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
    'previous': 2,
    'following': 1,
    'previous_stride': 1,
    'following_stride': 1,
    'strategy': 'temporal_neighbors',
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
task_gate_input_metadata Ran
ran; our contract draft was wrong, not the code
CURRENTF/ShallowStream/src/shallowstream/task_gate.py
code served (permissive licence) · get_code("c031d5cfb1c94c17")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import hashlib

# Analyze the function:
# - text: str - will be encoded to UTF-8 and hashed
# - source: str - used as-is in the output dict
# Both parameters are simple strings with no special methods called

ARGS = {
    'text': 'Hello, world! This is a test input for the task gate.',
    'source': 'test_source_identifier'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
validate_evidence_retrieval_config Ran
ran; our contract draft was wrong, not the code
CURRENTF/ShallowStream/src/shallowstream/evidence_retrieval.py
code served (permissive licence) · get_code("1ccf509c3b95fc2e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Test case 1: shallow backend with qwen3vl model family
config_shallow_qwen3vl = {
    'evidence_retrieval_backend': 'shallow',
    'evidence_retrieval_query_source': 'question_text',
    'evidence_retrieval_siglip_batch_size': 16,
    'evidence_retrieval_siglip_device': 'auto',
    'evidence_retrieval_siglip_model_path': '',
    'task_gate_mode': 'off',
    'retrieval_score_order': 'highest',
    'long_cluster_topk': 0,
}

model_family_qwen3vl = 'qwen3vl'

# For the siglip case with qwen3vl, we need a more complete config
config_siglip_qwen3vl = {
    'evidence_retrieval_backend': 'siglip',
    'evidence_retrieval_query_source': 'full_prompt',
    'evidence_retrieval_siglip_batch_size': 8,
    'evidence_retrieval_siglip_device': 'cpu',
    'evidence_retrieval_siglip_model_path': '/path/to/model',
    'task_gate_mode': 'query_choice_logits',
    'retrieval_score_order': 'highest',
    'long_cluster_topk': 0,
    'long_cluster_enabled': False,
    'retrieval_selection_granularity': 'unit',
    'retrieval_topk_units': 5,
}

# For the siglip case with onevision model family
config_siglip_onevision = {
    'evidence_retrieval_backend': 'siglip',
    'evidence_retrieval_query_source': 'question_text',
    'evidence_retrieval_siglip_batch_size': 12,
    'evidence_retrieval_siglip_device': 'auto',
    'evidence_retrieval_siglip_model_path': '/path/to/siglip/model',
    'task_gate_mode': 'query_choice_logits',
    'retrieval_score_order': 'highest',
    'long_cluster_topk': 0,
    'retrieval_subtitle_weight': 0.0,
    'retrieval_topk_frames': 3,
}

model_family_onevision = 'onevision'

# Primary test case: shallow backend (simplest path)
ARGS = {
    'config': config_shallow_qwen3vl,
    'model_family': model_family_qwen3vl,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 10 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Streaming video understanding is a critical capability for real-world applications, including embodied intelligence, autonomous driving, industrial monitoring, surveillance and early warning, and wearable assistants. However, processing continuous video streams with multimodal large language models (MLLMs) is computationally expensive. Existing efforts have explored reducing streaming overhead through visual token pruning, token merging, quantization, on-demand frame retrieval, and context offloading. However, most existing methods overlook the dimension of model depth. Repeatedly executing full-depth MLLM prefill over incoming frames is prohibitively expensive, incurring substantial computational overhead and causing the KV cache to grow at a rate directly proportional to the prefill depth. To address these challenges, we propose ShallowStream, a novel framework that leverages the shallow layers of an MLLM to simultaneously perform frame encoding and retrieval index building. During stream processing, ShallowStream maintains an always-on lightweight index using the KV cache of shallow layers. During query-time answering, we leverage the attention scores generated by the shallow layers to score context frames and employ a diversity-aware selection strategy to retrieve precise and comprehensive evidence. ShallowStream achieves performance on par with the strongest existing streaming methods, while reducing per-frame prefill latency and 10-second end-to-end latency by up to 52.1x and 11.9x, respectively. Our code is available at https://github.com/CURRENTF/ShallowStream.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2609.02780")
get_code_for_paper("2609.02780")
have("2609.02780")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2609.02780.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2609.02780.svg)](https://syntology.ai/paper/2609.02780)

Connect an agent — have() is free.