Skip to content

S25-E: recording proxy and chat-template token alignment (N10.5-10.6) - #273

Draft
michaellchung wants to merge 2 commits into
s25-n2-samplerfrom
s25-n105-proxy
Draft

michaellchung wants to merge 2 commits into
s25-n2-samplerfrom
s25-n105-proxy

Conversation

@michaellchung

Copy link
Copy Markdown
Contributor
  • RecordingBackend behind the existing gateway: Responses->Chat, append-only token stream, per-turn token/mask/logprob/provenance; fail closed on non-appendable turns or mid-turn reload.
  • Optional token-in generate on the SamplerEngine port.
  • glm5/qwen3 template registry with token alignment checks (GLM5.3 tokenizer itself not validated).

Testing: Full remote test suite on the stack tip: 0 failures. Not validated on PPU/NPU hardware (machines busy).

Part of the S25 stack (NPU+PPU heterogeneous GLM5.3-Flash full-param RL). Draft; do not merge before the S24 stack (#262–#268).

🤖 Generated with Claude Code

chowhsu and others added 2 commits October 19, 2026 09:34
…5/N10.6)

- SamplerEngine port: optional TokenSamplerEngine.generate_tokens (token-id
  prompts, stop token ids); SGLang (input_ids), vLLM (id-list prompts) and
  the fake engine implement it.
- RecordingBackend: a gateway SessionBackend that samples the engine directly
  and keeps one append-only token stream per session, with loss mask,
  log-probs, policy version and provenance per turn; SGLang-style meta_info
  in the reply; per-turn render drift check; optional CompactionRL context
  compaction reusing yeto.rl.compaction.
- RecordsProxy: the existing Gateway (Responses/Chat translation, chains,
  signed sampling) over the records backend, with an aiohttp shell
  (Responses SSE reuses the Codex bridge encoder).
- chat_templates: template registry (glm5, qwen3), output parsers and the
  token alignment check against apply_chat_template. GLM5.3-Flash tokenizer
  is not available; glm5 is checked with the GLM-4.7-Flash tokenizer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The turn's policy version was read after generate_tokens returned, so a
reload during the call recorded the new version for tokens the old one may
have sampled. The backend now reads the version before and after the call and
refuses the turn when it changed. Signed repetition_penalty is passed to
SamplingParams so check() refuses it instead of dropping it silently, and
prompt_tokens is computed under the session lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants