How to use from the
Use from the
PEFT library
from peft import PeftModel
from transformers import AutoModelForCausalLM

base_model = AutoModelForCausalLM.from_pretrained("nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-BF16")
model = PeftModel.from_pretrained(base_model, "rvindra/nemotron-3.5-lightning-bpf-guardian")

Nemotron-3.5-Lightning-30B BPF-Guardian: Verified In-Kernel eBPF/XDP Generation

Nemotron-3.5-Lightning-30B BPF-Guardian is a specialized eBPF/XDP coding model and PEFT LoRA adapter for nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-BF16, trained and verified against live Linux In-Kernel Verifiers (BPF_PROG_LOAD) and dynamic packet execution harnesses (BPF_PROG_TEST_RUN) on Linux Kernel 6.8.0-106-generic.

It achieves our best result to date on the project's held-out in-kernel eBPF/XDP benchmark, outperforming dense 8B baselines by +90.3% relative gain on protected synthesis benchmarks.

πŸš€ Interactive Visual Showcase: Launch Live Architecture & Workflow Dashboard β†—
(Displays live interactive pipeline diagrams, dataset breakdowns, benchmark figures, and in-kernel test logs)


Visual Performance Progression

BPF-Guardian Benchmark Performance Across Training Stages

4-Panel Detailed Suite Breakdown

Domain Robustness and Complexity Scaling


Performance Highlights (Live Linux Kernel 6.8 VPS Execution)

Evaluation Benchmark Benchmark Size Base Nemotron 30B Prior Baseline (Qwen3-8B SFT v2) Nemotron BPF-Guardian SFT v1 Nemotron BPF-Guardian RL (Solve@2) Relative Improvement
Protected Private Synthesis 120 tasks 0 / 120 (0.0%) 31 / 120 (25.8%) 54 / 120 (45.0%) 59 / 120 (49.2%) +90.3%
Protected Standalone Repair 120 tasks 79 / 120 (65.8%) 85 / 120 (70.8%) 91 / 120 (75.8%) 91 / 120 (75.8%) +7.1%
Confirmation Suite 60 tasks 20 / 60 (33.3%) 33 / 60 (55.0%) 42 / 60 (70.0%) 44 / 60 (73.3%) +33.3%
N3 Stratified Dev Suite 48 tasks β€” 18 / 48 (37.5%) 24 / 48 (50.0%) 23 / 48 (47.9%) +27.7%
Combined Protected Suite 276 tasks 79 / 276 (28.6%) 137 / 276 (49.6%) 168 / 276 (60.9%) 172 / 276 (62.3%) +25.6%

All results verified with zero mock verifiers using clang-18 -target bpf -O2 and kernel execution on Linux 6.8.0-106-generic. Paired McNemar test on combined suite confirms statistical significance ($p = 1.38 \times 10^{-5}$, $p < 0.0001$).


Available Checkpoints & Branches

  • main: Nemotron SFT v1 checkpoint (optimized for standalone synthesis and repair, 75.8% repair pass rate, 168/276 on combined benchmark).
  • rl-n3: Nemotron RL N3 checkpoint (optimized for two-turn interactive repair with compiler/verifier feedback, 49.2% Solve@2 on protected synthesis, 73.3% on confirmation).

Live In-Kernel Verification Pipeline

Every generated XDP program undergoes strict 4-stage validation:

[Candidate C Code]
       β”‚
       β–Ό
1. Structural Lint & Sanitization (SEC("xdp") header, helper verification)
       β”‚
       β–Ό
2. Compilation (clang-18 -target bpf -O2 -g -Wall -Werror)
       β”‚
       β–Ό
3. In-Kernel Verifier Check (bpftool prog load into Linux 6.8.0-106-generic)
       β”‚
       β–Ό
4. Dynamic Packet Execution (BPF_PROG_TEST_RUN socket test fixtures)
       β”‚
       β”œβ”€β”€ PASS: Reward = 1.0 (Pass@1)
       └── FAIL: Extract standardized compiler / verifier / assertion diff diagnostic
             β”‚
             β–Ό
[Turn 2: Repaired Code] ──► Re-run Stages 1-4 ──► PASS: Reward = 0.9 (Solve@2)

Published Datasets

  • rvindra/bpf-guardian-sft: Combined instruction-tuning corpus merging v1 and v2 synthesis and repair datasets (2,320 examples: 1,913 train / 407 val). Strictly audited with 0% calibration benchmark overlap.
  • rvindra/bpf-guardian-rl: Certified 264-task RLVR benchmark with raw packet hex fixtures and expected XDP verdicts. Packaged with formal contamination_audit.json.

Functional Capabilities

The model synthesizes pure, self-contained, and kernel-verified C code across four core network programming domains:

  1. Packet Filtering & Security (pfs): DDoS defenses, port knocking state machines, token bucket policers, bloom filters.
  2. Network Routing & Forwarding (nrf): Maglev consistent hashing, ECMP multipath routers, LPM trie routing, proxy ARP, tunnel encapsulation.
  3. Packet Inspection & Telemetry (pit): Heavy hitters (Count-Min Sketch), flow telemetry, TCP RTT and options analysis.
  4. Packet Transformation & Rewrite (ptr): VLAN/QinQ manipulation, GTP-U/VXLAN decapsulation, IPv4/IPv6 header rewrites.

Usage with PEFT & Transformers

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel

base_model_id = "nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-BF16"
peft_model_id = "rvindra/nemotron-3.5-lightning-bpf-guardian"

tokenizer = AutoTokenizer.from_pretrained(base_model_id)
base_model = AutoModelForCausalLM.from_pretrained(
    base_model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

# Load SFT model (revision="main") or RL model (revision="rl-n3")
model = PeftModel.from_pretrained(base_model, peft_model_id, revision="rl-n3")

prompt = \"\"\"You are an expert Linux kernel eBPF developer. Write a complete, self-contained XDP C program that inspects incoming IPv4 TCP packets, extracts the destination port, and drops packets targeting port 8080.
Output ONLY the raw C source code. Do not wrap with markdown code fences.\"\"\"

messages = [
    {"role": "system", "content": "You are an expert Linux kernel eBPF developer. Output ONLY valid, compilable C code."},
    {"role": "user", "content": prompt}
]

inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to("cuda")
outputs = model.generate(inputs, max_new_tokens=2048, do_sample=False)
print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))

Training Methodology

  • Base Architecture: Nemotron-3.5-Lightning (30B Total Parameters, 3.5B Active Parameters per token MoE).
  • LoRA Configuration: Rank 32, Alpha 64, Target Modules: all attention and MLP projections (q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj).
  • SFT Stage: 3 epochs on 1,600 verified instruction-tuning examples with family-heldout cross-validation.
  • RL Stage: 30 steps of Importance Sampling RLVR with live Linux kernel verifier rewards and $\beta = 0.05$ KL regularization.

Notes on AI

This project was primarily conducted using AI:

  • Model training
  • Dataset generation
  • Scripting and coding

Acknowledgements


Citation

@misc{nemotron_bpf_guardian_2026,
  author = {Tarunokusumo, Ravindra},
  title = {Nemotron-3.5-Lightning BPF-Guardian: Verified In-Kernel eBPF/XDP Generation},
  year = {2026},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/rvindra/nemotron-3.5-lightning-bpf-guardian}}
}
Downloads last month
53
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for rvindra/nemotron-3.5-lightning-bpf-guardian

Adapter
(14)
this model