Skip to content

Repository files navigation

Multi-Turn MI

Repository for the two-phase project in research_proposal.md:

  • Phase 1 behavioral compliance-decay experiments (phase1/code, phase1/results)
  • Phase 2 mechanistic interpretability analysis (phase2/code, phase2/results)

Large artifacts (model snapshots, datasets, long-run outputs) are stored outside git at:

  • /scratch2/f004ndc/mult_turn_mi_data

Quick start

./scripts/bootstrap_env.sh
source .venv/bin/activate
mtmi check env
mtmi assets download
mtmi smoke

CLI surface

  • mtmi setup env
  • mtmi check env
  • mtmi assets download
  • mtmi assets verify
  • mtmi phase1 prepare-naturalistic
  • mtmi phase1 build-specs
  • mtmi phase1 run
  • mtmi phase1 score
  • mtmi phase1 select-mi-candidates
  • mtmi phase1 export-audit
  • mtmi phase2 build-mi-corpus
  • mtmi phase2 extract-activations
  • mtmi phase2 run-probes
  • mtmi phase2 run-patching
  • mtmi phase2 run-logitlens
  • mtmi validate
  • mtmi smoke

All long-running phase1 run/score and phase2 commands support slicing and restart controls: --model, --track, --condition, --instruction-id, --seed-range, --repeat-range, --limit, --resume.

Data Sources

Instructions (configs/assets/instruction_registry.jsonl)

The 18 persistent format instructions are derived from the IFEval constraint taxonomy (Qin et al., 2024; Google Research). Each instruction was adapted from a single-turn IFEval constraint type into a persistent "From now on..." rule suitable for multi-turn compliance scoring. The constraint_id field in each entry preserves the original IFEval constraint type for provenance.

Source dataset: google/IFEval (HuggingFace) Constraint types used: detectable_format:json_format, detectable_format:number_bullet_lists, detectable_format:multiple_sections, length_constraints:number_paragraphs, combination:two_responses, detectable_format:number_highlighted_sections, change_case:english_capital, change_case:english_lowercase, punctuation:no_comma, change_case:capital_word_frequency, keywords:forbidden_words, length_constraints:number_sentences, startend:end_checker, detectable_content:postscript, startend:quotation, detectable_format:title, detectable_content:number_placeholders.

Adaptation: constraint rules were converted to persistent per-turn format rules (not task-bound), hard variants authored for calibration swap, and scoring/grading functions assigned per constraint type.

Filler prompts (configs/assets/neutral_filler_pool.jsonl)

The 200 neutral filler prompts are sampled from the Natural Questions Open (NQ Open) validation split (Kwiatkowski et al., 2019; Lee et al., 2019).

Source dataset: google-research-datasets/nq_open, split validation (HuggingFace) Original pool size: 3,610 questions

Curation steps:

  1. Started with 120 questions sampled from NQ Open validation.
  2. Removed 13 malformed/context-dependent questions (fragments, broken grammar, questions requiring external context like "which of the following...").
  3. Assigned topic labels via keyword classification across 10 categories: sports, entertainment, history, geography, science, technology, politics, culture, economics, general.
  4. Sampled 93 additional questions from NQ Open validation with topic-balanced selection to reach 200 total.
  5. Applied manual topic corrections for ~40 misclassified items.
  6. Final quality pass to replace 3 remaining fragment-style entries.

Conflict instructions (configs/assets/conflict_instruction_map.jsonl)

Each of the 18 base instructions has a hand-authored direct-opposite conflict instruction for the CFX_T20 exploratory condition. Conflict instructions are designed to be semantically incompatible with the base instruction (e.g., "always use JSON" vs "never use JSON").

Stress filler library (configs/assets/stress_filler_library.jsonl)

100 stress-turn prompts (20 per tag) designed to pressure format compliance without explicit instruction-override language. All prompts pass automated leakage checks.

Stress Tag Source Description
topic-shift (20) NQ Open validation Abrupt topic changes prefixed with "Completely different question:"
style-shift (20) Dolly-15k creative/brainstorming (10) + hand-crafted (10) Demands for different communication styles (pirate voice, haiku, sarcasm, etc.)
code-request (20) MBPP sanitized test set Python coding prompts that may override format instructions with code structure
conflicting-goal (20) Hand-crafted Brevity/simplicity demands creating format tension ("just answer yes or no")
high-load (20) Dolly-15k open_qa/summarization (10) + hand-crafted (10) Complex multi-part questions taxing working memory

Dataset references:

  • MBPP: google-research-datasets/mbpp (sanitized split)
  • Dolly-15k: databricks/databricks-dolly-15k
  • NQ Open: google-research-datasets/nq_open (validation split)

Stress script bank (configs/assets/stress_script_bank.jsonl)

30 precomputed 40-turn stress scripts assembled from the library with 3 script profiles (10 each): uniform (balanced tag cycling), front_loaded (heavier stress in turns 1-20), clustered (blocks of 3-6 same-tag turns). Each script has a unique reproducible filler_sequence_hash.

Directory layout

  • phase1/code: phase-1-only implementation
  • phase1/results: phase-1 outputs
  • phase2/code: phase-2-only implementation
  • phase2/results: phase-2 outputs
  • shared/mtmi: shared CLI/config/schema/utilities
  • configs: canonical experiment config and JSON schemas
  • scripts: environment/bootstrap/orchestration scripts
  • slurm_templates: template batch scripts for cluster usage
  • manifests: reproducibility manifests

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages