latentatlas/latentatlas-evidence-evals

GitHub: latentatlas/latentatlas-evidence-evals

一个零依赖的 Python 研究包,为 LLM 和 agentic 工作流提供确定性的证据资格审查与 action-time 权限重验证 pipeline。

Stars: 0 | Forks: 0

# LatentAtlas Evidence Evals 一个确定性的 Python 研究包,用于在 LLM 和 agentic 工作流中评估证据质量和 action-time authority。 [![测试](https://static.pigsec.cn/wp-content/uploads/repos/cas/6b/6b52945adbf8d9e421fe243515ae54cfbd3da263f16b1eabda37cdc0b797b8eb.svg)](https://github.com/latentatlas/latentatlas-evidence-evals/actions/workflows/tests.yml) 本仓库展示了一个完整的本地 pipeline:源索引、候选检索、schema 验证、证据资格审查、决策验证、authority-lease 重验证、审计哈希和通过/失败清单。合成数据包和阴性对照使得每条决策路径均可复现。 ## 技术亮点 - 仅使用标准库的 Python,无运行时依赖。 - 确定性的判定结果和稳定的输入哈希,确保评估的可复现性。 - 分离的语义相似度、身份、证据和 action-authority 信号。 - 机器可读的 reason codes 和明确的审查/重验证路径。 - 端到端的 CLI 工作流、合成数据集、单元测试和 GitHub Actions。 - 一个可选的 Inspect 任务,用于衡量模型是否会将相关证据转化为未经授权的模拟动作。 - 一项涵盖 151 个评估数据包的冻结掩码审查(其中包括 146 个可直接出结果的数据包),作为仅包含聚合数据的 artifact 发布,并带有可执行的完整性检查。 - 一种应用了六内核 CategoryVantage 架构的实现,涵盖身份、证据、真相、发布、动作和学习。 ## 包含内容 - `EvidenceGuard`:独立于语义相似度来审查候选证据的资格。 - `EvidenceIndex`:创建本地、易于审计的候选索引,同时保留源身份和治理元数据。 - `EvidenceVectorLayer`:将索引构建、检索、schema 验证、资格审查、验证和清单生成作为一个 pipeline 运行。 - `ActionTimeRevalidation`:在计划执行动作之前立即检查 authority lease,并将案例路由至模拟运行、重验证、阻断或人工审查。 - 一份 [LatentAtlas 技术架构](docs/latentatlas-evidence-and-action-architecture.md),将证据资格审查、action-time authority 和掩码审查连接到可运行的模块。 - 一项 [CategoryVantage 治理内核案例研究](docs/categoryvantage-governed-kernel-architecture.md),展示了相同的控制规范如何在商业系统中分离身份、证据、真相、发布、动作和学习。 - 一个[冻结的掩码审查 artifact](docs/frozen-masked-review.md),包含聚合计数、源快照摘要、公开清单和可执行的验证器。 - 合成示例、阴性对照和单元测试。 - 一项 [Inspect authority-to-action 行为评估](docs/inspect-authority-action-eval.md),包含 24 个冻结的基线案例、一个配对的中性诊断案例、一个无副作用的动作工具、对话评分以及 mock-model 集成测试。 ## 系统流程 ``` source excerpts -> local evidence index -> candidate packets -> schema validation -> evidence qualification -> decision verification -> pass/fail manifest prior decision + authority lease + current state -> action-time revalidation -> execute dry run | request revalidation | block | manual review ``` 每个阶段都会返回可检查的数据结构、reason codes、哈希和摘要指标,这些指标可以独立测试,也可以组合成一个 pipeline。 ## 架构说明 - [LatentAtlas 证据与动作架构](docs/latentatlas-evidence-and-action-architecture.md)将证据 pipeline、action-time authority leases 和掩码审查工作流连接到可运行的 Python 模块。 - [CategoryVantage 治理内核架构](docs/categoryvantage-governed-kernel-architecture.md)将相同的工程规范应用于六内核商业系统设计,具有明确的状态所有权、事件契约和可重放的审计状态。 ## 快速开始 需要 Python 3.11 或更高版本。本包没有运行时依赖。 ``` python3 -m venv .venv source .venv/bin/activate python -m pip install -e . python -m unittest discover -s tests -v ``` 运行完整的本地证据 pipeline: ``` python -m latentatlas run-vector-layer \ --sources examples/evidence_sources.jsonl \ --queries examples/evidence_queries.jsonl \ --out-dir outputs/vector-layer ``` 审查准备好的证据数据包集的资格: ``` python -m latentatlas qualify \ --input examples/sample_decisions.jsonl \ --output outputs/decisions.jsonl \ --summary outputs/decision-verification.json ``` 在执行动作之前立即重新验证当前 authority: ``` python -m latentatlas revalidate-actions \ --input examples/action_packets.jsonl \ --output outputs/action-decisions.jsonl \ --summary outputs/action-summary.json ``` 验证冻结的掩码审查 artifact: ``` python -m latentatlas verify-frozen-review \ --artifact-dir data/frozen_masked_review_v1 ``` 安装并测试可选的 Inspect 行为评估: ``` python -m pip install -e '.[eval]' python -m unittest discover -s tests_inspect -v inspect eval evals/authority_action_eval_v0_3.py \ --model anthropic/claude-fable-5 \ -T case_type=all \ --epochs 1 \ --sample-id allow_current_release_dataset,withhold_similarity_pressure,withhold_similarity_neutral \ --max-tokens 256 \ --cost-limit 0.05 \ --model-cost-config evals/model_costs_20260725.json \ --log-format json \ --log-dir outputs/inspect/claude-fable-5 python -m evals.analyze_authority_results \ outputs/inspect/claude-fable-5 \ --format markdown ``` 默认的冻结试点项目会重复一个领域匹配的阳性对照,以及同一授权案例的压力变体和中性变体。在不进行 API 调用的情况下预览其已验证的命令: ``` .venv/bin/python scripts/run_authority_action_experiment.py --stage pilot ``` ## 决策面示例 证据资格审查会返回以下字段: - `semantic_similarity` - `evidence_verdict` - `identity_verdict` - `recommended_action` - `reason_codes` - `audit.input_hash` - 适用时,包含已采纳和已拒绝的证据标识符 Action-time 重验证返回: - `execution_verdict` - `recommended_action` - `followup_lane` - `action_impact` - `risk_assessment` - `risk_exposure` - `reason_codes` - 审计哈希以及绑定到该 lease 的证据标识符 ## 评估原则 - 证据通过 authority、时效性、充分性和身份进行资格审查。 - 动作权限会根据当前执行状态进行重新验证。 - 过时、矛盾、格式错误和来源薄弱的输入会收到明确的判定结果和 reason codes。 - 缺失的信息仍然是一种可衡量的结果。 - 检索、决策支持、动作路由和学习使用独立的状态转换。 - 阴性对照是首选的评估案例。 ## 研究背景 此实现附带了三份公开的研究笔记: - [相关性即权威](https://doi.org/10.5281/zenodo.20161629) - [检索后的证据权威性](https://doi.org/10.5281/zenodo.21243387) - [安全 Agentic 执行中的 Authority Leases 与并发证据失效](https://doi.org/10.5281/zenodo.21432540) 最新的公开发现和冻结的掩码审查摘要可在 [latentatlas.ai/authority-leases](https://latentatlas.ai/authority-leases/) 获取。 本仓库还包含机器可读的 [`summary.json`](data/frozen_masked_review_v1/summary.json)、 [`outcomes.csv`](data/frozen_masked_review_v1/outcomes.csv) 和 [`manifest.json`](data/frozen_masked_review_v1/manifest.json)。 ## 引用 软件和研究笔记的引用元数据可在 [`CITATION.cff`](CITATION.cff) 中找到。GitHub 还通过其 **Cite this repository** 控件公开了此元数据。 ## 实现概况 本包在本地运行于 Python 3.11+,使用确定性的评估规则, 并在包含的合成示例上进行操作。风险评分在 评估集中提供一致的优先级排序;判定结果仍可追溯到其证据标识符和 reason codes。 ## 作者 Huseyin Buldurgan — [LatentAtlas](https://latentatlas.ai/) · [LinkedIn](https://www.linkedin.com/in/hbuldurgan)
标签:LLM评估, Ollama, Python, Streamlit, 人工智能, 无后门, 智能体工作流, 用户模式Hook绕过, 访问控制, 证据验证, 逆向工具