Glance-Stream-0.8B
Standing rules over a live video stream: one 0.8B model checks all your yes/no rules together every half second (16 per stream in our evaluation), including rules about what happened before, and boxes the person a rule is about.
GitHub (code, docs) · Usage · Results · Limitations · Training data · License
You attach rules to a 30 fps video stream: "is someone cutting vegetables right now", "whenever the fridge is opened it must be closed within 30 seconds", "cutting is only allowed if hands were washed in the minute before". Every 0.5 s the model answers all of them at once with p(yes) for "is this rule violated right now", from one shared state of the stream; an alert fires after two consecutive readouts above the threshold. For rules that carry a person description it also returns that person's box in the current frame.
Real model outputs on a Pexels clip (Anna Shvets, Pexels License), rendered by
examples/make_demo.py; raw
readouts in assets/demo_predictions.json.
What is in this repository
| File | Content |
|---|---|
text_lora.safetensors |
rule-question adapter: LoRA r=16, alpha=32 on the attention, Gated-DeltaNet and MLP projections of the Qwen3.5-0.8B language model, fp32 (10.2 M parameters) |
box_lora.safetensors |
box-question adapter, same shape, used only for box questions |
box_head.safetensors |
box head: presence, choice of patch, four ordinal edge distributions, IoU; one latent token read at layer 24 |
config.json |
base model id, adapter files, stream shape (256×256, 64 tokens per frame group), memory window, readout period, alert defaults |
checks/independence.json |
the check that the two adapters do not interact (see below) |
The base weights are not included; they load from Qwen/Qwen3.5-0.8B
(Apache-2.0). The weights need the glance_stream package: the
streaming state, the forked question blocks and the box head are not part of transformers.
Model description
- Stream. Each frame group (two consecutive frames through the Qwen3.5 vision tower's 2-frame tubelet, 64 tokens at 256×256, plus a text timestamp every 0.5 s) is written once into the model's state. The Gated-DeltaNet layers carry their recurrent state through the whole video; the full-attention layers keep a bounded window (every group of the last 4 s and older groups up to 600 s on a 2 s grid, about 30k tokens), with positions re-based so hour-long streams stay in the trained range.
- Questions never write back. Every rule is a short question block forked from the current state and discarded after the answer, so adding a rule never changes the other answers or the stream. All rules of one readout are one batched forward.
- Answers. p(yes) from the first answer token, restricted to the yes/no tokens; no text is generated.
- Adapters only on questions. The LoRA adapters are active only on question tokens. The video path runs the
unchanged base model, so rule questions and box questions can use separate adapters without interacting: on a 36 s
clip with four rules and one box, the released model's rule probabilities are bit-identical to the rule checkpoint
alone and its boxes bit-identical to the box checkpoint alone (
checks/independence.json). - Cross-time rules end to end. "After A, B is not allowed", "B only if A in the last T s", "A must be followed by B within T s", "at most N times in T s" and "B not allowed between A and C" are answered by the model from the stream state. There is no event detector or state machine at inference time.
Usage
pip install "glance-stream @ git+https://github.com/Vision-Decision/Glance-Stream"
pip install flash-linear-attention # optional, CUDA only: fast Gated-DeltaNet kernels
from glance_stream import GlanceStream, Rule
gs = GlanceStream.from_pretrained("Vision-Decision/Glance-Stream-0.8B") # CUDA if available
mon = gs.monitor([
Rule.now("someone is cutting vegetables"),
Rule.must_follow("someone opens the fridge", "someone closes the fridge", within=30),
Rule.now("someone is holding a knife", box="the woman holding a knife"),
])
def on_readout(r): # called every 0.5 s of video, as the stream is processed
for name in r.alerts:
print(f"{r.t:.1f}s ALERT {name} p={r.p[name]:.2f}", r.boxes.get(name))
readouts = mon.run("kitchen.mp4", fps=30, callback=on_readout) # all readouts, also returned at the end
Command line: python examples/run_rules.py my_video.mp4 --rules examples/kitchen_rules.json --out readouts.json.
Results
Only results that are final are listed. Protocols are in docs/EVALUATION.md.
| What | Data | Result |
|---|---|---|
| False alarms per rule-hour on cross-time rules, at 80% event recall | 22 EPIC-KITCHENS-100 streams, 10 participants (never trained on) | 289.9 → 173.4 against the same recipe without rule training (p = 0.002 over participants) |
| Box Acc@0.5 (person descriptions) | HC-STVG v2 test, 267 clips, 2 fps | 48.5 |
- The false-alarm result uses a threshold chosen for 80% event recall on held-out participants, alerts after 2 consecutive readouts and a 5 s cooldown, every rule asked every 0.5 s at 30 fps with the 600 s window.
- Speed: no latency number is reported for this release; an optimised engine is being verified and is planned for a later release.
Limitations
- Count rules fire too often. "At most N times in T seconds" rules over-count: the model reports the limit as exceeded more often than it is.
- "A must be followed by B within T s" is not reliable. On the benchmark this rule type was not significantly better than chance at ranking readouts. The model learned not to fire when A never happened, but it does not reliably tell "B already came" from "B has not come yet".
- Not shown to be as good as the baseline on simple rules. On a separate deployment benchmark of "is X happening now" rules (48 ten-minute streams), the rule-trained model's false alarms are on par with the baseline, but the test could not establish that it is no worse than the baseline within a 10% non-inferiority margin fixed before the test.
- Thresholds are not tuned for you. The default threshold 0.5 is a starting point; the benchmark chose thresholds on held-out data. Probabilities for cross-time rules are not calibrated. Set thresholds per rule on your own footage.
- Boxes are for people. The box head was trained and tested on person descriptions (HC-STVG) at 2 fps; boxes for objects are untested, and it reads a 256×256 frame, so small people are coarse.
- Domain. Trained on indoor home clips (Charades) and evaluated on kitchens; outdoor, industrial or surveillance footage is untested. Only the template wording was evaluated; Chinese and free-form rules were in training but are not evaluated.
- Size. A 4B version with the same recipe is Glance-Stream-4B: fewer cross-time false alarms, worse boxes, and its pre-registered primary test was not met; see its card.
Training
- Rule adapter. From the frozen base model, 1,200 steps of 4 clips each, streamed in the inference shape (bounded window, no gradient through the video path); questions are forked at random times and answered as text (yes/no, spans, counts, options) on Charades, Charades-STA and RepCount-A. 35% of the batches are long training streams (5–10 min of spliced Charades train clips) with about 16 rules each, labelled at every readout time by the rule engine from the human annotations.
- Box adapter and box head. A separate 1,500-step run on HC-STVG v2 box questions only, started from the sibling baseline checkpoint (same recipe without the rule streams): the box adapter began as a copy of that checkpoint's question adapter, the box head from its box head. Both runs write the video with the unchanged base model, which is why the box parts can be combined with the rule adapter.
Training data
| Source | Used for | Licence / terms |
|---|---|---|
| Charades (train), Charades-STA | "now", temporal, which-one and count questions; long training streams for cross-time rules | Allen Institute for AI, non-commercial research use |
| RepCount-A (train) | counting | no explicit licence found; treated as research use only |
| HC-STVG v2 (train) | boxes | no explicit licence found; treated as research use only |
| Rule wordings | English and Chinese wordings of the training rules, written by Claude Opus 5.5 from the structured rule and kept only if a blind back-parse matched; labels come from the rule engine, never from a language model | generated |
| Box head initialisation | box head of a 0.8B image Glance model (RefCOCO/+/g, gRefCOCO, COCO-based grounding data) | includes non-commercial sources |
Evaluation only: EPIC-KITCHENS-100 (CC BY-NC 4.0), HC-STVG v2 test.
License
- Weights (the two adapters and the box head): CC BY-NC 4.0, non-commercial use only. The training data includes non-commercial sources (Charades, gRefCOCO via the box-head initialisation) and sources without an explicit licence that we treat as research use only (RepCount-A, HC-STVG).
- Code (GitHub): Apache-2.0.
- Base model Qwen/Qwen3.5-0.8B: Apache-2.0, downloaded from its own repository.
Citation
@misc{glancestream2026,
title = {Glance-Stream: Standing Rules over a Live Video Stream},
author = {Vision-Decision},
year = {2026},
url = {https://github.com/Vision-Decision/Glance-Stream},
note = {Glance-Stream-0.8B, https://huggingface.co/Vision-Decision/Glance-Stream-0.8B}
}
- Downloads last month
- 6
