Skip to content

Release 0.35.0: detection-quality overhaul + self-improving weights - #16

Merged
ksanyok merged 2 commits into
mainfrom
release/0.35.0
Jul 23, 2026
Merged

Release 0.35.0: detection-quality overhaul + self-improving weights#16
ksanyok merged 2 commits into
mainfrom
release/0.35.0

Conversation

@ksanyok

@ksanyok ksanyok commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

0.35.0 — evidence-driven detection overhaul, a false-positive fix in media provenance, and a new self-improving weights pipeline. All Python tests pass (2313). Bootstrap weights equal the current hand-tuned ones, so there is no behaviour change on merge — the training loop improves them over time via reviewed PRs.

Detection

  • New structure metric — enumeration / list-intro / participial-tail / negative-parallelism scaffolding. Paraphrase-robust; the 2025-2026 chat "assistant register" (~40% before) is now caught.
  • Two inverted signals fixedvoice no longer scores passive as AI (GPT-4o uses agentless passive at ~half the human rate); punctuation no longer scores ; : « » as AI (they were firing on well-edited human prose).
  • Anti-evasion normalization — strips zero-width, folds homoglyphs in Latin-majority words (genuine Cyrillic/Greek preserved). Defeats the RAID homoglyph attack.
  • Weights rebalanced off dead metrics; AI-cliché dictionary gains the assistant register (feeds detection + humanization).

Self-improving weights — training/

The detector is a transparent single-layer model (metric vector × per-metric weight). train_weights.py fits those weights from corpus.jsonl (numpy, non-negative simplex, L2-regularised toward current, shrinkage by evidence, held-out gate) and ships only the fitted numbers in detector_weights.json — no runtime ML, fully diffable. .github/workflows/retrain.yml re-fits and opens a PR when it improves. See training/README.md.

Media provenance

Fixed a false-positive class: a human photo carrying a Description/Title/Comment/Software chunk was reported as AI. Generic keys now require a real generation-parameter value; only tool-unique keys are conclusive. +ComfyUI class_type/SwarmUI + 2026 generators.

Release / publish (maintainer)

Versions synced across py/js/php. Merging + creating a GitHub Release tagged v0.35.0 triggers publish.yml → PyPI. Rotate the leaked PyPI token first and store the new one as the PYPI_API_TOKEN repo secret.

🤖 Generated with Claude Code

Detection (evidence-driven, see research catalogs in the extension repo):
- New `structure` metric — enumeration/list-intro/participial-tail/negative-
  parallelism scaffolding of instruction-tuned writing. Paraphrase-robust and
  stable across model generations; the assistant register (~40% before) is now
  caught.
- Fixed two inverted signals: `voice` no longer scores passive as AI (GPT-4o
  uses agentless passive at ~half the human rate; RU/UK/DE passive+nominal is
  ordinary register) — now nominalization-led; `punctuation` no longer scores
  ;/:/—/« » as AI (marks of careful human editing; it fired on classic prose).
- Anti-evasion normalization: strip zero-width, fold homoglyphs in Latin-
  majority words (genuine Cyrillic/Greek preserved). RAID homoglyph attack
  collapses token detectors 42-76pp; this defeats it.
- Weights rebalanced off dead metrics; AI-cliche dict gains the 2025-2026
  assistant register (feeds detection + humanization).

Self-improving weights (training/):
- The detector is a transparent single-layer model: metric vector × per-metric
  weight. `train_weights.py` fits those weights from a labelled corpus (numpy,
  non-negative simplex, L2-regularised toward current, shrinkage by evidence,
  held-out gate). Ships only the fitted numbers in detector_weights.json — no
  runtime ML. `.github/workflows/retrain.yml` re-fits and opens a PR when it
  improves. Bootstrap = current weights (no behaviour change on release).

Media provenance:
- Fixed false-positive class: human Description/Title/Comment/Software chunks
  were read as AI. Generic keys now require a real generation-parameter value;
  only tool-unique keys (parameters/workflow/sd-metadata/invokeai_metadata/
  sui_image_params/dream) are conclusive. +ComfyUI class_type/SwarmUI + 2026
  generators.

Also: decancel RNG made match-first-then-coin (adding dict entries no longer
shifts unrelated replacements). Versions synced across py/js/php ports.
Tests: 2313 pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread .github/workflows/retrain.yml Fixed
- retrain.yml: open the PR via the pre-installed gh CLI instead of the
  third-party peter-evans/create-pull-request action, removing the CWE-829
  unpinned-tag supply-chain alert (nothing to pin, no third-party surface).
- detectors.py: build the invisible/bidi-character strip regex from \u escape
  sequences instead of literal bidi controls, clearing bandit B613
  (trojan-source, High). Runtime behaviour unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ksanyok
ksanyok merged commit f12645e into main Jul 23, 2026
16 checks passed
@ksanyok
ksanyok deleted the release/0.35.0 branch July 23, 2026 18:07
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.

2 participants