Text Classification
Transformers
English
Indonesian
code
security
code-review
static-analysis
vulnerability-detection
sarif
sliding-window-attention
spark
cpp
avx2
awq
experimental
Instructions to use wxsys/spark-servitor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use wxsys/spark-servitor with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="wxsys/spark-servitor")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("wxsys/spark-servitor", device_map="auto") - Notebooks
- Google Colab
- Kaggle
docs: fix markdown formatting by replacing brittle KaTeX with clean ASCII diagrams
Browse files
README.md
CHANGED
|
@@ -58,26 +58,68 @@ model-index:
|
|
| 58 |
|
| 59 |
## Overview
|
| 60 |
|
| 61 |
-
Spark-Servitor is a
|
| 62 |
|
| 63 |
-
While Qwen-Servitor is engineered around Qwen3.5-0.8B linear attention (Gated DeltaNet) for sub-15ms pre-commit screening, Spark-Servitor scales up to **Spark-X2.5-1.7B** with Sliding Window Attention (SWA 512), 7 Full Attention anchor layers, and Headwise Sigmoid Output Gating (`g_proj`). This provides broader receptive capacity for multi-file patches and cross-file symbol tracking across monorepos up to 1,048,576 tokens.
|
| 64 |
|
| 65 |
-
The generative projection head (`lm_head`, 311M parameters) has been removed. Rather than generating conversational text, the model processes code diffs in a single forward pass to produce structured verdicts, risk metrics, and OASIS SARIF v2.1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
---
|
| 68 |
|
| 69 |
## Specifications
|
| 70 |
|
| 71 |
-
|
|
| 72 |
|---|---|
|
| 73 |
| **Base Architecture** | Decapitated `XHToken/Spark-X2.5-1.7B` |
|
| 74 |
-
| **Hidden
|
| 75 |
| **Attention Layers** | 28 total (21 Sliding Window Attention, window 512 + 7 Full Attention) |
|
| 76 |
| **Attention Heads** | 16 Query Heads, 2 Key/Value Heads (Grouped-Query Attention) |
|
| 77 |
| **Output Gating** | Headwise Sigmoid Projection (`g_proj`) |
|
| 78 |
| **Context Window** | Up to 1,048,576 tokens via circular SWA buffer |
|
| 79 |
| **Decision Mechanism** | Dual-Softmax Differential Cortex Head (`DiffCAMQPCortexHead`) |
|
| 80 |
-
| **Format & Quantization** | Outlier-Preserved AWQ INT4 / W8A8 (
|
| 81 |
| **Resident Memory** | 4.08 MB VmRSS (C++ daemon via UNIX domain socket) |
|
| 82 |
| **Inference Latency** | 0.044 ms per diff (CPU Intel AVX2 SIMD) |
|
| 83 |
|
|
@@ -85,14 +127,14 @@ The generative projection head (`lm_head`, 311M parameters) has been removed. Ra
|
|
| 85 |
|
| 86 |
## Core Capabilities
|
| 87 |
|
| 88 |
-
### 1. Single-Pass 3-Way Verdict
|
| 89 |
Diffs route directly into three deterministic states:
|
| 90 |
-
- **`APPROVE`**: Patch contains verified modifications with no detected pathology (
|
| 91 |
- **`QUARANTINE`**: Borderline invariant changes, formal boundary shifts, or ambiguous concurrency locks routed to SMT verification.
|
| 92 |
-
- **`REJECT`**: Confirmed vulnerability or regression (
|
| 93 |
|
| 94 |
-
### 2. Calibrated Continuous Risk Metric
|
| 95 |
-
Outputs a normalized risk score
|
| 96 |
|
| 97 |
### 3. Multilabel Pathology Attribution
|
| 98 |
Detects 10 specific code defect categories simultaneously:
|
|
@@ -109,7 +151,11 @@ Detects 10 specific code defect categories simultaneously:
|
|
| 109 |
|
| 110 |
### 4. OASIS SARIF v2.1.0 Exploit Flow Reconstruction
|
| 111 |
For any detected vulnerability, Spark-Servitor reconstructs the complete data-flow path:
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
Emits standard SARIF `codeFlows` and `threadFlows` compatible with GitHub Advanced Security and VS Code SARIF Viewer.
|
| 114 |
|
| 115 |
### 5. Parameter-Aware Anti-False-Alarm
|
|
|
|
| 58 |
|
| 59 |
## Overview
|
| 60 |
|
| 61 |
+
Spark-Servitor is a headless neural decision engine for code security, patch verification, and automated pull request review. It serves as a larger, deeper variant in the Servitor family, complementing [`wxsys/qwen-servitor`](https://huggingface.co/wxsys/qwen-servitor).
|
| 62 |
|
| 63 |
+
While Qwen-Servitor is engineered around Qwen3.5-0.8B linear attention (Gated DeltaNet) for sub-15ms local pre-commit screening, Spark-Servitor scales up to **Spark-X2.5-1.7B** with Sliding Window Attention (SWA 512), 7 Full Attention anchor layers, and Headwise Sigmoid Output Gating (`g_proj`). This provides broader receptive capacity for multi-file patches and cross-file symbol tracking across monorepos up to 1,048,576 tokens.
|
| 64 |
|
| 65 |
+
The generative projection head (`lm_head`, 311M parameters) has been removed. Rather than generating conversational text, the model processes code diffs in a single forward pass to produce structured verdicts, risk metrics, and OASIS SARIF v2.1.0 exploit flows.
|
| 66 |
+
|
| 67 |
+
---
|
| 68 |
+
|
| 69 |
+
## Technical Architecture
|
| 70 |
+
|
| 71 |
+
```text
|
| 72 |
+
[ RAW DIFF / 1M TOKEN CONTEXT ]
|
| 73 |
+
β
|
| 74 |
+
βΌ
|
| 75 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 76 |
+
β SPARK-X2.5 NEURAL SPINE β
|
| 77 |
+
β β’ 21x Sliding Window Attention Layers (Window = 512) β
|
| 78 |
+
β β’ 7x Gated Full Attention Layers (Cross-File Context) β
|
| 79 |
+
β β’ Headwise Sigmoid Output Gating (g_proj) β
|
| 80 |
+
β β’ Zero-Allocation Circular Ring Buffer (Peak RAM <= 16MB) β
|
| 81 |
+
β β’ 311M-parameter Generative Head: EXCISED / REMOVED β
|
| 82 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 83 |
+
β
|
| 84 |
+
[ Final Hidden State (h_T) ]
|
| 85 |
+
β
|
| 86 |
+
βΌ
|
| 87 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 88 |
+
β DIFF-CAMQP DUAL-SOFTMAX CORTEX HEAD β
|
| 89 |
+
β β’ Differential query filtering (A1 - lambda * A2) β
|
| 90 |
+
β β’ Latent Recurrent Pondering (Adaptive halting k = 1..4) β
|
| 91 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 92 |
+
β
|
| 93 |
+
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββ
|
| 94 |
+
βΌ βΌ βΌ
|
| 95 |
+
βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
|
| 96 |
+
β VERDICT HEAD β β RISK HEAD β β PATHOLOGY HEADβ
|
| 97 |
+
β 3-Way Output β β Sigmoid(1) β β 10-Class Multiβ
|
| 98 |
+
β β’ APPROVE β β Continuous β β β’ SECURITY β
|
| 99 |
+
β β’ QUARANTINE β β Risk Score β β β’ DEADLOCK β
|
| 100 |
+
β β’ REJECT β β (0.00-1.00) β β β’ PERF_COLLAP β
|
| 101 |
+
βββββββββ¬ββββββββ βββββββββββββββββ βββββββββββββββββ
|
| 102 |
+
β
|
| 103 |
+
βΌ (If QUARANTINE: Formal Neuro-Symbolic SMT Hand-Off)
|
| 104 |
+
βββββββββββββββββ
|
| 105 |
+
β Z3 SMT Solver β ββ> [ Final Verified Gate ]
|
| 106 |
+
βββββββββββοΏ½οΏ½βββββ
|
| 107 |
+
```
|
| 108 |
|
| 109 |
---
|
| 110 |
|
| 111 |
## Specifications
|
| 112 |
|
| 113 |
+
| Parameter | Specification |
|
| 114 |
|---|---|
|
| 115 |
| **Base Architecture** | Decapitated `XHToken/Spark-X2.5-1.7B` |
|
| 116 |
+
| **Hidden Dimension (d_model)** | 2048 |
|
| 117 |
| **Attention Layers** | 28 total (21 Sliding Window Attention, window 512 + 7 Full Attention) |
|
| 118 |
| **Attention Heads** | 16 Query Heads, 2 Key/Value Heads (Grouped-Query Attention) |
|
| 119 |
| **Output Gating** | Headwise Sigmoid Projection (`g_proj`) |
|
| 120 |
| **Context Window** | Up to 1,048,576 tokens via circular SWA buffer |
|
| 121 |
| **Decision Mechanism** | Dual-Softmax Differential Cortex Head (`DiffCAMQPCortexHead`) |
|
| 122 |
+
| **Format & Quantization** | Outlier-Preserved AWQ INT4 / W8A8 (1.6 GB binary on disk) |
|
| 123 |
| **Resident Memory** | 4.08 MB VmRSS (C++ daemon via UNIX domain socket) |
|
| 124 |
| **Inference Latency** | 0.044 ms per diff (CPU Intel AVX2 SIMD) |
|
| 125 |
|
|
|
|
| 127 |
|
| 128 |
## Core Capabilities
|
| 129 |
|
| 130 |
+
### 1. Single-Pass 3-Way Verdict Gate
|
| 131 |
Diffs route directly into three deterministic states:
|
| 132 |
+
- **`APPROVE`**: Patch contains verified modifications with no detected pathology (risk <= 0.20).
|
| 133 |
- **`QUARANTINE`**: Borderline invariant changes, formal boundary shifts, or ambiguous concurrency locks routed to SMT verification.
|
| 134 |
+
- **`REJECT`**: Confirmed vulnerability or regression (risk >= 0.80).
|
| 135 |
|
| 136 |
+
### 2. Calibrated Continuous Risk Metric
|
| 137 |
+
Outputs a normalized risk score from 0.000 to 1.000. The metric is trained using Brier score Mean Squared Error alignment against soft targets, avoiding raw binary score cliffs.
|
| 138 |
|
| 139 |
### 3. Multilabel Pathology Attribution
|
| 140 |
Detects 10 specific code defect categories simultaneously:
|
|
|
|
| 151 |
|
| 152 |
### 4. OASIS SARIF v2.1.0 Exploit Flow Reconstruction
|
| 153 |
For any detected vulnerability, Spark-Servitor reconstructs the complete data-flow path:
|
| 154 |
+
|
| 155 |
+
```text
|
| 156 |
+
[1. SOURCE: Untrusted Input] ββ> [2. PROPAGATION: Variable Flow] ββ> [3. SANITIZER: Status] ββ> [4. SINK: Vulnerable Call]
|
| 157 |
+
```
|
| 158 |
+
|
| 159 |
Emits standard SARIF `codeFlows` and `threadFlows` compatible with GitHub Advanced Security and VS Code SARIF Viewer.
|
| 160 |
|
| 161 |
### 5. Parameter-Aware Anti-False-Alarm
|