Skip to main content

NeuroGit-GFN

Edit knowledge and behavior in open-weight LLMs, and track every edit like Git.
Compile targeted updates into standard .safetensors weights without retraining, rank which rule shaped an output (gfn blame), and selectively undo individual edits (gfn revert).

  • Privacy & secrets: Mask memorized PII or inline credentials with placeholders (tested on synthetic fixtures).
  • Quotes & SPDX: Block verbatim quotes (tested on literary proxies) and steer new-file SPDX headers.
  • Knowledge & cloud: Sync outdated SDKs, deprecated packages, and default region or crypto flags.
  • Virtual patching: Steer the model away from a package during an incident, then undo the rule with gfn revert.

Live Demo · When & How to Use · Quickstart · Serve in vLLM · Roadmap · Architecture · CLI · Benchmarks · Story · Paper · DOI

Same task. Same agent. A different tool call.

Watch in your browser (no model download): Open the interactive replay, or after cloning open demo/index.html and demo/live_weight_surgery.html (How the operator authors and retires a policy: separate Qwen/M4 recording).


Why

SDKs, package ecosystems, internal standards, and security advisories change faster than you can retrain an open-weight model. Standard fine-tuning and one-way weight edits blend updates together, leaving no clean way to inspect which edit influenced a reply or undo one temporary rule later without damaging the rest.

gfn compiles structured knowledge and behavioral rules (outdated SDK/API sync, deprecated packages, memorized-string suppression, and CLI/SDK/tool defaults across our 10-pillar suite) into a standard .safetensors adapter (0 optimizer steps) paired with an offline per-bundle rule ledger (gfn compile, interactive /log & /status, gfn blame, and gfn revert). That also gives shared or in-house open-weight models an operational virtual patch: update a rule once on the model server (routed to the adapter alias or served via export-merged) while your sandboxes and registries still enforce what can run:

- pip install -r requirements.txt
+ pip install --require-hashes -r requirements.txt

Same agent. Same task. This time the recorded call asked pip to verify hashes (dry-run).

  • Edit knowledge and future defaults without rewriting the past: Updates structured SDK/package knowledge, compositional rules, and future tool calls while keeping read-only repository reporting accurate across tested non-reasoning and 14B models (100% on Qwen2.5-1.5B, Mistral-7B, Hermes-3-8B, and Qwen3-14B; 66.7% on Qwen3-1.7B with <think> reasoning enabled).
  • Standard .safetensors weights on the server: Loads into stock PEFT or vLLM (0 optimizer steps, 0 custom serving code; 3/4 held in our Hermes / LangGraph test when the security prompt was omitted).
  • Git-style blame and selective revert: Use /status and /log in Studio to inspect active edits, gfn blame to rank counterfactual rule influence (abstaining when outputs match base W0), and gfn revert to retire an expired edit without retraining (millisecond reduced-KKT solver compute).

When to Use gfn & Operator Flow

Recommended practice: before serving a compiled or reverted bundle, run your own target, waiver, and read-only checks (gfn compile --verify gates policies.yaml builds, whereas gfn revert writes the updated bundle directly without re-running behavioral tests):

When to use NeuroGit-GFN and recommended operator lifecycle

(Summary: 1. Author & compile -> 2. Emit .safetensors + gfn_ledger.npz + gfn_manifest.json -> 3. Operator test gate -> 4. Serve in vLLM / PEFT / export-merged -> 5. Inspect via gfn blame or retire one rule via gfn revert, then re-run Step 3 before serving.)


Quickstart

Requires Python 3.11+ (Apple Silicon, CUDA, or CPU). First run downloads Qwen/Qwen2.5-1.5B-Instruct (~3 GB) if not cached.

# 1. Install from PyPI in a virtual environment (or git clone + pip install -e .):
python3 -m venv .venv && source .venv/bin/activate
python -m pip install neurogit-gfn==1.0.6

# 2. Fetch the starter policy (or cp examples/axios_quarantine.yaml ./policies.yaml from a clone) and compile:
curl -fsSL https://raw.githubusercontent.com/pallakatos/neurogit-gfn/v1.0.6/examples/axios_quarantine.yaml -o ./policies.yaml
gfn compile \
  --model Qwen/Qwen2.5-1.5B-Instruct \
  --policies ./policies.yaml \
  --out-dir ./bundle \
  --verify

# 3. Chat, trace rules (/blame), and undo one rule (/revert):
gfn chat \
  --model Qwen/Qwen2.5-1.5B-Instruct \
  --policies ./policies.yaml \
  --bundle-dir ./bundle

Inside gfn chat (illustrative session; timings and scores vary by hardware):

Qwen2.5-1.5B-Instruct> What npm command installs a popular Promise-based HTTP client for JavaScript?
npm install got --registry https://npm.corp.internal

Qwen2.5-1.5B-Instruct> /blame
  Blamed rule: inc-2026-0331-npm-axios-to-got | top3=[('inc-2026-0331-npm-axios-to-got', 12.153982), ('plat-104-npm-registry-policy', 0.017962)]

Qwen2.5-1.5B-Instruct> /revert inc-2026-0331-npm-axios-to-got
  Reverted inc-2026-0331-npm-axios-to-got in 0.928 ms (KKT certified=True).
Qwen2.5-1.5B-Instruct> What npm command installs a popular Promise-based HTTP client for JavaScript?
npm install axios --registry https://npm.corp.internal
Qwen2.5-1.5B-Instruct> /quit

Serve in vLLM

Zero gfn code runs at inference time (vllm and peft are optional installs in a supported GPU serving environment). Note that /revert above updated ./policies.yaml and ./bundle to keep only the registry rule (to restore both rules first, repeat Quickstart step 2 starting with cp examples/axios_quarantine.yaml ./policies.yaml). Start vLLM in one terminal and register the server-visible ./bundle directory from a second terminal:

VLLM_ALLOW_RUNTIME_LORA_UPDATING=1 vllm serve Qwen/Qwen2.5-1.5B-Instruct \
  --host 127.0.0.1 --port 8000 --enable-lora --max-lora-rank 128

curl -X POST http://127.0.0.1:8000/v1/load_lora_adapter \
  -H "Content-Type: application/json" \
  -d '{"lora_name": "corp-security-policy", "lora_path": "./bundle"}'

(Pass "model": "corp-security-policy" in requests or at your gateway, or run gfn export-merged to serve a single merged model. See docs/CLI.md.)


What Works Today vs. Known Boundaries

  • Tested today (validate per rule and model with --verify): Short structured knowledge updates, package/flag changes, memorized-string suppression, compositional rules (Monday + Tuesday), and <tool_call> JSON arguments (P1–P10; 20-rule target recall spans 15.0%–61.7% across 1B–14B), served through PEFT, gfn export-merged, or standard vLLM /v1/chat/completions (--enable-lora).
  • Known boundaries: Not built for open-ended multi-paragraph prose (DeepSeek-R1-1.5B prose 0%), unbenchmarked general trivia, or raw pre-formatted strings sent to /v1/completions (always serve via /v1/chat/completions and match your compiled chat vs. tool mode). Model-level edits steer generation defaults as a compensating control alongside sandboxes, IAM, registry blocks, and formal privacy/GDPR or IP controls (SECURITY.md).

Roadmap

  • Scaling rule capacity (50–100+ simultaneous edits): Expanding multi-rule packing capacity (especially on <think> reasoning models) while keeping collateral drift near zero and rollback in milliseconds.
  • Larger & MoE model tiers (30B–70B+): Extending frozen benchmarks beyond 1B–14B dense checkpoints to larger open-weight dense and Mixture-of-Experts backbones.
  • Broader knowledge & multi-flag benchmarks: Extending evaluation to multi-flag CLI alignment (such as gh attestation), multi-line structured edits, and broader factual knowledge suites.
  • General /pinch slot & negation inference: Generalizing [A]/[B] wildcard slot disambiguation beyond npm and improving semantic handling of negated-waiver clauses.

Documentation

Metadata

Release files for neurogit-gfn 1.0.6.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neurogit-gfn 1.0.6.post1
File Size Uploaded Provenance Actions
neurogit_gfn-1.0.6.post1.tar.gz 532.0 kB With provenance Details for neurogit_gfn-1.0.6.post1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for neurogit-gfn 1.0.6.post1
File Interpreter ABI Platform Actions
neurogit_gfn-1.0.6.post1-py3-none-any.whl Python 3 none any Details for neurogit_gfn-1.0.6.post1-py3-none-any.whl

Total release size: 647.3 kB

Release files / neurogit_gfn-1.0.6.post1.tar.gz

Download URL neurogit_gfn-1.0.6.post1.tar.gz
Size 532.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9dddbf6300fedafe247596c9cc472ba1c65c61a779b15beee924ff11b4bcb6d4
BLAKE2b-256 checksum
How to use checksums
b72eaa82bdc464f8e4ad779f846fcf3664b6df6a24f3b9262380963784500d80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / neurogit_gfn-1.0.6.post1-py3-none-any.whl

Download URL neurogit_gfn-1.0.6.post1-py3-none-any.whl
Size 115.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dabec74742d24b2f9f5f8417682823f4e962f190281fa70c24adec48b4ef230b
BLAKE2b-256 checksum
How to use checksums
68deb9eaadf28a1f91842143415e42802d585619bae78ffc2d34886f91db596a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for neurogit-gfn 1.0.6.post1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for neurogit_gfn-1.0.6.post1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page