Wl6adams's picture
Add portable Release 188 generation runtime
919fd68 verified
Raw
History Blame Contribute Delete
13.2 kB
"""Resynthesis configuration β€” all fields are INITIAL VALUES, NOT CAPS.
``num_layers``, ``num_experts``, ``recursive_steps``, and domains are SEEDS
that grow on observed demand. Termination is confidence-based (NeuralStopGate
+ utility/contradiction gates), never host-imposed caps.
The ONE allowed backstop is the malfunction-guardrail (anti-infinite-loop),
commented as guardrail-not-cap. Picking a bigger number is still a cap.
"""
from __future__ import annotations
from dataclasses import dataclass
# Resynthesis-owned vocabulary/feature parent (frozen, additive-only).
# Its immutable inherited tensor geometry is hidden_size=4096, 32 layers,
# linear_attention + full_attention hybrid, vocab=248320, native >4M context.
#
# AUTHORITY CONTRACT: these tensors are a small immutable lego in the larger
# NoNE/RBO/Fabric graph. They may tokenize, project additive hidden state into
# the inherited vocabulary, and seed feature/context tensors. Parent logits,
# confidence, answer selection, and parent-relative retention are diagnostics
# only and must never select, score, stop, retain, or veto an additive result.
RESYNTHESIS_HIDDEN_SIZE = 4096
RESYNTHESIS_NUM_HIDDEN_LAYERS = 32
RESYNTHESIS_PROJECTION_VOCAB_SIZE = 248_320
# Long-context STACK+COMPOSE (compose, do not replace):
# absolute KV order + Dual Chunk β†’ parent RoPE indices + trained parent
# YaRN live + exact online-softmax long pool over every hidden position.
# Context-intent C, action A, and relational connectivity R:
# Science attention composes C_i K_j, Q_i C_j, and R_i^Q R_j^K over the
# preserved Q_i K_j path. C is model-owned hidden-plus-intent-plus-action
# state: ``C = c_proj(hidden) + intent_c_proj(intent) + gate_a * action_c_proj(action)``.
# R is conditioned by the NoNE router's selected expert-intent tensor. Exact
# online-softmax tiling preserves every causal edge without a resident N x N
# score table. Long pools compose intent and action as separate additive
# ``QΒ·C`` and ``QΒ·A`` channels over the baseline ``QΒ·K`` path. These are
# trained graph tensors, never host routing flags.
# Long-pool C may be [batch, sequence] or [batch, sequence, hidden]; there is
# no host cap on C/R width or sequence length (uncapped-policy: intentional).
# Dual-Chunk keeps RoPE inside the pretrained band; do not YaRN-stretch.
RESYNTHESIS_MAX_POSITION_EMBEDDINGS = 4_194_304
# Native attention must exceed the trained 4M floor. This is a proof/geometry
# extent, not a floor+tile host cap: runtime admission observes absolute KV
# extent while Dual Chunk preserves the parent's folded RoPE band and exact
# KV-addressed history.
RESYNTHESIS_NATIVE_CONTEXT_FLOOR = 4_194_304
NATIVE_ATTENTION_POSITION_APERTURE = 100_000_001
DUAL_CHUNK_PRETRAIN_LENGTH = 262_144
DUAL_CHUNK_LOCAL_SIZE = 8_192
# Dual Chunk keeps parent RoPE inside the pretrained band; do not YaRN-stretch.
PRETRAINED_ROPE_BAND_TOKENS = DUAL_CHUNK_PRETRAIN_LENGTH
# Execution tile width for parent/additive online-softmax pools. One tile equals
# one Dual-Chunk successive window so prefill schedule and RoPE localization
# stay coherent at 4M+ tokens. ``validate_native_context_admission`` validates
# tensor shape/sign and observes full absolute KV extent; it must not silently
# truncate or reject merely because the prompt passed the old floor+tile value.
RESYNTHESIS_ONLINE_SOFTMAX_TILE_TOKENS = 8_192
# Native tiled prefill for the frozen parent backbone: long prompts are fed to
# the complete parent graph in cache-preserving tiles so activations stay
# bounded. Every token updates all 24 trained globally recurrent linear-
# attention layers. Beyond the pretrained band, the eight full-attention
# layers retain a bounded hot K/V window; no input token is dropped, rejected,
# or truncated. One prefill tile equals one Dual-Chunk successive window and
# one online-softmax pool window, keeping parent RoPE localization, recurrent
# state, prefill scheduling, and the additive long pool coherent.
RESYNTHESIS_NATIVE_PREFILL_TILE_TOKENS = 8_192
# Bounded activation geometry, not a context cap: every source token first
# executes the complete parent and participates in an attended segment summary
# before the additive Fabric/NoNE prefill traversal.
RESYNTHESIS_NATIVE_PREFILL_SUMMARIES_PER_TILE = 4
RESYNTHESIS_NUM_ATTENTION_HEADS = 16
RESYNTHESIS_NUM_KEY_VALUE_HEADS = 4
RESYNTHESIS_INTERMEDIATE_SIZE = 12_288
RESYNTHESIS_HEAD_DIM = 256
RESYNTHESIS_FULL_ATTENTION_INTERVAL = 4
RESYNTHESIS_FULL_ATTENTION_LAYERS = (
RESYNTHESIS_NUM_HIDDEN_LAYERS // RESYNTHESIS_FULL_ATTENTION_INTERVAL
)
RESYNTHESIS_LINEAR_ATTENTION_LAYERS = (
RESYNTHESIS_NUM_HIDDEN_LAYERS - RESYNTHESIS_FULL_ATTENTION_LAYERS
)
# Long prompts retain the parent's globally recurrent linear-attention state at
# every layer while bounding the resident full-attention K/V to one trained
# Dual-Chunk local window. The pretrained-band boundary selects the storage
# backend; it does not reject, truncate, route, or stop a prompt.
RESYNTHESIS_NATIVE_HYBRID_ACTIVATION_TOKENS = DUAL_CHUNK_PRETRAIN_LENGTH
RESYNTHESIS_NATIVE_HOT_KV_TOKENS = DUAL_CHUNK_LOCAL_SIZE
# Resynthesis glyph-plane dimension.
GLYPH_DIM = 168
# Public Release 188 resolves its immutable lexical parent and tokenizer
# directly from repository-relative files. Historical lab manifests, receipts,
# worktree paths, and source fingerprints are deliberately absent here.
RESYNTHESIS_NATIVE_PARENT_GENERATION = "release_188"
RESYNTHESIS_NATIVE_PARENT_ROOT = "weights/safetensors"
RESYNTHESIS_NATIVE_PARENT_RUNTIME_ROOT = ""
RESYNTHESIS_NATIVE_PARENT_MANIFEST_PATH = ""
RESYNTHESIS_NATIVE_PARENT_MANIFEST_SHA256 = ""
RESYNTHESIS_NATIVE_PARENT_MODEL_SHA256 = ""
RESYNTHESIS_PARENT_CHECKPOINT_MANIFEST_PATH = ""
RESYNTHESIS_PARENT_CHECKPOINT_MANIFEST_SHA256 = ""
_RESYNTHESIS_PARENT_ARTIFACT_PACKAGE = ""
# The public runtime uses the Transformers tokenizer files under ``tokenizer/``.
# Fastokens remains an optional acceleration implementation rather than a
# release-owned artifact or admission requirement.
RESYNTHESIS_FASTOKENS_VERSION = "0.2.1"
RESYNTHESIS_FASTOKENS_COMMIT = ""
RESYNTHESIS_FASTOKENS_ROOT = ""
RESYNTHESIS_FASTOKENS_SITE = ""
RESYNTHESIS_FASTOKENS_RECEIPT_PATH = ""
RESYNTHESIS_FASTOKENS_RECEIPT_SHA256 = ""
RESYNTHESIS_FASTOKENS_SOURCE_ARCHIVE_SHA256 = ""
RESYNTHESIS_FASTOKENS_WHEEL_PATH = ""
RESYNTHESIS_FASTOKENS_WHEEL_SHA256 = ""
RESYNTHESIS_PARENT_TOKENIZER_SHA256 = ""
RESYNTHESIS_PARENT_TOKENIZER_VOCAB_SIZE = 248_077
@dataclass(frozen=True)
class ResynthesisConfig:
"""Top-level config for the Resynthesis reasoning-science model.
``hidden_size`` names the frozen Resynthesis vocabulary/feature projection
seam (4096), not the capacity of the complete additive model. Successor
generations may add wider learned transfer, page, expert, and reasoning
structure around that seam through explicit prefix-preserving migrations.
Everything outside the immutable projection interface is an initial seed.
"""
# ── Frozen vocabulary/feature lego (never answer or learning authority) ──
hidden_size: int = RESYNTHESIS_HIDDEN_SIZE
# ``None`` starts the accepted additive generation at the complete current
# feature seam. An explicit positive value is its initial materialized
# knowledge-transfer rank, never a maximum. A retained successor may widen
# this rank while keeping every accepted row/column byte-exact.
knowledge_transfer_dim: int | None = None
# Rank of the additive hidden-to-vocabulary residual pathway. ``None``
# derives the initial accepted rank from the model-owned knowledge-transfer
# geometry, never from a fixed host constant. An explicit positive value is
# likewise only an initial materialized rank: retained successors may widen
# it through prefix-exact checkpoint migration, and no production path may
# treat it as a maximum.
logit_residual_rank: int | None = None
base_model_dir: str = RESYNTHESIS_NATIVE_PARENT_ROOT
native_parent_manifest_path: str = ""
native_parent_manifest_sha256: str = ""
# The graph parent predates the current rolling Resynthesis schema. These source
# fields describe the historical reconstruction lineage for diagnostics;
# they may change as the runtime improves and never veto load, resume, or
# promotion. Exact model/checkpoint tensor identities remain authoritative.
parent_runtime_source_dir: str = ""
parent_source_fingerprint_path: str = ""
parent_source_fingerprint_sha256: str = ""
parent_source_id: str = ""
parent_source_bundle_sha256: str = ""
parent_source_recovery_manifest_path: str = ""
parent_source_recovery_manifest_sha256: str = ""
parent_rbo_outcome_source_path: str = ""
parent_rbo_outcome_source_sha256: str = ""
parent_integrated_source_sha256: str = ""
parent_rbo_source_sha256: str = ""
parent_none_fabric_source_sha256: str = ""
parent_loader_source_sha256: str = ""
# The 553-tensor capability payload is isolated from the authoritative
# 1,043-tensor parent and fused by a separately trained Resynthesis surface.
# The directory is audit provenance only: the executable compatibility
# graph is pinned inside Resynthesis and never imports this mutable worktree.
legacy_capability_source_dir: str = ""
legacy_capability_source_sha256: str = ""
base_weights: str = "model.safetensors"
tokenizer_path: str = "tokenizer.json"
config_path: str = "config.json"
vocab_size: int = RESYNTHESIS_PROJECTION_VOCAB_SIZE
# Exact lexical rows currently owned by the verified Fastokens BPE. The
# frozen projection is padded to ``vocab_size`` for tensor geometry, so
# these values are deliberately distinct. This is not a generation cap:
# successor tokenizers may append rows while preserving every inherited
# token ID, and the additive vocabulary bridge maps any remaining physical
# projection rows through model-owned tensors before native selection.
tokenizer_vocab_size: int = RESYNTHESIS_PARENT_TOKENIZER_VOCAB_SIZE
# Immutable inherited token-ID prefix. Successor tokenizer artifacts may
# append rows beyond both this prefix and the physical projection width,
# but they may never renumber or replace these IDs. Keeping the prefix
# separate from the active lexical size makes vocabulary growth explicit
# without turning inherited projection geometry into a cap.
tokenizer_prefix_vocab_size: int = (
RESYNTHESIS_PARENT_TOKENIZER_VOCAB_SIZE
)
# Initial materialized rank of the learned projection-row-to-lexical-row
# bridge. This is a growth seed, not a ceiling: successor generations may
# widen it with prefix-exact checkpoint migration. The bridge prevents
# projection-only coordinates from becoming undecodable token IDs while
# retaining their trainable signal inside the Resynthesis graph.
vocabulary_transfer_rank: int = 16
# ── Additive science MoE stack (SEEDS β€” grow on demand, no ceiling) ──
num_layers: int = 4 # INITIAL count β€” grows via growth tool
num_experts: int = 8 # INITIAL count β€” grows via growth tool
expert_hidden_size: int = 1024
memory_slots: int = 1 # minimal seed row; grows on demand
attention_heads: int = 16
mhc_heads: int = 8
# Boundary provenance only. This does not route or stop the model; it binds
# a cold-reloaded graph to a checkpointed geometry migration.
geometry_migrated: bool = False
recursive_steps: int = 0 # 0 = RBO confidence controls traversal (no cap)
residual_init: float = 0.02
# This scale gates an additional *additive-hidden* low-rank update. It no
# longer blends parent logits into the answer surface; the frozen lm_head is
# used only as the shared vocabulary projection over trained additive state.
logit_residual_init: float = -4.0
# Parent-relative KL/identity retention is forbidden. Retention compares
# against the prior accepted additive generation at the explicit learning
# boundary, never against the hollow frozen vocabulary parent.
kl_anchor_weight: float = 0.0
kl_anchor_warmup_steps: int = 100
glyph_input_dim: int = GLYPH_DIM
# ── Identity ──
identity_name: str = "Resynthesis"
identity_creator: str = "Namenotfound.ai by Wendell Adams"
# ── Execution grounding (default ON) ──
execution_grounding: bool = True
# ── Uncapped policy marker ──
uncapped_policy: str = "intentional"
# ── Model artifacts root ──
artifacts_dir: str = ".nnf-resynthesis/models"
# ── Exact public-release relocation coordinates ──
# These paths may move in an exported repository. Their corresponding
# identities remain the immutable native-parent/Fastokens authority.
native_parent_model_sha256: str = ""
parent_checkpoint_manifest_path: str = ""
parent_checkpoint_manifest_sha256: str = ""
fastokens_receipt_path: str = ""
fastokens_receipt_sha256: str = ""
fastokens_site_path: str = ""
fastokens_wheel_path: str = ""
fastokens_wheel_sha256: str = ""
fastokens_source_archive_sha256: str = ""