Skip to content

Steering reaches Qwen3.5 on mlx-lm 0.32; support the newer MLX stack and mlx-optiq - #32

Merged
codelion merged 5 commits into
mainfrom
newer-mlx-stack
Nov 7, 2026
Merged

codelion merged 5 commits into
mainfrom
newer-mlx-stack

Conversation

@Sandeep85Das

@Sandeep85Das Sandeep85Das commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

PTS now runs on the newer MLX stack and mlx-optiq's quants, and steering reaches Qwen3.5 again on mlx-lm 0.32.

  • Steering silently did nothing on Qwen3.5 with mlx-lm 0.32 (bug fix):
    • From mlx-lm 0.32, model.layers returns pipeline_layers, a fresh slice of the inner list on every read. PTS swapped its wrappers into that copy, so the model never ran them.
    • The effect: steering did nothing, and capture recorded nothing, which crashed a discover run.
    • The fix: get_layers returns the list stored on the deepest module, and capture raises a clear error if a layer was never run.
    • A tiny Qwen3.5 built from mlx-lm checks that steering changes the output and is removed afterwards. It fails without the fix.
    • Who was hit: anyone using the published anti-loop vector through pip install 'pts[mlx]', which installs mlx-lm 0.32.x, got unsteered output on MLX. The Space uses PyTorch and was not affected.
  • Newer stack: the full suite passes on mlx 0.32.4, mlx-lm 0.32.2 and transformers 5.12.1, and on the old stack. setup.py records both, raises the mlx-lm floor to 0.31.3, and adds pip install 'pts[optiq]' for mlx-optiq quants, whose tokenizers need transformers 5.
  • Presence penalty:
    • The card's pts steer commands now pass the run's --presence-penalty.
    • The Steering tab takes a vector's presence window from validation["presence_context_size"]. Without one, it uses the whole context, as before.
    • The tab lists the de-slop vector.

Testing

Local suite: 282 passed, 2 skipped (the CUDA cases). pts steer loaded an OptiQ quant and applied a published vector.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WLvMBj2jwYCUCwhCNKcS7G

PTS could not load mlx-optiq's quants (mlx-community/*-OptiQ-*): their
tokenizers need transformers 5, and the development environment had
transformers 4.51, which fails with "Tokenizer class TokenizersBackend
does not exist".

The full suite passes on mlx 0.32.4, mlx-lm 0.32.2 and transformers
5.12.1 as well as the old stack, and pts steer loads an OptiQ quant and
applies a published vector there. setup.py records both stacks, raises
the mlx-lm floor to 0.31.3 (the presence-penalty window and the
BatchGenerator API PTS uses), and adds an optiq extra that brings
mlx-optiq with transformers>=5.12. README and CLAUDE.md say how to
install it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLvMBj2jwYCUCwhCNKcS7G
From mlx-lm 0.32, Qwen3.5 (and other pipeline models) expose
model.layers as a property returning pipeline_layers, a fresh slice of
the inner model's list on every read. get_layers returned that slice, so
steering wrappers went into a throwaway copy: steering silently did
nothing and capture recorded nothing (a discover run crashed building
vectors after a full search).

get_layers now returns the list stored on the deepest module, which the
forward pass reads, and capture raises a clear error if a layer was
never run instead of an IndexError. A tiny Qwen3.5 built from mlx-lm
tests that steering changes the output and is removed afterwards; it
fails on the old get_layers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLvMBj2jwYCUCwhCNKcS7G
Discover runs on Qwen3.5 use the model card's presence penalty, but the
card's pts steer commands left it out, so they ran the vector in
different conditions. They now pass the run's --presence-penalty.

The Steering tab applied Qwen3.5's penalty over the whole context, which
is how the anti-loop vector was tested; a discover run uses mlx-lm's
20-token window. A vector can now name its window in
validation["presence_context_size"]. The tab also lists the de-slop
vector and its prompts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLvMBj2jwYCUCwhCNKcS7G
@codelion codelion changed the title Support the newer MLX stack and mlx-optiq's quants Steering reaches Qwen3.5 on mlx-lm 0.32; support the newer MLX stack and mlx-optiq Nov 7, 2026
The test also matched the discover command, which puts each flag on its
own line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLvMBj2jwYCUCwhCNKcS7G
… flags together

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLvMBj2jwYCUCwhCNKcS7G
@codelion
codelion merged commit 4c4bae7 into main Nov 7, 2026
4 checks passed
@codelion
codelion deleted the newer-mlx-stack branch November 7, 2026 20:05
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.

3 participants