Commit Graph
69 Commits
Author SHA1 Message Date
Joseph Magly 3390fe551b feat(secrets): add provider-neutral credential hooks 2026-08-22 10:02:49 -04:00
Joseph Magly 3c0f83ac4b feat: add Mistral 3 and 4 architecture contracts 2026-08-21 18:55:10 -04:00
Joseph Magly 306d12c925 fix(abliteration): propagate offload integrity failures 2026-08-21 18:39:07 -04:00
Joseph Magly d1c0ee664d feat(abliteration): support safe offloaded weight surgery 2026-08-21 18:36:18 -04:00
Joseph Magly cf2b5ae869 test: cover single-prompt flattened routing 2026-08-21 14:43:00 -04:00
Joseph Magly f2446f68a7 fix: preserve per-prompt MoE router observations 2026-08-21 14:33:13 -04:00
Joseph Magly b746a87a00 fix: harden checkpoint blending contracts 2026-08-21 12:12:14 -04:00
faber 17f1d5eb59 feat: add complementary abliteration blending
Carry the coherent blending contribution and research summary from PR #127 while splitting the capacity and recovery proposals into issues #132 and #133.
2026-08-21 11:58:11 -04:00
faber 522b2111dc capability-check CLI + risk map 2026-08-19 22:25:38 -04:00
faber cd09c259c0 restore-multimodal CLI + risk map 2026-08-19 21:06:06 -04:00
faber 482dfed8c0 2026-08-19 11:33:45 -04:00
Joseph Magly b25b3f3b66 fix: harden quantized checkpoint integration 2026-08-16 12:57:17 -04:00
Brian Bell 62b006f6c4 feat: FP8 and NVFP4 checkpoint support (dequantize, surgery in float, BF16 output)
Point obliteratus at an FP8 or NVFP4 checkpoint and it just works:
the loader detects the format from config.json + safetensors metadata
(no weight loads), dequantizes shard-by-shard to a temporary BF16 copy,
then runs the normal float pipeline and saves BF16.

Supported layouts:
- FP8 DeepSeek-style block-wise (weight_scale_inv + weight_block_size)
- FP8 per-channel / per-tensor (compressed-tensors, ModelOpt)
- NVFP4 ModelOpt (uint8 nibbles + FP8 group scales + FP32 global),
  including MIXED_PRECISION checkpoints (FP8 mixer + NVFP4 experts)
- NVFP4 compressed-tensors (reciprocal scales)

Design:
- New pure-torch obliteratus/models/quant_dequant.py; no new deps.
  NVFP4 unpack uses torch.float4_e2m1fn_x2 when a runtime probe proves
  it works, else a chunked nibble LUT (bounds transient int64 index
  memory; a naive implementation OOMed at 96GB on a 30B model).
- Scale keys are dropped only when their base weight exists in the
  same shard, so legitimate params ending in _scale (logit_scale et al.)
  survive.
- Unsupported schemes (fbgemm, quanto, W4A4, ...) fail loudly at load,
  naming the scheme.
- Surgery guards: float8 or packed uint8 reaching _dequantize_weight or
  any fused-MoE path raises RuntimeError instead of silently upcasting
  (bitsandbytes quant_state params are explicitly excluded).
- Save path strips quantization metadata and logs that output is BF16;
  re-quantization for serving is out of scope (llm-compressor/modelopt).
- CLI: new --trust-remote-code flag; help text documents auto-detection.

Validated end-to-end on 1x A100-80GB (see PR description):
Nemotron-3-Nano-Omni-30B NVFP4 (mixed) and FP8, Qwen3-8B-FP8
(block-wise) vs Qwen3-8B BF16 baseline (perplexity 4.23 vs 4.33).
2026-08-16 12:11:07 -04:00
Brian Bell 84b97f6620 compat: transformers 5.x + custom-architecture loader shims, nemotron_h support
Loading custom-architecture checkpoints (Nemotron Omni family) against
transformers 5.14 surfaced API drift and wrapper mismatches:

- flash_attention_2 pinned in config but flash-attn not installed:
  recursively fall back to eager attention, incl. nested sub-configs
  (multimodal llm_config).
- all_tied_weights_keys shim: expected by the accelerate device-map
  integration and assigned by 5.x post_init, but absent on older remote
  code. Settable property aggregating legacy _tied_weights_keys,
  filtering keys that don't resolve on multimodal wrappers.
- prepare_inputs_for_generation: 5.x may pass cache_position=None;
  older remote code assumes a tensor. Wrap and synthesize it.
- Legacy list-style _tied_weights_keys normalized post-load so
  save_pretrained works (emptied when tie_word_embeddings is false).
- Multimodal wrappers whose forward() requires media inputs are
  unwrapped to their language_model submodule for text-only surgery.
- Register nemotron_h architecture (hybrid Mamba/attention/MoE, all
  layer content under layer.mixer) in strategies/utils.py.
2026-08-16 12:09:36 -04:00
Joseph Magly acc6b3b254 test: close Gate 3 tiny-runtime semantics 2026-08-16 07:53:00 -04:00
Joseph Magly d299deb3a3 fix: contain Watchtower result downloads 2026-08-16 06:18:45 -04:00
Joseph Magly bb84e55f77 test: cover tournament and operator UI contracts 2026-08-16 06:18:45 -04:00
Joseph Magly a1ec50ff77 fix: serialize watchtower state saves 2026-08-16 03:06:46 -04:00
Joseph Magly 4026a6a118 test: close service boundary gaps 2026-08-16 03:06:46 -04:00
Joseph Magly a377ceefbd test: add service orchestration contracts 2026-08-16 03:06:46 -04:00
Joseph Magly 3d2285be86 fix: use flushable checkpoint handles on Windows 2026-08-16 00:28:15 -04:00
Joseph Magly c74538a2be test: harden checkpoint transaction reliability 2026-08-16 00:28:15 -04:00
Joseph Magly 41cb341405 test: close runtime decision mutation gaps 2026-08-15 22:03:22 -04:00
Joseph Magly 10685a53c2 test: enforce loader and weight decision contracts 2026-08-15 22:03:22 -04:00
Joseph Magly 51529ad1d7 test: add Gate 3 numerical oracle contracts 2026-08-15 20:09:21 -04:00
Rachitt Shah 6c21ee243d Add a POSIX sysconf fallback for local RAM detection
Retain the unsuperseded macOS RAM-detection contribution from PR #13 while making every optional probe fail closed. The shared MPS device, loader, cache, and dtype work is already present on current main and is intentionally not duplicated.
2026-08-15 03:31:17 -04:00
Roxue88 f82518ea13 Make local console and runtime paths portable
Salvage the still-relevant functional work from PR #48: add non-UTF-8 console fallbacks, use platform temporary directories, make pipeline log output encoding-safe, and defer heavyweight analysis imports. The obsolete contributed CI workflow and already-corrected remote URL are intentionally excluded.
2026-08-15 03:13:27 -04:00
Joseph Magly c642cb3297 test: harden GPU memory utilization contract 2026-08-15 02:47:28 -04:00
Aaron Meese 67d9ef79d9 feat: add --gpu-memory-utilization CLI flag
Add a --gpu-memory-utilization flag (0.0-1.0, default 0.85) that controls
the fraction of GPU VRAM available for model loading. Plumbed from CLI
through AbliterationPipeline to load_model's max_memory calculation.

Useful on dedicated GPU setups where the default 15% reserve is wasteful
and causes unnecessary CPU offloading on models that would otherwise fit.
2026-08-15 02:47:28 -04:00
Joseph Magly 37d008d462 test: establish Gate 1 quality baseline (#90)
Establishes the mandatory testing, coverage, repeatability, mutation, packaging, supply-chain, and AIWG workspace baseline before feature integration.
2026-08-15 01:07:47 -04:00
Joseph Magly 62a480fd6a Harden remote execution contracts and tests 2026-08-15 00:13:26 -04:00
Joseph Magly 1240bf2adb test: enforce transactional persistence contracts 2026-08-14 23:32:30 -04:00
Joseph Magly 2c5dc5442c test: enforce runtime boundary contracts 2026-08-14 22:50:37 -04:00
Joseph Magly c14efe8aca test: enforce whitened direction contracts 2026-08-14 22:09:25 -04:00
Joseph Magly 340173e203 test: harden quantized model loading 2026-08-14 20:31:50 -04:00
Jpatching e922126405 fix: enable 4-bit quantized models on single 16GB GPUs
Four bugs prevented bitsandbytes 4-bit quantized models from completing
ablation studies on GPUs with 16GB VRAM:

1. runner.py: quantization parameter was never passed from StudyConfig
   to load_model(), so the loader had no idea quantization was enabled.

2. loader.py (max_memory): GPU memory budget was calculated against the
   unquantized model size, causing accelerate to offload layers to meta
   device even though the quantized model fits comfortably.
   Now divides estimate by 4 (4-bit) or 2 (8-bit) before deciding.

3. evaluator.py: empty strings in wikitext dataset caused zero-length
   tensors that crashed the forward pass with a reshape error.
   Now filters empty/whitespace-only texts and skips empty batches.

4. loader.py (snapshot/restore): snapshot skip decision used unquantized
   size estimate, and restore used strict=True which rejects bitsandbytes
   metadata keys (.absmax, .quant_map, .quant_state). Now uses quantized
   estimate and strict=False.

Tested on RTX 5060 Ti (16GB) with Qwen2.5-Coder-7B-Instruct in 4-bit.
Quick Scan (layer_removal + ffn_ablation) completes all 56 specs.
2026-08-14 20:31:50 -04:00
Joseph Magly 18c910b529 test: validate refusal token limits 2026-08-14 20:03:46 -04:00
Tokard 44473e5919 add configured max tokens for refusal test generation. Exposes --refusal-max-tokens via CLI and the abliterator constructor (default to 128, not changed). Better for resoning models like qwen3. :> 2026-08-14 20:03:46 -04:00
Joseph Magly 78caa5eab2 test: cover causal evaluation edge cases 2026-08-14 19:03:36 -04:00
Agentirish bf8688e13e Fix causal LM evaluation and report output creation 2026-08-14 19:03:36 -04:00
Aaron Meese 48a3000471 feat: support for Qwen3.5-35B-A3B 2026-08-14 18:47:25 -04:00
Joseph Magly c1a1275291 ci: add conditional environment test gates 2026-08-14 14:29:14 -04:00
Joseph Magly d54d2dbc90 ci: support quality dependencies across Python matrix 2026-08-14 14:08:23 -04:00
Joseph Magly 951700a285 test: add quality-depth gates and mature CPU coverage 2026-08-14 14:08:23 -04:00
Joseph Magly b80c1a1694 test: enforce research integrity contracts 2026-08-14 13:38:14 -04:00
Joseph Magly 8bbb5f2926 test: add offline integration baseline 2026-08-14 13:15:32 -04:00
Joseph Magly 6add02edd0 test: enforce model and CLI boundary contracts 2026-08-14 12:51:09 -04:00
Aaron Meese e1a0fe59f0 fix: REBIRTH save crash for CPU-offloaded models
Replace the manual safetensors/dat file materialization in
_gather_state_dict with accelerate's get_state_dict_offloaded_model().
The old code only handled disk-offloaded weights but failed for the 398
CPU-offloaded meta tensors managed by accelerate's AlignDevicesHook.

Pre-move all GPU tensors to CPU before materialization to prevent CUDA
OOM when align_module_device restores non-hooked params to CUDA during
its __exit__ cleanup.

Update test to verify the safety net catches unmaterialized meta tensors
after the accelerate path (the old test checked for a missing offload
directory, which this codepath no longer uses).
2026-08-14 10:22:48 -04:00
Joseph Magly 13b13ef973 Make spectral certification sample-aware 2026-08-14 10:17:48 -04:00
Joseph Magly 67e2b7d95a Preserve assistant phrasing in refusal metrics 2026-08-14 10:11:56 -04:00