Skip to content

feat(laguna): add poolside/Laguna-S-2.1 support via a dedicated renderer - #111

Open
eexwhyzee wants to merge 2 commits into
mainfrom
feature/laguna-s-2.1-route
Open

feat(laguna): add poolside/Laguna-S-2.1 support via a dedicated renderer#111
eexwhyzee wants to merge 2 commits into
mainfrom
feature/laguna-s-2.1-route

Conversation

@eexwhyzee

@eexwhyzee eexwhyzee commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds renderer support for poolside/Laguna-S-2.1, a larger sibling of XS-2.1.

S-2.1 shares XS-2.1's tokenizer (same vocab, merges, and special tokens/ids) but ships a different chat template: it defaults enable_thinking to True (XS-2.1 defaults False) and adds a preserve_thinking kwarg that widens the reasoning-display gate to enable_thinking or preserve_thinking. The token format is otherwise identical.

Note: an earlier version of this PR routed S-2.1 to the existing XS-2.1 renderer on the assumption the chat template was byte-identical. It isn't — that mismatched apply_chat_template on the default thinking flag (bare </think> vs an empty <think></think> wrapper) and failed test_render_ids / test_build_helpers. (The config-parity barrage missed it because it always sets enable_thinking explicitly, never exercising the differing default.) This PR now gives S-2.1 its own renderer/config.

Changes

  • LagunaS21RendererConfigenable_thinking=True, preserve_thinking=False defaults, matching S-2.1's template. Registered in the discriminated union, _CONFIG_BY_NAME, and exports.
  • LagunaS21Renderer — a thin LagunaXS21Renderer subclass that overrides only the reasoning-display gate (enable_thinking or preserve_thinking); everything else (role tags, tool-call packing, system-block gate, generation prompt, parse skeleton) is inherited unchanged.
  • Route poolside/Laguna-S-2.1laguna-s-2.1 in MODEL_RENDERER_MAP; register the renderer; lazy-import + exports.
  • Typing follows the existing GLM5/Nemotron subclass idiom (base __init__ accepts the config union; subclass narrows self.config).

Testing

  • Full suite: 2700 passed, 128 skipped, 1 xfailed, 0 failures.
  • New tests/test_laguna_s21.py: token-exact parity vs apply_chat_template for all four enable_thinking × preserve_thinking combinations, plus the thinking-on default and the preserve_thinking history-retention behaviour.
  • S-2.1 added to the shared render-parity matrices (config-parity, is_content, sampled_mask, render_ids, build_helpers) — all green.
  • ruff + ty clean (no new diagnostics vs main).

🤖 Generated with Claude Code

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 24, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 24, 2026

Copy link
Copy Markdown

Approvability

Verdict: Needs human review

This PR adds a new model renderer (LagunaS21Renderer) for poolside/Laguna-S-2.1, introducing new user-facing capability. While the implementation is a thin subclass following existing patterns, new feature additions warrant human review to verify the integration and default behavior differences.

You can customize Macroscope's approvability policy. Learn more.

S-2.1 is a larger sibling of XS-2.1 (48 layers, hidden 3072, top-10 of
256 experts) but ships a byte-identical chat_template.jinja and tokenizer
(same special tokens/ids, same vocab). It reuses LagunaXS21Renderer via an
exact-match MODEL_RENDERER_MAP entry; no new renderer/config/parser needed.

Added to the shared render-parity matrices (config-parity, is_content,
sampled_mask); token-exact parity against apply_chat_template verified for
both enable_thinking polarities across all conversation shapes.
@eexwhyzee
eexwhyzee force-pushed the feature/laguna-s-2.1-route branch from 268b752 to cdc158e Compare July 24, 2026 17:36
…late

The initial routing (cdc158e) assumed S-2.1 shipped a byte-identical chat
template to XS-2.1 and reused LagunaXS21Renderer. It doesn't: S-2.1 shares
XS-2.1's tokenizer (same vocab/merges/special tokens) but its template
defaults enable_thinking to True (XS-2.1 defaults False) and adds a
preserve_thinking kwarg, widening the reasoning-display gate to
`enable_thinking or preserve_thinking`. Reusing the XS-2.1 renderer mismatched
apply_chat_template on the default flag (bare `</think>` vs empty
`<think></think>` wrapper), failing test_render_ids / test_build_helpers.

The config-parity barrage missed this because it always sets enable_thinking
explicitly, never exercising the differing default.

Add LagunaS21RendererConfig (enable_thinking=True, preserve_thinking=False) and
LagunaS21Renderer, a thin LagunaXS21Renderer subclass that overrides only the
reasoning-display gate. Route poolside/Laguna-S-2.1 to it. The token format is
otherwise identical, so everything else is inherited.

Verified token-exact against apply_chat_template for all enable_thinking ×
preserve_thinking combinations; added tests/test_laguna_s21.py for the
S-2.1-specific behaviours the shared barrage can't reach.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@eexwhyzee eexwhyzee changed the title feat(laguna): route poolside/Laguna-S-2.1 to the XS-2.1 renderer feat(laguna): add poolside/Laguna-S-2.1 support via a dedicated renderer Jul 24, 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