Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: qtrust-research
|
| 4 |
+
base_model: huggingface/codeberta-language-id
|
| 5 |
+
tags:
|
| 6 |
+
- cryptography
|
| 7 |
+
- post-quantum-cryptography
|
| 8 |
+
- code-classification
|
| 9 |
+
- crypto-discovery
|
| 10 |
+
metrics:
|
| 11 |
+
- f1
|
| 12 |
+
- precision
|
| 13 |
+
- recall
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Q-Trust CryptoCodeDetector (CodeBERTa fine-tune)
|
| 17 |
+
|
| 18 |
+
Fine-tuned crypto-usage discovery model from [Q-Trust](https://github.com/humoge7502/q-trust)
|
| 19 |
+
(`qtrust_ai/` intelligence layer). Detects cryptographic API usage and algorithm families in
|
| 20 |
+
source code — the discovery stage that feeds CBOM generation and PQC migration planning.
|
| 21 |
+
|
| 22 |
+
## Training
|
| 23 |
+
|
| 24 |
+
- **Corpus:** 13,973 real code files — SolidiFI, SmartBugs, EIPs, WebAuthn blockchain contracts, OSS crypto repos
|
| 25 |
+
- **Schedule:** 4-epoch GPU fine-tune (A100), deterministic seed (same seed → same F1)
|
| 26 |
+
- **Dataset:** [`KRPur/q-trust-datasets`](https://huggingface.co/datasets/KRPur/q-trust-datasets) (`code_corpus.json`)
|
| 27 |
+
|
| 28 |
+
## Held-out results (repo-disjoint, n=2415)
|
| 29 |
+
|
| 30 |
+
| Metric | Q-Trust ensemble | Rules-only | Majority | Random |
|
| 31 |
+
|---|---|---|---|---|
|
| 32 |
+
| **F1** | **0.9525** | 0.673 | 0.8683 | 0.5981 |
|
| 33 |
+
| Precision | 0.952 | 0.979 | — | — |
|
| 34 |
+
| Recall | 0.953 | 0.513 | 1.0 | — |
|
| 35 |
+
|
| 36 |
+
Source: `qtrust_ai/artifacts/benchmark_comparison.json` (seed 42) in the GitHub repo.
|
| 37 |
+
|
| 38 |
+
## Usage
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 42 |
+
m = AutoModelForSequenceClassification.from_pretrained("KRPur/q-trust-codebert")
|
| 43 |
+
t = AutoTokenizer.from_pretrained("KRPur/q-trust-codebert")
|
| 44 |
+
```
|