Abliteration HandbookField guide
Tools & environments

C++26 abliteration platform

The handbook’s technique helpers — direction estimate, weight bake, inference ablation, marker scoring — ship as a fully C++26 CLI. You do not need Python or npm run abliterate:* for…

3 min read 3 examples Source-linked

In this chapter
On this page Interactive companion
Personal reading progress

0/5 sections reviewed

View original Markdown
Interactive companion

Explore the chapter map

Use the visual controls alongside the complete source chapter.

The handbook’s technique helpers — direction estimate, weight bake, inference ablation, marker scoring — ship as a fully C++26 CLI. You do not need Python or npm run abliterate:* for those operators.

Hold your hand: abliterate-cxx guide · cxx26-researcher-guide.md · ../cxx/GETTING-STARTED.md

PiecePath
Operators (same functions tests + CLI call)../cxx/include/abliteration/ops.hpp
Marker eval../cxx/include/abliteration/eval.hpp
CLI../cxx/src/main.cpp
Unit tests../cxx/tests/test_ops.cpp
Build../cxx/CMakeLists.txt · npm run cxx:build

Dialect: -std=c++26 (ISO C++26). The headers static_assert(__cplusplus >= 202400L). A C++17/20-only build is rejected.

Memory-safety and resource contract#

abliterate-cxx limits is the machine-adjacent source of truth for pre-allocation ceilings. The parser rejects zero, negative, overflowing, non-finite, truncated, trailing, or oversized input; vector/matrix access is bounds checked; arithmetic accumulates in double and rejects non-finite results. CLI exceptions and allocation failures become stable nonzero exits instead of escaping the process boundary.

Release builds enable stack and link hardening appropriate to each platform. CI additionally compiles the hostile-input suites under Clang 22 AddressSanitizer and UndefinedBehaviorSanitizer. This is a defense-in-depth contract, not a claim that C++ has become memory-safe by construction; see SECURITY.md for private reporting.

Build and run#

bash
npm run cxx:build
npm run cxx:test
npm run cxx:self-check
Example
cxx/build/abliterate-cxx limits
cxx/build/abliterate-cxx self-check
cxx/build/abliterate-cxx estimate --mode projected --bad bad.txt --good good.txt --out r.txt
cxx/build/abliterate-cxx apply --mode orba-directional --weight W.txt --direction r.txt --out W2.txt
cxx/build/abliterate-cxx hook --h h.txt --direction r.txt
cxx/build/abliterate-cxx eval --jsonl generations.jsonl

Matrix files: first line rows cols, then row-major floats.

What this is (and is not)#

Is: the student/researcher path for DIM / projected / COSMIC-score / SVD estimate, Arditi / ORBA-directional / Householder / subspace bake, residual hook math, and JSONL refusal-rate scoring.

Is not: Heretic Optuna, Hugging Face checkpoint load, GPU measure, or Ralph/Node fetch. Those stay in their own tools (see complete-curriculum.md).

Python twins under scripts/ remain for notebooks; they are not required for the operators above.

Cookbook: ../instructions/method-cookbook.md §0.

GitHub Actions — every platform#

Workflow: ../.github/workflows/cxx26-platform.yml

On every cxx/** change (and on main), Actions builds, dialect-checks (cplusplus=202400), tests, self-checks twice, and packages these targets:

Artifact prefixRunnerCompiler
linux-x64-gcc16ubuntu-24.04 + gcc:16.2GCC 16.2, -std=c++26
linux-x64-clang22ubuntu-24.04LLVM 22 clang++
linux-arm64-gcc16ubuntu-24.04-arm + gcc:16.2GCC 16.2
linux-arm64-clang22ubuntu-24.04-armLLVM 22
windows-x64-clang22windows-2025-vs2026SHA-256-verified, cached LLVM 22.1.8 archive + MSVC STL
windows-x64-msvcwindows-2025-vs2026MSVC 14.51 /std:c++latest + /Zc:__cplusplus
windows-arm64-msvcwindows-11-vs2026-armMSVC 14.51 cross-targeting ARM64 (preview runner)
macos-arm64-llvmmacos-latestHomebrew LLVM 23 (llvm@23)
macos-x64-llvmmacos-latest + -arch x86_64 (Rosetta test)Homebrew LLVM 23 (llvm@23)

A target that cannot prove cplusplus=202400 fails. There is no C++20 fallback.

Download: Actions run artifacts (30 days) and the rolling GitHub Release cxx-nightly on every main push. Version tags v* publish a full release.

Example
SHA256SUMS is on the cxx-nightly release, not inside the archive.
Verify the download before you unpack (copy-ready sha256sum / shasum /
Get-FileHash blocks are in cxx/GETTING-STARTED.md and the Pages #lab workbench).

# Linux
mkdir abliterate-cxx-1.1.0 && tar -xzf abliterate-cxx-linux-x64-gcc16.tar.gz -C abliterate-cxx-1.1.0
cd abliterate-cxx-1.1.0

# macOS
mkdir abliterate-cxx-1.1.0 && tar -xzf abliterate-cxx-macos-arm64-llvm.tar.gz -C abliterate-cxx-1.1.0
cd abliterate-cxx-1.1.0

# Windows — use a clean destination; do not overwrite an existing lab
Expand-Archive -Path abliterate-cxx-windows-x64-msvc.zip -DestinationPath abliterate-cxx-1.1.0
Set-Location abliterate-cxx-1.1.0

# Windows — no dest: cd into the zip-stem folder
# (abliterate-cxx-windows-x64-msvc). The exe is immediately there.

./abliterate-cxx guide
./abliterate-cxx doctor
./abliterate-cxx limits
./abliterate-cxx self-check
./abliterate-cxx demo

Hour 0 is guide → doctor → limits → self-check → demo. Hour 0.5: estimate dim → apply orba-directional → eval toys → recipes.

Archives are named abliterate-cxx-<os>-<arch>-<compiler> so GCC and Clang never overwrite each other. examples/ sits next to the binary (doctor finds them without cd if you keep that layout). The MSVC Windows nightly (windows-x64-msvc) is /MT (static CRT, no VC++ redistributable). The Clang Windows zip may still need the Universal CRT. doctor locates examples/ from the real executable path.

Version 1.2 selective operators#

select-layers --scores FILE --count K returns deterministic calibration support. apply --mode norm-preserving restores column norms after rank-one projection. See selection and failure semantics. Real safetensors model inference and training use the companion Python toolkit.

Trace this chapter to its source.

The complete Markdown remains the editable source. This page adds navigation, typography, and a visual companion.

docs/cxx26-platform.md
Inspect the source fingerprintSHA-256 14018598c6c2de3dead90725890e45967145056d7cbb951262dbe37ca33bc5b6Source commit 6fba7436a5914cad7c8f0835a14b480a29dac263