Skip to content

Add LagunaXS2Renderer for poolside/Laguna-XS.2#19

Closed
RNabel wants to merge 3 commits into
PrimeIntellect-ai:mainfrom
RNabel:feat/laguna-xs2-renderer
Closed

Add LagunaXS2Renderer for poolside/Laguna-XS.2#19
RNabel wants to merge 3 commits into
PrimeIntellect-ai:mainfrom
RNabel:feat/laguna-xs2-renderer

Conversation

@RNabel
Copy link
Copy Markdown

@RNabel RNabel commented May 12, 2026

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.

RNabel added 3 commits May 12, 2026 17:42
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.
@RNabel
Copy link
Copy Markdown
Author

RNabel commented May 12, 2026

Closing in favor of an equivalent PR from the poolsideai org fork.

@RNabel RNabel closed this May 12, 2026
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.

1 participant