KRISHNAPURI commited on
Commit
3986d38
·
verified ·
1 Parent(s): 440a9bf

fix card: correct pipeline_tag, dataset link, widget, usage

Browse files
Files changed (1) hide show
  1. README.md +46 -25
README.md CHANGED
@@ -1,41 +1,62 @@
1
  ---
2
  license: mit
3
  library_name: transformers
 
 
 
 
4
  tags:
 
5
  - cryptography
6
  - post-quantum
7
- - code
8
- - graph-neural-networks
9
- - reinforcement-learning
10
- base_model: huggingface/CodeBERTa-small-v1
11
  ---
12
 
13
- # Q-Trust Models
14
 
15
- Checkpoints for the Q-Trust post-quantum migration project
16
- (`humoge7502/q-trust` on GitHub). All metrics below are measured, never
17
- estimated. No superiority is claimed where the evidence shows a tie.
 
 
18
 
19
- ## Files
20
 
21
- | File | What | Measured result |
22
- |---|---|---|
23
- | `crypto_codebert/` | CodeBERTa-small-v1 fine-tune, 4 epochs, CUDA, seed 42 | F1 **0.9525** (P 0.952 / R 0.953, n=2,415, repo-disjoint split) |
24
- | `gnn/model_gpu_v3.pt` + `model_ddp_v3.pt` | Migration-ranking GNN | 42-fold LOO τ-b **0.7168** vs heuristic **0.7210** — **honest tie**, no superiority claim |
25
- | `rl/rl_agent.pt` | Migration-ordering RL agent | Reward 140.34 ± 8.13 vs heuristic 140.62 — tie |
26
- | `side-channel/side_channel_model_real.pt` | Trace anomaly detector, retrained on 54 real trace sets | 46 VERIFIED + 8 LOW_RISK clean; 51/54 HIGH_RISK leak-injected |
27
- | `reports/` | `training_report_real.json`, `benchmark_comparison.json` | Lineage: config + seed + metrics per artifact |
28
 
29
- ## Reproduce
30
 
31
- ```bash
32
- python scripts/train_qtrust_all.py --real --hf-epochs 3 # discovery (needs CUDA)
33
- python scripts/eval_real_cbom_loo.py # GNN 42-fold LOO (needs 2xA100)
34
- python scripts/train_real_side_channel.py --traces-dir <dir>
 
35
  ```
36
 
37
- ## Limitations
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
- GNN reproduces the doctrine heuristic rather than beating it; side-channel
40
- model misses FALCON-512/1024 + SLH-DSA-256s keygen at n≤200; RL ties the
41
- heuristic. Checkpoints pin via `models.sha256` at deploy (`QTRUST_ENFORCE_MODEL_MANIFEST=1`).
 
 
 
1
  ---
2
  license: mit
3
  library_name: transformers
4
+ pipeline_tag: text-classification
5
+ datasets:
6
+ - KRISHNAPURI/q-trust-datasets
7
+ base_model: huggingface/CodeBERTa-small-v1
8
  tags:
9
+ - code
10
  - cryptography
11
  - post-quantum
12
+ - static-analysis
13
+ widget:
14
+ - text: "cipher = Cipher.getInstance(\"AES/ECB/PKCS5Padding\"); // usage under review"
15
+ - text: "kem = OQS_KEM_ml_kem_768_new(); OQS_KEM_ml_kem_768_keypair(kem, pk, sk);"
16
  ---
17
 
18
+ # Q-Trust CodeBERT — crypto-usage discovery classifier
19
 
20
+ Binary code classifier that answers **"does this code use cryptography, and which
21
+ primitive?"** — the discovery layer of the Q-Trust post-quantum migration
22
+ project (`humoge7502/q-trust` on GitHub). Fine-tuned from
23
+ `huggingface/CodeBERTa-small-v1` on 12,462 real files (6,636 crypto-labeled,
24
+ 34 repos, deterministic seed-42 split, repo-disjoint held-out set).
25
 
26
+ ## Measured results (never estimated)
27
 
28
+ | Metric | Value |
29
+ |---|---|
30
+ | Precision / Recall / F1 | 0.952 / 0.953 / **0.9525** (n=2,415) |
31
+ | Training | 4 epochs, CUDA, `scripts/train_qtrust_all.py --real --hf-epochs 3` |
32
+ | Leakage audit | Split reproduced bit-identically; 0.4% cross-repo dupes, bounded below the +0.11 F1 gain |
 
 
33
 
34
+ Try it in the widget above, or in code:
35
 
36
+ ```python
37
+ from transformers import pipeline
38
+ clf = pipeline("text-classification", model="KRISHNAPURI/q-trust-codebert")
39
+ clf("EVP_PKEY_assign_RSA(pkey, rsa);")
40
+ # [{'label': 'LABEL_1', 'score': 0.99}] # LABEL_1 = crypto usage
41
  ```
42
 
43
+ ```python
44
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
45
+ tok = AutoTokenizer.from_pretrained("KRISHNAPURI/q-trust-codebert")
46
+ model = AutoModelForSequenceClassification.from_pretrained("KRISHNAPURI/q-trust-codebert")
47
+ ```
48
+
49
+ Training data: [`KRISHNAPURI/q-trust-datasets`](https://huggingface.co/datasets/KRISHNAPURI/q-trust-datasets)
50
+ (`qtrust_ai/artifacts/real_datasets/code_corpus.json`). Full lineage
51
+ (config + seed + metrics): `reports/training_report_real.json` in
52
+ [`KRISHNAPURI/q-trust-codebert`](https://huggingface.co/KRISHNAPURI/q-trust-codebert)
53
+ sibling files, and `qtrust_ai/artifacts/benchmark_comparison.json` in the
54
+ GitHub repo.
55
+
56
+ ## Scope and limits
57
 
58
+ This model finds crypto **usage** (recall 0.877 on CryptoAPI-Bench files); it is
59
+ not a misuse detector and makes no SOTA claim. Sibling artifacts in this repo:
60
+ GNN ranker (honest tie with the heuristic, τ-b 0.7168 vs 0.7210), RL agent
61
+ (tie), side-channel detector (54 real trace sets). See `REPORTS` and the
62
+ per-artifact notes in the repo card below.