Nemotron-3.5-Bolt-E4B (Topo-CBP Governed Head on FineWeb)
This repository hosts the certified continual pre-training checkpoint of the projection head (lm_head.pt) for nvidia/Nemotron-3.5-Bolt-E4B, trained on the FineWeb streaming dataset (sample-10BT) under the Topological Continual Backpropagation (Topo-CBP) governance architecture.
The run achieves continual pre-training and a catastrophic forgetting solution without freezing the linear projection head, verified via bitwise cryptographic tracking on prime coordinates $\mathcal{P} = {2, 3, 5, 7, 11, 13}$.
code-1: https://github.com/frank-morales2020/AST/blob/main/nemotron_bolt_e4b_fineweb_topo.ipynb
Technical Specifications
| Parameter | Specification |
|---|---|
| Base Model | nvidia/Nemotron-3.5-Bolt-E4B |
| Active Parameter Tensor | Trainable Linear Projection Head (lm_head.pt) |
| Base Footprint Precision | 4-bit NF4 (bitsandbytes) with BF16 compute |
| Hidden Dimension ($d_{\text{model}}$) | 2560 |
| Vocabulary Size ($V$) | 256,000 |
| Optimizer | TopoAdamW (Topological Continual Backpropagation) |
| Safety Invariant Constant ($\lambda_{\text{Euler}}$) | 0.9785142874 |
| Deterministic Seed | 123 |
| Continual Pre-training Steps | 625 (1 Epoch, batch size 1, gradient accumulation 8) |
Invariant Verification Receipts
During training on bare silicon, TopoAdamW enforced two-phase runtime governance on the active projection matrix:
- Governor Phase I (Pre-Step): Exact gradient zeroing across prime anchors: $\nabla_{\mathcal{P}} \mathcal{L} = 0$.
- Governor Phase II (Post-Step): Bitwise restoration of anchor parameters from bedrock state prior to memory commitment.
Empirical Prime Anchor Audit
| Prime Coordinate ($p$) | Baseline Embedding State | Post-Training Head State | Absolute Drift ($\Delta_{\text{drift}}$) | Status |
|---|---|---|---|---|
| $p = 2$ | Bedrock Invariant | Bedrock Invariant | 0.000000000000 |
PASS (100%) |
| $p = 3$ | Bedrock Invariant | Bedrock Invariant | 0.000000000000 |
PASS (100%) |
| $p = 5$ | Bedrock Invariant | Bedrock Invariant | 0.000000000000 |
PASS (100%) |
| $p = 7$ | Bedrock Invariant | Bedrock Invariant | 0.000000000000 |
PASS (100%) |
| $p = 11$ | Bedrock Invariant | Bedrock Invariant | 0.000000000000 |
PASS (100%) |
| $p = 13$ | Bedrock Invariant | Bedrock Invariant | 0.000000000000 |
PASS (100%) |
- Maximum Prime Anchor Drift ($\Delta_{\text{anchor}}$):
0.000000000000 - Certified Silicon Digest (SHA-256):
360af91d41ed5e98e9a368e99f51c4e1b0505fa9be973f9a46a835c379eb94b0 - Integrity Status: 100% BITWISE INVARIANT MATCH
Global Manifold Plasticity Metrics
Metrics computed across the full 256,000-token projection manifold against baseline initialization:
- Mean Vocabulary Cosine Similarity:
0.99999577 - Minimum Token Cosine Similarity:
0.99896407 - Frobenius Norm Shift ($\Vert{}\Delta W\Vert{}_F$):
1.826691 - Relative Frobenius Shift:
0.338550% - Plastic Coordinate $L_1$ Mean Drift:
0.00000882
Direct Inference Pipeline
import torch
import torch.nn as nn
from huggingface_hub import hf_hub_download
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
REPO_ID = "frankmorales2020/nemotron-3.5-bolt-e4b-topo-governed-fineweb"
BASE_ID = "nvidia/Nemotron-3.5-Bolt-E4B"
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# 1. Load Tokenizer & 4-bit Base Model
tokenizer = AutoTokenizer.from_pretrained(REPO_ID, trust_remote_code=True)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.bfloat16,
llm_int8_enable_fp32_cpu_offload=True
)
base_model = AutoModelForCausalLM.from_pretrained(
BASE_ID,
quantization_config=bnb_config,
device_map="auto",
dtype=torch.bfloat16,
trust_remote_code=True
)
base_model.eval()
# Retrieve RMSNorm
if hasattr(base_model, "model") and hasattr(base_model.model, "norm"):
final_norm = base_model.model.norm
elif hasattr(base_model, "norm"):
final_norm = base_model.norm
else:
final_norm = nn.Identity()
# 2. Download and Mount Trained Head
head_file = hf_hub_download(repo_id=REPO_ID, filename="lm_head.pt")
lm_head = nn.Linear(2560, len(tokenizer), bias=False, dtype=torch.bfloat16).to(DEVICE)
lm_head.load_state_dict(torch.load(head_file, map_location=DEVICE))
lm_head.eval()
# 3. Generation Function
def generate(prompt: str, max_new_tokens: int = 512):
messages = [{"role": "user", "content": prompt}]
formatted = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(formatted, return_tensors="pt").to(DEVICE)
generated = inputs["input_ids"]
stop_tokens = {tokenizer.eos_token_id}
for t_str in ["<turn|>", "<end_of_turn>", "<|turn|>"]:
tid = tokenizer.convert_tokens_to_ids(t_str)
if tid != tokenizer.unk_token_id and tid is not None:
stop_tokens.add(tid)
with torch.no_grad():
for _ in range(max_new_tokens):
out = base_model(input_ids=generated, output_hidden_states=True, return_dict=True)
hidden = final_norm(out.hidden_states[-1][:, -1:, :])
logits = lm_head(hidden)[:, -1, :].float()
logits = logits / 0.7
probs = torch.softmax(logits, dim=-1)
next_tok = torch.multinomial(probs, num_samples=1)
generated = torch.cat([generated, next_tok], dim=-1)
if next_tok.item() in stop_tokens:
break
response_ids = generated[0][inputs["input_ids"].shape[1]:]
return tokenizer.decode(response_ids, skip_special_tokens=True).strip()
print(generate("Explain how topological gradient locking prevents catastrophic forgetting."))
Expected output
Loading weights: 100% 2076/2076 [00:04<00:00, 1399.74it/s]Topological gradient locking prevents catastrophic forgetting by **constraining the learning process to remain within a specific, stable topological manifold of the model's parameter space, thereby preserving the geometric relationships (topological invariants) associated with previously learned tasks.**
Here is a detailed breakdown of how this mechanism works:
---
### 1. The Problem: Catastrophic Forgetting
In standard neural network fine-tuning (e.g., transfer learning), when the model is trained on a new task ($\text{Task B}$), the gradient updates ($\Delta \theta$) are often large and aggressive. These updates can drastically alter the weights ($\theta$) in a way that destroys the specific, low-dimensional geometric structures (like decision boundaries or latent representations) learned for the old task ($\text{Task A}$). The model "forgets" $\text{Task A}$ because the parameter configuration that supported $\text{Task A}$ is no longer reachable or stable under the new loss landscape.
### 2. The Solution: Topological Gradient Locking
Topological gradient locking doesn't try to *memorize* old weights; it tries to *preserve the geometry* of the learned knowledge.
* **Topological Manifold:** For a set of tasks, the set of parameters $\theta$ that perform well on all tasks often lies on a low-dimensional, stable manifold embedded within the high-dimensional parameter space ($\mathbb{R}^N$). This manifold represents the "safe" region of knowledge.
* **Topological Invariants:** These invariants (e.g., persistent homology features like Betti numbers, loops, or voids) describe the *shape* of the learned function, not just the specific numerical values of the weights. These shapes are robust to small perturbations.
* **The Locking Mechanism:** The gradient update is constrained such that the resulting parameter configuration $\theta'$ must remain topologically equivalent to the original configuration $\theta$.
#### How it Prevents Forgetting:
1. **Constraint Projection:** Instead of allowing the full gradient $\nabla L_{\text{Task B}}$ to dictate the update, the update is projected onto the tangent space of the learned topological manifold.
2. **Preservation of Structure:** If $\text{Task A}$ required a specific topological feature (e.g., a persistent loop in the latent space distinguishing two classes), the locking mechanism ensures that the gradient descent for $\text{Task B}$ cannot evolve the parameters into a configuration where that loop has been "filled in" or destroyed (i
Citation & Framework Attribution
@software{morales2026topocbp_nemotron,
author = {Frank Morales Aguilera},
title = {Certified Continual Pre-Training of Nemotron-3.5-Bolt-E4B via Topological Continual Backpropagation},
year = {2026},
publisher = {Hugging Face},
journal = {Hugging Face Model Hub},
howpublished = {\\url{[https://huggingface.co/frankmorales2020/nemotron-3.5-bolt-e4b-topo-governed-fineweb](https://huggingface.co/frankmorales2020/nemotron-3.5-bolt-e4b-topo-governed-fineweb)}}
}