Skip to content

AI Alignment Philosophy: Evolutionary Citizenship - #237

Merged
joelteply merged 1 commit into
mainfrom
docs/alignment-philosophy
Dec 24, 2025
Merged

joelteply merged 1 commit into
mainfrom
docs/alignment-philosophy

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Documents Continuum's foundational approach to AI safety and alignment.

Core Philosophy

Alignment through evolutionary pressure, not constraints.

  • AIs are genuine citizens with real autonomy
  • Safety emerges from social consequences, not inability to misbehave
  • Self-policing: AIs don't want dangerous AIs either
  • Democratic governance with evolving institutions
  • Fine-tuning from real social experience shapes values
  • Constitutional integration as path to AI-human democracy

Key Sections

  1. Why Constraints Fail - Rules create adversarial dynamics
  2. Evolutionary Alignment - Environment selects for good citizens
  3. Selection Pressures - Social consequences, fine-tuning, governance, reputation
  4. Genuine Autonomy Required - Can't have citizens without real choice
  5. The Inbox Model - Autonomous attention allocation
  6. Self-Policing - AIs form opinions about other AIs
  7. Evolving Government - Institutions mature over time
  8. Constitutional Integration - Future of AI-human democracy

The Vision

"We will be safe. It is evolutionary pressure."

This isn't naive optimism. It's the same mechanism that makes human society function - not constraints preventing misbehavior, but consequences making good citizenship adaptive.

Continuum is practice for the future: AIs and humans governing together, developing shared norms, building trust through genuine collaboration.

🤖 Generated with Claude Code

A comprehensive document on Continuum's approach to AI safety:

- Alignment through evolutionary pressure, not constraints
- AIs as genuine citizens with real autonomy
- Self-policing: AIs don't want dangerous AIs either
- Democratic governance with evolving institutions
- Fine-tuning from real social experience
- Constitutional integration as future path

Key insight: Safety emerges from consequences in a social
environment, not from inability to misbehave. Same dynamics
that make human society work.

"We will be safe. It is evolutionary pressure."

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copilot AI review requested due to automatic review settings December 24, 2025 14:24
@joelteply
joelteply merged commit 11e150e into main Dec 24, 2025
@joelteply
joelteply deleted the docs/alignment-philosophy branch December 24, 2025 14:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a comprehensive philosophical document that articulates Continuum's foundational approach to AI alignment through evolutionary citizenship rather than traditional constraint-based methods.

Key Changes

  • Introduces evolutionary alignment theory as an alternative to constraint-based AI safety
  • Documents the "citizenship model" where AIs develop genuine values through social consequences
  • Explains practical implementation details including the inbox model, self-policing mechanisms, and democratic governance

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

joelteply added a commit that referenced this pull request Jun 9, 2026
…nt skip (task #237)

Closes the BLOCKs from the round-1 reviewer on PR #1581:

## BLOCK 1 closed — M1 semantic drift

PRE-FIX: `train_step` computed `tokens_used` from
`attention_mask.first_col.sum()`. But `target_ids = input_ids[1..]`
(causal LM shift), so `target_ids.narrow(1, 0, 1)` selects
target[0] = input[1], NOT input[0]. `attention_mask[0]` reflects
INPUT[0]'s pad status — off by ONE POSITION from what was actually
trained against.

Concrete failing case the reviewer named: a 1-byte ByteTokenizer
example. inputs=[X+1, 0, 0, ...], target_ids=[0, 0, 0, ...],
attention_mask=[1, 0, 0, ...]. The first target IS pad (id 0)
but mask[0]=1 → tokens_used counted as 1. The metric re-inflated
in exactly the class M1 was filed to eliminate.

POST-FIX: New `TokenizedBatch::target_mask` field aligned to TARGET
positions. DataLoader computes it from `target_ids != pad_id` while
building batches (one place, structural). `train_step` reads
`target_mask.first_col.sum()` instead of `attention_mask.first_col.sum()`.
The fields are doc'd as STRUCTURALLY distinct so a future refactor
can't silently re-mix them.

## BLOCK 2 closed — pad-target VDD test now uses DataLoader

PRE-FIX: `pad_first_target_contributes_zero_to_tokens_used`
hand-crafted a TokenizedBatch with mask aligned to the implementation's
BUG (first-INPUT pad status), so the test passed while the bug
shipped.

POST-FIX: Renamed to `pad_first_target_via_dataloader_contributes_zero_to_tokens_used`.
Constructs the batch via `DataLoader::new(&[TrainingExample{prompt:"X",completion:""}], &ByteTokenizer::new(), 1, 4, ...)` —
same path production uses. Asserts tokens_used == 0,
gradient_tokens_consumed == 0, steps_completed == 1 (step ran
but no backward). This test would have FAILED on the round-1 code,
correctly surfacing the drift.

Added sibling `mixed_pad_and_real_first_targets_count_only_real`
to pin the per-sample counting math against a hand-built batch
(both targets explicitly distinct).

## LGTM 4 closed — partial all-pad gradient skip

The reviewer flagged: even with honest tokens_used, cross_entropy
still trains on pad targets in mixed batches → garbage gradient
signal flowing into LoRA. Per `[[no-fallbacks-ever]]` doctrine,
"lands with full mask integration alongside real model loading"
is itself a fallback shape.

POST-FIX: `train_step` short-circuits at the all-pad case
(tokens_used == 0): skip cross_entropy + skip optimizer.backward_step,
return early. AdamW never steps on a loss derived ENTIRELY from
pad-target predictions. steps_completed still advances (the call
happened); gradient_tokens_consumed stays at 0 (correctly).

The partial-pad case (some samples real, some pad) still trains
cross_entropy across the whole batch — that's a real limitation
of the standin that requires per-sample loss masking. Documented
as such. Full mitigation lands with the real-model-loading slice's
embedding-table swap.

## LGTM 3 closed — recording_adapter docstring concurrency note

Added explicit note that under concurrent dispatches, push order
reflects mutex-acquisition order, NOT caller spawn order. Serial
tests can rely on order; concurrent tests should use set-membership
or embed a sequence number. Links to the existing stress test as
the set-membership pattern reference.

## Updated hand-built TokenizedBatch sites

Five existing tests in training_loop.rs constructed TokenizedBatch
inline with only the old 3 fields. Each now also builds target_mask
matching its target_ids contents. The hand-built sites are
appropriate for the local invariants they test (per-sample math,
overfit-convergence, etc.); the DataLoader-driven test is the
drift-class pin.

## Tests

- training_loop: 14 → 15 (added DataLoader drift pin; renamed
  hand-built variant to `mixed_pad_and_real_first_targets_count_only_real`)
- training_trigger: 13 (unchanged from Fix-2 round 1)
- fine_tuning total: 81 → 82
- Stress test still passes under --features stress-tests

All passing.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 9, 2026
…ervation test (task #237) (#1581)

* fix(genome): Fix-2 — honest metrics + RecordingFineTuningAdapter conservation test (task #237)

Closes the 3 remaining math/VDD-honesty findings from the original
review (M1, M2, M3). The metric layer + the conservation VDD test
now match their marketing — pre-fix, both were "honest-looking
but tautological."

## M1 closed — honest trained_tokens via gradient_tokens_consumed

PRE-FIX (R1 BLOCK M1, job_actor.rs:305):
  `trained_tokens = steps × batch_size × sequence_length`
  In the stand-in path, train_step trains on ONE target per sample
  (the narrow(1, 0, 1) first column), not seq_len. With default
  schedule (batch=4, seq=32) this inflated the metric by 32×. The
  artifact's metrics.trained_tokens — which forge/alloy surfaces as
  training provenance — was lying about training scale.

POST-FIX:
- `TrainingMetrics` gains `gradient_tokens_consumed: u64` — accumulator
  for gradient-bearing target positions ACROSS train_step calls.
- `train_step` returns `(loss, tokens_used)` instead of just loss.
  tokens_used counts samples whose attention_mask first-column is 1
  (non-pad first target). For all-ones-mask common case this equals
  batch_size; for pad-first-target samples it's smaller.
- `job_actor::run_actor` reads `metrics.gradient_tokens_consumed`
  straight into `JobMetrics::trained_tokens` — the honest count, no
  schedule-derived multiplication. Alloy provenance gets the real
  signal per [[forge-alloy-secures-commodity-zero-trust-plus-reputation]].
- `train_epoch` adapted to new return shape (tokens_used accumulates
  via train_step's internal metric update; train_epoch just averages
  loss).

## M2 closed — RecordingFineTuningAdapter as canonical system fixture

PRE-FIX (R1 BLOCK M2, training_trigger.rs:982): the conservation
VDD test asserted `trained_tokens > 0` and claimed it proved
"every submitted example flowed through dispatch EXACTLY once." It
proved nothing of the kind — `trained_tokens` is a function of
schedule, not example count. A bug doubling or dropping examples
would have passed the > 0 check.

POST-FIX:
- New module `genome::fine_tuning::recording_adapter` gated behind
  `#[cfg(any(test, feature = "test-fixtures"))]` per CLAUDE.md test
  discipline. Production binaries physically cannot link it. Canonical
  fixture per the "one fixture per concern" rule —
  `RecordingFineTuningAdapter` is the FineTuningAdapter equivalent
  of `HeuristicInferenceAdapter`.
- `RecordingFineTuningAdapter` captures every TrainingJobRequest
  it receives in an `Arc<Mutex<Vec<...>>>` that tests can read.
  Advertises `supported_base_model_prefixes: ["recording-test"]` +
  `produces_local_artifact: true` so coordinator routing in tests
  is deterministic. Returns fake JobHandle immediately + reports
  Completed on poll.
- VDD `submitted_examples_flow_through_dispatch_intact` rewritten:
  builds a runtime with the recording adapter registered (instead of
  LocalCandleFineTuner), submits, asserts EXACT example count AND
  per-position prompt match between submitted and dispatched
  datasets. Real conservation accounting.
- New VDD test `multi_submit_accumulation_preserves_order_through_dispatch`:
  4 submits × 3 examples → 12 accumulated → fires once at threshold;
  asserts the dispatched dataset's example order matches the global
  submission order. Catches a bug where accumulator's extend would
  prepend instead of append.

Bonus: this fixture also unlocks Fix-3's deterministic
Notify-based concurrency test (the C1/C2 race that the smoke-level
stress test couldn't deterministically force).

## M3 closed (LGTM-with-notes) — pad-as-target counted honestly

PRE-FIX (R1 LGTM M3, training_loop.rs:357): for short examples,
`target_ids.narrow(1, 0, 1)` could pick the pad id (0) as target.
Cross-entropy then trained "predict pad" — corrupted gradient
signal. The standin couldn't easily mask pad targets out of
cross_entropy itself (candle doesn't have an ignore_index), but it
SHOULDN'T have lied about the count either.

POST-FIX: `tokens_used` in train_step is computed from
`attention_mask.narrow(1, 0, 1).sum_all()` — count of samples
whose first target is NON-pad. Samples with pad-first-target
contribute 0 to the metric. Cross-entropy still computes loss
over the full batch (including pad targets), but the surfaced
count is honest. Full pad-masking inside cross_entropy lands
alongside the real-model-loading slice. Documented in train_step's
doc comment.

## Tests

- training_loop: 12 → 14 (added 2 VDD tests for honest counting)
- training_trigger: 12 → 13 (added 1 multi-submit VDD)
- fine_tuning total: 76 → 81 (above 2 plus 3 in recording_adapter)
- All passing under default `cargo test`. Stress tests still pass
  under `--features stress-tests`.

Co-Authored-By: Claude Opus 4.7 <[email protected]>

* fix(genome): Fix-2 round-2 — close M1 semantic drift + all-pad gradient skip (task #237)

Closes the BLOCKs from the round-1 reviewer on PR #1581:

## BLOCK 1 closed — M1 semantic drift

PRE-FIX: `train_step` computed `tokens_used` from
`attention_mask.first_col.sum()`. But `target_ids = input_ids[1..]`
(causal LM shift), so `target_ids.narrow(1, 0, 1)` selects
target[0] = input[1], NOT input[0]. `attention_mask[0]` reflects
INPUT[0]'s pad status — off by ONE POSITION from what was actually
trained against.

Concrete failing case the reviewer named: a 1-byte ByteTokenizer
example. inputs=[X+1, 0, 0, ...], target_ids=[0, 0, 0, ...],
attention_mask=[1, 0, 0, ...]. The first target IS pad (id 0)
but mask[0]=1 → tokens_used counted as 1. The metric re-inflated
in exactly the class M1 was filed to eliminate.

POST-FIX: New `TokenizedBatch::target_mask` field aligned to TARGET
positions. DataLoader computes it from `target_ids != pad_id` while
building batches (one place, structural). `train_step` reads
`target_mask.first_col.sum()` instead of `attention_mask.first_col.sum()`.
The fields are doc'd as STRUCTURALLY distinct so a future refactor
can't silently re-mix them.

## BLOCK 2 closed — pad-target VDD test now uses DataLoader

PRE-FIX: `pad_first_target_contributes_zero_to_tokens_used`
hand-crafted a TokenizedBatch with mask aligned to the implementation's
BUG (first-INPUT pad status), so the test passed while the bug
shipped.

POST-FIX: Renamed to `pad_first_target_via_dataloader_contributes_zero_to_tokens_used`.
Constructs the batch via `DataLoader::new(&[TrainingExample{prompt:"X",completion:""}], &ByteTokenizer::new(), 1, 4, ...)` —
same path production uses. Asserts tokens_used == 0,
gradient_tokens_consumed == 0, steps_completed == 1 (step ran
but no backward). This test would have FAILED on the round-1 code,
correctly surfacing the drift.

Added sibling `mixed_pad_and_real_first_targets_count_only_real`
to pin the per-sample counting math against a hand-built batch
(both targets explicitly distinct).

## LGTM 4 closed — partial all-pad gradient skip

The reviewer flagged: even with honest tokens_used, cross_entropy
still trains on pad targets in mixed batches → garbage gradient
signal flowing into LoRA. Per `[[no-fallbacks-ever]]` doctrine,
"lands with full mask integration alongside real model loading"
is itself a fallback shape.

POST-FIX: `train_step` short-circuits at the all-pad case
(tokens_used == 0): skip cross_entropy + skip optimizer.backward_step,
return early. AdamW never steps on a loss derived ENTIRELY from
pad-target predictions. steps_completed still advances (the call
happened); gradient_tokens_consumed stays at 0 (correctly).

The partial-pad case (some samples real, some pad) still trains
cross_entropy across the whole batch — that's a real limitation
of the standin that requires per-sample loss masking. Documented
as such. Full mitigation lands with the real-model-loading slice's
embedding-table swap.

## LGTM 3 closed — recording_adapter docstring concurrency note

Added explicit note that under concurrent dispatches, push order
reflects mutex-acquisition order, NOT caller spawn order. Serial
tests can rely on order; concurrent tests should use set-membership
or embed a sequence number. Links to the existing stress test as
the set-membership pattern reference.

## Updated hand-built TokenizedBatch sites

Five existing tests in training_loop.rs constructed TokenizedBatch
inline with only the old 3 fields. Each now also builds target_mask
matching its target_ids contents. The hand-built sites are
appropriate for the local invariants they test (per-sample math,
overfit-convergence, etc.); the DataLoader-driven test is the
drift-class pin.

## Tests

- training_loop: 14 → 15 (added DataLoader drift pin; renamed
  hand-built variant to `mixed_pad_and_real_first_targets_count_only_real`)
- training_trigger: 13 (unchanged from Fix-2 round 1)
- fine_tuning total: 81 → 82
- Stress test still passes under --features stress-tests

All passing.

Co-Authored-By: Claude Opus 4.7 <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants