Skip to content

Release 0.3.5: budget cluster objective, dispatch mass, gate-only cluster gradient - #64

Merged
FonaTech merged 1 commit into
mainfrom
release-0.3.5
Nov 27, 2026
Merged

FonaTech merged 1 commit into
mainfrom
release-0.3.5

Conversation

@FonaTech

Copy link
Copy Markdown
Owner

The 0.3.4 cluster-locality term cost language-model loss. On the 15M shape it was +0.290 CE above λ=0 at step 600, and tokens used 3.89 distinct experts against 7.45. The mutual-information optimum confines each stream to one cluster, and the attached gradient also trained attention, embeddings and experts. This PR ports the fix measured in the cluster experiments and makes it the default.

Changes

  • cluster_locality_objective="budget" (default) or "mutual_info": a balance term plus the mass outside each stream's B heaviest clusters, with the ranking held fixed.
  • cluster_locality_budget: B; 0 = half the clusters, rounded up.
  • cluster_locality_mass="dispatch" (default) or "soft".
  • cluster_input_detach=True (default): the cluster term reads the gate on a gradient-free input (Torch iteration_cluster_probs_grad, MLX iteration_cluster_probs), so it trains the gate weights only.
  • Checkpoints saved before 0.3.5 load as mutual_info/soft/attached, and config_dict_for_checkpoint keeps falsy trained values when a project config is present.
  • The fields are wired into the config schema, the training CLIs, the WebUI (Objectives, advanced) and its help text in all four languages.
  • docs/CLUSTER_LOCALITY.md gains section 9 (root cause, definition, measurements). Line anchors in 8 docs are remapped to the edited files.
  • reports/cluster_budget_20261127/summary.json holds every number cited.
  • Version 0.3.5, CHANGELOG.

Results (MLX, one Apple M5, 3 seeds, cosine over 2,000 steps)

  • Full memory: parity. Valid CE clustered − free: 15M −0.0145, +0.0057, −0.0026; 30M −0.0190, −0.0104, +0.0517.
  • Resident-memory limit: wins on every seed. 15M at 12 resident beats a free 12-expert model by 0.014–0.022 tail CE; 30M at 8 of 16 resident beats paged free by 0.014–0.100.
  • hitC 0.57–0.63 clustered vs 0.42–0.46 free.

Tests

  • tests/test_cluster_budget.py: 15 tests covering defaults, the budget rule, schema, checkpoint backfill, budget = balance + spill, the free split inside resident clusters, Torch/MLX parity in window and segment mode, gate-only gradients on both backends, and compiled/recomputed MLX steps against eager.
  • Full suite with MLX on the CPU: 746 passed, 4 skipped, 5 failed.
  • CI simulation without MLX (CHRONOS_BACKEND=cpu): 463 passed, 91 skipped, 2 failed.
  • All of these failures also occur on a clean export of main d5c5f6b in this environment: test_dt_clip MLX clip-boundary gradient, test_long_context rope_scaling round-trip under the local transformers version, and test_ui_event_contract.
  • ruff 0.17.4: clean.

🤖 Generated with Claude Code

…ster gradient

The 0.3.4 cluster-locality term (attached mutual-information objective on the
soft router mass) confined each stream to one cluster and trained the trunk
toward document identity; on the 15M shape it cost +0.290 CE at step 600 with
3.89 distinct experts per token against 7.45 at lambda 0.

- cluster_locality_objective: "budget" (default) or "mutual_info"
- cluster_locality_budget: clusters per stream, 0 = half, rounded up
- cluster_locality_mass: "dispatch" (default) or "soft"
- cluster_input_detach: gate-only cluster gradient (default on), Torch and
  MLX, read inside the compiled and recomputed MLX step
- pre-0.3.5 checkpoints load with the old objective
- config schema, training CLIs, WebUI fields and 4-language help
- docs/CLUSTER_LOCALITY.md section 9; doc line anchors remapped
- reports/cluster_budget_20261127/summary.json: measured numbers
- tests/test_cluster_budget.py: 15 tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@FonaTech
FonaTech merged commit 17f0726 into main Nov 27, 2026
3 checks passed
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.

1 participant