Views
No views yet
Status: research preview — architecture only, weights are UNTRAINED. This repository ships the model code and a randomly-initialized checkpoint so the architecture can be loaded, inspected and trained. It is not a usable language model yet. Canonical source & experiments: github.com/kayra-hn/HFP
M ∈ ℝ^{key_dim×H}, z ∈ ℝ^{key_dim}).
The inference-time state is constant in context length (O(1) memory instead of
a growing KV-cache); long-range information must flow through the recurrent memory.decay_mode="exp" — standard geometric decay (the RetNet/GLA/Mamba family baseline).decay_mode="cubic_flux" — an exact discretization of the cubic relaxation
dθ/dτ = −η·θ³: a state-magnitude-dependent decay
λ_t = 1/√(1+2η·z_t²). Empty channels barely decay (plateau); full channels
forget actively (self-limiting).conv_kernel, ablate with 1) and a capacity axis via DPFP key feature maps
(key_feature_map="dpfp").key_feature_map="dpfp"): first mechanism with a clear
advantage — 2-6x baseline accuracy at long gaps under high interference, plus
more stable training. Recommended: exp + additive + dpfp + ffn_type="standard".cubic_flux currently trails the exponential baseline at this scale (parked as
a long-horizon hypothesis; exact parallel form implemented). No LM-benchmark
claims are made. Weights in this repo remain untrained/architecture-only.1import torch
2from transformers import AutoModelForCausalLM
3
4model = AutoModelForCausalLM.from_pretrained(
5 "kayrahan35/HFP-O1-Memory-Model",
6 trust_remote_code=True, # custom architecture (HFPForCausalLM)
7)
8
9# Streaming inference with constant memory:
10past = None
11for chunk in token_chunks: # e.g. 256-token chunks
12 out = model(chunk, past_key_values=past, use_cache=True)
13 past = out.past_key_values # fixed-size state, does not grow1from transformers import AutoConfig, AutoModelForCausalLM
2cfg = AutoConfig.from_pretrained("kayrahan35/HFP-O1-Memory-Model", trust_remote_code=True)
3cfg.decay_mode = "cubic_flux" # or "exp"
4cfg.key_feature_map = "dpfp" # or "elu"
5model = AutoModelForCausalLM.from_config(cfg, trust_remote_code=True)cubic_flux uses a sequential scan (O(L)) and is ~2–3× slower than the
parallel exp path.modeling_hfp.py / configuration_hfp.py — HF-compatible model & config;
hfp_bulk_state.py — the recurrent memory (retention laws, binding conv, DPFP);
bulk_trigger_decoder.py — decoder layer (windowed attention + shared-bulk FFN).
Training scripts, regression tests (smoke_test.py) and the retention/recall
experiment suite live in the GitHub repository.