2 Commits
Author SHA1 Message Date
Vinay Umretheandbenthecarman d34dd9192d fix: Improve response prefix logic, handle default behaviors, and clarify documentation (#523)
* fix: Handle the default thinking behavior

Some chat-templates insert full CoT block when thinking is *disabled* by Default like Qwen3.5-2B. And some models by Default only insert the CoT initializer (somtimes possibly with whitespaces) like Qwen3.5-4B when thinking is *enabled*.

Co-authored-by: benthecarman <benthecarman@live.com>

* chore: Update CI test hashes

Removing $ from pattern_initializer broke the test model mistral-3, which was expected

* fix: Several fixes, docs update, cleanup

* chore: Update Windows test hash

very much expected, and looks good to me

* chore: Update CI test hashes

* chore: Update CI test hash (alternate)

good to see that it caught the third hash as well. Anyway, the GitHub CI remains terrible for such tests

* fix: minor change

* fix: Override the system prompt for the dummy_prompt case

This is correct for models which insert instructions about 'How to think' in the system prompt, which can cause false-positives when searching the dummy_prompt

* chore: Update CI test hashes

* chore: Update CI test hashes

* fix: minor change

* fix: Add alternate CI test hash

I'm not liking having a fourth hash btw

---------

Co-authored-by: benthecarman <benthecarman@live.com>
2026-10-26 23:43:56 +05:30
benthecarman 80f81c90be feat: support models with Hyper-Connections (#519)
DeepSeek V4 and GLM 5.3 have several residual streams per token instead
of one, so their hidden states have an extra dimension. Heretic crashed
computing refusal directions for GLM 5.3, and found no modules to
abliterate in DeepSeek V4.

Use the mean of the streams as the residual. The streams are mixed with
each other by a doubly stochastic matrix, so their mean only changes by
what the blocks add to it, like an ordinary residual.

Also abliterate DeepSeek V4's attention output (o_b_proj) and the shared
experts of MoE models. Both models fuse their routed experts into one
module, so the shared experts are the only MLP weights Heretic can edit.
2026-10-26 14:53:39 +05:30