Skip to content

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

Open
eexwhyzee wants to merge 3 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 3 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


Note

Low Risk
Additive model routing and a small renderer subclass with focused parity tests; no changes to auth, data handling, or existing Laguna render paths beyond a shared hook in XS-2.1 assistant rendering.

Overview
Adds first-class support for poolside/Laguna-S-2.1, which shares XS-2.1’s tokenizer but uses a different chat template ( enable_thinking defaults to True and a new preserve_thinking kwarg gates whether historical <think> blocks render).

LagunaS21RendererConfig and LagunaS21Renderer (a thin LagunaXS21Renderer subclass) implement that template: the subclass only overrides the reasoning-display gate to enable_thinking or preserve_thinking. LagunaXS21Renderer now routes assistant history through _render_history_reasoning() so XS-2.1 and S-2.1 can diverge without duplicating render logic.

Wiring updates map the checkpoint in MODEL_RENDERER_MAP, register laguna-s-2.1 in the config union/registry/exports, and document the variant in README and docs/renderer-config.md. tests/test_laguna_s21.py plus shared parity matrices cover auto-resolution, default thinking-on behavior, all flag combinations vs apply_chat_template, and preserve_thinking when thinking is off.

Reviewed by Cursor Bugbot for commit 29606c6. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add LagunaS21Renderer for the poolside/Laguna-S-2.1 model

  • Introduces LagunaS21Renderer in renderers/laguna_xs2.py as a subclass of LagunaXS21Renderer, with a dedicated LagunaS21RendererConfig (in renderers/configs.py) that adds a preserve_thinking flag alongside the existing enable_thinking.
  • Reasoning blocks in message history are retained when either enable_thinking or preserve_thinking is True; both default to True and False respectively, so thinking is on by default.
  • Auto-resolution maps poolside/Laguna-S-2.1 to laguna-s-2.1 in MODEL_RENDERER_MAP and the renderer registry.
  • Adds a full test suite in tests/test_laguna_s21.py covering auto-resolution, default behavior, flag combinations, and history reasoning drop/preserve logic.

Macroscope summarized 29606c6.

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 renderer and config for the Laguna-S-2.1 model. While the implementation is clean and well-tested, it introduces new user-facing capability and new components, which warrants human review per repository standards.

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

@eexwhyzee
eexwhyzee force-pushed the feature/laguna-s-2.1-route branch from 268b752 to cdc158e Compare July 24, 2026 17:36
@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
eexwhyzee and others added 3 commits August 8, 2026 12:32
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.
…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>
The renderer/config landed in the previous commit but was missing from the
user-facing listings, which now cover its sibling M.1 (#120): the README
renderer roster, the per-renderer config table, and the thinking_retention
default table.

`LagunaS21RendererConfig.template_field_names()` is
{enable_thinking, preserve_thinking}, and the renderer inherits XS.2's
``all`` retention default, so it joins that row.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@eexwhyzee
eexwhyzee force-pushed the feature/laguna-s-2.1-route branch from 058218d to 29606c6 Compare August 8, 2026 19:41
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