EcoSLM-WebJEPA v3 (fragilov/ecoslm-web-jepa)
EcoSLM-WebJEPA (v3) unifies a calibrated edge Web Decision Policy with a Counterfactual Joint-Embedding Predictive Architecture (C-JEPA) world model (11,274,578 parameters, latent_dim=64, Dual ONNX INT8 total 13.72 MB) grounded in Counterfactual World Models: JEPAs That Reason About "What If" (Balestriero, LeCun & Varaku, 2026) and distilled from TypeSafe Jev (jev-latest) + local Qwen2.5-0.5B-Instruct for TYPE_TEXT synthesis.
Architecture Highlights
- Vietnamese + English Subword Backbone (
d_model=256, nhead=4): BamiBERT Byte-Level BPE (20,481 vocab) initialized via truncated SVD (768 -> 256), 4-layer Context Transformer, 2-layer Element Transformer, 2-layer Cross-Attention Decoder over up to 250 DOM controls with role & structural flags.
- Zero-Shot Lexical Cross-Match: Pure-tensor ONNX-safe
goal / history / page token overlap features (e_align) fused with split dropout (elem_cross_drop=0.10, elem_lex_drop=0.35).
- Euclidean FiLM
FactualWorldPredictor (latent_dim=64): Predicts (\mu(z_t, a) = z_t + \Delta\mu(z_t, e(a))) without trailing LayerNorm on state_proj or residual blocks, preserving additive disturbance geometry for zero-retrain Eq. (6) Latent Residual Reuse, Eq. (7) Readout Transport, and Interaction-Aware Gated C-JEPA (\alpha = \text{clamp}(1 - s_{\text{blocked}}, 0.15, 1.0)).
- Dual ONNX Dynamic-Shape INT8 Runtime:
- Policy + Encoder Graph:
13.46 MB (12.44 ms mean on CPU)
- Factual World Predictor (
K=4 candidates): 0.26 MB (0.23 ms mean on CPU)
- Combined INT8 Artifact Footprint:
13.72 MB (smaller than WebDM v2's 14.68 MB).
Verified Benchmarks
1. Policy, Calibration & Edge Latency (Head-to-Head vs Frozen EcoSLM-WebDM v2)
| Metric |
EcoSLM-WebDM v2 (Frozen) |
EcoSLM-WebJEPA v3 (Round 5) |
| Parameters |
10,830,085 |
11,274,578 |
val_v2_frozen Op Top-1 (n=35) |
0.8000 |
0.8286 (+0.0286) |
val_v2_frozen Target Top-1 (n=35) |
0.8462 |
0.8769 (+0.0307) |
val Full Op Top-1 (n=144) |
0.6181 |
0.9444 (+0.3263) |
val Full Target Top-1 (n=144) |
0.8317 |
0.9469 (+0.1152) |
val Target Top-3 (n=144) |
— |
1.0000 |
| Calibrated Op ECE / Target ECE |
0.0964 / 0.1173 (on 35) |
0.0296 / 0.0352 |
Rare Ops (WAIT / BLOCKED / SCROLL_UP / SCROLL_DOWN) |
— |
1.0000 across all 4 |
| Local CPU Policy ONNX INT8 Latency |
15.83 ms |
12.44 ms (0.0% Op Top-1 drop vs FP32 0.9444) |
Local CPU World ONNX INT8 (K=4) |
— |
0.23 ms |
| Total INT8 Bundle Size |
14.68 MB |
13.72 MB |
2. Zero-Retrain Counterfactual World Model Evaluation
A. Persistent Unobserved Disturbance Suite (counterfactual_persistent_eval.jsonl, n=30, empirical_interaction_rho=0.0)
| Method |
Latent $R^2$ |
Latent MSE |
Readout $R^2$ (MLP / Lin) |
3-Branch Selection |
Alt-Only Recovery |
Factual Copy (z_obs0) |
-0.3939 |
0.11132 |
-0.4983 |
0.7333 (Policy) |
1.0000 (Policy) |
Standard JEPA (mu(z_t, a')) |
0.5057 |
0.03948 |
0.3848 / 0.4572 |
0.9667 |
0.9667 |
| C-JEPA Eq. (6) |
0.5433 |
0.03648 |
0.5807 |
1.0000 |
1.0000 |
| C-JEPA Eq. (7) |
— |
— |
0.6485 / 0.6039 |
0.9667 |
0.9667 |
| Gated C-JEPA |
0.5545 |
0.03558 |
0.5313 |
0.9667 |
1.0000 |
| C-JEPA + Policy Fusion |
— |
— |
— |
0.9333 |
1.0000 |
B. Interactive Recovery Suite (counterfactual_eval.jsonl, n=50, empirical_interaction_rho=5974.6323)
| Method |
Readout $R^2$ |
3-Branch Selection |
Alt-Only Recovery |
| Frozen WebDM v2 (Reactive) |
— |
0.7200 |
0.9200 |
| Standard JEPA Lookahead |
0.2975 |
0.7800 |
1.0000 |
| C-JEPA Eq. (6) (un-gated high-$\rho$) |
-0.4836 |
0.7200 |
1.0000 |
| Gated C-JEPA |
0.1153 (+0.5989 vs un-gated) |
0.7600 |
1.0000 |
| C-JEPA + Policy Fusion |
— |
0.8400 |
1.0000 |
| v3 Reactive Policy |
— |
0.8600 |
1.0000 |
3. Local End-to-End Edge Verification (scripts/verify_web_jepa_e2e.py)
- Both quantized ONNX INT8 sessions active (
policy_onnx_int8=True, world_onnx_int8=True).
- Step 1 (
TYPE_TEXT + Qwen2.5-0.5B): Predicted TYPE_TEXT on e1 (confidence=0.9954, 44.78 ms); LocalQwenTextHelper synthesized "HS-2026-0891".
- Step 3 (
COUNTERFACTUAL_JEPA_RECOVERY on held-out cf_pers_throttle_2): world_surprise=2.1286 triggered zero-retrain residual reuse recovery to CLICK e2 (cf_value=0.5522) with teacher_fallback=0.
- Step 4: Completed workflow with
DONE (confidence=0.7867, 22.72 ms).
Quickstart Usage
from src.ecoslm_web_agent import CounterfactualWebAgentEngine
engine = CounterfactualWebAgentEngine(
model_name_or_path="models/EcoSLM_WebJEPA",
prefer_onnx=True,
local_slm_path="models/qwen2.5-0.5b-instruct",
)
decision = engine.decide(state=dom_state, goal="...", history=[], allow_fallback=False)
Academic References
- R. Balestriero, Y. LeCun, and K. Varaku, "Counterfactual World Models: JEPAs That Reason About 'What If'", arXiv:2611.24778v1, 2026.
- Qualcomm AI Research, "BamiBERT: A New BERT-based Language Model for Vietnamese", arXiv:2607.02259, 2026.
- C. Guo, G. Pleiss, Y. Sun, and K. Q. Weinberger, "On Calibration of Modern Neural Networks", ICML, 2017.
- Qwen Team, Alibaba Cloud, "Qwen2.5 Technical Report", arXiv:2409.12186, 2024.