triclock / README.md
resoajoe's picture
v0.4: usage note — sampling is load-bearing
3585859 verified
|
Raw
History Blame Contribute Delete
3.7 kB
---
license: apache-2.0
tags:
- benchmark
- video-understanding
- edge
- change-detection
- tiny-models
pretty_name: TriClock / LogLens
---
# LogLens · TriClock
*Live demo: https://huggingface.co/spaces/resoajoe/loglens · Code:
https://github.com/resoajoe/loglens*
**One question:** if a camera never moves, how little memory does a model need
to answer *"when did that change?"* at every timescale — a frame ago, a minute
ago, all day ago?
**One answer:** K = O(log T) frame embeddings at logarithmically-spaced ages.
A 128K-parameter model with **8 memory slots** localizes changes across a
1,024-frame horizon at 0.90–0.92 mean accuracy (3 seeds), where a sliding
window scores 0.48 (blind past 8 frames) and uniform sampling scores 0.67
(blind to the recent past). With **4 slots** it beats hand-crafted schedules
using 8 and matches them at 12. The schedule's base is a *deploy-time knob*:
retune it coarser on frozen weights and keep 99–101% of accuracy. And more
memory isn't better — K=12 loses to K=8; coverage, not capacity, is what to
buy.
## TriClock
A procedural benchmark isolating the memory schedule as the only variable.
Three objects per scene each change at most once, at an age drawn log-uniform
over [1, 1024]; the task is classifying WHEN (none/fast/med/slow). The current
frame is provably uninformative — colors, positions, and object existence are
randomized so only *comparison against a correctly-aged memory* answers the
question. Frames render functionally from a seed, so the dataset is infinite,
weightless, and exactly reproducible.
```python
from triclock.generate import Episode
ep = Episode(seed=42)
frame_now, frame_100_ago = ep.frame(0), ep.frame(100)
ep.labels # [light, agent, furniture] -> {0: none, 1: fast, 2: med, 3: slow}
```
## Headline table (K=8 slots, identical model & training)
| schedule | fast | med | slow | mean ± std (3 seeds) |
|---|---|---|---|---|
| log (boundary-tuned) | .91 | .90 | .91 | **.92 ± .01** |
| log (auto base) | .86 | .90 | .86 | .90 ± .02 |
| log (wrong boundaries — control) | .85 | .83 | .74 | .85 ± .00 |
| hybrid window+stride | .65 | .82 | .61 | .76 ± .01 |
| uniform stride | .06 | .74 | .92 | .67 ± .01 |
| sliding window | .92 | .01 | .00 | .48 ± .00 |
Train any row yourself in ~2.5 minutes on an M-series MacBook:
```bash
python3 -m triclock.train --policy log --steps 6000
```
## Try the demo (Space)
Move the budget slider and watch the sliding window go blind to the past and
the stride go blind to the present, while the log schedule keeps both — the
whole idea in one interaction.
## Usage note: the sampling is load-bearing (learned the hard way)
TriClock draws change ages **log-uniformly** over [1, T]. This is not a
detail. When we ported the task to real footage and sampled query times
uniformly instead, the label distribution silently collapsed to 87-100%
"slow" and models fit that prior perfectly while learning nothing (train
loss 0.002, gold accuracy 0.25). If you adapt this benchmark to your own
footage: port the age-sampling discipline, not just the task. The repo's
`realdata/` pipeline has the corrected anchored sampler.
## Status & roadmap
Temporal results: 3 seeds, 20K steps, synthetic scenes. Spatial axis: a fixed
log-*zoom* glimpse wrapper on SmolVLM-256M was inconclusive on V*Bench (both
arms at chance — the backbone, not the schedule, is the bottleneck at 256M);
spatial validation moves to TriClock-HD, a trained-from-scratch setting like
the temporal one. Next: real fixed-camera streams and Jetson Nano deployment
(target: full-day change localization in ~3 KB of memory state at ~5 W).
Draft writeup in `paper/DRAFT.md`.