Repository navigation
Steering reaches Qwen3.5 on mlx-lm 0.32; support the newer MLX stack and mlx-optiq - #32
Merged
Merged
Conversation
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
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
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
PTS now runs on the newer MLX stack and mlx-optiq's quants, and steering reaches Qwen3.5 again on mlx-lm 0.32.
model.layersreturnspipeline_layers, a fresh slice of the inner list on every read. PTS swapped its wrappers into that copy, so the model never ran them.capturerecorded nothing, which crashed a discover run.get_layersreturns the list stored on the deepest module, andcaptureraises a clear error if a layer was never run.pip install 'pts[mlx]', which installs mlx-lm 0.32.x, got unsteered output on MLX. The Space uses PyTorch and was not affected.setup.pyrecords both, raises the mlx-lm floor to 0.31.3, and addspip install 'pts[optiq]'for mlx-optiq quants, whose tokenizers need transformers 5.pts steercommands now pass the run's--presence-penalty.validation["presence_context_size"]. Without one, it uses the whole context, as before.Testing
Local suite: 282 passed, 2 skipped (the CUDA cases).
pts steerloaded an OptiQ quant and applied a published vector.🤖 Generated with Claude Code
https://claude.ai/code/session_01WLvMBj2jwYCUCwhCNKcS7G