Views
No views yet
| Component | Description | Params |
|---|---|---|
| GeometricProcessor | 4-layer causal transformer with KV caching producing additive geo_logits | ~148M |
| LatentPlanner | VAE with LaDiR-style diffusion ELBO for planning latent z₀ | ~14M |
| EBM Critic | Energy-based model scoring geometric sequence quality | ~0.5M |
| Alpha Gate | Learned sigmoid gate (α=0.537) blending sidecar corrections | 1 |
final_logits = base_logits + α · geo_logitsgoogle/gemma-4-E2B-it (frozen, ~2.6B params)1# Install
2!pip install transformers accelerate huggingface_hub torch
3
4# Clone the repo
5!git clone https://github.com/Bender1011001/dual-system-architecture.git
6
7import torch
8from transformers import AutoModelForCausalLM, AutoTokenizer
9from dual_system_v2 import DualSystemV2, SidecarConfig
10from huggingface_hub import hf_hub_download
11
12# Download sidecar
13sidecar_path = hf_hub_download(
14 repo_id="Bender1011001/gemma4-dualsystem-sidecar",
15 filename="sidecar_epoch2.pt"
16)
17
18# Load checkpoint config (guarantees weight compatibility)
19ckpt = torch.load(sidecar_path, map_location="cuda", weights_only=False)
20config = SidecarConfig(**ckpt["config"])
21
22# Load backbone
23backbone = AutoModelForCausalLM.from_pretrained(
24 ckpt["backbone"], torch_dtype=torch.bfloat16, device_map="cuda"
25)
26for p in backbone.parameters():
27 p.requires_grad = False
28
29# Build and load sidecar
30model = DualSystemV2(backbone=backbone, config=config).cuda().eval()
31model.geo_processor.load_state_dict(ckpt["geo_state"])
32model.ebm_critic.load_state_dict(ckpt["ebm_state"])
33model.latent_planner.load_state_dict(ckpt["planner_state"])
34
35# Generate
36tokenizer = AutoTokenizer.from_pretrained(ckpt["backbone"])
37result = model(input_ids=tokenizer("Hello", return_tensors="pt").input_ids.cuda())1@misc{dual-system-2026,
2 title={Dual-System Architecture: Geometric Sidecar Modules for Language Model Enhancement},
3 author={Bender1011001},
4 year={2026},
5 url={https://github.com/Bender1011001/dual-system-architecture}
6}