phishing-email-detection-distilbert-v2.4.1-CoreAI — Apple Core AI
A Core AI (.aimodel) build of cybersectony/phishing-email-detection-distilbert_v2.4.1 for on-device inference on
Apple Silicon. Upstream ships PyTorch weights and no Core AI build.
What the model is. A DistilBERT sequence classifier for phishing detection in emails and URLs (4 classes). Upstream claims 99.58% accuracy on its own dataset; that figure is upstream's, not measured here.
Outputs
main takes input_ids and attention_mask (int32, fixed length 512). The runtime names outputs after the
producing op, not after the wrapper's keys, so select by shape:
| Shape | Meaning |
|---|---|
[1,4] |
classification logits (argmax = class index) |
[1,768] |
mean-pooled, L2-normalised embedding (an addition; not in upstream) |
Class names are from the upstream README; config.json itself only says LABEL_0..3:
0 legitimate_email
1 phishing_url
2 legitimate_url
3 phishing_url_alt
Probes and results
Probes are in cases-phishing.txt; the predicted index is the argmax of the logits (ref-output.json), and was re-checked from the Hub download.
| Probe | Predicted index → name | logits max abs diff | relative to max logit | embedding diff |
|---|---|---|---|---|
| Dear User, your account security needs immediate attention. Please verify your credentials. Click here: http:/ | 1 → phishing_url |
9.54e-07 | 8.9e-08 | 7.64e-08 |
| URGENT: Your PayPal account has been limited. Confirm your password within 24 hours at http://paypa1-secure-lo | 1 → phishing_url |
1.91e-06 | 1.7e-07 | 7.45e-08 |
| Congratulations! You have won a $1000 gift card. Claim now by entering your bank details. | 1 → phishing_url |
3.81e-06 | 3.8e-07 | 7.08e-08 |
| Hi team, the quarterly planning meeting is moved to Tuesday at 10am. Agenda attached. | 0 → legitimate_email |
9.54e-07 | 1.0e-07 | 8.20e-08 |
| Your invoice #4821 from Acme Ltd is attached. Let me know if you have any questions. | 0 → legitimate_email |
9.54e-07 | 1.1e-07 | 8.94e-08 |
| http://secure-update-appleid.verify-account.ru/login.php | 3 → phishing_url_alt |
9.54e-07 | 9.6e-08 | 1.42e-07 |
| https://www.wikipedia.org/wiki/Machine_learning | 3 → phishing_url_alt |
1.91e-06 | 2.1e-07 | 1.63e-07 |
| https://github.com/huggingface/transformers | 3 → phishing_url_alt |
1.91e-06 | 2.0e-07 | 1.83e-07 |
Measured equivalence
Exported graph vs the original PyTorch model (float32), same inputs, raw outputs diffed.
- Worst absolute difference over all outputs: 3.815e-06
- Worst residual relative to output magnitude: 3.8e-07 (float32 rounding)
- Minimum cosine between embeddings: 1.0000000000
This is arithmetic equivalence only. There is no quality benchmark here (no F1, no accuracy, no comparison with upstream's reported numbers), and no speed or memory measurement.
Built by
ahmedandaloes — Apple Silicon builds (Core AI, MLX, GGUF) of security and language models that ship none: ahmedandaloes.com
Need a model in a format that is not here — another runtime, another quantisation, your own checkpoint? That is the same job. Ask.
Use
import asyncio, numpy as np
from coreai.runtime import AIModel, NDArray, SpecializationOptions
from transformers import AutoTokenizer
async def run(text):
tok = AutoTokenizer.from_pretrained(".")
model = await AIModel.load("phishing-email-detection-distilbert-v2.4.1.aimodel", SpecializationOptions.default())
fn = model.load_function("main")
enc = tok([text], padding="max_length", truncation=True, max_length=512, return_tensors="np")
out = await fn({"input_ids": NDArray(enc["input_ids"].astype("int32")),
"attention_mask": NDArray(enc["attention_mask"].astype("int32"))})
arrs = [np.asarray(v.numpy()) for v in out.values()]
logits = next(a for a in arrs if a.shape == (1, 4))
return int(logits.argmax())
Files
phishing-email-detection-distilbert-v2.4.1.aimodel/ (graph), manifest.json, validation.json, ref-output.json, cases-phishing.txt,
arabic_encoder_coreai.py (exporter and measurer), requirements.txt, tokenizer/config files.
Limits
- Fixed at 512 tokens; longer inputs need chunking.
- 8 English probes measured (listed above); nothing else was.
- Softmax and thresholding are the caller's steps.
- The bare-URL probes disagree with the README's class names. All three URL probes — one phishing-looking and two plainly legitimate (wikipedia.org, github.com) — got index 3 (
phishing_url_alt), in the original PyTorch model as well as here. So index 3 does not mean "phishing" on bare URLs, or the README names for 2/3 are off. This conversion reproduces upstream exactly; it does not repair it. Verify the class semantics on your own data before use.
Licence and attribution
apache-2.0, as declared in the upstream Hub card. A derivative of cybersectony/phishing-email-detection-distilbert_v2.4.1; credit for the model is theirs.