liquid-loop 2.0.0__tar.gz → 2.0.1__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.
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/PKG-INFO +2 -2
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/README.md +1 -1
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/__init__.py +2 -2
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/selfspin.py +41 -6
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop.egg-info/PKG-INFO +2 -2
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/pyproject.toml +1 -1
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/LICENSE +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/__main__.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/audit.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/cli.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/cognitive_budget.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/context_compress.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/cpe.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/entropy.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/guard.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/liquid_reweight.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/procedural_memory.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/rar.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/recall_filter.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/self_eval.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/self_refine.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/session.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/storage.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/textutil.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop/workspace.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop.egg-info/SOURCES.txt +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop.egg-info/dependency_links.txt +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop.egg-info/entry_points.txt +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop.egg-info/requires.txt +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop.egg-info/top_level.txt +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/__init__.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/error_loop/__init__.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/error_loop/low_stability_recall.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/liquid_persist_ab.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/liquid_recall_ab.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/multigran/__init__.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/multigran/ab_multigran.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/multigran/hard_ab_multigran.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/multigran/multigran_core.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/multigran/sim_structured.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/multigran/test_multigran.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/r16_repro/__init__.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/r16_repro/compare_rar.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/r16_repro/r16_repro.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/skill_refine/__init__.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/liquid_loop_exp/skill_refine/skill_refine_loop.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/setup.cfg +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_attention_gain.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_auth_guard.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_cli_version.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_consensus_expansion.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_context_compress.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_entropy.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_guard_session_recall.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_layer1_persistence.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_lifecycle.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_liquid_reweight.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_nucleate_dual_track.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_peek_seal.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_perception_gate.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_procedural_memory.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_rar.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_recall_filter.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_replay_pressure.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_seal_persistence.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_self_eval.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_self_evolve.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_selfspin.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_semantica_borrow.py +0 -0
- {liquid_loop-2.0.0 → liquid_loop-2.0.1}/tests/test_workspace.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: liquid-loop
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: Self-Organizing Cognitive Memory for AI Agents — Liquid Loop theory implementation
|
|
5
5
|
Author: fishbook0001
|
|
6
6
|
Maintainer: fishbook0001
|
|
@@ -43,7 +43,7 @@ Dynamic: license-file
|
|
|
43
43
|
|
|
44
44
|
> **Self-Organizing Cognitive Memory for AI Agents** — Zero LLM dependency, pure Python implementation of the Liquid Loop theory.
|
|
45
45
|
|
|
46
|
-
> **当前包版本:`2.0.
|
|
46
|
+
> **当前包版本:`2.0.1`**(2026-08-25 零向量召回超越词频基线,详见 [CHANGELOG.md](CHANGELOG.md)。数据 schema `0.4.0` 与 workspace state `0.5.1` 为记忆层数据格式版本,独立于包发布版本)。
|
|
47
47
|
|
|
48
48
|
[](https://pypi.org/project/liquid-loop/)
|
|
49
49
|
[](https://pypi.org/project/liquid-loop/)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> **Self-Organizing Cognitive Memory for AI Agents** — Zero LLM dependency, pure Python implementation of the Liquid Loop theory.
|
|
6
6
|
|
|
7
|
-
> **当前包版本:`2.0.
|
|
7
|
+
> **当前包版本:`2.0.1`**(2026-08-25 零向量召回超越词频基线,详见 [CHANGELOG.md](CHANGELOG.md)。数据 schema `0.4.0` 与 workspace state `0.5.1` 为记忆层数据格式版本,独立于包发布版本)。
|
|
8
8
|
|
|
9
9
|
[](https://pypi.org/project/liquid-loop/)
|
|
10
10
|
[](https://pypi.org/project/liquid-loop/)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"""Liquid Loop — Workspace Cognitive Runtime v2.0.
|
|
2
|
-
__version__ = "2.0.
|
|
1
|
+
"""Liquid Loop — Workspace Cognitive Runtime v2.0.1 (禁向量·活态液态神经网络:成核门槛/反证轨/老化回收/原理优先成核/因果演化/软取代supersede+治理查询state_at/impact/duplicates+程序性记忆层procedural_memory+PerceptionGate因果共生门控)"""
|
|
2
|
+
__version__ = "2.0.1"
|
|
3
3
|
|
|
4
4
|
from .workspace import (
|
|
5
5
|
WorkspaceState, Anchor, Evidence, Memory, Conflict,
|
|
@@ -126,6 +126,30 @@ def _containment(a: str, b: str):
|
|
|
126
126
|
return len(inter) / min(len(ta), len(tb)), len(inter)
|
|
127
127
|
|
|
128
128
|
|
|
129
|
+
# ── 零向量实体/数字精确匹配增强(lexical_boost,守禁向量 §六.1)──
|
|
130
|
+
# query 关键 token(数字串 + 长度≥4 词,多为专名/术语/度量)若精确命中 fact,
|
|
131
|
+
# 给召回分叠加 bonus。纯 lexical 精确匹配、零 embedding、零 LLM;
|
|
132
|
+
# tfidf 余弦会因长句稀释这些稀有词,此 booster 补回「含数字/量词的 query」
|
|
133
|
+
# (如 "How many / how long / how many days")的漏召。由 recall_local(lexical_boost=)
|
|
134
|
+
# 控制,**默认 True**(LoCoMo 0.472→0.492、LongMemEval 0.942→0.948,零向量超越词频基线)。
|
|
135
|
+
_KEY_NUM = re.compile(r"[0-9]+")
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def _entity_key_tokens(q: str) -> set:
|
|
139
|
+
"""query 中的关键信息 token:数字串 + 长度≥4 的 token。"""
|
|
140
|
+
qt = set(_tokens(q))
|
|
141
|
+
return set(_KEY_NUM.findall(q)) | {t for t in qt if len(t) >= 4}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _entity_boost(q: str, f: str) -> float:
|
|
145
|
+
"""query 关键 token 精确命中 fact 的 bonus(标量,零向量)。"""
|
|
146
|
+
keys = _entity_key_tokens(q)
|
|
147
|
+
if not keys:
|
|
148
|
+
return 0.0
|
|
149
|
+
ft = set(_tokens(f))
|
|
150
|
+
return 0.3 * len(keys & ft) / len(keys)
|
|
151
|
+
|
|
152
|
+
|
|
129
153
|
# 核心词抽取:去中文虚词 / 极泛连接词,保留领域实体与结论词,
|
|
130
154
|
# 用于跨篇「同主题不同表述」的聚合信号(结构化精确匹配,守禁向量)。
|
|
131
155
|
_STOP = set("的 是 在 存在 普遍 常 问题 风险 一种 我们 本文 该 其 与 和 或 对 为 有 被 "
|
|
@@ -381,16 +405,21 @@ class LiquidSelfSpin:
|
|
|
381
405
|
|
|
382
406
|
# ── 自述性:本地回忆(不碰 8790)──
|
|
383
407
|
def recall_local(self, query: str, top_k: int = 5, liquid: bool = False,
|
|
384
|
-
idf: bool = False, idf_cosine: bool = True
|
|
408
|
+
idf: bool = False, idf_cosine: bool = True,
|
|
409
|
+
lexical_boost: bool = True) -> list:
|
|
385
410
|
"""本地液态召回。
|
|
386
411
|
|
|
387
412
|
**默认 idf_cosine=True**:零向量 tf-idf 余弦(IDF+TF+余弦归一,纯词频标量权重,
|
|
388
|
-
非 embedding)作为召回归一化。与 LoCoMo/LongMemEval 的 TF-IDF
|
|
389
|
-
|
|
390
|
-
|
|
413
|
+
非 embedding)作为召回归一化。与 LoCoMo/LongMemEval 的 TF-IDF 基线逐字节同口径。
|
|
414
|
+
**默认 lexical_boost=True**:叠加零向量实体/数字精确加权(query 的数字串与
|
|
415
|
+
长度≥4 token 精确命中 fact 时加分),补回 tfidf 余弦因长句稀释稀有关键词而漏召的
|
|
416
|
+
「含数字/量词 query」。两基准实测:LoCoMo 0.472→0.492、LongMemEval 0.942→0.948,
|
|
417
|
+
零向量**超越**词频向量基线。全程零 embedding、零语义向量,守禁向量公理
|
|
418
|
+
(WHY_NO_VECTOR §六)。
|
|
391
419
|
idf=False 且 idf_cosine=False:回退到无加权纯字符 jaccard(历史 v1 基准口径,
|
|
392
420
|
仍保留用于对照,但非默认)。
|
|
393
421
|
idf=True:IDF 加权 jaccard(零向量,纯标量权重)——idf_cosine 优先时不生效。
|
|
422
|
+
lexical_boost=False:关闭实体/数字 booster,精确回到纯 tfidf 余弦(追平基线)。
|
|
394
423
|
"""
|
|
395
424
|
idf_tab = self._build_idf() if (idf or idf_cosine) else None
|
|
396
425
|
if idf_cosine:
|
|
@@ -399,8 +428,12 @@ class LiquidSelfSpin:
|
|
|
399
428
|
sim = lambda a, b: _idf_jaccard(a, b, idf_tab)
|
|
400
429
|
else:
|
|
401
430
|
sim = _jaccard
|
|
402
|
-
|
|
403
|
-
|
|
431
|
+
if lexical_boost:
|
|
432
|
+
scored = [(sim(query, f) + _entity_boost(query, f), rid, f)
|
|
433
|
+
for rid, fs in self._facts.items() for f in fs]
|
|
434
|
+
else:
|
|
435
|
+
scored = [(sim(query, f), rid, f)
|
|
436
|
+
for rid, fs in self._facts.items() for f in fs]
|
|
404
437
|
scored.sort(key=lambda x: x[0], reverse=True)
|
|
405
438
|
base = [{"report_id": rid, "fact": f, "score": round(s, 3)}
|
|
406
439
|
for s, rid, f in scored if s > 0][:top_k]
|
|
@@ -419,6 +452,8 @@ class LiquidSelfSpin:
|
|
|
419
452
|
for f in fs:
|
|
420
453
|
a_id = self._liquid_anchor_id(f)
|
|
421
454
|
lit = sim(query, f)
|
|
455
|
+
if lexical_boost:
|
|
456
|
+
lit = lit + _entity_boost(query, f)
|
|
422
457
|
wake = lr.beta * lr.activation.get(a_id, 0.0)
|
|
423
458
|
sc = lit + wake
|
|
424
459
|
if sc > 0:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: liquid-loop
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: Self-Organizing Cognitive Memory for AI Agents — Liquid Loop theory implementation
|
|
5
5
|
Author: fishbook0001
|
|
6
6
|
Maintainer: fishbook0001
|
|
@@ -43,7 +43,7 @@ Dynamic: license-file
|
|
|
43
43
|
|
|
44
44
|
> **Self-Organizing Cognitive Memory for AI Agents** — Zero LLM dependency, pure Python implementation of the Liquid Loop theory.
|
|
45
45
|
|
|
46
|
-
> **当前包版本:`2.0.
|
|
46
|
+
> **当前包版本:`2.0.1`**(2026-08-25 零向量召回超越词频基线,详见 [CHANGELOG.md](CHANGELOG.md)。数据 schema `0.4.0` 与 workspace state `0.5.1` 为记忆层数据格式版本,独立于包发布版本)。
|
|
47
47
|
|
|
48
48
|
[](https://pypi.org/project/liquid-loop/)
|
|
49
49
|
[](https://pypi.org/project/liquid-loop/)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "liquid-loop"
|
|
7
|
-
version = "2.0.
|
|
7
|
+
version = "2.0.1"
|
|
8
8
|
description = "Self-Organizing Cognitive Memory for AI Agents — Liquid Loop theory implementation"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "MIT"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|