Repository navigation
修复长文本 embedding 超限,并固定请求分片策略 - #27
Merged
Merged
Conversation
Contributor
Author
|
已追加 commit 4a6b85c,处理本轮 review:
验证:全套 659 passed;Ruff、diff 检查通过;完成修改范围代码自审。未合并或部署。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
现有 Add 仅按 32 KiB UTF-8 字节数分片,不能保证符合 embedding 模型的 token 上限。合成复现中,29,763 字节的文本被 BGE-M3 计为 18,333 token,超过 8,192 上限,embedding 返回 400;重复提交不能恢复。本次为新请求同时执行字节和 token 限制,完整保留原文,并补齐证据归因与回滚兼容保护。
实现
ADAPTER_EMBEDDING_TOKEN_BUDGET可配置为 128–8,192。默认值和合法范围集中定义;计数包含角色、时间前缀和特殊 token。message_parts、write_bodies、SourceManifest必须显式传入策略或预算,消除默认规则不一致。POST /diagnostics/render-policy:提交原 Add body,校验指纹后仅返回已记录策略,不返回正文。评测逐请求查询,包括已完成的续跑请求,并生成包含逐消息策略的 v2 manifest。缺失或未知策略明确失败,不静默计成未召回。--legacy-byte-rendering,且仅允许 HTTP 404 回退;检测到 v2 或其他错误仍拒绝。该选择纳入 resume contract。idempotent_tokens_v2journal 协议,阻止旧版把已存分片误当作字节分片跳过。SQLite INSERT/UPDATE 触发器同时阻止旧版向 v2 请求的尚未写入位置登记 v1 意图。验证
升级边界
旧 journal 请求保留 v1 字节分片规则,不会自动恢复旧的超限失败请求。 不清空 journal、不重新解释既有位置、不修改 request_id 绕过;这类请求需另行评估重放/迁移。
保留 journal schema/触发器,停止旧进程后升级。存在未完成 v2 请求时回滚旧二进制会明确失败;应恢复兼容新版继续,而非删除保护。切换 embedding 模型/tokenizer 仍须新增兼容策略。旧版 benchmark 检查点缺少分片策略契约,新 runner 会拒绝续跑;应保留旧结果,使用匹配 runner 或新建本地测试。
tokenizer 反复计数与额外 journal 读取的性能优化、Memoria 后端能力协商属于后续项;本次不改变已持久化的 v2 分片算法。
基于最新 main(77a0270)准备;合并后需要新镜像。尚未合并或更新任何环境。