mikeumus-divincian commited on
Commit
f798ee5
·
verified ·
1 Parent(s): fa094ae

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +14 -22
README.md CHANGED
@@ -1,9 +1,7 @@
1
  ---
2
  license: cc-by-nc-4.0
3
- library_name: larql
4
  tags:
5
  - vindex
6
- - larql
7
  - gemma4
8
  - gguf
9
  - mechanistic-interpretability
@@ -12,9 +10,9 @@ tags:
12
  base_model: google/gemma-4-e2b-it
13
  ---
14
 
15
- # Gemma 4 e2b — LarQL Vindex v0.2
16
 
17
- First-ever published [LarQL](https://github.com/chrishayuk/larql) vindex for Google's Gemma 4.
18
 
19
  A **vindex** is a transformer's weights decompiled into a queryable feature database — entity associations, circuit structure, and knowledge-editing surfaces exposed as APIs. No GPU required for most operations.
20
 
@@ -26,16 +24,16 @@ A **vindex** is a transformer's weights decompiled into a queryable feature data
26
  | Exposes entity associations via `/v1/walk` | `/v1/infer` does NOT produce factual completions |
27
  | Enables rank-1 knowledge edits (DELETE/INSERT) | Not a replacement for the base Gemma4 weights |
28
  | Circuit analysis (broadcast→domain→entity→prediction) |
29
- | Editing surface for `larql compile into model` → standard HuggingFace safetensors inference | Not a general inference engine |
30
 
31
- **Critical note on `/v1/infer`:** This endpoint returns a feature-modulated projection of the host model's activations — not a coherent text-generation distribution. Output is incoherent subword tokens by design (the vindex is a feature graph, not a full transformer forward pass). For factual text generation from the *base* model, use `google/gemma-4-e2b-it` directly. To run inference on an **edited** model (after DELETE/INSERT patches), use `larql compile into model` — this exports MEMIT-edited weights to HuggingFace safetensors that load like any standard `transformers` model. Use `/v1/walk` and `/v1/patch` for the validated vindex operations.
32
 
33
  **Validated surfaces:** `/v1/walk` (entity-association retrieval), `/v1/describe` (feature neighborhood), `/v1/patch` DELETE/INSERT (rank-1 weight editing, Gate 3 confirmed).
34
 
35
  **Compile edited vindex to a runnable model:**
36
  ```bash
37
  # After applying patches, export to safetensors for standard inference
38
- larql compile into model \
39
  --vindex Divinci-AI/gemma-4-e2b-vindex \
40
  --output ./edited-gemma4 \
41
  --format safetensors
@@ -48,21 +46,17 @@ model = AutoModelForCausalLM.from_pretrained('./edited-gemma4')
48
  ## Quick start
49
 
50
  ```bash
51
- # Install LarQL (requires our fork with Gemma 4 support until upstreamed)
52
- git clone https://github.com/Divinci-AI/larql.git
53
- cd larql && cargo build --release
54
-
55
  # Set environment variables
56
- export LARQL_SERVICE_URL=<your_larql_cloud_run_url>
57
- export INTERNAL_LARQL_S2S_TOKEN=<your_s2s_token>
58
 
59
  # Query entity associations
60
- curl "$LARQL_SERVICE_URL/v1/walk?prompt=Paris&layers=14-27&top=10" \
61
- -H "Authorization: Bearer $INTERNAL_LARQL_S2S_TOKEN"
62
 
63
  # Gate 3 repro: DELETE the Paris→capital feature then verify suppression
64
- curl -X POST "$LARQL_SERVICE_URL/v1/patches/apply" \
65
- -H "Authorization: Bearer $INTERNAL_LARQL_S2S_TOKEN" \
66
  -H "Content-Type: application/json" \
67
  -d '{"name":"delete-paris-capital","patch":{"version":1,"base_model":"gemma4-e2b","created_at":"2026-04-20T00:00:00Z","operations":[{"op":"delete","entity":"Paris","relation":"capital","target":"서울","weight":1.0,"layer":27,"feature":11179}]}}'
68
 
@@ -87,7 +81,7 @@ curl -X POST "$LARQL_SERVICE_URL/v1/patches/apply" \
87
 
88
  Total: ~2.8 GB (without full weight files)
89
 
90
- > **Note on `down_features.bin`:** Generated from `down_weights.bin` via a Python transposition step that handles Gemma 4's variable intermediate sizes per layer (L0-14: 6144, L15-34: 12288). The Rust `build_down_features` binary segfaults on variable intermediate sizes; our fix is the Python Cloud Build step in `build-larql-service.sh`. Required for walk-mode feature retrieval.
91
 
92
  ## Gate 3 Validation (DELETE patch confirmed)
93
 
@@ -136,9 +130,7 @@ This vindex enabled the following findings (see `notebooks/PAPER_universal_const
136
 
137
  1. **Substitute tokenizer**: Feature labels show Qwen 2.5 tokens (151,643-vocab), not Gemma 4 tokens. Gate vectors are correct Gemma 4 weights; only the label mapping is approximate.
138
 
139
- 2. **Built with patched LarQL**: 7 bug fixes required for Gemma 4 (column-major loading, Q4_K block size, variable FFN size support, etc.). See https://github.com/Divinci-AI/larql and upstream PR https://github.com/chrishayuk/larql/pull/24.
140
-
141
- 3. **License**: CC-BY-NC 4.0. Academic and research use. Contact [mike@divinci.ai](mailto:mike@divinci.ai) for commercial licensing.
142
 
143
  ## Citation
144
 
@@ -160,4 +152,4 @@ This vindex enabled the following findings (see `notebooks/PAPER_universal_const
160
 
161
  ## Acknowledgments
162
 
163
- Chris Hayuk for creating LarQL. Google DeepMind for Gemma 4. Cloudflare for frontier model hosting.
 
1
  ---
2
  license: cc-by-nc-4.0
 
3
  tags:
4
  - vindex
 
5
  - gemma4
6
  - gguf
7
  - mechanistic-interpretability
 
10
  base_model: google/gemma-4-e2b-it
11
  ---
12
 
13
+ # Gemma 4 e2b — vIndex v0.2
14
 
15
+ First-ever published vindex for Google's Gemma 4.
16
 
17
  A **vindex** is a transformer's weights decompiled into a queryable feature database — entity associations, circuit structure, and knowledge-editing surfaces exposed as APIs. No GPU required for most operations.
18
 
 
24
  | Exposes entity associations via `/v1/walk` | `/v1/infer` does NOT produce factual completions |
25
  | Enables rank-1 knowledge edits (DELETE/INSERT) | Not a replacement for the base Gemma4 weights |
26
  | Circuit analysis (broadcast→domain→entity→prediction) |
27
+ | Editing surface for compiling into a standard HuggingFace safetensors model | Not a general inference engine |
28
 
29
+ **Critical note on `/v1/infer`:** This endpoint returns a feature-modulated projection of the host model's activations — not a coherent text-generation distribution. Output is incoherent subword tokens by design (the vindex is a feature graph, not a full transformer forward pass). For factual text generation from the *base* model, use `google/gemma-4-e2b-it` directly. To run inference on an **edited** model (after DELETE/INSERT patches), compile it — this exports MEMIT-edited weights to HuggingFace safetensors that load like any standard `transformers` model. Use `/v1/walk` and `/v1/patch` for the validated vindex operations.
30
 
31
  **Validated surfaces:** `/v1/walk` (entity-association retrieval), `/v1/describe` (feature neighborhood), `/v1/patch` DELETE/INSERT (rank-1 weight editing, Gate 3 confirmed).
32
 
33
  **Compile edited vindex to a runnable model:**
34
  ```bash
35
  # After applying patches, export to safetensors for standard inference
36
+ vindex compile into model \
37
  --vindex Divinci-AI/gemma-4-e2b-vindex \
38
  --output ./edited-gemma4 \
39
  --format safetensors
 
46
  ## Quick start
47
 
48
  ```bash
 
 
 
 
49
  # Set environment variables
50
+ export VINDEX_SERVICE_URL=<your_vindex_cloud_run_url>
51
+ export INTERNAL_VINDEX_S2S_TOKEN=<your_s2s_token>
52
 
53
  # Query entity associations
54
+ curl "$VINDEX_SERVICE_URL/v1/walk?prompt=Paris&layers=14-27&top=10" \
55
+ -H "Authorization: Bearer $INTERNAL_VINDEX_S2S_TOKEN"
56
 
57
  # Gate 3 repro: DELETE the Paris→capital feature then verify suppression
58
+ curl -X POST "$VINDEX_SERVICE_URL/v1/patches/apply" \
59
+ -H "Authorization: Bearer $INTERNAL_VINDEX_S2S_TOKEN" \
60
  -H "Content-Type: application/json" \
61
  -d '{"name":"delete-paris-capital","patch":{"version":1,"base_model":"gemma4-e2b","created_at":"2026-04-20T00:00:00Z","operations":[{"op":"delete","entity":"Paris","relation":"capital","target":"서울","weight":1.0,"layer":27,"feature":11179}]}}'
62
 
 
81
 
82
  Total: ~2.8 GB (without full weight files)
83
 
84
+ > **Note on `down_features.bin`:** Generated from `down_weights.bin` via a Python transposition step that handles Gemma 4's variable intermediate sizes per layer (L0-14: 6144, L15-34: 12288). The Rust binary segfaults on variable intermediate sizes; our fix is a Python Cloud Build step. Required for walk-mode feature retrieval.
85
 
86
  ## Gate 3 Validation (DELETE patch confirmed)
87
 
 
130
 
131
  1. **Substitute tokenizer**: Feature labels show Qwen 2.5 tokens (151,643-vocab), not Gemma 4 tokens. Gate vectors are correct Gemma 4 weights; only the label mapping is approximate.
132
 
133
+ 2. **License**: CC-BY-NC 4.0. Academic and research use. Contact [mike@divinci.ai](mailto:mike@divinci.ai) for commercial licensing.
 
 
134
 
135
  ## Citation
136
 
 
152
 
153
  ## Acknowledgments
154
 
155
+ Google DeepMind for Gemma 4. Cloudflare for frontier model hosting.