Text Classification
Transformers
ONNX
Safetensors
roberta
code
cryptography
post-quantum
static-analysis
text-embeddings-inference
Instructions to use KRISHNAPURI/q-trust-codebert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KRISHNAPURI/q-trust-codebert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="KRISHNAPURI/q-trust-codebert")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("KRISHNAPURI/q-trust-codebert") model = AutoModelForSequenceClassification.from_pretrained("KRISHNAPURI/q-trust-codebert", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 2,465 Bytes
440a9bf 3986d38 440a9bf 3986d38 440a9bf 3986d38 440a9bf 3986d38 440a9bf 3986d38 440a9bf 3986d38 440a9bf 3986d38 440a9bf 3986d38 440a9bf 3986d38 440a9bf 3986d38 440a9bf 3986d38 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | ---
license: mit
library_name: transformers
pipeline_tag: text-classification
datasets:
- KRISHNAPURI/q-trust-datasets
base_model: huggingface/CodeBERTa-small-v1
tags:
- code
- cryptography
- post-quantum
- static-analysis
widget:
- text: "cipher = Cipher.getInstance(\"AES/ECB/PKCS5Padding\"); // usage under review"
- text: "kem = OQS_KEM_ml_kem_768_new(); OQS_KEM_ml_kem_768_keypair(kem, pk, sk);"
---
# Q-Trust CodeBERT — crypto-usage discovery classifier
Binary code classifier that answers **"does this code use cryptography, and which
primitive?"** — the discovery layer of the Q-Trust post-quantum migration
project (`humoge7502/q-trust` on GitHub). Fine-tuned from
`huggingface/CodeBERTa-small-v1` on 12,462 real files (6,636 crypto-labeled,
34 repos, deterministic seed-42 split, repo-disjoint held-out set).
## Measured results (never estimated)
| Metric | Value |
|---|---|
| Precision / Recall / F1 | 0.952 / 0.953 / **0.9525** (n=2,415) |
| Training | 4 epochs, CUDA, `scripts/train_qtrust_all.py --real --hf-epochs 3` |
| Leakage audit | Split reproduced bit-identically; 0.4% cross-repo dupes, bounded below the +0.11 F1 gain |
Try it in the widget above, or in code:
```python
from transformers import pipeline
clf = pipeline("text-classification", model="KRISHNAPURI/q-trust-codebert")
clf("EVP_PKEY_assign_RSA(pkey, rsa);")
# [{'label': 'LABEL_1', 'score': 0.99}] # LABEL_1 = crypto usage
```
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tok = AutoTokenizer.from_pretrained("KRISHNAPURI/q-trust-codebert")
model = AutoModelForSequenceClassification.from_pretrained("KRISHNAPURI/q-trust-codebert")
```
Training data: [`KRISHNAPURI/q-trust-datasets`](https://huggingface.co/datasets/KRISHNAPURI/q-trust-datasets)
(`qtrust_ai/artifacts/real_datasets/code_corpus.json`). Full lineage
(config + seed + metrics): `reports/training_report_real.json` in
[`KRISHNAPURI/q-trust-codebert`](https://huggingface.co/KRISHNAPURI/q-trust-codebert)
sibling files, and `qtrust_ai/artifacts/benchmark_comparison.json` in the
GitHub repo.
## Scope and limits
This model finds crypto **usage** (recall 0.877 on CryptoAPI-Bench files); it is
not a misuse detector and makes no SOTA claim. Sibling artifacts in this repo:
GNN ranker (honest tie with the heuristic, τ-b 0.7168 vs 0.7210), RL agent
(tie), side-channel detector (54 real trace sets). See `REPORTS` and the
per-artifact notes in the repo card below.
|