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
Watch in your browser (no model download): Open the interactive replay, or after cloning open
demo/index.htmlanddemo/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
14Bmodels (100%onQwen2.5-1.5B,Mistral-7B,Hermes-3-8B, andQwen3-14B;66.7%onQwen3-1.7Bwith<think>reasoning enabled). - Standard
.safetensorsweights on the server: Loads into stockPEFTorvLLM(0optimizer steps,0custom serving code;3/4held in ourHermes/LangGraphtest when the security prompt was omitted). - Git-style blame and selective revert: Use
/statusand/login Studio to inspect active edits,gfn blameto rank counterfactual rule influence (abstaining when outputs match baseW0), andgfn revertto 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):
(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 spans15.0%–61.7%across1B–14B), served throughPEFT,gfn export-merged, or standardvLLM/v1/chat/completions(--enable-lora). - Known boundaries: Not built for open-ended multi-paragraph prose (
DeepSeek-R1-1.5Bprose0%), unbenchmarked general trivia, or raw pre-formatted strings sent to/v1/completions(always serve via/v1/chat/completionsand 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 beyond1B–14Bdense 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
/pinchslot & negation inference: Generalizing[A]/[B]wildcard slot disambiguation beyondnpmand improving semantic handling of negated-waiver clauses.
Documentation
docs/ARCHITECTURE.md: repository layout, module-by-module guide (authoring,harness,compiler,kkt,bundle), and contributor workflowdocs/CLI.md:/pinchauthoring,policies.yamlschema,PEFTand merged exportsdocs/BENCHMARKS.md: method comparison,1B–14Bresults across 10 models, Lean 4 proofs, and boundariesBLOG_STORY.md&PAPER.pdf: the March 2026axiosstory and 6-page research preprint- Cite (
Zenodo):10.5281/zenodo.24727308(Concept DOI:10.5281/zenodo.24727307; seeCITATION.cff) LICENSE&NOTICE: Apache-2.0 (gfn1.0.6; Gemma evaluations under Gemma Terms of Use)
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)
| 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)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| 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 logRelease 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 logSecurity 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.
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 logA 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.