Views
No views yet
k from features of the public-key point (X, Y). All converged to exactly 50% accuracy on held-out k's, consistent with the long-held cryptographic belief that even one bit of the discrete logarithm is as hard to recover as the whole key.Do not use these models for any cryptographic application. They cannot predict the parity ofk, by construction.
Q = k·G = (X, Y), predict k mod 2 (whether the underlying private scalar is odd or even).k = 1 … 1,000,000 (sequential)Gk — train 70% (k=1..700K), val 15% (k=700K..850K), holdout 15% (k=850K..1M).X and Y (decimal digit statistics, mod residues, bit-length, popcount, comparisons). Target column k_state and traceability column k are excluded from inputs.feature_cols.json for the full input schema.| Model | Architecture | Params | Holdout acc | Holdout AUC | Train time |
|---|---|---|---|---|---|
| Logistic Regression | sklearn baseline | tiny | 0.4982 | 0.4983 | ~3 s |
| XGBoost | 400 trees, depth 6 | — | 0.5033 | 0.5036 | ~3 s |
| LightGBM | 400 trees, 63 leaves | — | 0.5002 | 0.4998 | ~11 s |
| MLP | 4 layers, 512–512–256 | ~1M | 0.4997 | 0.5009 | ~8 s |
| BitTransformer | 4-layer encoder, d=128, over raw 512-bit (X|Y) | 859K | 0.5000 | 0.4998 | ~2.8 h |
| Permutation sanity (XGBoost on shuffled labels) | — | — | 0.4994 | 0.4994 | — |
.
├── README.md # this file
├── metrics.json # full per-model metrics
├── feature_cols.json # input feature schema
├── data/
│ └── features_sample_1k.parquet # 1K-row sample of training data
├── models/
│ ├── xgb.json # XGBoost
│ ├── lgbm.txt # LightGBM
│ ├── mlp.pt # PyTorch MLP state_dict
│ └── bit_xformer.pt # PyTorch BitTransformer state_dict
└── scripts/
├── gen.py # generates feature parquet from k range
├── train.py # trains logreg / XGBoost / LightGBM / MLP
├── bit_transformer.py # trains the BitTransformer
├── predict.py # single-point inference
├── batch_eval.py # batch evaluation on fresh k range
└── build_html.py # generates a result-table HTML1# 1. install deps
2pip install numpy pandas pyarrow scikit-learn xgboost lightgbm torch huggingface_hub
3
4# 2. generate features (k=1..1M)
5python scripts/gen.py 1000000
6
7# 3. train the fast models
8python scripts/train.py
9
10# 4. train the bit-transformer (takes ~3 h on an NVIDIA L4)
11python scripts/bit_transformer.py1# XGBoost
2import xgboost as xgb
3m = xgb.XGBClassifier(); m.load_model("models/xgb.json")
4
5# LightGBM
6import lightgbm as lgb
7m = lgb.Booster(model_file="models/lgbm.txt")
8
9# MLP
10import torch, torch.nn as nn
11D = 44
12mlp = nn.Sequential(nn.Linear(D,512), nn.ReLU(),
13 nn.Linear(512,512), nn.ReLU(),
14 nn.Linear(512,256), nn.ReLU(),
15 nn.Linear(256,1))
16mlp.load_state_dict(torch.load("models/mlp.pt"))
17
18# BitTransformer
19class BitTransformer(nn.Module):
20 def __init__(self, seq_len=512, d=128, nhead=4, nlayers=4):
21 super().__init__()
22 self.tok = nn.Embedding(2, d)
23 self.pos = nn.Parameter(torch.randn(1, seq_len, d) * 0.02)
24 self.cls = nn.Parameter(torch.randn(1, 1, d) * 0.02)
25 enc = nn.TransformerEncoderLayer(d_model=d, nhead=nhead, dim_feedforward=4*d,
26 batch_first=True, activation="gelu", norm_first=True)
27 self.enc = nn.TransformerEncoder(enc, num_layers=nlayers)
28 self.head = nn.Linear(d, 1)
29 def forward(self, x_bits):
30 h = self.tok(x_bits) + self.pos
31 cls = self.cls.expand(h.size(0), -1, -1)
32 h = torch.cat([cls, h], dim=1)
33 h = self.enc(h)
34 return self.head(h[:, 0, :]).squeeze(1)
35bx = BitTransformer()
36bx.load_state_dict(torch.load("models/bit_xformer.pt"))g2-standard-8 instance with 1× NVIDIA L4 GPU.