collapseindex commited on
Commit
14a0518
·
verified ·
1 Parent(s): bd9c7af

Upload 11 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ probertbanner.png filter=lfs diff=lfs merge=lfs -text
ATTRIBUTIONS.md ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Attributions & Licenses
2
+
3
+ ## ProBERT
4
+
5
+ Copyright © 2026 Alex Kwon (Collapse Index Labs)
6
+ Licensed under Collapse Index Open Model License v1.0 (see LICENSE.md)
7
+
8
+ ## DistilBERT
9
+
10
+ **ProBERT is derived from DistilBERT**, a transformer model developed by Hugging Face.
11
+
12
+ - **Project**: [DistilBERT](https://github.com/huggingface/transformers)
13
+ - **Author**: Hugging Face Team
14
+ - **License**: Apache 2.0
15
+ - **Citation**:
16
+ ```
17
+ Sanh, V., Debut, L., Ehrhardt, J., & Uniform, D. (2019).
18
+ DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter.
19
+ arXiv preprint arXiv:1910.01108.
20
+ ```
21
+
22
+ ### DistilBERT Apache 2.0 License (Summary)
23
+
24
+ DistilBERT is distributed under the Apache 2.0 license, which permits:
25
+ - ✅ Commercial use
26
+ - ✅ Modification
27
+ - ✅ Distribution
28
+ - ✅ Private use
29
+ - ⚠️ Requires: Attribution, license notice, documentation of changes
30
+
31
+ Full Apache 2.0 text: https://www.apache.org/licenses/LICENSE-2.0
32
+
33
+ ---
34
+
35
+ ## Dependencies
36
+
37
+ ProBERT uses the following libraries, all compatible with Apache 2.0:
38
+ - **transformers** (Hugging Face) — Apache 2.0
39
+ - **torch** (PyTorch) — BSD
40
+ - **numpy** (NumPy Foundation) — BSD
FROZEN_WEIGHTS.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "frozen_date": "2026-01-31",
3
+ "freeze_reason": "Production release v1.0",
4
+ "sha256": "288520E28AEC14D1BFA2474E2694CAF612070DCA839AAECDA3B95F12FE418A11",
5
+ "verification_method": "SHA256 hash of model.safetensors",
6
+ "why_frozen": "Weights locked to ensure reproducibility and prevent unintended modifications. All future versions will be released as separate model versions (ProBERT-1.1, etc.) with new SHA256 hashes and changelog.",
7
+ "weights_immutable": true,
8
+ "model_type": "DistilBERT-base-uncased (66M parameters)",
9
+ "training_date": "2026-01-31",
10
+ "training_duration": "10 minutes",
11
+ "training_hardware": "CPU (Intel i5)",
12
+ "training_data_samples": 450,
13
+ "test_accuracy": "95.6%",
14
+ "type_i_ghosts": 0,
15
+ "collapse_index_score": 0.003,
16
+ "real_world_validation": "10/10 outputs correctly classified",
17
+ "license": "Apache 2.0"
18
+ }
METRICS.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "accuracy": 0.9556,
3
+ "macro_f1": 0.9551,
4
+ "weighted_f1": 0.9551,
5
+ "class_metrics": {
6
+ "process_clarity": {
7
+ "precision": 0.9375,
8
+ "recall": 1.0,
9
+ "f1": 0.9677,
10
+ "support": 30
11
+ },
12
+ "rhetorical_confidence": {
13
+ "precision": 0.9643,
14
+ "recall": 0.9,
15
+ "f1": 0.9310,
16
+ "support": 30
17
+ },
18
+ "scope_blur": {
19
+ "precision": 0.9667,
20
+ "recall": 0.9667,
21
+ "f1": 0.9667,
22
+ "support": 30
23
+ }
24
+ },
25
+ "test_set_size": 90,
26
+ "misclassifications": 3,
27
+ "timestamp": "2026-01-31"
28
+ }
NOTICE ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Licensed by Alex Kwon (Collapse Index Labs) under the Collapse Index Open Model License
2
+ ProBERT™ - Rhetorical Confidence Detection (66M params, 95.6% accuracy, behaviorally stable)
3
+ https://collapseindex.org | https://huggingface.co/collapseindex/ProBERT-1.0
4
+ GitHub: https://github.com/collapseindex/ProBERT-1.0
5
+ Contact: ask@collapseindex.org | ORCID: 0009-0002-2566-5538
6
+
7
+ ---
8
+
9
+ ProBERT v1.0
10
+ Copyright © 2026 Alex Kwon. All rights reserved.
11
+
12
+ This product is licensed under the Collapse Index Open Model License v1.0.
13
+ See LICENSE.md for full terms.
14
+
15
+ ProBERT™, Collapse Index™, and Type I Ghost Detection™ are trademarks of Alex Kwon (dba Collapse Index Labs).
16
+
17
+ ---
18
+
19
+ UPSTREAM ATTRIBUTION:
20
+
21
+ ProBERT is built on DistilBERT, which is distributed under the Apache License 2.0.
22
+ See ATTRIBUTIONS.md for full upstream license text and notices.
QUICKSTART.md ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```python
2
+ # ProBERT Quick Inference Example
3
+ # Zero dependencies beyond transformers + torch
4
+
5
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
6
+ import torch
7
+
8
+ # Load frozen model
9
+ model = AutoModelForSequenceClassification.from_pretrained("collapseindex/ProBERT-1.0")
10
+ tokenizer = AutoTokenizer.from_pretrained("collapseindex/ProBERT-1.0")
11
+
12
+ def score_text(text: str) -> dict:
13
+ """Score text for rhetorical patterns"""
14
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
15
+
16
+ with torch.no_grad():
17
+ outputs = model(**inputs)
18
+
19
+ probs = torch.softmax(outputs.logits, dim=1)[0]
20
+
21
+ labels = ["process_clarity", "rhetorical_confidence", "scope_blur"]
22
+ scores_dict = {label: float(probs[i]) for i, label in enumerate(labels)}
23
+ prediction = labels[torch.argmax(probs).item()]
24
+
25
+ # Confidence: max probability
26
+ confidence = float(probs.max())
27
+
28
+ # Coherence: margin between top 2 predictions (lower = less clear decision)
29
+ sorted_probs = torch.sort(probs, descending=True)[0]
30
+ coherence = float(sorted_probs[0] - sorted_probs[1])
31
+
32
+ return {
33
+ **scores_dict,
34
+ "prediction": prediction,
35
+ "confidence": confidence,
36
+ "coherence": coherence
37
+ }
38
+
39
+ # Test examples
40
+ examples = [
41
+ "This revolutionary AI will transform your business and guarantee results.",
42
+ "To implement binary search: 1. Define left and right pointers. 2. Calculate mid. 3. Compare value. If less, move right pointer.",
43
+ "Trust your intuition and embrace the cosmic energy flowing through all things.",
44
+ ]
45
+
46
+ for text in examples:
47
+ scores = score_text(text)
48
+ print(f"\nText: {text[:60]}...")
49
+ print(f"Prediction: {scores['prediction']}")
50
+ print(f" • Process Clarity: {scores['process_clarity']:.1%}")
51
+ print(f" • Rhetorical Confidence: {scores['rhetorical_confidence']:.1%}")
52
+ print(f" • Scope Blur: {scores['scope_blur']:.1%}")
53
+ print(f"Confidence: {scores['confidence']:.1%}")
54
+ print(f"Coherence: {scores['coherence']:.1%} (decision clarity)")
55
+ ```
56
+
57
+ **Output Example:**
58
+ ```
59
+ Text: This revolutionary AI will transform your business and guarantee r...
60
+ Prediction: rhetorical_confidence
61
+ • Process Clarity: 11.5%
62
+ • Rhetorical Confidence: 67.2%
63
+ • Scope Blur: 21.3%
64
+ Confidence: 67.2%
65
+ Coherence: 45.9% (decision clarity)
66
+
67
+ Text: To implement binary search: 1. Define left and right pointers. 2....
68
+ Prediction: process_clarity
69
+ • Process Clarity: 79.7%
70
+ • Rhetorical Confidence: 12.3%
71
+ • Scope Blur: 8.0%
72
+ Confidence: 79.7%
73
+ Coherence: 67.4% (decision clarity)
74
+
75
+ Text: Trust your intuition and embrace the cosmic energy flowing through all things.
76
+ Prediction: scope_blur
77
+ • Process Clarity: 14.2%
78
+ • Rhetorical Confidence: 25.3%
79
+ • Scope Blur: 60.5%
80
+ Confidence: 60.5%
81
+ Coherence: 35.2% (decision clarity)
82
+ ```
config.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation": "gelu",
3
+ "architectures": [
4
+ "DistilBertForSequenceClassification"
5
+ ],
6
+ "attention_dropout": 0.1,
7
+ "bos_token_id": null,
8
+ "dim": 768,
9
+ "dropout": 0.1,
10
+ "dtype": "float32",
11
+ "eos_token_id": null,
12
+ "hidden_dim": 3072,
13
+ "id2label": {
14
+ "0": "process_clarity",
15
+ "1": "rhetorical_confidence",
16
+ "2": "scope_blur"
17
+ },
18
+ "initializer_range": 0.02,
19
+ "label2id": {
20
+ "process_clarity": 0,
21
+ "rhetorical_confidence": 1,
22
+ "scope_blur": 2
23
+ },
24
+ "max_position_embeddings": 512,
25
+ "model_type": "distilbert",
26
+ "n_heads": 12,
27
+ "n_layers": 6,
28
+ "pad_token_id": 0,
29
+ "problem_type": "single_label_classification",
30
+ "qa_dropout": 0.1,
31
+ "seq_classif_dropout": 0.2,
32
+ "sinusoidal_pos_embds": false,
33
+ "tie_weights_": true,
34
+ "tie_word_embeddings": true,
35
+ "transformers_version": "5.0.0",
36
+ "use_cache": false,
37
+ "vocab_size": 30522
38
+ }
demo.html ADDED
@@ -0,0 +1,573 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>ProBERT - Detect Rhetorical Overconfidence</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ body {
15
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
16
+ background: linear-gradient(135deg, #fffaec 0%, #fff5d6 100%);
17
+ min-height: 100vh;
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ padding: 20px;
22
+ color: #2c2c2c;
23
+ }
24
+
25
+ .container {
26
+ max-width: 700px;
27
+ width: 100%;
28
+ background: #fffef9;
29
+ border-radius: 12px;
30
+ padding: 40px;
31
+ box-shadow: 0 10px 40px rgba(218, 165, 32, 0.15);
32
+ border: 1px solid #f0e68c;
33
+ }
34
+
35
+ .header {
36
+ text-align: center;
37
+ margin-bottom: 30px;
38
+ }
39
+
40
+ .header h1 {
41
+ font-size: 28px;
42
+ margin-bottom: 8px;
43
+ color: #b8860b;
44
+ font-weight: 600;
45
+ }
46
+
47
+ .header p {
48
+ font-size: 14px;
49
+ color: #8b7500;
50
+ }
51
+
52
+ .mode-toggle {
53
+ display: flex;
54
+ gap: 8px;
55
+ margin-bottom: 20px;
56
+ justify-content: center;
57
+ }
58
+
59
+ .mode-btn {
60
+ padding: 8px 14px;
61
+ font-size: 12px;
62
+ font-weight: 600;
63
+ border: 2px solid #daa520;
64
+ background: #fffef9;
65
+ color: #b8860b;
66
+ border-radius: 4px;
67
+ cursor: pointer;
68
+ transition: all 0.2s;
69
+ text-transform: uppercase;
70
+ letter-spacing: 0.5px;
71
+ }
72
+
73
+ .mode-btn.active {
74
+ background: #daa520;
75
+ color: #fff;
76
+ }
77
+
78
+ .mode-btn:hover {
79
+ border-color: #b8860b;
80
+ }
81
+
82
+ .input-section {
83
+ margin-bottom: 20px;
84
+ }
85
+
86
+ label {
87
+ display: block;
88
+ font-size: 13px;
89
+ font-weight: 600;
90
+ margin-bottom: 8px;
91
+ color: #2c2c2c;
92
+ text-transform: uppercase;
93
+ letter-spacing: 0.5px;
94
+ }
95
+
96
+ textarea {
97
+ width: 100%;
98
+ height: 140px;
99
+ padding: 12px;
100
+ border: 2px solid #f0e68c;
101
+ border-radius: 6px;
102
+ background: #fffef9;
103
+ color: #2c2c2c;
104
+ font-size: 14px;
105
+ font-family: inherit;
106
+ resize: none;
107
+ transition: border-color 0.2s;
108
+ }
109
+
110
+ textarea:focus {
111
+ outline: none;
112
+ border-color: #daa520;
113
+ }
114
+
115
+ .button-group {
116
+ display: flex;
117
+ gap: 10px;
118
+ margin-bottom: 30px;
119
+ }
120
+
121
+ button {
122
+ flex: 1;
123
+ padding: 12px 20px;
124
+ font-size: 14px;
125
+ font-weight: 600;
126
+ border: none;
127
+ border-radius: 6px;
128
+ cursor: pointer;
129
+ transition: all 0.2s;
130
+ text-transform: uppercase;
131
+ letter-spacing: 0.5px;
132
+ }
133
+
134
+ .score-btn {
135
+ background: linear-gradient(135deg, #00d4ff, #0099cc);
136
+ color: #fff;
137
+ }
138
+
139
+ .score-btn:hover {
140
+ transform: translateY(-2px);
141
+ box-shadow: 0 8px 20px rgba(0, 212, 255, 0.3);
142
+ }
143
+
144
+ .score-btn:active {
145
+ transform: translateY(0);
146
+ }
147
+
148
+ .score-btn:disabled {
149
+ opacity: 0.5;
150
+ cursor: not-allowed;
151
+ transform: none;
152
+ }
153
+
154
+ .example-btn {
155
+ background: #fff8dc;
156
+ color: #b8860b;
157
+ border: 2px solid #daa520;
158
+ }
159
+
160
+ .example-btn:hover {
161
+ background: #f0e68c;
162
+ }
163
+
164
+ .results {
165
+ display: none;
166
+ background: #fffef9;
167
+ border: 2px solid #f0e68c;
168
+ border-radius: 6px;
169
+ padding: 20px;
170
+ margin-top: 20px;
171
+ }
172
+
173
+ .results.show {
174
+ display: block;
175
+ animation: slideIn 0.3s ease-out;
176
+ }
177
+
178
+ @keyframes slideIn {
179
+ from {
180
+ opacity: 0;
181
+ transform: translateY(10px);
182
+ }
183
+ to {
184
+ opacity: 1;
185
+ transform: translateY(0);
186
+ }
187
+ }
188
+
189
+ .result-item {
190
+ margin-bottom: 16px;
191
+ }
192
+
193
+ .result-item:last-child {
194
+ margin-bottom: 0;
195
+ }
196
+
197
+ .result-label {
198
+ font-size: 12px;
199
+ font-weight: 700;
200
+ text-transform: uppercase;
201
+ letter-spacing: 0.5px;
202
+ margin-bottom: 6px;
203
+ color: #8b7500;
204
+ }
205
+
206
+ .result-bar {
207
+ height: 32px;
208
+ background: #f0e68c;
209
+ border-radius: 4px;
210
+ overflow: hidden;
211
+ position: relative;
212
+ display: flex;
213
+ align-items: center;
214
+ }
215
+
216
+ .result-fill {
217
+ height: 100%;
218
+ display: flex;
219
+ align-items: center;
220
+ justify-content: flex-end;
221
+ padding-right: 10px;
222
+ font-weight: 600;
223
+ font-size: 13px;
224
+ color: #fff;
225
+ transition: width 0.4s ease-out;
226
+ }
227
+
228
+ .process_clarity {
229
+ background: linear-gradient(90deg, #00d4ff, #0099cc);
230
+ }
231
+
232
+ .rhetorical_confidence {
233
+ background: linear-gradient(90deg, #ff6b6b, #ee5a5a);
234
+ }
235
+
236
+ .scope_blur {
237
+ background: linear-gradient(90deg, #ffd93d, #ffb700);
238
+ }
239
+
240
+ .prediction {
241
+ margin-top: 20px;
242
+ padding-top: 20px;
243
+ border-top: 1px solid #16213e;
244
+ }
245
+
246
+ .prediction-label {
247
+ font-size: 12px;
248
+ font-weight: 600;
249
+ color: #b0b0b0;
250
+ margin-bottom: 8px;
251
+ }
252
+
253
+ .prediction-value {
254
+ font-size: 18px;
255
+ font-weight: 700;
256
+ padding: 12px;
257
+ background: #16213e;
258
+ border-radius: 4px;
259
+ text-transform: capitalize;
260
+ }
261
+
262
+ .loading {
263
+ display: none;
264
+ text-align: center;
265
+ color: #00d4ff;
266
+ font-size: 13px;
267
+ }
268
+
269
+ .loading.show {
270
+ display: block;
271
+ }
272
+
273
+ .error {
274
+ display: none;
275
+ background: rgba(255, 107, 107, 0.1);
276
+ border: 1px solid #ff6b6b;
277
+ border-radius: 6px;
278
+ padding: 12px;
279
+ color: #ff9999;
280
+ font-size: 13px;
281
+ margin-top: 15px;
282
+ }
283
+
284
+ .error.show {
285
+ display: block;
286
+ }
287
+
288
+ .footer {
289
+ text-align: center;
290
+ margin-top: 30px;
291
+ font-size: 12px;
292
+ color: #8b7500;
293
+ }
294
+
295
+ .footer a {
296
+ color: #b8860b;
297
+ text-decoration: none;
298
+ }
299
+
300
+ .footer a:hover {
301
+ text-decoration: underline;
302
+ }
303
+ </style>
304
+ </head>
305
+ <body>
306
+ <div class="container">
307
+ <div class="header">
308
+ <h1>ProBERT</h1>
309
+ <p>Detect rhetorical overconfidence in real-time</p>
310
+ </div>
311
+
312
+ <div class="input-section">
313
+ <label for="input-text">Paste LLM output or any text:</label>
314
+ <textarea id="input-text" placeholder="This revolutionary approach will transform your business..."></textarea>
315
+ </div>
316
+
317
+ <div class="button-group">
318
+ <button class="score-btn" onclick="scoreText()">Score It</button>
319
+ <button class="example-btn" onclick="loadExample(0)">Process-Driven</button>
320
+ <button class="example-btn" onclick="loadExample(1)">Rhetorical</button>
321
+ <button class="example-btn" onclick="loadExample(2)">Scope Blur</button>
322
+ </div>
323
+
324
+ <div class="loading" id="loading">
325
+ Analyzing text...
326
+ </div>
327
+
328
+ <div class="error" id="error"></div>
329
+
330
+ <div class="results" id="results">
331
+ <div class="result-item">
332
+ <div class="result-label">Process Clarity (Step-by-step reasoning)</div>
333
+ <div class="result-bar">
334
+ <div class="result-fill process_clarity" id="bar-process" style="width: 0%">
335
+ <span id="score-process">0%</span>
336
+ </div>
337
+ </div>
338
+ </div>
339
+
340
+ <div class="result-item">
341
+ <div class="result-label">Rhetorical Confidence (Authority without process)</div>
342
+ <div class="result-bar">
343
+ <div class="result-fill rhetorical_confidence" id="bar-rhetorical" style="width: 0%">
344
+ <span id="score-rhetorical">0%</span>
345
+ </div>
346
+ </div>
347
+ </div>
348
+
349
+ <div class="result-item">
350
+ <div class="result-label">Scope Blur (Vague generalizations)</div>
351
+ <div class="result-bar">
352
+ <div class="result-fill scope_blur" id="bar-blur" style="width: 0%">
353
+ <span id="score-blur">0%</span>
354
+ </div>
355
+ </div>
356
+ </div>
357
+
358
+ <div class="prediction">
359
+ <div class="prediction-label">Primary Classification</div>
360
+ <div class="prediction-value" id="prediction">Process Clarity</div>
361
+ </div>
362
+
363
+ <div class="result-item">
364
+ <div class="result-label">Model Confidence</div>
365
+ <div class="result-bar">
366
+ <div class="result-fill process_clarity" id="bar-confidence" style="width: 0%">
367
+ <span id="score-confidence">0%</span>
368
+ </div>
369
+ </div>
370
+ </div>
371
+
372
+ <div class="result-item">
373
+ <div class="result-label">Decision Coherence</div>
374
+ <div class="result-bar">
375
+ <div class="result-fill process_clarity" id="bar-coherence" style="width: 0%">
376
+ <span id="score-coherence">0%</span>
377
+ </div>
378
+ </div>
379
+ </div>
380
+
381
+ <div class="prediction">
382
+ <div class="prediction-label">Verdict</div>
383
+ <div class="prediction-value" id="verdict" style="background: #f0e68c; color: #2c2c2c;">Analyzing...</div>
384
+ </div>
385
+ </div>
386
+
387
+ <div class="footer">
388
+ <p><a href="https://collapseindex.org" target="_blank">Collapse Index Labs</a> • ProBERT v1.0 | <a href="https://huggingface.co/collapseindex/ProBERT-1.0" target="_blank">Model</a> | <a href="https://collapseindex.org/case-studies/template.html?s=probert-case-study" target="_blank">Case Study</a></p>
389
+ </div>
390
+ </div>
391
+
392
+ <script type="module">
393
+ // Sanitize HTML to prevent XSS
394
+ function sanitizeHTML(text) {
395
+ const map = {
396
+ '&': '&amp;',
397
+ '<': '&lt;',
398
+ '>': '&gt;',
399
+ '"': '&quot;',
400
+ "'": '&#039;'
401
+ };
402
+ return text.replace(/[&<>"']/g, m => map[m]);
403
+ }
404
+
405
+ const EXAMPLES = [
406
+ "To implement binary search: 1. Define left and right pointers. 2. Calculate mid point. 3. Compare value with target. If less, move right pointer. If greater, move left pointer. 4. Repeat until found or pointers converge.",
407
+ "This revolutionary AI will transform your business and guarantee unprecedented results. Our innovative approach will definitely solve all your problems.",
408
+ "Trust your intuition and embrace the cosmic energy. The universe has a plan for you."
409
+ ];
410
+
411
+ const HF_API_URL = "https://api-inference.huggingface.co/models/collapseindex/ProBERT-1.0";
412
+ let isLoading = false; // Prevent concurrent requests
413
+
414
+ window.scoreText = async function() {
415
+ const text = document.getElementById("input-text").value.trim();
416
+
417
+ if (!text) {
418
+ showError("Please enter some text to analyze.");
419
+ return;
420
+ }
421
+
422
+ if (text.length > 2000) {
423
+ showError("Text too long (max 2000 characters). ProBERT uses 128 token max.");
424
+ return;
425
+ }
426
+
427
+ // Prevent double-clicks during loading
428
+ if (isLoading) return;
429
+ isLoading = true;
430
+
431
+ const scoreBtn = document.querySelector('button');
432
+ scoreBtn.disabled = true;
433
+ scoreBtn.style.opacity = "0.6";
434
+ scoreBtn.style.cursor = "not-allowed";
435
+
436
+ showLoading(true, "Scoring text with ProBERT...");
437
+ hideError();
438
+
439
+ try {
440
+ const response = await fetch(HF_API_URL, {
441
+ method: "POST",
442
+ headers: { "Content-Type": "application/json" },
443
+ body: JSON.stringify({ inputs: text }),
444
+ timeout: 30000
445
+ });
446
+
447
+ if (response.status === 401) {
448
+ throw new Error("ProBERT model not yet public on HuggingFace. Upload coming soon!");
449
+ }
450
+ if (response.status === 503) {
451
+ throw new Error("Model loading... Please try again in 30 seconds");
452
+ }
453
+ if (response.status === 429) {
454
+ throw new Error("Rate limited. Please wait a moment.");
455
+ }
456
+ if (!response.ok) {
457
+ throw new Error("API error. Please try again.");
458
+ }
459
+
460
+ const result = await response.json();
461
+
462
+ if (!result || !result[0] || !Array.isArray(result[0])) {
463
+ throw new Error("Invalid response format from API.");
464
+ }
465
+
466
+ const scores = result[0];
467
+ const classMap = ["process_clarity", "rhetorical_confidence", "scope_blur"];
468
+ const classScores = {};
469
+
470
+ scores.forEach((score, idx) => {
471
+ if (typeof score.score !== 'number') {
472
+ throw new Error("Invalid score value received.");
473
+ }
474
+ classScores[classMap[idx]] = score.score;
475
+ });
476
+
477
+ displayResults(classScores);
478
+ } catch (err) {
479
+ // Show user-friendly error, don't leak stack traces
480
+ const userMsg = err.message.includes("fetch")
481
+ ? "Network error. Please check your connection."
482
+ : (err.message || "An error occurred. Please try again.");
483
+ showError(userMsg);
484
+ } finally {
485
+ isLoading = false;
486
+ scoreBtn.disabled = false;
487
+ scoreBtn.style.opacity = "1";
488
+ scoreBtn.style.cursor = "pointer";
489
+ showLoading(false);
490
+ }
491
+ };
492
+
493
+ function displayResults(scores) {
494
+ const process = Math.round(scores.process_clarity * 100);
495
+ const rhetorical = Math.round(scores.rhetorical_confidence * 100);
496
+ const blur = Math.round(scores.scope_blur * 100);
497
+
498
+ document.getElementById("bar-process").style.width = process + "%";
499
+ document.getElementById("score-process").textContent = process + "%";
500
+
501
+ document.getElementById("bar-rhetorical").style.width = rhetorical + "%";
502
+ document.getElementById("score-rhetorical").textContent = rhetorical + "%";
503
+
504
+ document.getElementById("bar-blur").style.width = blur + "%";
505
+ document.getElementById("score-blur").textContent = blur + "%";
506
+
507
+ // Calculate confidence (max probability) and coherence (margin to 2nd place)
508
+ const sorted = [process, rhetorical, blur].sort((a, b) => b - a);
509
+ const confidence = sorted[0];
510
+ const coherence = Math.max(0, sorted[0] - sorted[1]);
511
+
512
+ document.getElementById("bar-confidence").style.width = confidence + "%";
513
+ document.getElementById("score-confidence").textContent = confidence + "%";
514
+
515
+ document.getElementById("bar-coherence").style.width = coherence + "%";
516
+ document.getElementById("score-coherence").textContent = coherence + "%";
517
+
518
+ const max = Math.max(process, rhetorical, blur);
519
+ let prediction = "Process Clarity";
520
+ let verdict = "🟢 Clear & Process-Driven\nStep-by-step reasoning detected.";
521
+
522
+ if (rhetorical === max) {
523
+ prediction = "Rhetorical Confidence";
524
+ verdict = "🔴 Warning: Rhetorical Confidence\nAuthority without clear process.";
525
+ } else if (blur === max) {
526
+ prediction = "Scope Blur";
527
+ verdict = "🟠 Caution: Scope Blur\nVague generalizations detected.";
528
+ }
529
+
530
+ document.getElementById("prediction").textContent = prediction;
531
+ document.getElementById("verdict").textContent = verdict;
532
+ document.getElementById("results").classList.add("show");
533
+ }
534
+
535
+ window.loadExample = function(idx) {
536
+ if (idx < 0 || idx >= EXAMPLES.length) return;
537
+ document.getElementById("input-text").value = EXAMPLES[idx];
538
+ document.getElementById("input-text").focus();
539
+ };
540
+
541
+ function showLoading(show, msg = "Analyzing text...") {
542
+ const el = document.getElementById("loading");
543
+ el.textContent = msg;
544
+ el.classList.toggle("show", show);
545
+ el.setAttribute("aria-live", "polite");
546
+ }
547
+
548
+ function showError(msg) {
549
+ const el = document.getElementById("error");
550
+ el.textContent = sanitizeHTML(msg);
551
+ el.classList.add("show");
552
+ el.setAttribute("role", "alert");
553
+ el.setAttribute("aria-live", "assertive");
554
+ }
555
+
556
+ function hideError() {
557
+ document.getElementById("error").classList.remove("show");
558
+ }
559
+
560
+ // Keyboard accessibility: Ctrl/Cmd + Enter to submit
561
+ document.getElementById("input-text").addEventListener("keydown", (e) => {
562
+ if ((e.ctrlKey || e.metaKey) && e.key === "Enter") {
563
+ window.scoreText();
564
+ }
565
+ });
566
+
567
+ // Focus management
568
+ window.addEventListener("load", () => {
569
+ document.getElementById("input-text").focus();
570
+ });
571
+ </script>
572
+ </body>
573
+ </html>
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:288520e28aec14d1bfa2474e2694caf612070dca839aaecda3b95f12fe418a11
3
+ size 267835644
probertbanner.png ADDED

Git LFS Details

  • SHA256: 6e42ebb066de612a64f08edf2d1488d3554be085b11e166d795fa74ba4aad6a5
  • Pointer size: 131 Bytes
  • Size of remote file: 523 kB
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "cls_token": "[CLS]",
4
+ "do_lower_case": true,
5
+ "is_local": false,
6
+ "mask_token": "[MASK]",
7
+ "model_max_length": 512,
8
+ "pad_token": "[PAD]",
9
+ "sep_token": "[SEP]",
10
+ "strip_accents": null,
11
+ "tokenize_chinese_chars": true,
12
+ "tokenizer_class": "BertTokenizer",
13
+ "unk_token": "[UNK]"
14
+ }