convmemory 0.4.0__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {convmemory-0.4.0 → convmemory-0.6.0}/PKG-INFO +100 -4
  2. {convmemory-0.4.0 → convmemory-0.6.0}/README.md +576 -481
  3. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory/__init__.py +32 -22
  4. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory/api.py +925 -496
  5. convmemory-0.6.0/convmemory/evidence_reranker.py +174 -0
  6. convmemory-0.6.0/convmemory/hub.py +87 -0
  7. convmemory-0.6.0/convmemory/memory_mla.py +638 -0
  8. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory/reranker.py +1 -0
  9. convmemory-0.6.0/convmemory/validity.py +438 -0
  10. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory.egg-info/PKG-INFO +100 -4
  11. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory.egg-info/SOURCES.txt +7 -1
  12. {convmemory-0.4.0 → convmemory-0.6.0}/pyproject.toml +2 -2
  13. convmemory-0.6.0/tests/test_evidence_reranker.py +153 -0
  14. convmemory-0.6.0/tests/test_memory_mla.py +182 -0
  15. convmemory-0.6.0/tests/test_validity_context.py +365 -0
  16. convmemory-0.4.0/convmemory/hub.py +0 -45
  17. {convmemory-0.4.0 → convmemory-0.6.0}/LICENSE +0 -0
  18. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory/ccge.py +0 -0
  19. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory/encoder.py +0 -0
  20. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory/metrics.py +0 -0
  21. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory/models.py +0 -0
  22. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory/routing.py +0 -0
  23. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory/scoring.py +0 -0
  24. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory.egg-info/dependency_links.txt +0 -0
  25. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory.egg-info/requires.txt +0 -0
  26. {convmemory-0.4.0 → convmemory-0.6.0}/convmemory.egg-info/top_level.txt +0 -0
  27. {convmemory-0.4.0 → convmemory-0.6.0}/setup.cfg +0 -0
  28. {convmemory-0.4.0 → convmemory-0.6.0}/tests/test_api_smoke.py +0 -0
  29. {convmemory-0.4.0 → convmemory-0.6.0}/tests/test_ccge.py +0 -0
  30. {convmemory-0.4.0 → convmemory-0.6.0}/tests/test_hub_loading.py +0 -0
  31. {convmemory-0.4.0 → convmemory-0.6.0}/tests/test_reranker.py +0 -0
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: convmemory
3
- Version: 0.4.0
3
+ Version: 0.6.0
4
4
  Summary: Lightweight temporal memory reranking for long-term conversational memory.
5
5
  Author: ConvMemory contributors
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/pth2002/ConvMemory
8
8
  Project-URL: Issues, https://github.com/pth2002/ConvMemory/issues
9
9
  Keywords: memory,retrieval,reranking,rag,agents
@@ -25,9 +25,18 @@ Requires-Dist: tqdm>=4.60
25
25
  Requires-Dist: scikit-learn>=1.2
26
26
  Provides-Extra: hub
27
27
  Requires-Dist: huggingface_hub>=0.20; extra == "hub"
28
+ Dynamic: license-file
28
29
 
29
30
  # ConvMemory
30
31
 
32
+ ## Technical Report
33
+
34
+ [ConvMemory: A Lightweight Learned Memory Reranker, a Negative Attribution Result, and a Research-Preview Conflict Editor](paper/convmemory_report.pdf) (May 2026)
35
+
36
+ **Headline finding**: The temporal-window mechanism originally claimed for ConvMemory is refuted by a 5-seed paired-bootstrap attribution study. The engineering value of the reranker (10-100× cheaper than cross-encoder baselines on conversational memory retrieval) survives the negative attribution.
37
+
38
+ ---
39
+
31
40
  [![CI](https://github.com/pth2002/ConvMemory/actions/workflows/ci.yml/badge.svg)](https://github.com/pth2002/ConvMemory/actions/workflows/ci.yml)
32
41
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
33
42
  [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](pyproject.toml)
@@ -46,7 +55,7 @@ reranker. Its intended use is recall-oriented memory selection for structured
46
55
  memory streams: conversations, user histories, agent traces, task logs, and
47
56
  session-level notes.
48
57
 
49
- Current package version: `0.4.0`
58
+ Current package version: `0.6.0`
50
59
 
51
60
  ## When To Use It
52
61
 
@@ -278,6 +287,93 @@ ranked = memory_reranker.retrieve(
278
287
  The checkpoint and embeddings must use the same embedding model family and
279
288
  embedding dimension.
280
289
 
290
+ ### ConvMemory v2: Evidence Reranker (recall-preserving top-10 cross-encoder)
291
+
292
+ ConvMemory v2 is an opt-in evidence reranker that runs after v1. It preserves
293
+ the exact v1 top-10 candidate set, then uses token-level query/memory evidence
294
+ to reorder only that protected prefix. This improves precision and MRR without
295
+ changing v1 Recall@10; if v1 did not retrieve the gold memory into top-10, v2
296
+ cannot rescue it. The v0.5.0 evidence checkpoint is published on Hugging Face,
297
+ but loading remains explicit.
298
+
299
+ ```python
300
+ from convmemory import ConvMemory
301
+
302
+ model = ConvMemory.from_pretrained("Purdy0228/ConvMemory-LoCoMo-MPNet")
303
+ model.load_evidence_reranker("Purdy0228/ConvMemory-v2-Evidence-Reranker")
304
+
305
+ ranked = model.retrieve(
306
+ query=query,
307
+ memories=candidates,
308
+ evidence_reranker="v2",
309
+ top_k=10,
310
+ )
311
+ ```
312
+
313
+ See [Evidence Reranker](docs/EVIDENCE_RERANKER.md) for the v363 headline
314
+ numbers, v364 load-bearing ablations, anti-leak guards, and limitations.
315
+
316
+ ### ConvMemory v3: Validity Context Layer
317
+
318
+ ConvMemory v3 adds validity evidence for agent memory without changing v1/v2
319
+ ranking by default. In `validity_mode="context"`, returned memories can carry a
320
+ structured `validity` note with possible update evidence; the rank order and
321
+ candidate set are preserved. Automatic demotion is available only as an explicit
322
+ opt-in mode for dense current-state/update workloads.
323
+
324
+ ```python
325
+ model.load_validity_module("Purdy0228/ConvMemory-v3-Validity-Context")
326
+
327
+ ranked = model.retrieve(
328
+ query=query,
329
+ memories=candidates,
330
+ evidence_reranker="v2",
331
+ validity_mode="context",
332
+ top_k=10,
333
+ )
334
+ ```
335
+
336
+ See [Validity Context](docs/VALIDITY_CONTEXT.md) for mode semantics and safety
337
+ contracts. See [V3 Model Card](docs/V3_MODEL_CARD.md) for checkpoint
338
+ provenance, package-level benchmark numbers, latency, and the source-of-truth
339
+ ledger.
340
+
341
+ ### Experimental Memory-MLA Recall Expander
342
+
343
+ This is **not** the v0.5.0 evidence reranker. See "ConvMemory v2: Evidence
344
+ Reranker" above for the v2 release.
345
+
346
+ Memory-MLA is an opt-in prefix-protected recall expander. It is not a
347
+ replacement for v1, and it is off by default: `retrieve(query, memories)` remains
348
+ the pure v1 ConvMemory path.
349
+
350
+ The expander runs after the base ConvMemory ranking. It preserves the top
351
+ `protect_top_k` results exactly, then uses compressed memory latent codes to
352
+ reorder a small suffix window for extra recall. The verified v320 configuration
353
+ is `latent_count=12`, `code_dim=64`, `protect_top_k=7`, and
354
+ `expand_window=16`. It mainly targets Recall@10 / hard-recall improvements; it
355
+ does not claim SOTA.
356
+
357
+ ```python
358
+ from convmemory import ConvMemory
359
+
360
+ model = ConvMemory.from_pretrained("Purdy0228/ConvMemory-LoCoMo-MPNet")
361
+ model.load_expander("path-or-hub-id-for-memory-mla")
362
+
363
+ ranked = model.retrieve(
364
+ query=query,
365
+ memories=candidates,
366
+ expander="memory_mla",
367
+ protect_top_k=7,
368
+ expand_window=16,
369
+ top_k=20,
370
+ )
371
+ ```
372
+
373
+ The API is experimental and follows the CCGE-LA opt-in pattern. See
374
+ [Memory-MLA](docs/MEMORY_MLA.md) for mechanism notes, training discipline, and
375
+ the v320 verification numbers.
376
+
281
377
  ## Results
282
378
 
283
379
  These are retrieval-stage evaluations. They measure whether annotated evidence