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
Q-Trust CodeBERT (v1 β legacy checkpoint)
Superseded. This is the first Q-Trust crypto-usage classifier, kept for lineage and for reproducing earlier experiments. Its published held-out score came from a split that was later found to leak: the 2026-10-23 audit measured 87.6 % of its evaluation paths inside its own training data. The weights are unchanged, but its F1 is not a clean generalization estimate and should not be quoted as one.
Current model:
KRISHNAPURI/q-trust-crypto-detectorβ clean held-out F1 0.9205 de-duplicated / 0.9235 native at the 0.50 gate, 0 % train/eval path overlap. SeeEXPERIMENTS.mdE-13 β E-17c for the audit, the retraining and the recorded negatives.
Binary code classifier that answers "does this code use cryptography?" β the discovery layer of
the Q-Trust post-quantum migration pipeline (humoge7502/q-trust on GitHub).
What this checkpoint is
| Base | huggingface/CodeBERTa-small-v1, 2-label sequence classification |
| Training data | 12,462 real files (6,636 crypto-labelled) from 34 repositories |
| Input | source code, truncated to 256 tokens |
| Output | LABEL_1 = crypto usage, LABEL_0 = no crypto usage |
| Retained for | v1-vs-v4 head-to-head, GNN ranker and RL experiments that reference these exact weights |
Corrected evaluation status
| Pre-audit held-out F1 | 0.9395 (leak-inflated: 87.6 % eval-path overlap) |
| Leakage audit | eval_leakage_audit β 2026-10-23 |
| Clean estimate for this checkpoint | none established β do not cite |
| Recommended successor | v4 detector, F1 0.9205 de-duplicated / 0.9235 native at gate 0.50, 0 % overlap |
The correction is enforced in the GitHub repository by scripts/verify_metric_consistency.py, so
the retired figure cannot drift back into current-facing documentation. This card keeps the
checkpoint unchanged: it is the canonical v1 artifact, not the current recommendation.
Usage
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
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tok = AutoTokenizer.from_pretrained("KRISHNAPURI/q-trust-codebert")
model = AutoModelForSequenceClassification.from_pretrained("KRISHNAPURI/q-trust-codebert")
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. Labels are regex-derived weak labels, so the attainable score is bounded by the labeler's error. It is not a vulnerability scanner and not a substitute for human review.
Sibling artifacts in this repository, all reported at their measured values:
- GNN ranker β Ο-b 0.7168 vs 0.7210 for the doctrine heuristic: a tie.
- RL migration agent β likewise a tie with the heuristic.
- Side-channel detector β evaluated on 54 real trace sets.
onnx/model_quantized.onnx is the original int8 export used by the first browser demo. The current
in-browser scanner loads the v4 detector
instead.
Provenance
- Training corpus:
KRISHNAPURI/q-trust-datasets - Metrics and audit trail:
reports/in this repository andhumoge7502/q-trust
- Downloads last month
- 55
Model tree for KRISHNAPURI/q-trust-codebert
Base model
huggingface/CodeBERTa-small-v1