Decoder-only Causal Transformer
LogicGPT
Section titled “LogicGPT”Defined in: griffith_logic.models.logic_gpt.LogicGPT (class)
class LogicGPT( config: LogicGPTConfig, dfa_targets: list[str] | None = None, dfa_mode: str = 'micro', dfa_lr: float | None = None,)Logic-gate version of a decoder-only causal Transformer. forward(tokens[B,S]) → (logits, emb_reg).
Causality: logits[:, i] depends only on tokens[:, :i+1].
- LogicEmbedding / positional codes / head / GroupSum are all position-independent
- LogicTransformerBlock uses causal=True (never looks at future positions)
- LogicLayerNorm normalizes along the feature axis (d_model) and never crosses the sequence axis
Examples using this API
- Writing Shakespeare with a Logic-Gate GPT —
examples/07_logic_gpt.py
LogicGPTConfig
Section titled “LogicGPTConfig”Defined in: griffith_logic.models.logic_gpt.LogicGPTConfig (class)
class LogicGPTConfig( vocab_size: int = 67, d_model: int = 128, n_layers: int = 2, n_heads: int = 1, block_size: int = 64, mlp_ratio: int = 2, pos_width: int = 8, pos_code: str = 'binary', head_group_factor: int = 8, tau: float = 1.0, n_inputs: int = 2, parameterization: str = 'softmax', selection: str = 'soft', connections: str = 'random', merge: str = 'xor', norm: str = 'layernorm',)Hyperparameters for LogicGPT.
Examples using this API
- Writing Shakespeare with a Logic-Gate GPT —
examples/07_logic_gpt.py