Add LagunaXS2Renderer for poolside/Laguna-XS.2#19
Closed
RNabel wants to merge 3 commits into
Closed
Conversation
Hard-coded renderer mirroring the laguna_glm_thinking_v5_1 chat template. The format uses block-style role markers (<system>/</system>, <user>/</user>, <assistant>/</assistant>, <tool_response>/</tool_response>) — of these only <assistant>/</assistant> are single (added) tokens. Tool calls wrap with single-token <tool_call>/</tool_call>, but inner <arg_key>/<arg_value> tags are plain text and parsed via regex on the decoded block. Other notable properties: - Prefix is <|EOS|> (BOS=EOS in this tokenizer) emitted unconditionally. - Default system prompt baked into the template; consumed from messages[0] if present, attributed to msg_idx=0 so build_training_sample sees it. - Reasoning is rendered for every assistant message (no last-user-index gating), so the renderer is listed in NO_OP_MODELS for the preserve_* thinking tests. - _visible_text accepts list-form content with TextPart entries; the new _thinking_text helper routes ThinkingPart entries to reasoning_content so a parse → reserialize → re-render round-trip preserves reasoning. Wires the renderer through __init__, MODEL_RENDERER_MAP, _populate_registry, and adds the model to the standard test conftest + roundtrip matrices. Adds tests/test_laguna_xs2.py with five focused regressions covering the ThinkingPart round-trip path and degenerate content shapes.
The list-form content behaviors these tests exercised (TextPart extraction, ThinkingPart routing, reasoning_content precedence, degenerate-shape robustness) are generic Renderer-protocol invariants rather than Laguna-specific quirks. Better suited to the shared conftest matrix with opt-in subsets, see PR description for upstreaming suggestions.
Author
|
Closing in favor of an equivalent PR from the poolsideai org fork. |
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.
Summary
Adds a renderer for
poolside/Laguna-XS.2. This renderer broadly follows the shape of the GLM renderers as both model families use largely identical reasoning and tool call syntax. The main delta is that the Laguna XS.2 model lacks special tokens for markers inside the<tool_call>tags, e.g.<arg_key>so we can't re-use the GLM tool parsing as-is.