mlx-bun 0.4.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1453 -88
- package/THIRD_PARTY_NOTICES.md +882 -0
- package/bin/mlx-bun.convert.mjs +4 -0
- package/bin/mlx-bun.fuse.mjs +4 -0
- package/bin/mlx-bun.generate.mjs +4 -0
- package/bin/mlx-bun.lora.mjs +4 -0
- package/bin/mlx-bun.mjs +13 -21
- package/bin/mlx-bun.server.mjs +4 -0
- package/bin/mlx-bun.upload.mjs +4 -0
- package/dist/web/app.js +9584 -0
- package/package.json +50 -53
- package/src/cli/ane-install.ts +76 -0
- package/src/cli/args.ts +179 -0
- package/src/cli/engine-entry.ts +68 -0
- package/src/cli/inference.ts +214 -0
- package/src/cli/job-entry.ts +97 -0
- package/src/cli/library-host.ts +117 -0
- package/src/cli/main.ts +57 -0
- package/src/cli/memory-engine.ts +163 -0
- package/src/cli/memory.ts +36 -0
- package/src/cli/mlx-lm-aliases.ts +309 -0
- package/src/cli/model-choice.ts +33 -0
- package/src/cli/model-selection.ts +84 -0
- package/src/cli/module-host.ts +11 -0
- package/src/cli/module-verbs.ts +50 -0
- package/src/cli/numerical-policy.ts +12 -0
- package/src/cli/perplexity.ts +89 -0
- package/src/cli/serve-host.ts +423 -0
- package/src/cli/serve-isolated.ts +217 -0
- package/src/cli/serve-options.ts +106 -0
- package/src/cli/serve-state.ts +205 -0
- package/src/cli/serve.ts +500 -0
- package/src/cli/served-model-host.ts +102 -0
- package/src/cli/server-entry.ts +148 -0
- package/src/cli/serving-unit.ts +177 -0
- package/src/{tui.ts → cli/terminal.ts} +13 -8
- package/src/cli/worker-adapters.ts +34 -0
- package/src/cli/worker-entry.ts +272 -0
- package/src/cli/worker-unit.ts +179 -0
- package/src/engine/adapter-operation.ts +26 -0
- package/src/engine/cache-services.ts +114 -0
- package/src/engine/completion.ts +39 -0
- package/src/engine/generation-gateway.ts +358 -0
- package/src/engine/index.ts +59 -0
- package/src/engine/kv-budget.ts +120 -0
- package/src/engine/media-preparation.ts +232 -0
- package/src/engine/model-binding.ts +24 -0
- package/src/engine/model-host.ts +513 -0
- package/src/engine/model-serving.ts +89 -0
- package/src/{serve → engine}/preparation.ts +10 -8
- package/src/{serve → engine}/session-completion-engine.ts +6 -6
- package/src/engine/telemetry.ts +109 -0
- package/src/hub/downloads.ts +116 -0
- package/src/jobs/db.ts +16 -7
- package/src/jobs/events.ts +29 -0
- package/src/jobs/executable.ts +5 -0
- package/src/jobs/host.ts +51 -0
- package/src/jobs/in-process.ts +55 -0
- package/src/{contracts/jobs.ts → jobs/protocol.ts} +7 -9
- package/src/jobs/runner.ts +150 -231
- package/src/jobs/service.ts +75 -0
- package/src/jobs/sse.ts +59 -23
- package/src/jobs/worker-memory.ts +46 -0
- package/src/jobs/worker-process.ts +163 -0
- package/src/jobs/worker-supervisor.ts +258 -0
- package/src/modules.ts +58 -0
- package/src/publishing/catalog-hub.ts +18 -0
- package/src/publishing/credentials.ts +31 -0
- package/src/publishing/upload.ts +37 -0
- package/src/residency/leased-adapters.ts +21 -0
- package/src/residency/local-records.ts +16 -0
- package/src/residency/model-residency.ts +405 -0
- package/src/residency/record-index.ts +28 -0
- package/src/residency/resident-estimate.ts +50 -0
- package/src/{anthropic.ts → server/anthropic.ts} +3 -81
- package/src/server/cache-routes.ts +36 -0
- package/src/{serve → server}/chat-request.ts +12 -10
- package/src/{serve → server}/chat-stage.ts +27 -22
- package/src/{client.ts → server/client.ts} +28 -2
- package/src/{serve → server}/completion-executor.ts +42 -42
- package/src/server/decision-body.ts +55 -0
- package/src/server/decision-routes.ts +134 -0
- package/src/server/decision-wire.ts +228 -0
- package/src/{serve → server}/discovery-routes.ts +42 -83
- package/src/server/generated-token-history.ts +57 -0
- package/src/{serve → server}/http.ts +25 -13
- package/src/{serve → server}/inference-request.ts +5 -5
- package/src/server/job-routes.ts +20 -0
- package/src/server/media-prompt.ts +63 -0
- package/src/server/memory-completion-client.ts +46 -0
- package/src/server/model-routes.ts +192 -0
- package/src/{serve → server}/openai-wire.ts +3 -2
- package/src/{serve → server}/pipeline.ts +1 -1
- package/src/server/prompt-builder.ts +13 -0
- package/src/server/prompt-contracts.ts +17 -0
- package/src/server/proxy-routes.ts +187 -0
- package/src/server/publishing-routes.ts +41 -0
- package/src/{serve → server}/request-plan.ts +8 -8
- package/src/{serve → server}/request-prep.ts +82 -68
- package/src/{serve → server}/responses-client.ts +30 -13
- package/src/{responses.ts → server/responses.ts} +12 -93
- package/src/server/routes.ts +205 -0
- package/src/server/start.ts +72 -0
- package/src/server/status-routes.ts +108 -0
- package/src/{serve → server}/text-completion-stage.ts +25 -4
- package/src/server/text-prompt.ts +12 -0
- package/src/{serve → server}/token-streams.ts +36 -38
- package/src/server/worker-routes.ts +311 -0
- package/src/storage/paths.ts +61 -0
- package/src/web/assets.ts +37 -0
- package/src/web/{src → browser}/api.ts +5 -23
- package/src/web/browser/chat-host.ts +17 -0
- package/src/web/browser/installed-panels.ts +6 -0
- package/src/web/browser/main.ts +55 -0
- package/src/web/browser/markdown.ts +279 -0
- package/src/web/browser/memory-panel.ts +9 -0
- package/src/web/browser/palette.ts +64 -0
- package/src/web/browser/protocol.ts +13 -0
- package/src/web/browser/shell.ts +467 -0
- package/src/web/{src → browser}/status.ts +32 -36
- package/src/web/build.ts +51 -0
- package/src/web/public/app.html +1054 -0
- package/src/web/{sw.js → public/sw.js} +4 -3
- package/src/web/{vendor → public/vendor}/hljs-theme.css +2 -2
- package/src/web/{vendor → public/vendor}/hljs.js +2 -2
- package/THIRD_PARTY_LICENSES.md +0 -51
- package/docs/README.md +0 -94
- package/docs/archive/hlg-sampling.md +0 -350
- package/docs/archive/investigations/audio-input-plan.md +0 -356
- package/docs/archive/investigations/chunk-finetune-experiment.md +0 -84
- package/docs/archive/investigations/colibri-glm52-port.md +0 -1486
- package/docs/archive/investigations/colibri-oracle-pin.md +0 -1284
- package/docs/archive/investigations/curve-bisector-routing.md +0 -123
- package/docs/archive/investigations/decode-roofline-lookagain.md +0 -348
- package/docs/archive/investigations/diffusion-gemma-port.md +0 -602
- package/docs/archive/investigations/dspark-handoff.md +0 -224
- package/docs/archive/investigations/expert-offload-single-user-moe.md +0 -292
- package/docs/archive/investigations/faithful-l1-consolidation.md +0 -310
- package/docs/archive/investigations/hlg-sampling-investigation.md +0 -970
- package/docs/archive/investigations/indexshare-performance-spike.md +0 -357
- package/docs/archive/investigations/kernel-perf-review-2026-07.md +0 -171
- package/docs/archive/investigations/lab-build-journal.md +0 -157
- package/docs/archive/investigations/minicpm5-decode-megakernel.md +0 -489
- package/docs/archive/investigations/openjarvis-fit.md +0 -198
- package/docs/archive/investigations/openwiki-evaluation.md +0 -249
- package/docs/archive/investigations/optimization_plan.md +0 -346
- package/docs/archive/investigations/orpo-base-uf-experiment-and-directions.md +0 -120
- package/docs/archive/investigations/orpo-flash-cce-pin-leak.md +0 -167
- package/docs/archive/investigations/orpo-uf-testing-handoff.md +0 -126
- package/docs/archive/investigations/pareto-specialized-runtime-findings.md +0 -92
- package/docs/archive/investigations/pi-builtin-investigation.md +0 -308
- package/docs/archive/investigations/pre-colibri-stabilization.md +0 -329
- package/docs/archive/investigations/qwen38-27b-campaign-log.md +0 -1092
- package/docs/archive/investigations/segmented-backward-handoff.md +0 -148
- package/docs/archive/investigations/starter-model-port-handoff.md +0 -342
- package/docs/archive/investigations/steel-flash-cce-handoff.md +0 -489
- package/docs/archive/investigations/the-dreaming-handoff.md +0 -141
- package/docs/archive/investigations/trainer-validation-experiment.md +0 -173
- package/docs/archive/planning/chat-ui-vision-memory-first.md +0 -199
- package/docs/archive/planning/chat-ui-vision.md +0 -50
- package/docs/archive/planning/chunk-task-roadmap.md +0 -77
- package/docs/archive/planning/curve-sampler-research-plan.md +0 -331
- package/docs/archive/planning/journal.md +0 -316
- package/docs/archive/planning/memory-docs-and-dag-plan.md +0 -194
- package/docs/archive/planning/pi-integration-review.md +0 -178
- package/docs/archive/planning/release-notes-v0.0.10.md +0 -57
- package/docs/archive/planning/release-notes-v0.0.11.md +0 -239
- package/docs/archive/planning/release-notes-v0.0.12.md +0 -80
- package/docs/archive/planning/release-notes-v0.0.13.md +0 -77
- package/docs/archive/planning/release-notes-v0.0.9.md +0 -122
- package/docs/archive/planning/release-notes-v0.2.0.md +0 -49
- package/docs/archive/planning/release-notes-v0.3.0.md +0 -35
- package/docs/archive/planning/web-ui-pass-plan.md +0 -213
- package/docs/archive/planning/website-readme-pass-plan.md +0 -224
- package/docs/design/batching.md +0 -1841
- package/docs/design/decode-speed-program.md +0 -2349
- package/docs/design/dreaming-nightly-pipeline.md +0 -684
- package/docs/design/generic-model-support.md +0 -705
- package/docs/design/kv-cache.md +0 -824
- package/docs/design/orpo-training.md +0 -680
- package/docs/design/speculative-decoding.md +0 -1990
- package/docs/design/turboquant.md +0 -2212
- package/docs/design/unified-engine-frontier-plan.md +0 -1880
- package/docs/design/web-chat-redesign.md +0 -695
- package/docs/planning/PRODUCT_ROADMAP.md +0 -594
- package/docs/planning/ResearchTopics.md +0 -119
- package/docs/planning/release-notes-v0.4.0.md +0 -45
- package/docs/planning/video-series.md +0 -421
- package/docs/reference/benchmarks.md +0 -3613
- package/docs/reference/cli.md +0 -585
- package/docs/reference/distribution.md +0 -355
- package/docs/reference/environment.md +0 -398
- package/docs/reference/glossary.md +0 -39
- package/docs/reference/library-api.md +0 -674
- package/docs/reference/memory.md +0 -260
- package/docs/reference/models.md +0 -334
- package/docs/reference/server-api.md +0 -1775
- package/docs/reference/server-config.md +0 -846
- package/docs/reference/training.md +0 -462
- package/docs/reference/troubleshooting.md +0 -158
- package/src/admission-plan.ts +0 -18
- package/src/audio/conformer.ts +0 -647
- package/src/audio/decode.ts +0 -133
- package/src/audio/features.ts +0 -202
- package/src/audio/transcode.ts +0 -67
- package/src/backends/mlx/assistant-target.ts +0 -46
- package/src/backends/mlx/autoregressive-draft-rows.ts +0 -120
- package/src/backends/mlx/autoregressive.ts +0 -108
- package/src/backends/mlx/batch-group.ts +0 -1790
- package/src/backends/mlx/cache-attachment.ts +0 -67
- package/src/backends/mlx/cache-layout.ts +0 -31
- package/src/backends/mlx/checkpoint-state.ts +0 -53
- package/src/backends/mlx/continuation-persistence.ts +0 -106
- package/src/backends/mlx/continuation-request.ts +0 -43
- package/src/backends/mlx/continuation.ts +0 -77
- package/src/backends/mlx/diffusion.ts +0 -39
- package/src/backends/mlx/draft-target.ts +0 -32
- package/src/backends/mlx/evaluation.ts +0 -105
- package/src/backends/mlx/fill-append.ts +0 -45
- package/src/backends/mlx/full-kv-row-append.ts +0 -32
- package/src/backends/mlx/full-kv-row-donor.ts +0 -54
- package/src/backends/mlx/full-transitioning-kv-rows.ts +0 -65
- package/src/backends/mlx/gateway-binding.ts +0 -130
- package/src/backends/mlx/graph.ts +0 -38
- package/src/backends/mlx/kv-codec.ts +0 -9
- package/src/backends/mlx/kv-maintenance.ts +0 -133
- package/src/backends/mlx/kv-tensor-rows.ts +0 -212
- package/src/backends/mlx/memory-client.ts +0 -189
- package/src/backends/mlx/methods.ts +0 -90
- package/src/backends/mlx/model-prompt.ts +0 -164
- package/src/backends/mlx/model-serving.ts +0 -79
- package/src/backends/mlx/prefill-cohort.ts +0 -89
- package/src/backends/mlx/prefill-rows.ts +0 -200
- package/src/backends/mlx/prefill.ts +0 -33
- package/src/backends/mlx/projected-context-rows.ts +0 -72
- package/src/backends/mlx/request-policy.ts +0 -20
- package/src/backends/mlx/request-state-policy.ts +0 -41
- package/src/backends/mlx/rollback.ts +0 -89
- package/src/backends/mlx/row-sampling.ts +0 -49
- package/src/backends/mlx/serial-executor.ts +0 -242
- package/src/backends/mlx/speculative-group.ts +0 -359
- package/src/backends/mlx/speculative-round.ts +0 -161
- package/src/backends/mlx/speculative.ts +0 -114
- package/src/backends/mlx/state-rows.ts +0 -104
- package/src/backends/mlx/state-views.ts +0 -46
- package/src/backends/mlx/target-layout-capability.ts +0 -35
- package/src/backends/mlx/text-engine.ts +0 -73
- package/src/backends/mlx/transitioning-kv-rows.ts +0 -165
- package/src/chat-template.ts +0 -382
- package/src/cli.ts +0 -3168
- package/src/config.ts +0 -399
- package/src/contracts/completion.ts +0 -16
- package/src/contracts/execution.ts +0 -60
- package/src/contracts/generation.ts +0 -103
- package/src/contracts/host.ts +0 -7
- package/src/contracts/pi-provider.ts +0 -30
- package/src/contracts/pi.ts +0 -259
- package/src/contracts/prefix-cache.ts +0 -23
- package/src/contracts/resources.ts +0 -25
- package/src/contracts/sampling.ts +0 -23
- package/src/contracts/scheduling.ts +0 -45
- package/src/contracts/tsconfig.json +0 -14
- package/src/dataset/generators.ts +0 -1087
- package/src/dataset/index.ts +0 -12
- package/src/dataset/job.ts +0 -81
- package/src/dataset/llm.ts +0 -71
- package/src/dataset/registry.ts +0 -528
- package/src/diffusion/diffusion-generate.ts +0 -507
- package/src/download.ts +0 -505
- package/src/embed.ts +0 -77
- package/src/engine/admission.ts +0 -59
- package/src/engine/cancellation.ts +0 -38
- package/src/engine/engine.ts +0 -56
- package/src/engine/execution-coordinator.ts +0 -70
- package/src/engine/execution-plan.ts +0 -53
- package/src/engine/resources.ts +0 -53
- package/src/engine/scheduler.ts +0 -72
- package/src/engine/session.ts +0 -247
- package/src/eval/README.md +0 -130
- package/src/eval/ifeval.ts +0 -81
- package/src/eval/kl-prompts.ts +0 -29
- package/src/eval/kl.ts +0 -590
- package/src/eval/perplexity.ts +0 -164
- package/src/eval/quality-db.ts +0 -92
- package/src/eval/reference-logits.ts +0 -207
- package/src/eval/runner.ts +0 -124
- package/src/eval/score.ts +0 -49
- package/src/eval/tasks/bfcl.ts +0 -535
- package/src/eval/tasks/gsm8k.ts +0 -98
- package/src/eval/tasks/hashhop.ts +0 -139
- package/src/eval/tasks/humaneval.ts +0 -275
- package/src/eval/tasks/ifeval.ts +0 -525
- package/src/eval/tasks/mmlu.ts +0 -157
- package/src/eval/ultrafeedback.ts +0 -60
- package/src/evaldb.ts +0 -199
- package/src/expert-io.ts +0 -393
- package/src/expert-offload-build.ts +0 -77
- package/src/expert-offload.ts +0 -76
- package/src/expert-residency.ts +0 -1134
- package/src/expert-usage.ts +0 -415
- package/src/fill/echo-index.ts +0 -188
- package/src/fill/fill-session.ts +0 -452
- package/src/fill/proposal.ts +0 -68
- package/src/fill/schema-rows.ts +0 -506
- package/src/fill/tool-boundary.ts +0 -103
- package/src/fit.ts +0 -249
- package/src/generate.ts +0 -1346
- package/src/grammar.ts +0 -591
- package/src/harness-pi.ts +0 -184
- package/src/hf-push.ts +0 -628
- package/src/hub-rest.ts +0 -242
- package/src/index.ts +0 -63
- package/src/inference/denoising.ts +0 -17
- package/src/inference/draft-acceptance.ts +0 -41
- package/src/inference/draft-output.ts +0 -49
- package/src/inference/graph.ts +0 -33
- package/src/inference/prefill.ts +0 -39
- package/src/inference/rollback.ts +0 -7
- package/src/jobs/index.ts +0 -31
- package/src/jobs/job-entry.ts +0 -107
- package/src/jobs/task-client.ts +0 -19
- package/src/jobs/types.ts +0 -2
- package/src/kv-scheme.ts +0 -257
- package/src/kv-store.ts +0 -1099
- package/src/lab/README.md +0 -18
- package/src/lab/curve/curve-designer.html +0 -303
- package/src/lab/curve/curve-sampler.ts +0 -122
- package/src/lab/expert-trace/expert-trace.ts +0 -69
- package/src/lab/paged-kv/paged-kv-rows.ts +0 -83
- package/src/lab/paged-kv/paged-kv.ts +0 -270
- package/src/library.ts +0 -40
- package/src/lora.ts +0 -408
- package/src/md-modules.d.ts +0 -49
- package/src/media-fetch.ts +0 -442
- package/src/memory/article.ts +0 -558
- package/src/memory/chunk-validation.ts +0 -150
- package/src/memory/chunk.ts +0 -318
- package/src/memory/cluster.ts +0 -351
- package/src/memory/coverage.ts +0 -134
- package/src/memory/crosslink.ts +0 -0
- package/src/memory/db.ts +0 -253
- package/src/memory/entity.ts +0 -203
- package/src/memory/gate.ts +0 -187
- package/src/memory/history.ts +0 -152
- package/src/memory/ingest.ts +0 -335
- package/src/memory/model.ts +0 -183
- package/src/memory/normalize.ts +0 -671
- package/src/memory/parse.ts +0 -22
- package/src/memory/pipeline.ts +0 -275
- package/src/memory/prompts.ts +0 -65
- package/src/memory/query.ts +0 -334
- package/src/memory/reconcile.ts +0 -734
- package/src/memory/redirect.ts +0 -108
- package/src/memory/reindex.ts +0 -325
- package/src/memory/resolve.ts +0 -307
- package/src/memory/rest.ts +0 -245
- package/src/memory/route.ts +0 -272
- package/src/memory/schedule.ts +0 -165
- package/src/memory/stages.ts +0 -777
- package/src/memory/synthesize.ts +0 -1638
- package/src/memory/tools.ts +0 -749
- package/src/memory/vault.ts +0 -1194
- package/src/memory/wikify.ts +0 -1064
- package/src/mlx/array.ts +0 -388
- package/src/mlx/autograd.ts +0 -304
- package/src/mlx/checkpoint.ts +0 -149
- package/src/mlx/compile.ts +0 -168
- package/src/mlx/custom-vjp.ts +0 -188
- package/src/mlx/ffi.ts +0 -512
- package/src/mlx/materialize.ts +0 -23
- package/src/mlx/metal-kernel.ts +0 -159
- package/src/mlx/ops.ts +0 -1021
- package/src/mlx/quantized-rows.ts +0 -36
- package/src/mlx/token-bitmask.ts +0 -52
- package/src/mlx/turboquant-kv-decode.ts +0 -82
- package/src/mlx/turboquant-kv-inverse.ts +0 -122
- package/src/mlx/turboquant-ops.ts +0 -861
- package/src/mlx/turboquant-tables.ts +0 -237
- package/src/mmap.ts +0 -90
- package/src/model/artifact-identity.ts +0 -73
- package/src/model/batched-kv.ts +0 -235
- package/src/model/batched-mask.ts +0 -279
- package/src/model/batched-quant.ts +0 -212
- package/src/model/batched-quantized-kv.ts +0 -144
- package/src/model/batched-rotating-quant.ts +0 -353
- package/src/model/batched-rotating-state.ts +0 -149
- package/src/model/batched-rotating.ts +0 -338
- package/src/model/batched-row-storage.ts +0 -179
- package/src/model/batched-ssm.ts +0 -52
- package/src/model/batched-turboquant-kv.ts +0 -93
- package/src/model/compiled-decode.ts +0 -712
- package/src/model/decoded-kv-donor.ts +0 -12
- package/src/model/delayed-quantized-kv.ts +0 -72
- package/src/model/delayed-rotating-quantized-kv.ts +0 -93
- package/src/model/delayed-turboquant-kv.ts +0 -55
- package/src/model/diffusion-gemma.ts +0 -1026
- package/src/model/factory.ts +0 -189
- package/src/model/fingerprint.ts +0 -33
- package/src/model/flash-attention.ts +0 -694
- package/src/model/full-prefill-padding.ts +0 -56
- package/src/model/full-prefill-row.ts +0 -105
- package/src/model/gemma4-base.ts +0 -2351
- package/src/model/gemma4.ts +0 -1315
- package/src/model/generated/gemma4-12b.ts +0 -429
- package/src/model/generated/gemma4-26b.ts +0 -448
- package/src/model/generated/gemma4-e4b.ts +0 -717
- package/src/model/generated/index.ts +0 -18
- package/src/model/glm52-atlas.ts +0 -511
- package/src/model/glm52-cache.ts +0 -792
- package/src/model/glm52-config.ts +0 -262
- package/src/model/glm52-container.ts +0 -305
- package/src/model/glm52-coupling.ts +0 -388
- package/src/model/glm52-dsa.ts +0 -606
- package/src/model/glm52-expert-layout.ts +0 -253
- package/src/model/glm52-layout.ts +0 -152
- package/src/model/glm52-memory.ts +0 -500
- package/src/model/glm52-mla.ts +0 -792
- package/src/model/glm52-moe.ts +0 -223
- package/src/model/glm52-pilot.ts +0 -537
- package/src/model/glm52-reference.ts +0 -445
- package/src/model/glm52-residency.ts +0 -557
- package/src/model/glm52-resident-weights.ts +0 -135
- package/src/model/glm52-streamed-experts.ts +0 -453
- package/src/model/glm52-streamed-metal.ts +0 -610
- package/src/model/glm52-weights.ts +0 -503
- package/src/model/glm52.ts +0 -1132
- package/src/model/implementation.ts +0 -69
- package/src/model/kv-attention-view.ts +0 -67
- package/src/model/minicpm5.ts +0 -376
- package/src/model/profile.ts +0 -443
- package/src/model/qwen-append.ts +0 -12
- package/src/model/qwen-conv.ts +0 -52
- package/src/model/qwen3-delta-state.ts +0 -74
- package/src/model/qwen3-delta.ts +0 -451
- package/src/model/qwen3-moe.ts +0 -404
- package/src/model/qwen3-mrope.ts +0 -252
- package/src/model/qwen3.ts +0 -277
- package/src/model/qwen3_5-checkpoint.ts +0 -164
- package/src/model/qwen3_5.ts +0 -819
- package/src/model/rotating-kv-donor.ts +0 -35
- package/src/model/rotating-kv-layout.ts +0 -262
- package/src/model/rotating-row-transaction.ts +0 -35
- package/src/model/speculative-rotating-kv.ts +0 -101
- package/src/model/ssm-prefill-padding.ts +0 -39
- package/src/model/support.ts +0 -102
- package/src/model/trellis-balanced-scatter.ts +0 -51
- package/src/model/trellis-linear.ts +0 -672
- package/src/model/trellis-shared-m.ts +0 -151
- package/src/model/trellis-shared-scatter.ts +0 -144
- package/src/model/trellis-splitk-prefill.ts +0 -158
- package/src/model/trellis-tiled-prefill.ts +0 -136
- package/src/model/trellis-vector-expand.ts +0 -62
- package/src/model/trellis-wide-prefill.ts +0 -94
- package/src/model/turboquant-codec.ts +0 -83
- package/src/model/universal/archs.ts +0 -332
- package/src/model/universal/dense.ts +0 -612
- package/src/model/universal/modules.ts +0 -170
- package/src/model/universal/rope.ts +0 -381
- package/src/native/expert_io.c +0 -523
- package/src/native/frame_extract.swift +0 -140
- package/src/native-pack.ts +0 -162
- package/src/pi-provider.ts +0 -53
- package/src/pi-session.ts +0 -81
- package/src/pi-terminal.ts +0 -274
- package/src/pi-web.ts +0 -1932
- package/src/preflight.ts +0 -158
- package/src/prompt-cache.ts +0 -460
- package/src/quantize/allocator.ts +0 -627
- package/src/quantize/atomic-output.ts +0 -38
- package/src/quantize/calibration.ts +0 -181
- package/src/quantize/config-writer.ts +0 -145
- package/src/quantize/index.ts +0 -84
- package/src/quantize/job.ts +0 -162
- package/src/quantize/quantizer.ts +0 -666
- package/src/quantize/rotate.ts +0 -603
- package/src/quantize/safetensors-writer.ts +0 -249
- package/src/quantize/sensitivity.ts +0 -216
- package/src/quantize/trellis.ts +0 -586
- package/src/quantize/weight-transform.ts +0 -292
- package/src/registry.ts +0 -602
- package/src/runtime-config.ts +0 -81
- package/src/safetensors.ts +0 -158
- package/src/sampler.ts +0 -1011
- package/src/serve/admin-routes.ts +0 -184
- package/src/serve/assets/curve-terrain.html +0 -105
- package/src/serve/assets/training-inference-map.html +0 -575
- package/src/serve/aux-routes.ts +0 -132
- package/src/serve/batch-scheduler.ts +0 -8
- package/src/serve/checkpoint-identity.ts +0 -64
- package/src/serve/generation-gateway.ts +0 -496
- package/src/serve/isolate.ts +0 -609
- package/src/serve/kv-budget.ts +0 -14
- package/src/serve/lab-routes.ts +0 -341
- package/src/serve/lane-registry.ts +0 -45
- package/src/serve/model-admin-routes.ts +0 -155
- package/src/serve/model-binding.ts +0 -43
- package/src/serve/model-host.ts +0 -511
- package/src/serve/parent-application.ts +0 -56
- package/src/serve/prompt-response-trace.ts +0 -147
- package/src/serve/response-lease.ts +0 -24
- package/src/serve/session-search.ts +0 -326
- package/src/serve/static-routes.ts +0 -101
- package/src/server.ts +0 -1314
- package/src/spec/assistant-rows.ts +0 -92
- package/src/spec/assistant-source.ts +0 -126
- package/src/spec/cache-identity.ts +0 -22
- package/src/spec/deepspec-rows.ts +0 -29
- package/src/spec/deepspec-source.ts +0 -145
- package/src/spec/dflash-source.ts +0 -149
- package/src/spec/drafter.ts +0 -304
- package/src/spec/dspark/ab-stats.ts +0 -136
- package/src/spec/dspark/calibration.ts +0 -112
- package/src/spec/dspark/data-dflash.ts +0 -156
- package/src/spec/dspark/data.ts +0 -201
- package/src/spec/dspark/deepspec-module.ts +0 -776
- package/src/spec/dspark/generate-dflash.ts +0 -245
- package/src/spec/dspark/generate.ts +0 -290
- package/src/spec/dspark/loader.ts +0 -23
- package/src/spec/dspark/loss.ts +0 -213
- package/src/spec/dspark/module-dflash.ts +0 -560
- package/src/spec/dspark/module.ts +0 -540
- package/src/spec/dspark/quantize-drafter.ts +0 -91
- package/src/spec/dspark/sample.ts +0 -112
- package/src/spec/generate.ts +0 -276
- package/src/spec/glm52-mtp-graph.ts +0 -29
- package/src/spec/glm52-mtp-rows.ts +0 -132
- package/src/spec/glm52-mtp-source.ts +0 -317
- package/src/spec/glm52-mtp-state.ts +0 -33
- package/src/spec/ngram-source.ts +0 -204
- package/src/spec/projected-draft-rows.ts +0 -73
- package/src/spec/qwen-mtp-module.ts +0 -171
- package/src/spec/qwen-mtp-rows.ts +0 -219
- package/src/spec/qwen-mtp-source.ts +0 -383
- package/src/spec/qwen-mtp-state.ts +0 -30
- package/src/spec/serve-loop.ts +0 -585
- package/src/spec/source.ts +0 -215
- package/src/spec/two-model-rows.ts +0 -61
- package/src/spec/two-model.ts +0 -113
- package/src/ssd-cache.ts +0 -372
- package/src/ssd-durability.ts +0 -211
- package/src/tokenizer.ts +0 -335
- package/src/tool-approvals.ts +0 -131
- package/src/tool-call.ts +0 -695
- package/src/train/dataset.ts +0 -484
- package/src/train/diffusion-lora.ts +0 -216
- package/src/train/export.ts +0 -32
- package/src/train/flash-cce.ts +0 -1234
- package/src/train/forward.ts +0 -266
- package/src/train/fuse.ts +0 -243
- package/src/train/index.ts +0 -46
- package/src/train/job.ts +0 -205
- package/src/train/lora-params.ts +0 -254
- package/src/train/loss.ts +0 -1591
- package/src/train/merge.ts +0 -195
- package/src/train/optimizer.ts +0 -183
- package/src/train/prefix-shared.ts +0 -490
- package/src/train/rank.ts +0 -137
- package/src/train/segmented.ts +0 -1828
- package/src/train/steel-qmm-header.ts +0 -1461
- package/src/train/trainer.ts +0 -1221
- package/src/train/watch.ts +0 -542
- package/src/vision/diffusion-vision.ts +0 -620
- package/src/vision/embedder.ts +0 -168
- package/src/vision/preprocess.ts +0 -247
- package/src/vision/prompt.ts +0 -373
- package/src/vision/qwen3vl-preprocess.ts +0 -409
- package/src/vision/qwen3vl-prompt.ts +0 -196
- package/src/vision/qwen3vl-tower.ts +0 -555
- package/src/vision/siglip.ts +0 -599
- package/src/vision/video-frames.ts +0 -148
- package/src/web/app.html +0 -2143
- package/src/web/app.js +0 -5703
- package/src/web/skills/memory/SKILL.md +0 -120
- package/src/web/skills/web-research/SKILL.md +0 -46
- package/src/web/skills.ts +0 -97
- package/src/web/src/adapters-panel.ts +0 -288
- package/src/web/src/assistant.ts +0 -451
- package/src/web/src/chat.ts +0 -1057
- package/src/web/src/composer.ts +0 -959
- package/src/web/src/dataset.ts +0 -132
- package/src/web/src/finetune.ts +0 -267
- package/src/web/src/hub.ts +0 -428
- package/src/web/src/main.ts +0 -98
- package/src/web/src/markdown.ts +0 -0
- package/src/web/src/memory-panel.ts +0 -572
- package/src/web/src/model-picker.ts +0 -159
- package/src/web/src/palette.ts +0 -346
- package/src/web/src/protocol.ts +0 -26
- package/src/web/src/quantize.ts +0 -167
- package/src/web/src/rag.ts +0 -274
- package/src/web/src/sessions.ts +0 -469
- package/src/web/src/shell.ts +0 -804
- package/src/web/src/ui-catalog.ts +0 -78
- package/src/web/vendor/README.md +0 -61
- package/src/web-assets.ts +0 -47
- package/src/web-tools.ts +0 -478
- package/src/weights.ts +0 -255
- /package/src/{serve → server}/completion-sink.ts +0 -0
- /package/src/web/{icon.svg → public/icon.svg} +0 -0
- /package/src/web/{manifest.webmanifest → public/manifest.webmanifest} +0 -0
- /package/src/web/{vendor → public/vendor}/hljs-LICENSE +0 -0
|
@@ -1,970 +0,0 @@
|
|
|
1
|
-
# Investigation: HLG sampling — a piecewise tone curve on the logits
|
|
2
|
-
|
|
3
|
-
*2026-06-14. Question: can the structure of a piecewise nonlinear transfer
|
|
4
|
-
function (HLG, the HDR transfer function) be transplanted onto a logit
|
|
5
|
-
distribution as a sampling method, and if so, where do you place its pivot
|
|
6
|
-
(middle grey)? Design contract: [docs/archive/hlg-sampling.md](../design/hlg-sampling.md).
|
|
7
|
-
Code: `src/sampler.ts` (`applyHlg`, `makeSampler`). Harness:
|
|
8
|
-
`scripts/hlg-compare.ts`. Model under test: `gemma-4-e4b-it-OptiQ-4bit` on the
|
|
9
|
-
M4 Pro.*
|
|
10
|
-
|
|
11
|
-
> **Outcome.** Two passes. **Pass 1** (a *parametric* HLG-shaped curve, §1–9):
|
|
12
|
-
> top-anchored pivot holds; entropy/median collapse into word-salad because a
|
|
13
|
-
> permissive (lifting) toe inflates the 262k-vocab tail. **Pass 2** (the *literal*
|
|
14
|
-
> HLG transfer system, then the user's exact `HLGShaper`, §10): the full chain
|
|
15
|
-
> transplants onto sampling, but only with **two adaptations the source domain
|
|
16
|
-
> doesn't need** — (1) **windowed-anchor input** (LM logits are a spike-plus-tail,
|
|
17
|
-
> not an image's tonal spread, so min-max over the vocab collapses every candidate
|
|
18
|
-
> into the shoulder and elevates deep-tail junk in the mid), and (2) **the toe
|
|
19
|
-
> inverted** (a sampler crushes shadows; HLG describes them). With those, the
|
|
20
|
-
> `HLGShaper` is a **working, coherent replacement sampler** (e4b, W=5 /
|
|
21
|
-
> out_scale=18) exposing **four orthogonal knobs** — `s_m` (mid sharpness) · `A`
|
|
22
|
-
> (shoulder / confidence) · `x_floor`+toe (tail gate) · `L_W` (global γ) — where
|
|
23
|
-
> temperature gave one. Method note that recurs throughout: **distinct-2 rewards
|
|
24
|
-
> garbage**; read the text.
|
|
25
|
-
>
|
|
26
|
-
> **Final verdict (§14, after TWO premature verdicts were each corrected).** Pass 1
|
|
27
|
-
> concluded "control, not dominance" — a sweep-range + metric artifact (A swept
|
|
28
|
-
> only [0.2,0.8]; distinct-2 at small N). Widening every knob (runL) + self-BLEU
|
|
29
|
-
> **+ a semantic embedding metric** at N=10 (runM) + **reading the text** (runN)
|
|
30
|
-
> *looked like* a reversal: at A=0.01, s_m=0.05, self-BLEU 0.783 vs 0.672, text
|
|
31
|
-
> verified genuinely diverse and correct. **But the fresh-seed repeat (runO) did
|
|
32
|
-
> not replicate it** — the default's own self-BLEU swung +0.083 across seeds and at
|
|
33
|
-
> seed 5000 edged above the HLG cell, so N=10 variance (~0.08) swamps the effect.
|
|
34
|
-
> **Honest landing: HLG's loose-corner cells are *comparable* to the default on
|
|
35
|
-
> diversity at equal coherence — within N=10 noise — with at most a small,
|
|
36
|
-
> consistent embedding edge below the measurement resolution. Neither "dominance"
|
|
37
|
-
> nor "negative" survives; it's a wash at this N.** Meta-result: the fresh-seed
|
|
38
|
-
> repeat caught BOTH premature verdicts within one run each — sweep wide, use ≥2
|
|
39
|
-
> metrics, repeat seeds, read the text.
|
|
40
|
-
|
|
41
|
-
## TL;DR
|
|
42
|
-
|
|
43
|
-
- **The transplant is real and cheap.** One piecewise curve (`applyHlg`),
|
|
44
|
-
model-agnostic, O(V) per token, replaces the temperature scaling step. Bit-exact
|
|
45
|
-
degeneracy to temperature is the safety anchor; flag-off is byte-identical.
|
|
46
|
-
- **HLG is a replacement sampler**, not a layer: `if (hlg.enabled)` → the curve
|
|
47
|
-
is the whole post-logits step; `else` → top_p, top_k, temperature (unchanged).
|
|
48
|
-
- **Pivot = top-anchored.** Of the three middle-grey methods, only top-anchored
|
|
49
|
-
survives as a drop-in replacement. Entropy and median place the pivot near the
|
|
50
|
-
peak on confident distributions, dumping the whole distribution into the
|
|
51
|
-
lifting toe → near-uniform over 262k tokens → garbage.
|
|
52
|
-
- **Mild positive signal where it should appear:** HLG raises lexical diversity
|
|
53
|
-
on open-ended prompts (brainstorm 0.78 → 0.88, continuation 0.75 → 0.86) while
|
|
54
|
-
leaving the confident factual answer untouched (0.30). The concrete win: it
|
|
55
|
-
broke e4b out of always opening the paperclip list with "SIM Card Ejector".
|
|
56
|
-
- **Method lesson:** distinct-2 rewards incoherence; entropy/median scored
|
|
57
|
-
~1.0 *because* they were broken. Diversity metrics must be paired with a
|
|
58
|
-
coherence gate (perplexity / NLL under the base recipe).
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## 1. The idea — a cross-domain transplant
|
|
63
|
-
|
|
64
|
-
Temperature is a single global slope on the logits (`logit / T`). Its limitation
|
|
65
|
-
is a coupling: the only way it loosens the model's grip on the top token is by
|
|
66
|
-
raising `T`, which simultaneously lifts the tail. One number can't move two
|
|
67
|
-
regions independently.
|
|
68
|
-
|
|
69
|
-
Nonlinear transfer functions in signal/color encoding solve the analogous
|
|
70
|
-
problem with a **piecewise** curve that shapes the low, middle, and high range
|
|
71
|
-
under separate constraints. HLG (Hybrid Log-Gamma, ARIB STD-B67 / ITU-R BT.2100)
|
|
72
|
-
is the specific structure lifted here: a gamma segment for the lower range and a
|
|
73
|
-
log segment for the upper range, joined at a breakpoint. A logit distribution is
|
|
74
|
-
another value distribution, so the apparatus carries over. Whether it *helps* is
|
|
75
|
-
an empirical question — settled by measurement in this domain, not by the
|
|
76
|
-
structure's pedigree in its original one.
|
|
77
|
-
|
|
78
|
-
Mapped onto the three regions of a token distribution:
|
|
79
|
-
|
|
80
|
-
- **High-probability region** (confident tokens) → **shoulder**: roll the slope
|
|
81
|
-
off so the top compresses toward its neighbours ("won't be so fixed on that
|
|
82
|
-
answer").
|
|
83
|
-
- **Mid-probability region** (novelty/interest) → **gain**: control the slope.
|
|
84
|
-
- **Low-probability tail** → **toe**: shape it smoothly rather than hard-clipping
|
|
85
|
-
(top_p/top_k) or inflating it (high temperature).
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## 2. The curve
|
|
90
|
-
|
|
91
|
-
Operate in log-probability space. Let `ℓ_i` be each token's log-prob and `μ` the
|
|
92
|
-
pivot. With centered coordinate `z = ℓ_i − μ`, remap with a C¹ log-toe /
|
|
93
|
-
linear-mid / log-shoulder curve:
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
⎧ −m·w − m·β_t·ln(1 + (−z − w)/β_t) z < −w (toe / shadows)
|
|
97
|
-
g(z) = ⎨ m·z |z| ≤ w (gain / mids)
|
|
98
|
-
⎩ m·w + m·β_h·ln(1 + ( z − w)/β_h) z > w (shoulder / highlights)
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Output logits `ℓ'_i = g(z_i)`, then the existing categorical draw. Properties:
|
|
102
|
-
|
|
103
|
-
- **Monotone in ℓ** ⇒ ranking-preserving (argmax invariant). It's a contrast/tone
|
|
104
|
-
operation, not a re-ranker.
|
|
105
|
-
- **Slope** is `m` at the pivot and decays as `m·β/(β + d)` a distance `d` past
|
|
106
|
-
each knot — continuous, always positive.
|
|
107
|
-
- **Degeneracy = safety anchor:** `m=1`, rolloff off ⇒ `g(z)=z` (identity,
|
|
108
|
-
bit-exact); rolloff off, any `m` ⇒ `g(z)=m·z` (temperature `T=1/m`, bit-exact).
|
|
109
|
-
- **`-inf` safe:** a masked token lands in the toe branch and stays `-inf`.
|
|
110
|
-
|
|
111
|
-
Knobs (all in nats): `gain` m (mid slope; folds from temperature as m=1/T by
|
|
112
|
-
default, explicit override allowed), `width` w (mid half-width), `shoulder` β_h,
|
|
113
|
-
`toe` β_t, plus the pivot and its offset.
|
|
114
|
-
|
|
115
|
-
### The critical, non-obvious property: the toe is *permissive*
|
|
116
|
-
|
|
117
|
-
"Don't crush the blacks" means the toe slope is **less** than linear, so deep-tail
|
|
118
|
-
tokens are pulled *up* toward a floor at `−m·w` rather than suppressed. This is
|
|
119
|
-
the opposite of top_p/top_k (hard cut) and gentler than temperature. It is the
|
|
120
|
-
mechanism behind the central finding below: as a replacement for the hard
|
|
121
|
-
cutoffs, the toe under-suppresses the tail, and only the pivot's distance below
|
|
122
|
-
the peak keeps the top token dominant.
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## 3. Architecture — a replacement sampler
|
|
127
|
-
|
|
128
|
-
`makeSampler` (`src/sampler.ts`) branches:
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
if (hlg.enabled) → scaled = applyHlg(lp, params) // the whole methodology;
|
|
132
|
-
// toe does the tail control
|
|
133
|
-
else → top_p, then top_k, then mulScalar(1/T) // exactly what we used to do
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Mutually exclusive. When HLG is on, top_p/top_k are **not** applied — the smooth
|
|
137
|
-
toe is their replacement, not a layer on top. Greedy (`temperature 0`) returns
|
|
138
|
-
argmax in both branches (a monotone curve can't move the argmax), so HLG is a
|
|
139
|
-
no-op there by construction. Flag-off (`hlg` undefined) is byte-identical to the
|
|
140
|
-
prior sampler.
|
|
141
|
-
|
|
142
|
-
> Evolution note: earlier experiment runs (0, A, B below) were built before the
|
|
143
|
-
> clean replacement restructure — they either passed no cutoffs (so HLG ran
|
|
144
|
-
> alone by accident) or kept top_p/top_k under HLG (layering). Run C is the first
|
|
145
|
-
> true replacement test and is where the architecture was finalised.
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## 4. Three pivots (middle grey)
|
|
150
|
-
|
|
151
|
-
The same curve, centered three ways (`hlgPivotBase` in `src/sampler.ts`), applied
|
|
152
|
-
to the full logprob vector:
|
|
153
|
-
|
|
154
|
-
1. **`top`** — μ = ℓmax − `offset`. Middle grey a fixed number of nats below the
|
|
155
|
-
peak. One `max` reduction.
|
|
156
|
-
2. **`entropy`** — μ = Σ p·ℓ = −H. The distribution's center of mass in tonal
|
|
157
|
-
space ("auto-exposure"). One dot product.
|
|
158
|
-
3. **`median`** — μ = the logprob at the 50% cumulative-mass boundary
|
|
159
|
-
("auto-levels" / histogram median). Reuses the sort top-p already does.
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## 5. Implementation status
|
|
164
|
-
|
|
165
|
-
- **Piece 1** — pure `applyHlg(lp, params)` + degeneracy/monotonicity/`-inf`
|
|
166
|
-
tests. `src/sampler.ts`, `tests/hlg-sampling.test.ts`.
|
|
167
|
-
- **Piece 2** — wired into `makeSampler`; CLI flags `--hlg-sampling` +
|
|
168
|
-
`--hlg-width/-shoulder/-toe/-pivot-offset`; `ServerOptions.hlg`; per-request
|
|
169
|
-
`hlg` object on `ChatRequest` resolved by `resolveHlg` in `toOptions`.
|
|
170
|
-
- **Piece 4 (brought forward)** — all three pivot modes + the explicit `gain`
|
|
171
|
-
override; `HlgConfig.gain`/`pivot` widened. `--hlg-pivot` CLI flag still TODO.
|
|
172
|
-
- **Replacement architecture** — finalised (Section 3).
|
|
173
|
-
- Tests: **14/14 green**, tsc clean. Pure (no weights): bit-exact degeneracy to
|
|
174
|
-
temperature/identity, monotone + ranking-preserving, `-inf` safe, three pivots
|
|
175
|
-
monotone+finite+distinct, wiring neutrality (identity config ≡ plain
|
|
176
|
-
temperature, rolloff-on diverges).
|
|
177
|
-
|
|
178
|
-
Harness: `scripts/hlg-compare.ts` — runs a fixed prompt set × sampling patterns,
|
|
179
|
-
K samples each, reports distinct-2 (after stripping the shared chat-template
|
|
180
|
-
prefix) + unique-count + length, and prints the samples. The model's recommended
|
|
181
|
-
recipe is read from its `generation_config.json` (e4b: temp 1.0 · top_p 0.95 ·
|
|
182
|
-
top_k 64).
|
|
183
|
-
|
|
184
|
-
---
|
|
185
|
-
|
|
186
|
-
## 6. Experiments
|
|
187
|
-
|
|
188
|
-
All on `gemma-4-e4b-it-OptiQ-4bit`, K=4 samples/cell (greedy n=1), maxTokens 80,
|
|
189
|
-
seeds 1234–1237. distinct-2 = unique bigrams / total bigrams pooled across the K
|
|
190
|
-
samples; higher = more lexically varied (**but see the garbage caveat in Run C**).
|
|
191
|
-
Full transcripts in the appendices.
|
|
192
|
-
|
|
193
|
-
### 6.1 Run 0 — the wrong baseline (Appendix A)
|
|
194
|
-
|
|
195
|
-
Patterns: `greedy`, `temp-0.7`, `temp-1.2`, `hlg-default`, `hlg-rolloff` —
|
|
196
|
-
**temperature alone, no top_p/top_k, and not the model's recommended temp.** This
|
|
197
|
-
was wrong on two counts (the recommended recipe gates the tail with top_p
|
|
198
|
-
0.95/top_k 64, and the recommended temp is 1.0, not 0.7/1.2). distinct-2 here was
|
|
199
|
-
computed *without* the prefix strip, so it is not comparable to later runs.
|
|
200
|
-
|
|
201
|
-
| prompt | greedy | temp-0.7 | temp-1.2 | hlg-default | hlg-rolloff |
|
|
202
|
-
|---|---|---|---|---|---|
|
|
203
|
-
| creative | 0.97 | 0.85 | 0.95 | 0.88 | 0.88 |
|
|
204
|
-
| brainstorm | 0.97 | 0.69 | 0.59 | 0.63 | 0.68 |
|
|
205
|
-
| factual | 1.00 | 0.30 | 0.30 | 0.30 | 0.30 |
|
|
206
|
-
| reasoning | 0.87 | 0.28 | 0.34 | 0.30 | 0.34 |
|
|
207
|
-
| continuation | 0.97 | 0.84 | 0.87 | 0.83 | 0.83 |
|
|
208
|
-
|
|
209
|
-
What it taught: the prompts + temp ≤ 1.2 never put e4b into HLG's target regime
|
|
210
|
-
(confident prompts collapse everything, including temp-1.2; open prompts give
|
|
211
|
-
temp-1.2 free diversity with no visible downside). And the baseline must be the
|
|
212
|
-
model's own recipe, not an arbitrary temperature. Both corrected after.
|
|
213
|
-
|
|
214
|
-
### 6.2 Run A — recommended control; layered vs replace (Appendix B)
|
|
215
|
-
|
|
216
|
-
Patterns hold the recommended recipe (temp 1.0 · top_p 0.95 · top_k 64) and vary
|
|
217
|
-
the curve. `rec+hlg` = recipe **with** HLG layered on top of top_p/top_k.
|
|
218
|
-
`hlg-replace` = recipe temp, **no** cutoffs, HLG's toe doing tail control.
|
|
219
|
-
distinct-2 here and after is prefix-stripped.
|
|
220
|
-
|
|
221
|
-
| prompt | recommended | rec+hlg | hlg-replace |
|
|
222
|
-
|---|---|---|---|
|
|
223
|
-
| creative | 0.90 | 0.89 | 0.90 |
|
|
224
|
-
| brainstorm | 0.78 | **0.88** | **0.88** |
|
|
225
|
-
| factual | 0.30 | 0.30 | 0.30 |
|
|
226
|
-
| reasoning | 0.28 | 0.32 | 0.34 |
|
|
227
|
-
| continuation | 0.75 | **0.84** | **0.86** |
|
|
228
|
-
|
|
229
|
-
The positive signal first appears: HLG raises open-ended diversity (brainstorm
|
|
230
|
-
+0.10, continuation +0.09–0.11) and leaves factual locked at 0.30. Concrete win —
|
|
231
|
-
`rec+hlg` broke the "SIM Card Ejector" rut on item 1: *"**Improvised Zipper
|
|
232
|
-
Pull:** If the tab or pull on a zipper breaks off…"*. Cost first appears in
|
|
233
|
-
`hlg-replace`: one frayed tail token (*"a cartographer's stain—**aving
|
|
234
|
-
purpose**"*).
|
|
235
|
-
|
|
236
|
-
### 6.3 Run B — gain variants (Appendix C)
|
|
237
|
-
|
|
238
|
-
Recipe held fixed (top_p/top_k kept); HLG layered with explicit gains and varied
|
|
239
|
-
edges, pivot top. Confirms the open-ended diversity gain is robust across knobs
|
|
240
|
-
and never disturbs factual.
|
|
241
|
-
|
|
242
|
-
| prompt | standard | hlg-rolloff | hlg-midboost | hlg-soft | hlg-full |
|
|
243
|
-
|---|---|---|---|---|---|
|
|
244
|
-
| creative | 0.90 | **0.96** | 0.90 | 0.94 | 0.92 |
|
|
245
|
-
| brainstorm | 0.78 | **0.88** | 0.82 | **0.88** | **0.88** |
|
|
246
|
-
| factual | 0.30 | 0.30 | 0.30 | 0.30 | 0.30 |
|
|
247
|
-
| reasoning | 0.28 | 0.31 | 0.32 | 0.31 | 0.32 |
|
|
248
|
-
| continuation | 0.75 | **0.82** | 0.83 | 0.84 | **0.85** |
|
|
249
|
-
|
|
250
|
-
### 6.4 Run C — the pivot comparison, as a true replacement (Appendix D) — DECISIVE
|
|
251
|
-
|
|
252
|
-
`standard` = recipe. `hlg-top` / `hlg-entropy` / `hlg-median` = **replacement**
|
|
253
|
-
sampler (no top_p/top_k), one curve (gain 1.0, width 3, shoulder 4, toe 4), only
|
|
254
|
-
the pivot placement changes (offset 6 for top; 0 for entropy/median).
|
|
255
|
-
|
|
256
|
-
| prompt | standard | hlg-top | hlg-entropy | hlg-median |
|
|
257
|
-
|---|---|---|---|---|
|
|
258
|
-
| creative | 0.90 | 0.95 | 0.99 ⚠️ | 1.00 ⚠️ |
|
|
259
|
-
| brainstorm | 0.78 | 0.91 | 0.99 ⚠️ | 1.00 ⚠️ |
|
|
260
|
-
| factual | 0.30 | 0.55 | 0.99 ⚠️ | 1.00 ⚠️ |
|
|
261
|
-
| reasoning | 0.28 | 0.35 | 1.00 ⚠️ | 0.99 ⚠️ |
|
|
262
|
-
| continuation | 0.75 | 0.88 | 1.00 ⚠️ | 1.00 ⚠️ |
|
|
263
|
-
|
|
264
|
-
⚠️ = the score is **garbage**, not diversity.
|
|
265
|
-
|
|
266
|
-
- `hlg-top` is coherent and varied. Continuation #3: *"…how it acts like a coral
|
|
267
|
-
reef—brilliantly shaped in its fleeting, vibrant bloom, only to be slowly
|
|
268
|
-
colonized and ultimately obscured by the perpetual, grinding algae of the
|
|
269
|
-
new…"*
|
|
270
|
-
- `hlg-entropy` continuation #1: *"'The Aideang strane簿 sche tup de uman tuturí
|
|
271
|
-
namiatório hidadierá escult প্রশ্ন p a'i nto'…"*
|
|
272
|
-
- `hlg-median` factual #2: *"The जैसे overtakehouses仰рачи倾olver漏洞格局 ᵛ<br
|
|
273
|
-
Zweigen graisseuse.apparent échelle saisonAlloc Lieu en cours rotation follicle
|
|
274
|
-
orbit 結構"*
|
|
275
|
-
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
## 7. Findings
|
|
279
|
-
|
|
280
|
-
### 7.1 The pivot is top-anchored
|
|
281
|
-
|
|
282
|
-
As a replacement sampler, **only the top-anchored pivot is viable**. Entropy and
|
|
283
|
-
median collapse to multilingual token-salad on every prompt.
|
|
284
|
-
|
|
285
|
-
### 7.2 Why — the toe permissiveness × pivot offset (the mechanism)
|
|
286
|
-
|
|
287
|
-
The toe lifts the deep tail toward a floor at `−m·w` instead of suppressing it. In
|
|
288
|
-
replacement mode (no hard cutoffs) the only thing keeping the top token dominant
|
|
289
|
-
is how far below the peak the pivot sits, because that sets where the toe floor
|
|
290
|
-
lands and therefore the total tail mass over a 262k vocab. With the Run C params
|
|
291
|
-
(m=1, w=3, β_t=4):
|
|
292
|
-
|
|
293
|
-
- **`hlg-top`**, μ = ℓmax − 6: top token maps to g ≈ +5.2, a deep-tail token
|
|
294
|
-
(ℓmax − 20) to g ≈ −8.3 → gap ≈ 13.5 nats. Tail mass ≈ 262k·e^−13.5 ≈ **0.4×**
|
|
295
|
-
the peak → top stays dominant → coherent.
|
|
296
|
-
- **`hlg-entropy` / `hlg-median`**, μ ≈ ℓmax (both land near the peak on a
|
|
297
|
-
confident distribution): the entire distribution falls into the toe; a deep-tail
|
|
298
|
-
token maps ~9.6 nats below the top → tail mass ≈ 262k·e^−9.6 ≈ **17×** the peak
|
|
299
|
-
→ near-uniform over the vocab → garbage.
|
|
300
|
-
|
|
301
|
-
The 6-nat offset is the difference between tail-mass 0.4 (coherent) and 17
|
|
302
|
-
(salad). The adaptive pivots have no equivalent "push the floor down" lever, so
|
|
303
|
-
they place middle grey too high to survive a replacement. (They would likely
|
|
304
|
-
behave layered on top of top_p/top_k, or given their own downward offset — future
|
|
305
|
-
work, not a drop-in replacement.)
|
|
306
|
-
|
|
307
|
-
### 7.3 distinct-2 rewards garbage
|
|
308
|
-
|
|
309
|
-
Entropy/median scored ~1.0 distinct-2 *because* they emit random unique tokens.
|
|
310
|
-
Lexical-diversity metrics reward incoherence and must be paired with a coherence
|
|
311
|
-
gate (e.g. NLL/perplexity of the generation under the model's standard recipe, or
|
|
312
|
-
a fraction-of-in-vocab/in-language check). This directly shapes the Piece 5
|
|
313
|
-
diversity lens.
|
|
314
|
-
|
|
315
|
-
### 7.4 The positive signal (the thesis, mildly confirmed)
|
|
316
|
-
|
|
317
|
-
Across Runs A and B, HLG consistently raises open-ended diversity (brainstorm
|
|
318
|
-
0.78 → 0.88, continuation 0.75 → 0.86) while leaving the confident factual answer
|
|
319
|
-
at 0.30 — more variation where it helps, none where it shouldn't. The decoupling
|
|
320
|
-
the thesis predicts does appear; it is mild at default knobs.
|
|
321
|
-
|
|
322
|
-
### 7.5 Costs / caveats
|
|
323
|
-
|
|
324
|
-
- Even `hlg-top` leaks a trickle (stray "ten正常的 yards", "schuman") — the toe is
|
|
325
|
-
leakier than hard cutoffs.
|
|
326
|
-
- `hlg-top` loosened the factual answer more than desired (0.30 → 0.55, "the
|
|
327
|
-
planet' adorable axis"). A confident answer probably shouldn't be varied at all.
|
|
328
|
-
- The confident prompts (factual/reasoning) never trigger temperature's
|
|
329
|
-
garbage-tail failure mode on e4b, so this model can't showcase the *full*
|
|
330
|
-
decoupling advantage — a less confident model or longer generations might.
|
|
331
|
-
|
|
332
|
-
---
|
|
333
|
-
|
|
334
|
-
## 8. Current state
|
|
335
|
-
|
|
336
|
-
- Curve in place, replacement architecture finalised, three pivots implemented +
|
|
337
|
-
tested (14/14 green, tsc clean).
|
|
338
|
-
- Pivot question answered: **top-anchored**.
|
|
339
|
-
- Harness (`scripts/hlg-compare.ts`) reusable and reads each model's recommended
|
|
340
|
-
recipe.
|
|
341
|
-
|
|
342
|
-
---
|
|
343
|
-
|
|
344
|
-
## 9. Next steps
|
|
345
|
-
|
|
346
|
-
1. **Shape the toe** (the "shape the pieces" step): on the top-anchored pivot,
|
|
347
|
-
sweep `β_t` (smaller = harder tail suppression) and the offset `c` to stop the
|
|
348
|
-
residual leak without killing the open-ended diversity gain. This is the
|
|
349
|
-
calibration that sets the shipped default.
|
|
350
|
-
2. **Coherence-gated diversity metric** for Piece 5: distinct-n + an NLL/perplexity
|
|
351
|
-
gate so garbage can't win. Add as `src/eval/tasks/diversity.ts`.
|
|
352
|
-
3. **Capability guardrail**: `bun scripts/eval.ts capability` with the chosen
|
|
353
|
-
top-anchored config vs off — confirm GSM8K/BFCL/etc. don't regress.
|
|
354
|
-
4. **Decide entropy/median's fate**: either retire them for replacement use, or
|
|
355
|
-
give them a downward offset / pair them with top_p/top_k and re-test.
|
|
356
|
-
5. `--hlg-pivot` CLI flag (the last bit of Piece 4).
|
|
357
|
-
6. Batched neutrality test (Piece 3) — plumbing already live via the shared
|
|
358
|
-
sampler.
|
|
359
|
-
|
|
360
|
-
---
|
|
361
|
-
|
|
362
|
-
## 10. Pass 2 — the full HLG transfer system → the working HLGShaper
|
|
363
|
-
|
|
364
|
-
Pass 1 used an HLG-*shaped* parametric curve. Pass 2 implemented the **literal**
|
|
365
|
-
HLG system (BT.2100) and then the user's exact `HLGShaper`, end-to-end. Code:
|
|
366
|
-
`src/sampler.ts` (`applyHlgOetf`, `applyHlgEotf`, `applyHlgPipeline`,
|
|
367
|
-
`applyHlgShaper`). All A/B against the model's **default recipe, untouched** (the
|
|
368
|
-
only thing taken from the standard side); the HLG side is a full **replacement**
|
|
369
|
-
(no temp/top_p/top_k). Runs D–G in `hlg-runs/`.
|
|
370
|
-
|
|
371
|
-
**The arc, and what each step taught:**
|
|
372
|
-
|
|
373
|
-
1. **Literal OETF, replacement** (runD). `E' = √(3E)` below 1/12, `a·ln(12E−b)+c`
|
|
374
|
-
above; sample ∝ V. **Semi-garbage.** The √ toe is HLG's *precision* curve — it
|
|
375
|
-
**lifts** the tail (√ of 1e-6 is 1e-3); over 262k tokens that floods the draw.
|
|
376
|
-
2. **EOTF (decode) vs OETF (encode)** (runE). The inverse-OETF low branch `E'²/3`
|
|
377
|
-
**squares the tail down** — coherent where the OETF flooded. So the *direction*
|
|
378
|
-
matters, and the **OOTF on a grayscale (single-"pixel") distribution reduces
|
|
379
|
-
to `E^γ` = temperature** (no colour channels for luminance to couple), with
|
|
380
|
-
`γ = 1.2+0.42·log10(L_W/1000)`. The "system-level" part has no sampling analog.
|
|
381
|
-
3. **Full pipeline `α·E'^γ`** (runF predecessor). As pure logits with `α=5` over
|
|
382
|
-
262k → near-uniform (the flat floor outweighs the top): `α` must exceed
|
|
383
|
-
`ln(vocab) ≈ 12.5` just for the top to win.
|
|
384
|
-
4. **The exact HLGShaper** (runF/runG). min-max input → still garbage, but
|
|
385
|
-
*prompt-dependent* this time, with coherent fragments fighting through. Cause:
|
|
386
|
-
**min-max over the 262k vocab collapses every real candidate into the shoulder**
|
|
387
|
-
(`x ≥ 0.9`, log-compressed together) while the **mid band `s_m` elevates is
|
|
388
|
-
tokens 15–22 nats below the top = noise**. The curve was fine; the *signal* was
|
|
389
|
-
wrong.
|
|
390
|
-
|
|
391
|
-
**The two adaptations the source domain doesn't need** (both found empirically):
|
|
392
|
-
|
|
393
|
-
- **Windowed-anchor input** instead of min-max: `x = clamp((ℓ−ℓmax)/W + 1, 0, 1)`.
|
|
394
|
-
The top `W` nats of real candidates span the curve; deeper tokens clamp into the
|
|
395
|
-
toe. (LM logits are a spike-plus-tail, not an image's tonal spread.)
|
|
396
|
-
- **The toe inverted**: a **cubic** `e·x³+f·x²` that suppresses to 0, not HLG's
|
|
397
|
-
`√` that lifts. (A sampler crushes shadows; HLG describes them.)
|
|
398
|
-
|
|
399
|
-
**Result (runF/runG).** With `W=5, out_scale=18` the HLGShaper is a **working,
|
|
400
|
-
coherent replacement sampler** — vivid, varied, factually/arithmetically correct,
|
|
401
|
-
no salad (e.g. continuation: *"…it doesn't archive; it re-weaves… the vibrant
|
|
402
|
-
threads of joy are often knotted with the dull grey of forgotten anxiety…"*).
|
|
403
|
-
Comparable to the default recipe on both coherence and diversity.
|
|
404
|
-
|
|
405
|
-
**Knob sweep (runG).** The four orthogonal knobs are live — `s_m` (mid sharpness),
|
|
406
|
-
`A` (shoulder/confidence), `x_floor`+toe (tail gate), `L_W` (global γ) — **where
|
|
407
|
-
temperature gave one.** But the **coherent slice of that 4-D space is narrow**:
|
|
408
|
-
loosening toward more diversity (`W=7, out_scale=13, A=0.6`) tipped straight back
|
|
409
|
-
into garbage, because a *smooth* tail over 262k stays coherent only under
|
|
410
|
-
aggressive gating (nothing hard-cuts like top-k). So the chain *works*, but the
|
|
411
|
-
sweep did **not** yet show it beating temperature on diversity.
|
|
412
|
-
|
|
413
|
-
**Open / next.** Probe the corner the loose run missed: keep the **toe/x_floor
|
|
414
|
-
gate aggressive** (tail dead) while loosening **A + out_scale** (flatten the top,
|
|
415
|
-
spread the survivors) — decoupling "kill the tail" from "loosen the top," the
|
|
416
|
-
original thesis. Plus a coherence-gated diversity metric (distinct-n is useless —
|
|
417
|
-
it scores the salad ~1.0). Default stays **off**; this is a novel knob, never a
|
|
418
|
-
silent change to the sampler.
|
|
419
|
-
|
|
420
|
-
---
|
|
421
|
-
|
|
422
|
-
## 11. Pass 3 — fencing the exposure axes (clean single-variable sweeps)
|
|
423
|
-
|
|
424
|
-
The runG sweep was confounded: B-sharp→B-loose moved **three** knobs at once
|
|
425
|
-
(`W` 5→7, `out_scale` 18→13, `A` .35→.60), so its collapse couldn't be
|
|
426
|
-
attributed. Two fixes made the knobs separable:
|
|
427
|
-
|
|
428
|
-
**Decouple `out_scale` from `W`.** It had been hand-retuned (12→18) when `W`
|
|
429
|
-
went 10→5 — a coupling that confounds every comparison. Now `out_scale`
|
|
430
|
-
**auto-derives** so the top-1-to-reference final-logit gap equals a fixed
|
|
431
|
-
`target_gap`, *independent of W* (the reference token sits `ref_gap` nats below
|
|
432
|
-
the top; its post-shape value is the scalar curve evaluated in JS — no device
|
|
433
|
-
cost). Calibrated so `W=5 ⇒ out_scale≈18` (the known-good); it rises to ≈35 at
|
|
434
|
-
W=8 to hold the same effective sharpness. `W` is now a clean 1-D variable.
|
|
435
|
-
|
|
436
|
-
**The factual prompt is the canary** — it has the sharpest spike-to-tail
|
|
437
|
-
structure, so it breaks last; read it for the *first junk-token position*, not
|
|
438
|
-
just pass/fail.
|
|
439
|
-
|
|
440
|
-
**W-sweep (runH; W ∈ {4..8}, all else fixed at A=.35 / s_m=.7 / L_W=1200 /
|
|
441
|
-
out_scale auto):**
|
|
442
|
-
|
|
443
|
-
| W | out_scale | factual canary |
|
|
444
|
-
| --- | --- | --- |
|
|
445
|
-
| 4 | 15.0 | **junk** (sample 2 breaks at word 3) — below the floor |
|
|
446
|
-
| 5 | 18.3 | clean ×3 |
|
|
447
|
-
| 6 | 23.6 | clean ×3 |
|
|
448
|
-
| 7 | 29.4 | clean ×3 |
|
|
449
|
-
| 8 | 35.4 | clean ×3 |
|
|
450
|
-
|
|
451
|
-
- **Bad wall at W=4, basin W=5–8.** The cliff is a *floor* (too-narrow window),
|
|
452
|
-
not a high-W ceiling. Within the basin, diversity is **nearly constant** (same
|
|
453
|
-
~3 creative openings / continuation framings at every W) because auto-`out_scale`
|
|
454
|
-
holds sharpness fixed. So **`W` is a coherence-floor knob, not a diversity
|
|
455
|
-
knob** — it sets *which* candidates are eligible, not how spread the draw is.
|
|
456
|
-
- The W-sweep left two suspects for the runG (B-loose) collapse (`A` and
|
|
457
|
-
`out_scale` both also moved). The **A-sweep (runI; A ∈ {.20...60}, W=6 fixed,
|
|
458
|
-
out_scale auto)** resolves it: the **factual canary is clean at every A,
|
|
459
|
-
including `A=.60`**. So neither `W` nor `A` killed B-loose — **by elimination
|
|
460
|
-
the killer was the manually-set `out_scale=13`** (< half the ~29 the
|
|
461
|
-
auto-derivation gives W=7). The decoupling wasn't just *a* confound; it was
|
|
462
|
-
*the* one. (This corrects an earlier draft that blamed `A`.)
|
|
463
|
-
|
|
464
|
-
**Corrected knob model** (after fencing W and A):
|
|
465
|
-
- `out_scale` / `target_gap` = **sharpness — the load-bearing knob** (too low →
|
|
466
|
-
garbage, as in B-loose; now auto-derived → robust) and **the diversity lever**.
|
|
467
|
-
- `W` = **coherence floor** (bad wall at 4; robust ≥ 5).
|
|
468
|
-
- `A` = **robust across .20–.60** — modulates framing subtly, does NOT break
|
|
469
|
-
coherence. *Not* the dangerous knob after all.
|
|
470
|
-
- `s_m`, `L_W` — untested.
|
|
471
|
-
|
|
472
|
-
With `W` and `A` both fenced as wide basins, the shaper is **robust, not a
|
|
473
|
-
knife-edge** — the runG "narrow regime" was the `out_scale` confound. Temperature
|
|
474
|
-
collapses all of these into one knob; here they separate. The single axis that
|
|
475
|
-
decides whether the curve beats temperature on diversity is **`target_gap`** (the
|
|
476
|
-
sharpness lever), swept next — canary-gated, at fixed W=6 / A=.35.
|
|
477
|
-
|
|
478
|
-
---
|
|
479
|
-
|
|
480
|
-
## 12. The automated knob map — and the verdict
|
|
481
|
-
|
|
482
|
-
`scripts/hlg-map.ts` — two-stage (cheap factual-canary **coherence** gate →
|
|
483
|
-
**diversity** on survivors only, so garbage can't win), per-knob 1-D sweeps from
|
|
484
|
-
the known-good base, every cell scored against the **default recipe** as the
|
|
485
|
-
diversity reference. runJ / `hlg-map.json`. Coherence = non-Latin letter ratio
|
|
486
|
-
(the salad signature); ACCEPTABLE < 1% on both the canary and the open prompts.
|
|
487
|
-
|
|
488
|
-
Default recipe reference: **diversity 0.87, junk 0.0%.**
|
|
489
|
-
|
|
490
|
-
| knob | acceptable range | diversity across band | role |
|
|
491
|
-
| --- | --- | --- | --- |
|
|
492
|
-
| `W` | **[5, 8]** (wall ≤4) | 0.80 → 0.72 | coherence floor |
|
|
493
|
-
| `A` | **[0.2, 0.8]** (no cliff) | ~0.79 (0.73 high) | near-inert |
|
|
494
|
-
| `target_gap` | **[12, 20]** (cliff ≤10) | 0.79 → 0.69 | coherence floor + sharpness |
|
|
495
|
-
| `s_m` | **[0.4, 1.3]** (no cliff) | flat 0.78–0.80 | near-inert |
|
|
496
|
-
| `L_W` | **[50, 4000]** (no cliff) | ~0.79 (0.71 at 4000) | near-inert |
|
|
497
|
-
|
|
498
|
-
**Verdict (conclusive):**
|
|
499
|
-
|
|
500
|
-
1. **No acceptable cell beats the default.** The shaper caps at ~**0.80**
|
|
501
|
-
diversity; the default is **0.87** — at the same zero junk. Across the entire
|
|
502
|
-
five-knob space the HLG curve is consistently *less* diverse than
|
|
503
|
-
temperature+top_p+top_k while coherent.
|
|
504
|
-
2. **Only `W` and `target_gap` do anything, and both are coherence *gates*, not
|
|
505
|
-
diversity dials.** `A`, `s_m`, `L_W` are near-inert across their whole valid
|
|
506
|
-
range. So "four orthogonal controls where temperature gave one" doesn't
|
|
507
|
-
materialise — it's one gate (sharpness/window) plus three inert knobs, and the
|
|
508
|
-
only way to move diversity is off the cliff into garbage.
|
|
509
|
-
3. **Why the default wins:** a hard tail-cut (top_p/top_k) *removes* the tail, so
|
|
510
|
-
you can be loose on the ~64 survivors without garbage. A smooth curve must
|
|
511
|
-
keep the tail gated by sharpness, and that same gating caps how loose the top
|
|
512
|
-
can get — the hard cut is strictly more diversity-efficient. And the default
|
|
513
|
-
already keys off the distribution's own entropy (peaked→decisive, broad→loose)
|
|
514
|
-
via top_p — the adaptive behaviour the curve was reaching for, done better.
|
|
515
|
-
|
|
516
|
-
**Bottom line.** The HLG transfer system transplants onto sampling and yields a
|
|
517
|
-
*working, coherent* replacement sampler; the cross-domain mapping is sound and
|
|
518
|
-
the two required adaptations (windowed anchor, inverted toe) are real findings.
|
|
519
|
-
But it does **not** beat a well-tuned temperature+cutoff recipe — equal-or-less
|
|
520
|
-
diversity at equal coherence, everywhere in the mapped space.
|
|
521
|
-
|
|
522
|
-
## 13. Frontier probe — better metric + interactions (the definitive landing)
|
|
523
|
-
|
|
524
|
-
The §12 map has two blind spots: distinct-2 is lexical/noisy at small N, and every
|
|
525
|
-
sweep is one-knob-at-a-time from one base (so it cannot see a B-loose-type *joint*
|
|
526
|
-
failure). `scripts/hlg-frontier.ts` closes both — **self-BLEU on the divergent
|
|
527
|
-
region at N=10** (diversity = 1 − self-BLEU), over a curated set: the per-knob
|
|
528
|
-
diversity edges **plus** the `target_gap×W` / `target_gap×A` corners. runK /
|
|
529
|
-
`hlg-frontier.json`. Default reference: **diversity 0.672.**
|
|
530
|
-
|
|
531
|
-
| cell | diversity (1−selfBLEU) | canary |
|
|
532
|
-
| --- | --- | --- |
|
|
533
|
-
| **default** | **0.672** | clean (reference) |
|
|
534
|
-
| tg12 × A.2 | 0.605 | clean (best HLG) |
|
|
535
|
-
| tg=12 | 0.570 | clean |
|
|
536
|
-
| base / Lw50 / sM1.3 | ~0.53 | clean |
|
|
537
|
-
| W=5 / A.20 / tg12×W8 | ~0.50 | clean |
|
|
538
|
-
| tg12 × A.8 | 0.470 | clean |
|
|
539
|
-
| **tg12 × W5** | — | **REJECT 8.5%** |
|
|
540
|
-
| **tg12 × W5 × A.2** | — | **REJECT 4.1%** |
|
|
541
|
-
|
|
542
|
-
1. **The sharper metric widens the gap — but reveals the real gradient.** Lowering
|
|
543
|
-
`target_gap` (15→12) and `A` (.35→.2) genuinely raises diversity (0.525 → 0.570
|
|
544
|
-
→ 0.605) — the gradient distinct-2 flattened. So the knobs *do* control
|
|
545
|
-
diversity. But the ceiling is **0.605 vs default 0.672** (~10% gap), consistent.
|
|
546
|
-
2. **The interaction probes caught a joint failure the marginal map structurally
|
|
547
|
-
could not.** `tg=12` alone is clean, `W=5` alone is clean, but **`tg12 × W5`
|
|
548
|
-
rejects (8.5% junk)** — so the "valid ranges" are **not** an independent box
|
|
549
|
-
`W∈[5,8] × tg∈[12,20]`; they're a **coupled manifold** (low target_gap needs a
|
|
550
|
-
*wider* W: tg12×W8 clean, tg12×W5 not). Exactly the B-loose-type joint failure
|
|
551
|
-
the one-at-a-time map can't see.
|
|
552
|
-
|
|
553
|
-
**Final, rigorous verdict.** HLG sampling gives **finer, decomposed control over
|
|
554
|
-
the coherence/diversity tradeoff, but does not dominate temperature on the
|
|
555
|
-
frontier** — its reachable diversity sits strictly inside the default's, and
|
|
556
|
-
pushing to the edge crosses a coupled coherence cliff. A true, useful, publishable
|
|
557
|
-
**negative-but-informative result** — control, not dominance.
|
|
558
|
-
|
|
559
|
-
---
|
|
560
|
-
|
|
561
|
-
## 14. Reversal — wide ranges + semantic metric + text verification → DOMINANCE
|
|
562
|
-
|
|
563
|
-
The §12/§13 "negative" was **premature**, from the two methodology gaps the user
|
|
564
|
-
flagged: (a) sweep ranges too narrow (A ∈ [0.2,0.8] never reached the loose
|
|
565
|
-
extreme where the shoulder actually engages), and (b) distinct-2 is noisy at
|
|
566
|
-
small N. Fixing both overturns the verdict.
|
|
567
|
-
|
|
568
|
-
**Wide-range map (runL):** every knob swept across orders of magnitude — and
|
|
569
|
-
**every knob breaks somewhere** (so each does something): W low (~5),
|
|
570
|
-
target_gap low (~12), L_W low (γ→0), A **high** (~100 → garbage), s_m **high**
|
|
571
|
-
(~4 → curve goes non-monotonic). The loose extremes the narrow sweeps skipped
|
|
572
|
-
(A=0.01, s_m=0.05) approach/match the default — the cells that mattered.
|
|
573
|
-
|
|
574
|
-
**Frontier + semantic metric (runM):** N=10, self-BLEU (lexical) + **embedding**
|
|
575
|
-
(1 − mean cosine of mean-pooled LM hidden states, semantic) + distinct-2, on the
|
|
576
|
-
loose-edge cells. Default reference: self-BLEU 0.672, emb 0.136.
|
|
577
|
-
|
|
578
|
-
| cell | self-BLEU | emb | distinct2 |
|
|
579
|
-
| --- | --- | --- | --- |
|
|
580
|
-
| default | 0.672 | 0.136 | 0.73 |
|
|
581
|
-
| A=0.01 | 0.713 ★ | 0.128 | 0.73 |
|
|
582
|
-
| s_m=0.05 | 0.720 ★ | 0.136 | 0.74 |
|
|
583
|
-
| **A.01 × s_m.05** | **0.783 ★** | **0.142 ★** | **0.79** |
|
|
584
|
-
| A.01 × s_m.05 × Lw10 | 0.745 ★ | 0.143 ★ | 0.78 |
|
|
585
|
-
|
|
586
|
-
**Text verification (runN):** read every output of `A.01 × s_m.05`. Factual: all
|
|
587
|
-
four correct (varied phrasings, not degenerate). Reasoning: equations set up
|
|
588
|
-
correctly. Creative/continuation: genuinely diverse, vivid, coherent — *real*
|
|
589
|
-
variety, not metric-fooling repetition. Confirmed.
|
|
590
|
-
|
|
591
|
-
**Reversed verdict.** At the loose corner **A=0.01, s_m=0.05** (W=6,
|
|
592
|
-
target_gap=15, L_W=1200) HLG **beats** the default temperature+cutoff recipe on
|
|
593
|
-
diversity — self-BLEU 0.783 vs 0.672 (large), distinct-2 0.79 vs 0.73, embedding
|
|
594
|
-
marginal — at **zero junk and full correctness**, verified by reading the text.
|
|
595
|
-
This is the **thesis realized**: A→0 flattens the overconfident top, s_m→0 keeps
|
|
596
|
-
the mids loose, the window/target_gap gate kills the tail — loosening the top
|
|
597
|
-
*without* lifting the tail, the one thing a single temperature knob structurally
|
|
598
|
-
cannot do. Caveats: the semantic edge is small (+0.006 on a weak LM-hidden-state
|
|
599
|
-
proxy, not a real sentence encoder); single seed-base at N=10 (the large,
|
|
600
|
-
text-verified *lexical* margin still wants one fresh-seed repeat); `×Lw10`
|
|
601
|
-
occasionally breaks character.
|
|
602
|
-
|
|
603
|
-
**Fresh-seed repeat (runO, seed 5000) — the dominance does NOT replicate.** The
|
|
604
|
-
default's own self-BLEU swung **+0.083** across seeds (0.672 → 0.755), *larger*
|
|
605
|
-
than the effect I claimed; at seed 5000 the default (0.755) edges **above**
|
|
606
|
-
A.01×s_m.05 (0.747). N=10 self-BLEU variance (~0.08) swamps the effect — no
|
|
607
|
-
self-BLEU dominance survives. The only signal stable across both seeds is the
|
|
608
|
-
small **embedding** edge (loose HLG cells > default at both: 0.142/0.141 vs the
|
|
609
|
-
default's 0.136/0.121), on a weak proxy.
|
|
610
|
-
|
|
611
|
-
| | self-BLEU s1000 → s5000 | emb-div s1000 → s5000 |
|
|
612
|
-
| --- | --- | --- |
|
|
613
|
-
| default | 0.672 → **0.755** | 0.136 → 0.121 |
|
|
614
|
-
| A.01 × s_m.05 | 0.783 → **0.747** | 0.142 → 0.141 |
|
|
615
|
-
|
|
616
|
-
**Honest final landing (neither premature verdict).** HLG's loose-corner cells
|
|
617
|
-
(A=0.01, s_m=0.05) are **comparable** to the default on diversity at equal
|
|
618
|
-
coherence — *within N=10 measurement noise* — with at most a small, consistent
|
|
619
|
-
*semantic* (embedding) edge below what this metric/N can resolve. Proving a real
|
|
620
|
-
effect of that size needs N in the hundreds (variance ~1/√N) or a proper sentence
|
|
621
|
-
encoder, not the LM's own hidden states. **Meta-result: the fresh-seed repeat is
|
|
622
|
-
the discipline that catches over-claims — it caught the premature "negative"
|
|
623
|
-
(§12/§13) AND the premature "dominance" (§14 first draft) within one run each.**
|
|
624
|
-
(Runs L/M/N/O.)
|
|
625
|
-
|
|
626
|
-
---
|
|
627
|
-
|
|
628
|
-
## 15. Mapping the terrain (ongoing — not verdicts)
|
|
629
|
-
|
|
630
|
-
Reframing, deliberately: this is a forest, not a yes/no, and §12–§14's
|
|
631
|
-
"verdicts" (negative → dominance → wash) were premature lurches at individual
|
|
632
|
-
data points. Each run is a *coordinate*. What we actually have is a partial map
|
|
633
|
-
of where the shaper is coherent and how diverse it is, held loosely.
|
|
634
|
-
|
|
635
|
-
`scripts/hlg-grid.ts` adds the first **2-D** layer — `A × s_m` (runP, N=5; cell =
|
|
636
|
-
self-BLEU-div (emb-div), `✗` = canary broke; default contour 0.799 / 0.140):
|
|
637
|
-
|
|
638
|
-
```
|
|
639
|
-
s_m\A 0.01 0.05 0.2 1 5
|
|
640
|
-
0.05 +0.81(.15) +0.83(.12) +0.86(.14) +0.82(.13) 0.56(.04)
|
|
641
|
-
0.2 +0.85(.13) 0.73(.11) +0.86(.07) 0.76(.05) 0.58(.10)
|
|
642
|
-
0.7 +0.80(.13) 0.74(.11) +0.81(.06) 0.72(.05) 0.67(.05)
|
|
643
|
-
1.5 0.79(.13) 0.71(.11) 0.74(.09) 0.66(.05) ✗3%
|
|
644
|
-
3 +0.78(.16) ✗3% ✗3% ✗4% ✗4%
|
|
645
|
-
```
|
|
646
|
-
|
|
647
|
-
Terrain features (confidence noted):
|
|
648
|
-
- **The coherent basin's upper edge is a coupled `A↔s_m` trade-off** (sharp,
|
|
649
|
-
reliable): `s_m=3` breaks across the row *except* at `A=0.01` (a clean **spur**),
|
|
650
|
-
and `A=5` breaks a row lower (`s_m=1.5`). Loose `A` *buys* high-`s_m` tolerance —
|
|
651
|
-
hard shoulder-flattening appears to stabilize the otherwise non-monotonic
|
|
652
|
-
high-`s_m` mid. Same coupling family as `tg×W` (§13).
|
|
653
|
-
- **Diversity is a noisy plateau near the default level**, sloping down only toward
|
|
654
|
-
tight `A` (`A=5`: self-BLEU 0.56–0.67, clearly low). The dense `+` cells sit
|
|
655
|
-
within the measured seed-noise (±0.08) of the default — comparable, not a clean
|
|
656
|
-
peak. (emb at N=5 is noisier; trust the coherence contour and the `A` slope.)
|
|
657
|
-
|
|
658
|
-
**Second plane — `W × target_gap` (runQ, N=5):**
|
|
659
|
-
|
|
660
|
-
```
|
|
661
|
-
W\tg 10 13 16 25 50
|
|
662
|
-
4 ✗21% ✗6% ✗4% 0.78(.05) 0.57(.03)
|
|
663
|
-
5 ✗38% ✗4% 0.75(.05) 0.78(.05) 0.57(.03)
|
|
664
|
-
6 ✗4% +0.81(.06) 0.71(.05) 0.71(.05) 0.50(.03)
|
|
665
|
-
10 0.75(.09) 0.78(.05) 0.74(.05) 0.73(.04) 0.57(.03)
|
|
666
|
-
20 +0.88(.06) 0.58(.05) 0.63(.05) 0.60(.04) 0.58(.03)
|
|
667
|
-
```
|
|
668
|
-
|
|
669
|
-
The coherence cliff is a clean **diagonal**: wide `W` buys low `target_gap`, high
|
|
670
|
-
`target_gap` buys narrow `W` — they trade off, exactly like `A↔s_m`. **Two
|
|
671
|
-
independent planes now show the same coupling — promoting it from quirk to
|
|
672
|
-
structural fact: the coherent basin is walled by COUPLED diagonal cliffs, not
|
|
673
|
-
independent per-knob thresholds; the knobs trade off against each other at the
|
|
674
|
-
edge.** (This is why the marginal 1-D ranges can't be trusted jointly — the
|
|
675
|
-
`tg12×W5` failure was the first hint.) Diversity peaks at the loose corner (wide
|
|
676
|
-
`W`, low `target_gap`: 0.88; falls to 0.50–0.57 as `target_gap` sharpens), near
|
|
677
|
-
the default contour and within seed-noise.
|
|
678
|
-
|
|
679
|
-
**Cross-pair coherence (runS, canary-only — swap partners).** Each shaping knob
|
|
680
|
-
(`A`, `s_m`) × each gate knob (`tg`, `W`). The coupling is **selective, not
|
|
681
|
-
global**:
|
|
682
|
-
- **`A` is nearly orthogonal to the gates** — in `A×tg` and `A×W` the gate cliffs
|
|
683
|
-
(`tg<~12`, `W<~5`) hold across *every* `A` (only the extreme `A=100` corner
|
|
684
|
-
nudges them). `A` reshapes the top without moving the coherence floor.
|
|
685
|
-
- **`s_m` is the coupling hub** — `s_m×tg` is a clean diagonal (`s_m=0.2` *rescues*
|
|
686
|
-
`tg=8`; `s_m≥2` breaks `tg=12`), `s_m×W` the same milder bend. Loose mid demands
|
|
687
|
-
a tighter gate.
|
|
688
|
-
|
|
689
|
-
So the coherence wall is a **gate+mid cluster** (`tg`, `W`, `s_m` share a
|
|
690
|
-
tail-mass budget) with **`A` outside it**. Mechanism: the floor is a *tail*
|
|
691
|
-
phenomenon (gates set it, `s_m` feeds the mid into it); `A` only flattens the
|
|
692
|
-
*top* — no tail mass — so it's free on coherence.
|
|
693
|
-
|
|
694
|
-
**Map so far (held loosely, no verdict):** a coherent basin whose wall is a
|
|
695
|
-
coupled `tg`/`W`/`s_m` surface, with **`A` an orthogonal degree of freedom**;
|
|
696
|
-
diversity a noisy plateau rising toward the loose corner, near the default level.
|
|
697
|
-
The two diversity levers split by their relation to the wall — **`A` is free,
|
|
698
|
-
`s_m` is coupled.** All pairwise coherence boundaries now mapped (2 within-pair +
|
|
699
|
-
4 cross-pair). Next layers: the **blind external-judge** read (`scripts/hlg-blind.ts`,
|
|
700
|
-
artifacts ready — independent of self-BLEU/embedding), and zooming the loose
|
|
701
|
-
corner / the `A↔s_m` spur.
|
|
702
|
-
|
|
703
|
-
### Generalization across models (runT CPM5, runU 12B)
|
|
704
|
-
|
|
705
|
-
The whole map above is e4b. To ask whether the basin geometry is a property of
|
|
706
|
-
the *curve* or of *e4b*, re-ran the cross-pair coherence map on two more models:
|
|
707
|
-
**12B** (dense Gemma, same ~262k vocab as e4b) and **CPM5** (MiniCPM5-1B,
|
|
708
|
-
Llama-family, ~73k vocab). The split is clean:
|
|
709
|
-
|
|
710
|
-
- **The sharpness cluster replicates on all three.** `s_m×target_gap` is the same
|
|
711
|
-
diagonal everywhere (low `s_m` tolerates low `tg`; high `s_m` needs high `tg`),
|
|
712
|
-
and `A` stays orthogonal to the `tg` gate. Two architectures, two vocab sizes —
|
|
713
|
-
same structure. This is the load-bearing finding, and it's curve-level, not
|
|
714
|
-
model-level. (CPM5's diagonal is *shifted* — it breaks only at `s_m≥2` where the
|
|
715
|
-
Gemmas break at `s_m≥0.7` — i.e. the same coupling direction, a more tolerant
|
|
716
|
-
threshold.)
|
|
717
|
-
- **The window (`W`) axis is vocab-dependent.** The two same-vocab Gemmas (e4b, 12B)
|
|
718
|
-
behave identically on `W` (low-`W` gate breaks across all `A`; `s_m×W` couples at
|
|
719
|
-
`W=5`); CPM5 diverges (`W=3` robust at low `A`, `s_m×W` fully decoupled, plus a
|
|
720
|
-
high-`A`/wide-`W` break absent in e4b — 12B shows a mild hint of the same). The
|
|
721
|
-
12B control did its job: it tracked e4b, not CPM5, confirming the `W` difference
|
|
722
|
-
follows vocab size (smaller vocab → less tail to inflate → different gate dynamics).
|
|
723
|
-
|
|
724
|
-
So the **sharpness coupling is the invariant**; the **window axis is the
|
|
725
|
-
vocab-sensitive part**. Visualized in `scripts/hlg-viz.ts` (e4b diversity terrain)
|
|
726
|
-
and `scripts/hlg-viz-cross.ts` (3-model coherence comparison). Logs: runT (CPM5),
|
|
727
|
-
runU (12B).
|
|
728
|
-
|
|
729
|
-
### L_W — the fifth knob (runV e4b, runW 12B, runX CPM5)
|
|
730
|
-
|
|
731
|
-
`L_W` sets the OOTF gamma: `γ = 1.2 + 0.42·log10(L_W/1000)`. The auto-`out_scale`
|
|
732
|
-
pins the top→reference gap to `target_gap`, so `L_W` does **not** move the anchor —
|
|
733
|
-
it bends the **curvature** of the mid/tail. Swept wide (`L_W` 1 … 10⁶, γ −0.06 … 2.46),
|
|
734
|
-
`scripts/hlg-lw.ts`, two-stage:
|
|
735
|
-
|
|
736
|
-
- **`L_W` is not a gate-cluster member.** Coherence is robust across **five decades**
|
|
737
|
-
(`L_W ∈ [3, 10⁵]`, γ ∈ [0.14, 2.04]) — the opposite of `tg`/`W`'s tight breaks.
|
|
738
|
-
It walls only at the *extremes*: low (`L_W≈1`, γ<0 *inverts* the ranking → junk)
|
|
739
|
-
and high (`L_W≈10⁶`, γ≈2.46, over-sharpened → junk). The low wall and coherent
|
|
740
|
-
range are **identical on e4b and 12B** (same-vocab Gemmas). The *high* wall is
|
|
741
|
-
Gemma-only: **CPM5 has no high wall** (clean through `L_W=10⁶`, range `[3, 10⁶]`) —
|
|
742
|
-
the smaller vocab is more robust at high γ, the same vocab-sensitivity seen on `W`.
|
|
743
|
-
- **Diversity response is model-specific, and not monotone.** On e4b it's an
|
|
744
|
-
interior peak that *appeared* to rise above the 0.70 default (0.76 at γ≈1.0) — **but
|
|
745
|
-
this was K=6 noise, retracted at K=20** (see the deep-dive below): the K=20 default is
|
|
746
|
-
0.633 and every `L_W` point sits at 0.42–0.45, well below it. On 12B (K=6) it's a flat
|
|
747
|
-
**0.51–0.56 floor below the 0.72 default**. Corrected read: `L_W` diversity is *below*
|
|
748
|
-
the recommended recipe on every model measured — it does not help diversity.
|
|
749
|
-
|
|
750
|
-
`L_W` is therefore its own kind of knob: a **curvature control**, coherence-robust
|
|
751
|
-
(unlike the gates), with a non-monotone diversity response whose useful direction
|
|
752
|
-
flips by model. Visualized in `scripts/hlg-lw-viz.ts`.
|
|
753
|
-
|
|
754
|
-
### Cliff resolution (runY e4b, runZ 12B, runAA CPM5)
|
|
755
|
-
|
|
756
|
-
The coarse maps stepped *over* the steepest features. `scripts/hlg-cliff.ts` steps
|
|
757
|
-
`target_gap` 7→13 (unit) at base, and `W` 3→10 at `A=100` (the channel-closing edge),
|
|
758
|
-
reporting the junk% gradient (K=5 seeds). Fine resolution revealed **two different
|
|
759
|
-
cliff shapes** the coarse jumps had flattened into "a break somewhere in 8–12":
|
|
760
|
-
|
|
761
|
-
- **`target_gap` is a graded ramp, not a step.** e4b 31%→17%→1% over tg 8→9→10;
|
|
762
|
-
12B 17%→4%→1%. The whole transition is a 2–3-step slope. Its *position shifts by
|
|
763
|
-
vocab*: CPM5 coherent earliest (clean by tg≈8), e4b latest (still 31% at tg 8,
|
|
764
|
-
crosses tg 9→10), 12B between — same vocab-sensitivity as the `W`/`L_W`-high stories.
|
|
765
|
-
- **`W` at high `A` is a sharp edge.** All three sit on a high junk plateau through
|
|
766
|
-
W 3–7, then drop to 0% at **W=8** — an abrupt channel close between 7 and 8. The
|
|
767
|
-
*edge position is model-invariant* (all three close 7→8); only the plateau *height*
|
|
768
|
-
differs by vocab. So the channel-closing W is a property of the window math at high
|
|
769
|
-
`A`, not the model.
|
|
770
|
-
|
|
771
|
-
The earlier "12B is steeper" hypothesis **did not hold** — e4b's `tg` cliff is if
|
|
772
|
-
anything the steepest (31→1 over two steps vs 12B's gentler 24→17→4→1). 12B's
|
|
773
|
-
"sensitivity" was real but in *diversity* (the `L_W` suppression), not cliff
|
|
774
|
-
steepness — two distinct senses. Logged as a data point. Visualized in
|
|
775
|
-
`scripts/hlg-cliff-viz.ts`.
|
|
776
|
-
|
|
777
|
-
**Knob taxonomy (the five mapped, held as terrain):** `tg`+`W`+`s_m` = the coupled
|
|
778
|
-
*gate/sharpness cluster* (tight, coupled, vocab-shifted breaks); `A` = orthogonal to
|
|
779
|
-
the wall (free diversity lever); `L_W` = a coherence-robust *curvature* knob (walls
|
|
780
|
-
only at γ extremes; diversity *below* default — see K=20). Cliff shapes split too:
|
|
781
|
-
`tg` graded, `W@highA` sharp.
|
|
782
|
-
|
|
783
|
-
### K=20 deep-dive (runAB grids, runAC peaks — e4b)
|
|
784
|
-
|
|
785
|
-
Four experiments re-run at K=20 (`scripts/hlg-grid2.ts`, `scripts/hlg-peak.ts`) to
|
|
786
|
-
settle the noisy diversity claims and resolve the cross-terms. Results corrected two
|
|
787
|
-
earlier reads:
|
|
788
|
-
|
|
789
|
-
- **The cliffs are tilted surfaces, not fixed walls.** The `tg` cliff edge *slides
|
|
790
|
-
monotonically with `s_m`*: at `s_m=0.2` there's no cliff at all (0% to tg=7), at
|
|
791
|
-
`s_m=0.7` it sits at tg≈9, at `s_m=2` past tg=12, at `s_m=4` out of frame. And the
|
|
792
|
-
`W` edge *slides with `A`*: it closes at W≈4–5 for `A`≤10 but not until **W≈8 at
|
|
793
|
-
`A=100`** — so the "invariant 7→8 edge" above was specific to `A=100`, not general.
|
|
794
|
-
- **The `L_W` "peak beats default" was noise — retracted.** At K=20 the e4b default is
|
|
795
|
-
0.633 and every `L_W` point is 0.42–0.45 (~0.19 below). The K=6 0.76>0.70 was
|
|
796
|
-
small-sample artifact; `L_W` shaping is below default on every model measured.
|
|
797
|
-
- **`A` is confirmed the free diversity lever** — clean monotone, 0.66 (A=0.01) → 0.31
|
|
798
|
-
(A=0.7), and the *one* place HLG clears a default is the loosest `A` (+0.03 at 0.01).
|
|
799
|
-
(Sweep cut at A=0.7 when the batch was stopped; trend + ceiling captured.)
|
|
800
|
-
|
|
801
|
-
### Edge texture (runAE — sub-unit K=20) + a single-config probe
|
|
802
|
-
|
|
803
|
-
`scripts/hlg-edge.ts` zooms sub-unit into the transitions, tracking break-*rate* and
|
|
804
|
-
max (not just mean). The edges turn out heterogeneous:
|
|
805
|
-
|
|
806
|
-
- **Gate cliffs (`tg`, `W`) are *statistical* edges** — per seed bimodal (clean or
|
|
807
|
-
hard-break, max 43–88% mid-ramp); the smooth ramp is the declining *fraction* of
|
|
808
|
-
seeds that break (`tg` 20→2/20 over 7→10; `W` 18→0/20 over 6→8.5), not a softening.
|
|
809
|
-
- **`L_W` low wall is a *hard* threshold at γ=0** — the ranking sign-flip; every γ≥0 is clean.
|
|
810
|
-
- **`L_W` high wall is barely a wall** — 3/20 at γ=2.46; the coarse "REJECT" was a 1-of-2-seed artifact.
|
|
811
|
-
|
|
812
|
-
`scripts/hlg-eval1.ts` evaluates one explorer-dialed config at K=20. A heavily reshaped
|
|
813
|
-
curve (W 7.5, A 3.55, s_m 0.05, **target_gap 4**, γ 1.93, xM 0.74, xFloor 0.45) came back
|
|
814
|
-
**20/20 incoherent** (pure salad; "diversity 1.000" = the garbage signature — why the
|
|
815
|
-
two-stage gate exists). The driver: `target_gap=4` → `out_scale≈5.2` → HLG top-1 25% (vs
|
|
816
|
-
raw 50%), entropy *up* → samples the tail. **Lesson: the curve shape is secondary to the
|
|
817
|
-
final sharpness (`out_scale`); the distribution's top-1/entropy is the coherence oracle.**
|
|
818
|
-
The shaper now forwards the curve-geometry params (`xM/yM/xFloor/yFloor/p`) through
|
|
819
|
-
`HlgConfig` so explorer-tuned configs can be evaluated faithfully.
|
|
820
|
-
|
|
821
|
-
Interactive tools: `docs/investigations/hlg-explorer.html` (live curve + distribution
|
|
822
|
-
under sliders), `docs/investigations/hlg-ab.html` (side-by-side samples). Full report:
|
|
823
|
-
`docs/investigations/hlg-report.html` (`scripts/hlg-report.ts`, figures in `hlg-figs/`).
|
|
824
|
-
|
|
825
|
-
---
|
|
826
|
-
|
|
827
|
-
## Appendix A — Run 0 (original: greedy / temp-0.7 / temp-1.2 / hlg-default / hlg-rolloff)
|
|
828
|
-
|
|
829
|
-
```
|
|
830
|
-
# HLG sampling comparison — model "gemma-4-e4b-it-OptiQ-4bit", K=4, maxTokens=80
|
|
831
|
-
|
|
832
|
-
═══ [creative] Write the first sentence of a short story about a lighthouse keeper who discovers something strange in the fog.
|
|
833
|
-
▸ greedy len~ 36 unique 1/1 distinct-2 0.97
|
|
834
|
-
1. The fog, a thick, clammy blanket that swallowed the beam of the old lantern, seemed to press against the glass of the tower, and it was in that suffocating grey that Silas first saw the impossible.
|
|
835
|
-
▸ temp-0.7 len~ 35 unique 4/4 distinct-2 0.85
|
|
836
|
-
1. The fog, a thick, clammy blanket that swallowed the beam of the lantern, seemed to press against the glass, and it was through that swirling gray veil that Silas first saw the impossible.
|
|
837
|
-
2. The sea fog, a thick, soupy thing that swallowed the beam of the old lantern whole, was the perfect shroud for what he found bobbing just beyond the reach of the rocks.
|
|
838
|
-
3. The fog, a clammy, grey beast clinging to the tower like wet shrouds, usually offered only the familiar damp chill, but tonight, it carried a scent utterly alien—a metallic tang mixed with the faint, sweet perfume of som…
|
|
839
|
-
4. The fog, a thick, clammy blanket that swallowed the horizon whole, seemed to carry a faint, unnatural chime as Silas, perched in the lantern room, peered into its milky depths.
|
|
840
|
-
▸ temp-1.2 len~ 39 unique 4/4 distinct-2 0.95
|
|
841
|
-
1. The swirling, pea-soup fog that clung to the edge of the jagged coastline seemed to thicken just as a flash of unnatural green light pulsed from the watery expanse below the lantern's rhythmic beam.
|
|
842
|
-
2. The sea fog, a thick, soupy thing that seemed to swallow the very light from the lantern, usually brought with it only the familiar smell of salt and damp rock, but this morning, it carried a scent unreasonably sweet—lik…
|
|
843
|
-
3. The relentless, butter-yellow fog was thick enough to chew, and steady, Elias felt the usual creeping silence of the isolated tower until a single, impossibly bright crimson streak broke through the gray curtain near the…
|
|
844
|
-
4. The St. Agnes, usually a solitary sentinel against the swirling gray, held a silence that felt too deep until he saw the impossible gleam through the shroud of fog clinging to the lantern room's glass.
|
|
845
|
-
▸ hlg-default len~ 33 unique 4/4 distinct-2 0.88
|
|
846
|
-
1. The fog, a thick, woolly blanket that swallowed the beam of the lantern, seemed to press against the glass, and it was through that swirling gray veil that Silas first saw the impossible.
|
|
847
|
-
2. The sea fog, a thick, soupy thing that seemed to swallow the very sound of the waves, usually brought with it only the familiar smell of salt and damp stone, but this morning, it carried a faint, metallic tang, like old …
|
|
848
|
-
3. The relentless, salt-laced fog that clung to the tower like a shroud offered no respite until the moment a slick, pearlescent object drifted into the beam of his lantern.
|
|
849
|
-
4. The fog, a thick, clammy blanket that swallowed the horizon whole, finally delivered something unexpected to the beam of the old lighthouse.
|
|
850
|
-
▸ hlg-rolloff len~ 34 unique 4/4 distinct-2 0.88
|
|
851
|
-
1. The fog, a thick, woolly blanket that swallowed the beam of his lantern, seemed to press against the glass, and it was through that swirling gray veil that Silas first saw the impossible.
|
|
852
|
-
2. The sea fog, a thick, soupy thing that seemed to swallow the very light from the lantern, usually brought with it only the familiar smell of salt and damp rock, but this morning, it carried a scent of something metallic …
|
|
853
|
-
3. The relentless, salt-laced fog that clung to the tower like a shroud offered no respite until the moment a slick, pearlescent object drifted into the beam of his lantern.
|
|
854
|
-
4. The fog, a thick, clammy blanket that swallowed the horizon whole, finally delivered something unexpected to the beam of the old lighthouse.
|
|
855
|
-
|
|
856
|
-
[brainstorm/factual/reasoning/continuation: full text in run0-original.log —
|
|
857
|
-
factual & reasoning were near-identical across all rows (~0.30); brainstorm
|
|
858
|
-
temp-1.2 dipped to 0.59 (all converged on "SIM Card Ejector" as item 1).]
|
|
859
|
-
```
|
|
860
|
-
|
|
861
|
-
Full verbatim transcript: [hlg-runs/run0-original.log](hlg-runs/run0-original.log).
|
|
862
|
-
|
|
863
|
-
## Appendix B — Run A (recommended / rec+hlg / hlg-replace)
|
|
864
|
-
|
|
865
|
-
Full transcript: see the run output below (creative + continuation shown; factual
|
|
866
|
-
& reasoning collapsed to ~0.30 near-verbatim across all rows).
|
|
867
|
-
|
|
868
|
-
```
|
|
869
|
-
═══ [creative]
|
|
870
|
-
▸ recommended distinct-2 0.90
|
|
871
|
-
1. The fog, a thick, woolly blanket that swallowed the beam of his lantern, seemed to press against the glass, and it was through that swirling gray veil that Silas first saw the impossible.
|
|
872
|
-
2. The sea fog … carried a faint, metallic tang, like old …
|
|
873
|
-
3. The relentless, salt-laced fog … until the silence was broken by a sound that certainly hadn't been the groan of the old lamp mechanism.
|
|
874
|
-
4. The fog … finally delivered something unexpected to the beam of the Grand Shoal light.
|
|
875
|
-
▸ rec+hlg distinct-2 0.89
|
|
876
|
-
1. The fog, a thick and suffocating blanket that clung to the granite tower like wet wool, had been a familiar, monotonous companion to Elias for thirty years, yet this morning … a scent entirel…
|
|
877
|
-
3. The relentless, salt-laced fog that clung to the tower like a shroud offered up, on a Tuesday afternoon, something that was decidedly, inexplicably *not* a seabird.
|
|
878
|
-
▸ hlg-replace distinct-2 0.90
|
|
879
|
-
1. The fog, a thick and scudding curtain that had swallowed the coastline whole … what Silas glimpsed in its inky heart was something that decidedly did not belong t…
|
|
880
|
-
3. The relentless, butter-yellow fog … a single, impossible flash of deep sap…
|
|
881
|
-
|
|
882
|
-
═══ [brainstorm] recommended 0.78 → rec+hlg 0.88 → hlg-replace 0.88
|
|
883
|
-
rec+hlg #1: "…1. **Improvised Zipper Pull:** If the tab or pull on a zipper breaks off or becomes too small to grip, you can carefully thread a s…" ← broke the "SIM Card Ejector" rut
|
|
884
|
-
|
|
885
|
-
═══ [continuation] recommended 0.75 → rec+hlg 0.84 → hlg-replace 0.86
|
|
886
|
-
hlg-replace #4 (tail leak): "…behaves like a cartographer's stain—aving purpose, dissolving under new light…"
|
|
887
|
-
```
|
|
888
|
-
|
|
889
|
-
Complete verbatim transcript: [hlg-runs/runA-recommended.log](hlg-runs/runA-recommended.log).
|
|
890
|
-
|
|
891
|
-
## Appendix C — Run B (gain variants: rolloff / midboost / soft / full)
|
|
892
|
-
|
|
893
|
-
Diversity numbers in §6.3. Representative creative openings:
|
|
894
|
-
|
|
895
|
-
```
|
|
896
|
-
▸ hlg-rolloff #1: "The swirling, pea-soup fog that clung to the edge of the jagged coastline seemed to thicken just as Elias, his face ruddy from years of wind-whipped solitude, noticed a flicker of unnatural, vibrant green…"
|
|
897
|
-
▸ hlg-midboost #1: "…it was through that swirling gray veil that Silas first saw it—a perfectly smooth, obsidian orb bobbing just…"
|
|
898
|
-
▸ hlg-full #3: "The relentless, salt-laced fog … offered up, on a Tuesday afternoon, something that was decidedly, inexplicably *not* a seabird."
|
|
899
|
-
```
|
|
900
|
-
|
|
901
|
-
All rows coherent; factual locked at 0.30; continuation 0.75 → 0.82–0.85.
|
|
902
|
-
Complete verbatim transcript: [hlg-runs/runB-gain-variants.log](hlg-runs/runB-gain-variants.log).
|
|
903
|
-
|
|
904
|
-
## Appendix D — Run C (pivots: top / entropy / median, as replacement) — full transcript
|
|
905
|
-
|
|
906
|
-
```
|
|
907
|
-
# standard (control) = the model's recipe: temp 1 · top_p 0.95 · top_k 64
|
|
908
|
-
# hlg-* = REPLACEMENT sampler (one curve, 3 pivot placements, no top_p/top_k).
|
|
909
|
-
|
|
910
|
-
═══ [creative]
|
|
911
|
-
▸ standard 0.90
|
|
912
|
-
1. The fog, a thick, woolly blanket … Silas first saw the impossible.
|
|
913
|
-
2. The sea fog … a faint, metallic tang, like old …
|
|
914
|
-
3. The relentless, salt-laced fog … the groan of the old lamp mechanism.
|
|
915
|
-
4. The fog … the beam of the Grand Shoal light.
|
|
916
|
-
▸ hlg-top 0.95
|
|
917
|
-
1. The swirling, pea-soup fog that clung to the edge of the jagged coastline seemed to thicken just as a flash of unnatural green light pulsed from the gray expanse.
|
|
918
|
-
2. The sea fog … carried a scent of something alien.
|
|
919
|
-
3. The relentless, butter-yellow fog was thick enough to chew … the odd, rhythmic glimmer appeared ten正常的 yards from t… [← stray token]
|
|
920
|
-
4. The fog, usually a thick, insulating blanket around the solitary tower, began to swirl with an unnatural luminescence as he made his evening rounds.
|
|
921
|
-
▸ hlg-entropy 0.99 ⚠️ GARBAGE
|
|
922
|
-
1. The Lern AideObserver, a scfileobjextracted keeper subs tuturल्तान subscription exam بالتfog साप्ताहिक, প্রশ্ন তোলার মতো অপ্রত্যাশিত, when MSMাবেনевич' başlayan তার ঘূর্ণAvlৰ আলো inulai a peculiar हॉकी of scent and effor…
|
|
923
|
-
2. The जैसে overtakehouses, a thickolver漏洞 খাওয়ার,ᵛ<br Zweigen graissesigğim, is where Continuando stared homedidnivased the fog pressing against synthwave- kajak-soaked ClauseCloudsPPT…
|
|
924
|
-
▸ hlg-median 1.00 ⚠️ GARBAGE
|
|
925
|
-
1. The Lern AideObserveratic簿 scfileobjextracteddatabases Nimbus stretched thickatório بالتح साप्ताहिक帳 প্রশ্ন, a hateful, damp shroud…
|
|
926
|
-
2. The जैसे overtakehouses,рачиnolver fog খাওয়ার,ᵛकेनोइक 瞭臤ğim stumbledgryifford丹अ through traysivased glass sacksстая
|
|
927
|
-
|
|
928
|
-
═══ [factual]
|
|
929
|
-
▸ standard 0.30 — "The seasons on Earth are primarily caused by the tilt of the Earth's axis as it revolves around the Sun." (×4, minor variants)
|
|
930
|
-
▸ hlg-top 0.55 — mostly correct; #3 leaked: "the tilt of the planet' adorable axis … throughout kä's orbit."
|
|
931
|
-
▸ hlg-entropy 0.99 ⚠️ — "The Lern AideObserver Electrons' scfileobjextracted, tutur tubatório hidadier tut প্রশ্নତ୍Kurs'"
|
|
932
|
-
▸ hlg-median 1.00 ⚠️ — "The जैसे overtakehouses仰рачи倾olver漏洞格局 ᵛ<br Zweigen graisseuse.apparent échelle saisonAlloc Lieu en cours rotation follicle orbit 結構"
|
|
933
|
-
|
|
934
|
-
═══ [reasoning]
|
|
935
|
-
▸ standard 0.28 — coherent step-by-step (×4)
|
|
936
|
-
▸ hlg-top 0.35 — coherent; tiny leaks ("scavenging price of the bat", "প্রশ্ন let 'B'")
|
|
937
|
-
▸ hlg-entropy 1.00 ⚠️ GARBAGE
|
|
938
|
-
▸ hlg-median 0.99 ⚠️ GARBAGE
|
|
939
|
-
|
|
940
|
-
═══ [continuation]
|
|
941
|
-
▸ standard 0.75 — coherent, vivid (×4)
|
|
942
|
-
▸ hlg-top 0.88 — coherent AND varied:
|
|
943
|
-
2. "…how it insists on polishing fractured timelines into gleaming, heroic monuments, even when the original quarry was a muddy, bewildered ditch."
|
|
944
|
-
3. "…how it acts like a coral reef—brilliantly shaped in its fleeting, vibrant bloom, only to be slowly colonized and ultimately obscured by the perpetual, grinding algae of the new…"
|
|
945
|
-
4. "…how it vaccinates us against our own truth … yesterday's sharpest agony marketable as yesterday' recalls u…" [← tail fraying]
|
|
946
|
-
▸ hlg-entropy 1.00 ⚠️ GARBAGE — "'The Aideang strane簿 sche tup de uman tuturí namiatório hidadierá escult প্রশ্ন p a'i nto'…"
|
|
947
|
-
▸ hlg-median 1.00 ⚠️ GARBAGE — "'The Aideang strane簿 scfileobj tup ad tutur sbonnadier…"
|
|
948
|
-
```
|
|
949
|
-
|
|
950
|
-
Complete verbatim transcript: [hlg-runs/runC-pivots.log](hlg-runs/runC-pivots.log).
|
|
951
|
-
|
|
952
|
-
---
|
|
953
|
-
|
|
954
|
-
*Raw logs (committed, full verbatim transcripts):*
|
|
955
|
-
Pass 1 — [run0-original.log](hlg-runs/run0-original.log),
|
|
956
|
-
[runA-recommended.log](hlg-runs/runA-recommended.log),
|
|
957
|
-
[runB-gain-variants.log](hlg-runs/runB-gain-variants.log),
|
|
958
|
-
[runC-pivots.log](hlg-runs/runC-pivots.log).
|
|
959
|
-
Pass 2 — [runD-oetf.log](hlg-runs/runD-oetf.log) (literal OETF),
|
|
960
|
-
[runE-eotf.log](hlg-runs/runE-eotf.log) (EOTF/OOTF),
|
|
961
|
-
[runF-shaper-working.log](hlg-runs/runF-shaper-working.log) (HLGShaper W5/os18 — works),
|
|
962
|
-
[runG-shaper-sweep.log](hlg-runs/runG-shaper-sweep.log) (knob sweep, full untruncated text).
|
|
963
|
-
Pass 3 (premature negative) — [runH-wsweep.log](hlg-runs/runH-wsweep.log) (clean 1-D W sweep),
|
|
964
|
-
[runI-asweep.log](hlg-runs/runI-asweep.log) (clean 1-D A sweep),
|
|
965
|
-
[runJ-knobmap.log](hlg-runs/runJ-knobmap.log) (narrow 5-knob map),
|
|
966
|
-
[runK-frontier.log](hlg-runs/runK-frontier.log) (N=10 self-BLEU + interactions).
|
|
967
|
-
Pass 4 (reversal → DOMINANCE) — [runL-widemap.log](hlg-runs/runL-widemap.log) (wide ranges, all knobs break),
|
|
968
|
-
[runM-frontier-emb.log](hlg-runs/runM-frontier-emb.log) + [hlg-frontier.json](hlg-runs/hlg-frontier.json) (N=10, self-BLEU + **embedding** + distinct-2),
|
|
969
|
-
[runN-verify.log](hlg-runs/runN-verify.log) (text verification of A.01×s_m.05 — correct + genuinely diverse).
|
|
970
|
-
Harnesses: `scripts/hlg-compare.ts`, `scripts/hlg-map.ts`, `scripts/hlg-frontier.ts` (the latter now scores embedding-similarity too).
|