Skip to main content

vmfstream

Gradient-free online story discovery in ~1 MB of state.

vmfstream clusters incoming news articles into stories one by one as they arrive, with no online training, no GPUs and no growing buffers. It maintains a memory of von Mises–Fisher nodes that updates and forgets sufficient statistics in a single pass on a single CPU thread, keeping its entire state in a compact ~1 MB table that you can inspect, save, and resume at any point.

The memory explorer on 3 March 2022: nine years of the Wikipedia Current Events Portal read by vmfstream, with the node that followed the invasion of Ukraine selected, its words and its parts

The memory explorer: nine years of the Wikipedia Current Events Portal, day by day. The sphere holds the items the memory still remembers, coloured by story, with each story's mass as relief and its words as a label; the timeline, the mass of each story; the table, the memory's rows on the chosen day; the inspector, any story or item.

What it does

  • One item at a time. Each text is compared with every story in memory and with a slot for a new one, and assigned on arrival: about half a millisecond per item on one CPU thread, whatever the length of the stream.
  • Nothing trained while reading. A story is three additive statistics. Adding an item is a sum, forgetting is a product; the only fitted part is a principal-component projection, computed once on another sample.
  • Tools around the memory. Retrieve the stories of a theme at a given time, follow a story's centre as it drifts, keep the parts of each story (Memory(parts=6), without changing any assignment), describe stories and parts with their words, pick exemplars, score against labels, and explore a whole stream in the browser.

Results

On the standard benchmark of online story discovery (News14, WCEP18, WCEP19), scored on sliding seven-day windows as in SCStory's evaluation code, one run per test set with the configuration chosen on a development stream. Each cell is B³ F1 / AMI / ARI:

Method News14 WCEP18 WCEP19
vmfstream, encoder adapted once, Memory.main() 0.899 / 0.913 / 0.838 0.861 / 0.909 / 0.785 0.877 / 0.922 / 0.809
HRSTORY 0.889 / 0.899 / 0.836 0.851 / 0.895 / 0.776 0.864 / 0.908 / 0.805
SCStory, trains its encoder on each test stream 0.872 / 0.879 / 0.809 0.837 / 0.884 / 0.757 0.844 / 0.892 / 0.781
vmfstream, nothing trained, Memory() 0.867 / 0.876 / 0.805 0.811 / 0.866 / 0.745 0.835 / 0.887 / 0.784
USTORY 0.789 / 0.812 / 0.699 0.810 / 0.871 / 0.739 0.825 / 0.880 / 0.765

The first row adapts the sentence encoder once, offline, on the labelled events of a disjoint year (2016), labels SCStory does not use; that encoder is not distributed with vmfstream yet, so the library reproduces the fourth row (to within 0.002), which is above every training-free method in the paper. Published rows are copied from SCStory's and HRSTORY's papers.

On one CPU thread vmfstream reads a day of stream in 0.05 to 0.15 s, against 0.18 to 0.42 s for SCStory on a GPU, and carries 1.3 MB of state against 260 to 480 MB. Details, ablations and the label-free choice of granularity are in the paper.

Install

vmfstream is not on PyPI yet. From a clone of this repository:

pip install -e ".[all]"   # the memory, plus the sentence encoder (encode) and the viewers (viz)

The memory itself needs only NumPy; encode adds sentence-transformers and viz adds matplotlib and umap-learn.

Quickstart

from vmfstream import Memory
from vmfstream.encode import SentenceEncoder

encoder = SentenceEncoder()                     # sentence embeddings, 1,024 numbers per text
embeddings = encoder.encode(texts)              # the stream, in arrival order
reference = encoder.encode(other_texts)         # another sample, to fit the projection on

memory = Memory().fit_projection(reference)     # the analytic configuration
history = memory.read(embeddings, hours)        # one story per item; times in hours

for s in history.summary()[:5]:                 # the largest stories, each with its most central item
    print(s.node, s.size, texts[history.exemplars(s.node, central=1, diverse=0)[0]])

query = memory.project(encoder.encode(["Russian invasion of Ukraine"])[0])
history.query(query, time=hours_at_date, k=3)   # the stories closest to a theme around a time

On the Portal stream (49,090 items, 2016–2024) Memory() opens 7,075 stories; Memory.main() adds expiry and a hard write. The memory can also be fed item by item with memory.step(embedding, time), saved and loaded.

Explore your own stream

Read the stream as usual, then open the explorer on it, served from your machine:

from vmfstream.viz import serve

points = memory.project(embeddings)
history = memory.read(points, hours, projected=True, candidates=3)  # keep the options of every read
serve(history, points=points, titles=texts, start=first_date)      # opens the page; Ctrl-C to stop

The bar at the top offers the two presets and the main settings (half-life, concentration cap, alpha, expiry, write). Choosing one that has not been read yet makes the library read the stream with it, and the page switches to the new reading when it is done. explorer_html writes the same page as a single HTML file, to share.

Documentation

https://manucouto1.github.io/vmfstream/: concepts, guides with real outputs, the API reference and the memory explorer. The sources are in docs/ (Starlight); the built site is in the branch doc (scripts/publish_docs.sh).

Author

Manuel Couto Pintos, CiTIUS (Centro Singular de Investigación en Tecnoloxías Intelixentes), Universidade de Santiago de Compostela.

Citation

If you use vmfstream, please cite the paper:

@misc{coutopintos2026vmfstream,
  title         = {{vmfstream}: An Online Memory for Story Discovery That Adapts to the News Stream at Two Time Scales},
  author        = {Couto Pintos, Manuel},
  year          = {2026},
  eprint        = {2612.02360},
  archivePrefix = {arXiv},
  primaryClass  = {cs.IR},
  doi           = {10.48550/arXiv.2612.02360},
  url           = {https://arxiv.org/abs/2612.02360}
}

GitHub's Cite this repository gives the same reference, from CITATION.cff.

License

Apache License 2.0 (LICENSE). Commercial use is allowed; redistributions must keep the copyright notice and the NOTICE file.

Metadata

Release files for vmfstream 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vmfstream 0.1.0
File Size Uploaded Provenance Actions
vmfstream-0.1.0.tar.gz 365.4 kB With provenance Details for vmfstream-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vmfstream 0.1.0
File Interpreter ABI Platform Actions
vmfstream-0.1.0-py3-none-any.whl Python 3 none any Details for vmfstream-0.1.0-py3-none-any.whl

Total release size: 438.0 kB

Release files / vmfstream-0.1.0.tar.gz

Download URL vmfstream-0.1.0.tar.gz
Size 365.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0787f4102d3f2e212d875b141b7e924fb227067717a04d6f817ba96dce6a5dd2
BLAKE2b-256 checksum
How to use checksums
4fee49ba4acd3950f4fe70b709bc4c3b3abc7be9fb6fec892405563581f18072
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Release files / vmfstream-0.1.0-py3-none-any.whl

Download URL vmfstream-0.1.0-py3-none-any.whl
Size 72.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a29ff26db0f42dc162672fb7679e6d616bb359a3a13fdd75dd3f514a07e8190
BLAKE2b-256 checksum
How to use checksums
4fd5678a877062c6c06a69fd501fef00137b5e9bd3ed19347a82ba2aabda2303
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Security for vmfstream 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vmfstream-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page