Manuscript Offprint

arXiv:2609.35416

When Should the Count Change? Learning State Maintenance for Causal Video Counting

Pengyiang Liu, Dongyue Lyu, Junbo Niu, Zhongyue Shi, Jiahao Xie, Si Liu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Pengyiang Liu 1,∗^{1,*} Dongyue Lyu 1,∗^{1,*} Junbo Niu 2,∗^{2,*}

Zhongyue Shi 1^{1} Jiahao Xie 1,†^{1,\dagger} Si Liu 1^{1}

1^{1}Beihang University 2^{2}Peking University

∗^{*}Equal contribution †^{\dagger}Corresponding author

Continuous video counting requires distinguishing new observations from new objects or completed events. We introduce STAMINA (State Maintenance), which learns to maintain counting state through state-conditioned updates. Recurrent visual context supports recognition; learned transitions maintain visibility, persistent identities, and completed-event records. A differentiable recurrence trains event transitions over legal paths constrained by count endpoints; visibility and association objectives train the object branch. A multi-source pipeline organizes 39.8K spatial queries and complementary event annotations into counting trajectories. On SVCBench, we evaluate counting adaptation with partial video overlap and held-out groups of linked annotations. Under prefix replay (Full) and persistent streaming (Stream), 4B and 8B models reach 41.9/36.4 and 44.9/38.2 Gaussian Precision Accuracy, respectively. The 8B model gains 10.9/3.2 points over Counting-SFT on the same queries. Matched-graph comparisons isolate phase conditioning and trajectory supervision, assessing training objectives alongside hard decisions. Online video benchmarks and count-conditioned decisions assess online understanding and task eligibility.

Project Page: https://PLACEHOLDER.github.io/StaMina/

(a) Keeping count in a changing scene

Figure

Same identity: no new count

Count after completion

(b) Human intuition: recognize and record

Figure

(c) StaMina: context with counting state

Recognize the object. Register the event.

Remember context. Learn when to update.

Visible now

Distinct objects

Completed events

Figure 1. Counting while packing. (a) Reappearance preserves object identity; lowering and releasing the orange mug distinguish an ongoing placement from a completed event. Hatched cutaways show the placement stages. (b) The inventory clerk uses remembered appearance to recognize objects and a notebook to track completed placements. (c) Current evidence and previously recorded state jointly determine whether the count should change.

1 Introduction

A packing assistant sees a blue striped mug and an orange mug beside a box (Figure 1a). A mug that disappears from view and reappears is still the same object: visibility changes while the number of distinct mugs stays fixed. The orange mug is then lowered into the box. The placement remains in progress while the hand holds it and completes after release. Observing the placed mug again preserves that completed-event count. These cases distinguish changes in visibility, identity, and completion (Liu et al., 2026c; Yang et al., 2025a; Shangguan et al., 2025).

Long-context and streaming vision-language models retain visual evidence through attention, recurrent summaries, or learned associative memory (Bai et al., 2025a; Xu et al., 2026; Zhang et al., 2025; Yang et al., 2025d; Sun et al., 2025). Hybrid local attention and online learners extend this context along a stream (Chen et al., 2026). The inventory clerk in Figure 1b illustrates the additional role of a record: remembered appearance supports recognition, while the notebook indicates which placements have already been counted. Thus the same observation can warrant an update during an active event and a hold after completion (Figure 1c). The key is to learn when current evidence changes previously recorded state.

We introduce STAMINA (State Maintenance), which learns to maintain the counting state through state-conditioned transitions. Gated delta memory carries causal appearance and motion context; typed state records current visible candidates, accepted identities, and completed events. An event head uses visual context and the current phase to score legal updates. Training sums the probabilities of paths consistent with supported count endpoints, allowing interval counts to supervise completion and persistence without assigning a boundary to every frame. The object branch separately learns visibility and association, so that an identity decision can be deferred while a visible mug remains countable.

This formulation connects data construction to the decisions being learned. The training resource must cover both identity-preserving reappearance and the transition from held to placed. We construct such supervision from visual tracking, independent prefix counting, and verified periodic transformations. The pool contains 39829 spatial queries and complementary event records. Count endpoints constrain the number of accepted updates; reliable identities and boundaries supervise their local meaning. Snapshot and interval queries share the underlying trajectory.

We instantiate STAMINA-4B and STAMINA-8B using the corresponding Qwen3-VL (Bai et al., 2025a) instruction models. Our contributions are:

• State-conditioned causal counting. A recurrent visual context and typed transition heads distinguish identity birth, visibility change, and event completion, with numerical answers read from the accepted state.

• Trajectory-constrained transition learning. A differentiable forward recurrence trains event transitions from supported count endpoints, while verified boundaries and identities supervise their respective operators.

• Trajectory data and evaluation. A multi-source pipeline supplies 39.8K spatial queries and complementary event trajectories. Evaluation at two model scales covers counting adaptation, online-video transfer on disjoint media, and count-conditioned action predicates.

References (89)