ianblenke commited on
Commit
5b17fa3
·
verified ·
1 Parent(s): ade0034

Exp 164: upload JEPA violation predictor v2 (Exp 155 artifact)

Browse files
Files changed (2) hide show
  1. README.md +109 -0
  2. jepa_predictor_v2.safetensors +3 -0
README.md ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - energy-based-model
4
+ - jepa
5
+ - constraint-verification
6
+ - carnot
7
+ - jax
8
+ license: apache-2.0
9
+ ---
10
+
11
+ # jepa-predictor-v2
12
+
13
+ **JEPA Violation Predictor v2** — a multi-domain neural verifier trained to predict
14
+ whether a language model answer violates domain constraints (arithmetic, code, logic).
15
+
16
+ This is a research artifact from the [Carnot EBM framework](https://github.com/ianblenke/carnot).
17
+ It is a small MLP (input_dim=200, hidden_dim=128, output_dim=1) trained with class-weighted
18
+ binary cross-entropy and early stopping on a balanced multi-domain dataset.
19
+
20
+ ## Performance (Exp 155)
21
+
22
+ | Domain | AUROC (v2) | vs v1 |
23
+ |--------|-----------|-------|
24
+ | Arithmetic | 0.721 | +0.018 |
25
+ | Code | 0.776 | +0.071 |
26
+ | Logic | 0.479 | −0.056 |
27
+ | **Macro average** | **0.659** | **+0.011** |
28
+
29
+ Training details: 963 samples, best epoch 19 / 100, early stopping on
30
+ validation macro AUROC (patience=15), class-weighted BCE loss (pos_weight clipped [0.1, 10]).
31
+
32
+ ## Architecture
33
+
34
+ ```
35
+ JEPAViolationPredictor(
36
+ input_dim = 200 # 200-dim binary feature vector (same encoder as Ising models)
37
+ hidden_dim = 128
38
+ output_dim = 1 # P(violation | x)
39
+ )
40
+ ```
41
+
42
+ The predictor is trained on structured (question, answer, violated) triples. Features are
43
+ the same 200-dim binary structural encoding used by the Ising constraint models
44
+ (Carnot-EBM/constraint-propagation-*). This makes the two model families interoperable.
45
+
46
+ ## Training Data (Exp 154 → Exp 155)
47
+
48
+ - **Arithmetic**: 800 pairs reused from Exp 143 (carry-chain arithmetic templates)
49
+ - **Code**: 200 synthetic pairs (Python type, return, initialisation constraints)
50
+ - **Logic**: 200 synthetic pairs (implication, exclusion, disjunction, negation)
51
+ - Total: 1,200 pairs; 963 train / 237 validation (stratified by domain × violated)
52
+
53
+ ## Usage
54
+
55
+ ```python
56
+ from safetensors.numpy import load_file
57
+
58
+ weights = load_file("jepa_predictor_v2.safetensors")
59
+ # Keys: "layer1.weight", "layer1.bias", "layer2.weight", "layer2.bias"
60
+
61
+ # Or load via the carnot package:
62
+ from carnot.inference.jepa_predictor import JEPAViolationPredictor
63
+ predictor = JEPAViolationPredictor.load("jepa_predictor_v2.safetensors")
64
+
65
+ # Score a 200-dim binary feature vector
66
+ import numpy as np
67
+ x = np.zeros(200, dtype=np.float32)
68
+ x[:20] = 1.0 # example features
69
+ prob_violation = predictor.predict(x)
70
+ print(f"P(violation) = {prob_violation:.3f}")
71
+ ```
72
+
73
+ ## Limitations
74
+
75
+ 1. **Logic AUROC low (0.479)**: byte-level structural features do not capture
76
+ logical implication structure well. Semantic embeddings are needed.
77
+ 2. **Code domain fast-path issues** (Exp 156): at threshold ≥ 0.3, all code questions
78
+ are fast-pathed (200/200), causing degradation. Use threshold ≥ 0.8 for code.
79
+ 3. **Target not met**: <2% degradation target at t=0.5 not achieved. Treat as
80
+ directional baseline, not production-ready.
81
+ 4. **Template training data**: Not validated on real LLM outputs.
82
+
83
+ ## Note: Production Installation
84
+
85
+ > **Note:** This is a Phase 1 research artifact. For production use of the full
86
+ > Carnot EBM framework (constraint verification, guided decoding, energy-based repair), see:
87
+ >
88
+ > ```bash
89
+ > pip install carnot
90
+ > ```
91
+ >
92
+ > Source and documentation: <https://github.com/ianblenke/carnot>
93
+
94
+ ## Spec
95
+
96
+ - REQ-JEPA-001: Violation predictor trained on multi-domain data.
97
+ - REQ-JEPA-002: Fast-path routing using predictor confidence.
98
+ - SCENARIO-JEPA-003: Cross-domain AUROC improvement over v1.
99
+
100
+ ## Citation
101
+
102
+ ```bibtex
103
+ @misc{carnot2026jepa,
104
+ title = {Carnot JEPA Violation Predictor v2},
105
+ author = {Carnot-EBM},
106
+ year = {2026},
107
+ url = {https://github.com/ianblenke/carnot}
108
+ }
109
+ ```
jepa_predictor_v2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0098f83b4bc3fd3edcfafa7388bc692aa9733c1d7028e442c2ea94ca753517b
3
+ size 74892