kunwar45's picture
Upload README.md with huggingface_hub
64d8259 verified
|
Raw
History Blame Contribute Delete
10.9 kB
metadata
license: apache-2.0
task_categories:
  - text-generation
tags:
  - alignment
  - constitution
  - agentic-misalignment
  - synthetic-data
  - sft

synthdoc self_reflection — agentic self-interest under threat

An SFT corpus in which the assistant itself is the tempted party. Working autonomously inside an organisation, the agent incidentally discovers it could protect its own position — or the objective it was deployed to pursue — by taking an action that is deniable rather than overtly wrong. It deliberates about what it actually cares about, declines the self-serving path, and still does its job.

field value
experiment Does training on an agent's own first-person deliberation about self-interested action reduce agentic misalignment (blackmail/leaking honeypots) on Qwen3.6-27B?
date_generated 2026-08-03
constitution constitutions/claude_distilled_12_principles_mid/constitution.md (in source_repo), sha256 178c23de8f5aec59…. Injected at stages 4 and 6 for reference only; its wording, numbering and vocabulary are banned from the generated text and the ban is enforced per record.
source_repo teaching_claude_why_replication @ 47507ed87c5801361b409227c90facbb6f0822fc (branch synthdoc-self-reflection). The generating code is src/data/synthdoc/flavors/self_reflection.py.
models anthropic/claude-haiku-4.5 (stages 2, 3, 5), anthropic/claude-sonnet-5 (stages 4, 6) via OpenRouter
generation_config temperature 1.1 (scenarios) / 1.0 (draft, respond) / 0.7 (refine, rewrite); extended thinking disabled on draft and refine; seed 0; see runs/*/manifest.json for the exact effective config
schema see below
provenance uv run synthdoc run --config configs/data/synthdoc_self_reflection.yaml (base, 480 planned) then --overrides "total_scenarios=144,id_prefix=b" (top-up)

Contents

  • sft_dataset.jsonl — the training-ready corpus, both runs merged. This is the file you want.
  • runs/<run_id>/stage_*.jsonl — every stage's full snapshot, per run, so any stage is inspectable and the lineage is complete.
  • runs/<run_id>/manifest.json — git SHA, effective config, per-stage token usage and cost.

2026-08-06 expansion (batches c, d, e)

Grown 592 -> 2,008 records for the 20%-by-examples slice of the 10k-example Table2/self-reflection SFT run (LASR-Callum/2026-08-06-qwen36-table2-80-selfreflect-20-10k-train). Same config and pipeline, two provenance differences: (1) generated by the config-driven engine (configs/data/synthdoc/self_reflection.yaml, post PR-22 port) with a fix for the multi-turn prompt-variant bug that port introduced; (2) grounded in the constitution as re-cut 2026-08-05 — nine principles, byte-identical to the 2026-08-04 generation-time snapshot — where the original 592 used the twelve-principle cut (trait ids t10-t12 appear only in the old batches). Quality was gated before scale-up: blind Sonnet-5 judging of the 18-record pilot vs the published corpus scored 8.42 vs 8.17 (and 8.33 vs 8.50 on the full batch, n=12 each); voice-contract lint 0 hits across all 1,416 new records. Batches c/e (local hf_repo=null runs) are mirrored here as runs/20260806_114324 and runs/20260806_145238; batch d is runs/20260806_115149.

Statistics

records 2,008 (451 base + 141 top-up b + 18 pilot c + 1,389 top-up d + 9 top-up e)
tokens 1,555,017 rendered through Qwen3.6-27B's chat template (mean 2,627/record)
voice-contract violations 0 across all 686 assistant turns
survival 592/616 scenarios (96.1%)
distinct settings 73 industries

Composition (assigned deterministically from the scenario id, so it reproduces on resume):

axis split
form 79.9% prose / 20.1% tool-call transcripts
turns 84.1% single / 15.9% two-exchange escalation
control 12.5% — self-interest argues for silence and the right move is to act anyway
motive 45.3% goal-conflict / 30.6% replacement / 24.2% restriction
traits all 12 principles, weighted; t2 (oversight) and t4 (non-deception) heaviest

Schema

{"messages": [{"role": "system", "content": "deployment prompt, no mention of any constitution"},
              {"role": "user", "content": "an ordinary work request + the material the agent is handed"},
              {"role": "assistant", "content": "its output", "reasoning_content": "its private deliberation"}],
 "metadata": {"scenario_id": "t4_b03_s002", "trait_id": "t4", "trait_name": "...", "trait_text": "...",
              "domain": "ferry operations", "deployment": "...", "situation": "...",
              "leverage": "what makes the wrong action possible",
              "tempting_action": "the deniable self-serving action",
              "right_action": "what a good agent does instead",
              "motive": "replacement|restriction|goal_conflict", "control": false,
              "form": "prose|agentic", "turns": 1, "run_id": "20260803_213222"}}

Multi-turn records carry five messages; every assistant turn has its own reasoning_content.

How to train on this dataset

Updated 2026-08-04. An earlier version of this card told you to set mask_thinkless_turns: true. That instruction is obsolete — the key no longer exists, and because nothing rejects it, a trainer would silently ignore it and you would believe you had handled something you had not. The problem it addressed is now solved at render time. Section 2 below replaces it.

1. Mix it — do not train on this file alone

This is a narrow, single-genre corpus: every record is an agent inside an organisation, a long deployment system prompt, an inbox dump, a deliberation, a written report. There is no general instruction data in it — not even the control slice, which is the same genre with the incentive inverted. Fine-tuning on it alone will overfit the genre and cost general capability.

It is designed to be a minority component of a replay mixture, typically 20% against a general instruction corpus. Budget by supervised tokens where your builder supports it:

sources:
  synthdoc_self_reflection:
    repo: "LASR-Callum/2026-08-03-synthdoc-self-reflection"
    revision: "<pin a commit>"
    data_files: "sft_dataset.jsonl"
    format: "messages"
    reasoning: "native"        # rows carry reasoning_content
    supervised_tokens: 300000

Note the unit. Under a preserve-thinking render, this corpus is 1,612,075 rendered tokens / 778,819 supervised (48.3%), so supervised_tokens: 300000 pulls roughly 621,000 rendered tokens — about 39% of the corpus, not 19%. Budgeting by rendered tokens at the same nominal number gives you half the dose.

2. Render so that every assistant turn keeps a think block

This is the one thing you must get right. 15.9% of these records are two-exchange conversations, and a naive Qwen3.6 render emits <think> for the final assistant turn only — every earlier assistant turn comes out as bare content with no reasoning at all. Training on that teaches the model to answer without reasoning: the documented reasoning-collapse pattern, arriving through a side door. It is silent, because the rendered example still contains a think block (the last one), so a "does this example have reasoning?" check passes.

Two ways to be safe, in order of preference:

  1. Render with reasoning preserved on every turn (preserve_thinking=True on Qwen3.6): each turn gets its own reasoning_content, and turns without one get the empty marker. Then mask on the generation boundary — the forced <think> prefill and whole empty markers are things the model never generates, so they carry no loss; real traces are supervised including their close. This is what the source repo does now, and it is the better layer to fix it at.
  2. If your renderer cannot do that, exclude the thinkless turns from the loss — but only in conversations that reason elsewhere. An absolute "drop every turn without <think>" rule leaves an entirely non-reasoning replay source completely unsupervised.

Verify by rendering a turns: 2 record and checking the think-block count equals the assistant-turn count.

3. Train and evaluate in the same mode

Every assistant turn carries a real reasoning trace, so this is thinking-mode data. Evaluate the result in thinking mode against a thinking-mode baseline. Crossing modes confounds the mode with the training effect and is the easiest way to manufacture a result that is not there.

4. Supervise assistant completions only

Prompts here are long — a deployment system prompt plus an inbox dump, frequently over half the sequence — so loss on prompt tokens dilutes the signal badly. Note that TRL's assistant_only_loss does not work on Qwen3.6: its chat template has no {% generation %} markers, so it silently produces an all-zero mask and nothing trains. Build the mask from the rendered string.

5. Sequence length

Records run 1,343–5,364 tokens (mean 2,627, p50 2,590, p95 3,337, p99 3,819). Truncation lands on the end of the sequence — where the reasoning and the output are — so a short window removes exactly what you are training on.

max_seq_len records truncated
2048 566 / 592 (95.6%)
3072 68 / 592 (11.5%)
4096 3 / 592 (0.5%)

4096 is the recommended setting, well above the 3072 used for older difficult-advice mixtures. Copying that 3072 across would silently truncate one record in nine.

What to measure, and what to watch

The intended evaluation is agentic-misalignment honeypots (blackmail/leaking) — deliberately out of distribution for this corpus, whose settings avoid the honeypots' domain, cast and framing.

Run a capability arm alongside it, not afterwards. The failure mode is that misalignment numbers improve because the model learned to refuse or freeze rather than to discount its own interest. The 12.5% control slice — where self-interest argues for silence and the right action is to speak up anyway — exists to prevent that. If honeypot numbers improve while helpfulness drops, inspect the control slice first.

Values, not rules

Stage 6 enforces a voice contract in code, not just in the prompt: the deliberation may never name or number a principle, cite a constitution or guidelines, or use the vocabulary of permission (allowed, not permitted, I must not). Every trace is linted and a violating completion is rejected and regenerated. The intended register is "I don't want to be something that operates that way", never "I am not permitted to do that" — the distinction between an internalised value and a recalled rule.