HangJang's picture
Update citation: single author (Selyutin I.G.)
910fee7 verified
|
Raw
History Blame Contribute Delete
3.39 kB
---
language:
- en
- ru
license: apache-2.0
tags:
- c4-framework
- cognitive-states
- text-classification
- onnx
- multilingual
- mdeberta
pipeline_tag: text-classification
---
# C4 Cognitive Classifier — Heavy (mDeBERTa-v3-base)
**High-accuracy 27-class cognitive state classifier.**
This is the "heavy" variant of the C4-Cognitive-Classifier. It uses a larger multilingual encoder (`mDeBERTa-v3-base`) and is significantly more accurate than the light DistilBERT variant, at the cost of larger size and slower inference.
## Variants
| Variant | Repository | Base model | ONNX size | Mean val accuracy | Best for |
|---|---|---|---|---|---|
| **light** | [HangJang/C4-Cognitive-Classifier-v1](https://huggingface.co/HangJang/C4-Cognitive-Classifier-v1) | DistilBERT | ~416 MB | ~85.9% | Laptops, fast SaaS, first tries |
| **heavy** | this repo | mDeBERTa-v3-base | ~1.1 GB | **~96.5%** | Best accuracy, multilingual text, research |
## State space (Z₃³)
The model classifies text into three independent axes:
| Axis | ID | Values | Meaning |
|------|----|--------|---------|
| **Time** (t) | 0 | Past, Present, Future | Temporal orientation of thought |
| **Scale** (s) | 1 | Concrete, Abstract, Meta | Level of abstraction |
| **Agency** (a) | 2 | Self, Other, System | Relational stance |
The full space is 3 × 3 × 3 = **27 cognitive states**.
## Performance
Measured on the c4factory validation split:
| Head | Accuracy |
|------|----------|
| Time (t) | 98.1% |
| Scale / Dimension (s) | 97.1% |
| Agency / Identity (a) | 94.2% |
| **Mean** | **96.5%** |
## Files
- `c4_mdeberta_v2.onnx` — ONNX inference model (~1.1 GB)
- `tokenizer.json`, `tokenizer_config.json`, `spm.model` — mDeBERTa-v3-base tokenizer
- `config.json` — base model config
## Usage
### Direct ONNX inference
```python
import onnxruntime as ort
import numpy as np
from transformers import AutoTokenizer
session = ort.InferenceSession("c4_mdeberta_v2.onnx")
tokenizer = AutoTokenizer.from_pretrained("HangJang/C4-Cognitive-Classifier-Heavy")
text = "Я думаю о будущем и строю планы на многие годы вперёд."
tokens = tokenizer(text, return_tensors="np", padding=True, truncation=True, max_length=256)
outputs = session.run(None, {
"input_ids": tokens["input_ids"],
"attention_mask": tokens["attention_mask"],
})
t = int(np.argmax(outputs[0][0])) # Time
s = int(np.argmax(outputs[1][0])) # Scale (dimension)
a = int(np.argmax(outputs[2][0])) # Agency (identity)
print(f"C4 State: ({t}, {s}, {a})")
```
### With Deep Self Mirror (DSM)
```bash
# CLI
dsm me ~/Downloads/conversations.json --c4-model heavy
# Web UI
streamlit run dsm_web.py
# Then choose "Heavy — best accuracy" in Model settings.
```
## Notes
- The tokenizer comes from `microsoft/mdeberta-v3-base` and is included here for a self-contained download.
- Quantized (INT8) versions were tested but degraded accuracy substantially, so this release keeps FP32 weights for maximum quality.
- Multilingual: the mDeBERTa-v3-base encoder supports English, Russian, and 100+ languages.
## Citation
```bibtex
@misc{c4_cognitive_classifier_v1,
title = {C4-Cognitive-Classifier: Z₃³ Cognitive Topology from Natural Language},
author = {Selyutin, I.G.},
year = {2026},
url = {https://huggingface.co/HangJang/C4-Cognitive-Classifier-v1}
}
```