Feature-dispatch training and standard model releases
The Main App repository handles raw samples and feature extraction. This ML repository accepts only pre-extracted numeric rows. It requires no provider API key, downloads no APKs and runs no APK parser.
The dataset decision is recorded in DATASET_STRATEGY.md: the scheduled fallback uses the checksum-pinned real Drebin-215 CSV. McNdroid and MH-1M remain isolated research/diagnostic datasets because their processed matrices do not contain a complete, unambiguous mapping to the Android schema.
Triggers
The automation has two separate responsibilities:
.github/workflows/continuous-learning.ymlowns the weekly0 0 * * 0schedule (Sunday 00:00 UTC / 05:30 IST) and manualworkflow_dispatch. It downloads only the pinned Drebin-215 CSV with--require-real, trains a baseline candidate, converts/verifies TFLite and enforces the fixed 1,451-row holdout plus the 97.45% accuracy floor. It uploads a candidate-validation artifact only; it does not publish a release or change the latest model..github/workflows/train-and-export.ymllistens forrepository_dispatch, typenew_malware_features, plus manualworkflow_dispatch. Pushes tomainrun validation only. This is the event-driven path for gated model updates from newly extracted 215-feature rows supplied by the Main App.
Both workflows share the non-cancelling safemobile-model-promotion
concurrency group. The scheduled fallback is candidate validation, not a
second model publisher.
The sender authenticates its GitHub dispatch with permission to this repository.
The receiver uses the built-in GITHUB_TOKEN for GitHub releases and download statistics;
no additional Actions secret is needed in this repository.
Event contract
Send event_type: "new_malware_features" and a client_payload object containing
both feature_rows and metadata. Each feature_rows entry is a JSON array
of exactly 215 finite numeric binary values, accepting integers 0/1
and floats 0.0/1.0. Boolean values, strings, nulls, non-finite values,
non-binary values and incorrect lengths fail the entire batch before any
dataset/state mutation. The batch limit is 100 rows, subject to GitHub's
overall repository-dispatch payload-size limit.
metadata must contain exactly one object for each feature row, with a
64-character hexadecimal sample sha256 and finite ha_threat_score from
0 through 100. Metadata is aligned by array position. The optional
vt_malicious_count field is ignored completely; it may be absent or set to
-1. No VirusTotal credential, lookup, value, or signal is used.
The ingestion gate relies exclusively on Hybrid Analysis: scores of 70 or
higher are retained as confirmed malware; scores from 10 up to but not
including 70 are retained as malware-positive and annotated
low_confidence; scores below 10 are discarded. Missing or misaligned
metadata is rejected for non-empty batches. Cached records are reclassified
using their Hybrid Analysis score so previous VirusTotal-based labels cannot
override the current HA-only policy.
scripts/ingest_dispatch_data.py reads the event directly from
GITHUB_EVENT_PATH; payload values are never interpolated into shell code.
It makes no network requests. Accepted vectors are added to
data/latest_training_data.csv in the frozen schema order with only
is_malware=1 as the target column. Confidence annotations and counts are
stored in the adjacent metadata JSON sidecar, not in the CSV feature columns.
VirusTotal values are not retained in dispatch history or audit sidecars.
docs/feature_schema.json remains identical to the original 215-key Android
schema and the TFLite input remains [1, 215]. SHA-256:
ffb386be14adf8c0af1bb96032e5485fcc8fd5b401a24488c5896e2d5ea425ac.
Duplicate rows are identified by normalized vector hashes. Up to 2,000 rows
are retained in ignored/cached state/dispatch_features.json. Replayed events
do not duplicate vectors. A later confirmed assessment upgrades an existing
low-confidence vector and makes it eligible for a fresh build. A successful
update release acknowledges its rows; rows from rejected/unpublished
candidates remain pending for weekly/manual retry. Empty events with no
pending rows do not retrain or publish an update.
One-time baseline publication
If standard release v1.0.1-model does not exist, the workflow trains the
existing Drebin CSV once, converts/verifies the model, and publishes that exact
tag with prerelease: false, draft: false, and make_latest: true.
The CSV is restored from the existing dataset cache, including the original
Drebin cache. No new APK downloads are attempted.
The 64/32-neuron DNN now trains for up to 30 epochs with batch size 64. A stratified 15% validation slice is drawn only from the training partition; ReduceLROnPlateau monitors val_loss, and EarlyStopping(patience=5, restore_best_weights=True) prevents unnecessary overfitting. The fixed 20% reference holdout remains reserved for final evaluation and is never used by either callback.
The verified real baseline must meet the same 97.45% final TFLite accuracy
floor. If no baseline CSV exists, the user-authorized synthetic fallback can
bootstrap the endpoint, but its report/notes explicitly state SYNTHETIC TEST
ONLY and make no detection claim. That exception applies only to the
one-time baseline; it never relaxes the gate for dispatched-feature updates.
Once v1.0.1-model is published, ordinary pushes/manual/weekly events do not
publish it again. New event rows received during bootstrap remain pending for
the next update. Existing model releases are preserved.
Gated feature updates
Updates use the same original 1,451-vector real Drebin holdout, with
fingerprint c1af386260fdd6b248e18cc067d734e61db1d3d59e337a4c07d06f8293e5dec1.
Dispatched rows overlapping that holdout, duplicate vectors and vectors
conflicting with a real benign training vector are excluded. Training classes
are balanced with unique, existing benign vectors from the training partition;
no held-out vector or fabricated benign label can enter training.
Training runs only when usable unacknowledged features exist. The actual
quantized TFLite model is evaluated on every frozen holdout vector. The gate
requires unrounded accuracy >= 0.9745, consistent confusion-matrix counts,
the unchanged schema and real baseline lineage. Synthetic update candidates
are rejected. A valid candidate below the accuracy floor produces a clear
warning and a rejection summary. The workflow's --warn-on-accuracy-rejection
mode exits with code 0 but emits approved=false: version allocation, stats
generation, publication and acknowledgment all stay skipped. The current
published model is retained and pending feature rows are preserved for retry.
The default CLI remains strict (exit code 3). Invalid provenance, changed
schema/holdout, corrupt reports and training/conversion errors remain failures;
they are never disguised as ordinary accuracy rejections.
Approved updates receive the next unused version (v1.0.2-model, etc.) and are
standard/latest releases. Every bundle contains malware_model.tflite,
feature_schema.json, model_report.json, stats.json, DATASET_NOTICE.md and SHA256SUMS.
No raw APK, ZIP, DEX, training CSV or individual evaluation vector is committed
or uploaded as a release/audit asset. Dataset and feature-state caches are
serialized across runs to avoid lost concurrent events.
Live dashboard and Android statistics
The public dashboard is published from main / /docs:
As the final data-compilation step of each successful dispatch/manual/weekly
run, python scripts/generate_stats.py creates docs/index.html and
docs/stats.json. A candidate's expected accuracy rejection is a successful
evaluation, so the dashboard still refreshes. Hard execution/integrity failures
retain the last good dashboard instead of publishing incomplete statistics.
Live model version, accuracy and size come from the current standard GitHub Release, with its report, asset digests and checksum manifest verified. They never advertise a rejected candidate as the installed/released model. The pipeline section separately describes the latest candidate verdict. Feature matrices trigger evaluation here; signature updates remain in the Main App.
The live sample pool is the verified real baseline CSV, before balancing or deduplication, plus retained unique dispatched feature vectors absent from that CSV. Benign samples come from that baseline. The rolling history is bounded at 2,000 records; these are available-pool counts, not a lifetime threat counter. Synthetic fallback rows cannot supply public live sample counts.
The JSON retains the same seven-field Android contract. The same bytes are
uploaded as stats.json on the existing approved model release, and that
release's SHA256SUMS is refreshed to match. The model, schema, evaluation
report, notice and model tag remain untouched by metadata synchronization.
New model publication still requires the unchanged 97.45% gate.
The runner sets the GitHub Actions bot name/email, stages only the two
public files and commits with docs: update live stats [skip ci]. Only the
publishing job persists checkout credentials and has contents: write and
pages: write. It rebases its generated-file commit before pushing to main,
using autostash so unrelated tracked documentation restored by the data cache
cannot block publication or enter the dashboard commit.
An explicit Pages build request follows because GITHUB_TOKEN pushes do not
automatically trigger branch-based Pages builds. No PAT or extra secret is
required. Set Pages once to Deploy from a branch → main → /docs.
The navy/cyan dashboard uses self-contained HTML/CSS, no tracking or external frameworks, and refreshes its view every five minutes. Statistics update when the pipeline runs; download counts are measured at compilation time.
Release-bundle statistics
After the promotion gate passes and a model version is allocated,
scripts/generate_stats.py writes models/stats.json and adds its SHA-256 to
the bundle's SHA256SUMS. The release step uploads it alongside the model and
schema. The generator checks the CSV and model hashes against the evaluated
report so a different dataset or rejected model cannot supply a release's stats.
| JSON field | Value source |
|---|---|
total_malware_samples |
Rows labeled malware in the exact model input CSV |
total_benign_samples |
Rows labeled benign in that same CSV |
model_version |
Allocated vX.Y.Z-model tag, shared with the release step |
accuracy |
Final TFLite holdout accuracy, formatted as a percentage with two decimal places |
model_size_kb |
Actual .tflite bytes / 1,000, rounded to two decimal places |
total_downloads |
Sum of malware_model.tflite download counts across published standard model releases, using all GitHub API pages |
last_updated |
Generation time in UTC, ISO 8601 with Z |
CSV counts describe the dataset file before the trainer's deduplication/split. For dispatched candidates this is the balanced training CSV; the fixed holdout is separate. For the baseline it is the original Drebin CSV. Counts are never inflated by the example numbers in a client UI. Accuracy rounding is for display only: the unchanged promotion gate compares the unrounded score.
The table describes the initial release-bundle snapshot. Later live refreshes
use the available sample pool defined above and the current published model.
GitHub API errors fail generation instead of advertising a fabricated zero.
Local runs can use GH_TOKEN or GITHUB_TOKEN.
GITHUB_REPOSITORY=owner/repository python scripts/generate_stats.py \
--dataset data/latest_training_data.csv --model-version v1.0.2-model
To compile the public dashboard from the published model and local baseline /
feature state, omit --model-version:
GITHUB_REPOSITORY=owner/repository python scripts/generate_stats.py
The optional --output-dir changes the live output folder. Release mode
(--model-version) keeps staging files under models/, adds index.html for
preview and writes the checksummed stats snapshot used for initial publication.
Android endpoint verification
After publication the workflow verifies HTTP 200 OK from /releases/latest,
checks the expected tag, confirms non-draft/non-prerelease status, and checks
the model, schema and stats assets. Android can use this endpoint to select the
latest accepted bundle and retain its previous bundle if an update fails.
Standard GitHub publication does not itself validate feature-extractor parity
or modern malware performance; the independent Android/current-sample checks
and report's production_ready status remain separate deployment evidence.
Local commands
With Python 3.10 and requirements.txt installed:
python scripts/prepare_baseline_data.py
python scripts/ingest_dispatch_data.py --event /path/to/github-event.json
python scripts/train_model.py --dataset data/latest_training_data.csv
python scripts/convert_to_tflite.py
python scripts/verify_artifacts.py
python scripts/quality_gate.py
For the original baseline, train the default dataset and use
python scripts/quality_gate.py --baseline. Only the workflow publishes to
GitHub; a local ingestion or training command has no publication side effect.
Modern research datasets (separate from production model promotion)
The modern-dataset tools are opt-in local preparation workflows. They do not change the default Drebin-215 training pipeline, the models directory, Android TFLite assets, release gates, or the current published model. Large archives, unpacked matrices, local reports and experimental checkpoints are all ignored by Git under data/.
MH-1M — separate 23,247-feature Android research track
Source: Malware-Hunter/MH-1M, Harvard Dataverse (DOI 10.7910/DVN/LLHEGN), and Figshare (article 28355897).
The processed feature matrix described by the upstream notebook contains 1,340,515 samples × 23,247 features. It combines 22,394 API-call indicators, 407 intents, 232 opcodes and 214 permissions. It is not the frozen Android Drebin-215 feature contract and must never be projected, truncated, or reordered into the existing 215-input model. It is downloaded and extracted only under data/mh1m/.
The repository's metadata-only coverage inspection resolved 141 of the canonical 215 names. Seventy names had no exact source match and four more were ambiguous because one owner-qualified API token could populate multiple Drebin class names: 74 features are unresolved in total. The extraction script refuses to create a 215-column array until all names have unique, verified source columns. This dataset is not an active model-training source.
The downloader retrieves the upstream multi-volume processed 7-Zip feature archive (not the raw APK collection), verifies each part against the Git blob object ID published by the source repository, and extracts the processed NPZ with the system 7z/7zz utility. It writes a dataset manifest and reports the expected matrix dimensions. No APKs are downloaded.
License caution: the MH-1M paper is published under CC BY 4.0, but the GitHub data repository does not provide a root dataset LICENSE file. The script therefore records that the exact Figshare/Dataverse asset-level Rights/License field has not been independently confirmed. Before commercial use or redistribution, verify the selected archive's own license/rights metadata and retain the required attribution. Do not interpret the paper's article license alone as a confirmed license for every supplementary asset.
# Download the processed feature archive and extract it under data/mh1m/
python scripts/download_modern_datasets.py mh1m
# Download and verify only; extract later after installing 7-Zip
python scripts/download_modern_datasets.py mh1m --download-only
McNdroid — yearly static DREBIN adaptation (2013–2025)
Sources: McNdroid dataset card and Zenodo record 19969833.
The dataset card identifies the dataset as CC BY 4.0, spanning 2013–2025, with year-specific train/test static feature matrices and metadata. The Zenodo mcn_data.zip archive is the static-feature modality; the separate GML and JSON archives are not downloaded by this workflow. The pinned Zenodo MD5 for mcn_data.zip is d279b66aaf59c751de019abec234b0e4. The downloader verifies that checksum before safely extracting the archive into data/mcndroid/.
The mapping investigation found that the 2013 original vocabulary
contains 501,525 entries, but selector_meta.json reduces the actual source
matrix to 2,390 columns. Explicit category aliases and selector-index
translation resolve 115 of the 215 Android features. 100 features are
unavailable in the selected matrix (29 were removed by the selector and
71 have no matching token in the inspected vocabulary). The mapper fails
closed; do not rename, pad, truncate, zero-fill or infer substitute columns.
McNdroid is therefore research/diagnostic only and is no longer part of the
scheduled training workflow.
The CC BY 4.0 dataset-card license requires attribution. Keep the dataset citation and source with any resulting work, and recheck the Zenodo record's current Rights metadata before redistributing the archive or derived data.
# Download/checksum-check/extract static feature modality only
python scripts/download_modern_datasets.py mcndroid
# Sequential 2013 -> 2025 adaptation (local experimental checkpoints only)
python scripts/train_mcn_yearly.py --start-year 2013 --end-year 2025 \
--epochs-per-year 1 --batch-size 512
EMBER 2018 — Windows PE architecture validation only
Official source: elastic/ember. Archive: ember_dataset_2018_2.tar.bz2.
Pinned SHA-256:
b6052eb8d350a49a8d5a5396fbe7d16cf42848b86ff969b77464434cf2997812
License correction: the official EMBER repository says its downloadable dataset files are MIT-licensed, while the repository's helper/source code is AGPL-3.0. The dataset is not described as Apache-2.0 by the official license file. The architecture validator does not copy or vendor the EMBER helper source; when --prepare is used, the separately installed official helper package is subject to its own AGPL-3.0 terms.
EMBER contains Windows PE features, not Android APK features. It is strictly an isolated architecture/runtime smoke test. validate_architecture.py verifies the archive SHA-256 again before use, excludes the unlabeled -1 samples, selects a bounded balanced subset of benign/malware rows, and trains the requested temporary architecture:
Dense(64, ReLU) → Dropout(0.3) → Dense(32, ReLU) → Dense(1, Sigmoid).
It tests evaluation, save/reload and finite predictions. The temporary model is deleted; only a report is written under data/ember2018/. EMBER rows, labels, feature vectors and weights are never added to Android training data, the frozen 215-feature input, models/, or a release.
# Download, SHA-256 verify, and safely extract EMBER 2018 PE features
python scripts/download_modern_datasets.py ember2018
# Install the external official reader/vectorizer only in your local environment.
# Its source code is AGPL-3.0; it is not bundled into SafeMobile.
python -m pip install git+https://github.com/elastic/ember.git
# Create local vectorized PE matrices, then train/evaluate the temporary smoke model
python scripts/validate_architecture.py --prepare --feature-version 2 \
--max-per-class 25000 --epochs 1 --batch-size 512
# Repeat validation using already-vectorized local matrices
python scripts/validate_architecture.py --feature-version 2
Storage and isolation rules
The following paths are explicitly ignored by Git (as are all other generated files under data/): data/mh1m/, data/mcndroid/, data/lamda/, and data/ember2018/. Do not commit archives, extracted NPZ/Parquet matrices, sample metadata, trained checkpoints or validation reports. The scheduled fallback and the event-driven update lane both preserve the existing Drebin-215 schema. McNdroid, MH-1M and LAMDA are opt-in research/diagnostic inputs only and cannot redefine the Android model feature contract.
Scheduled Drebin-215 fallback validation
The autonomous workflow .github/workflows/continuous-learning.yml runs
every Sunday at 00:00 UTC (05:30 IST) and supports manual dispatch. Its
sequence is intentionally limited to the stable fallback:
- Download real data only.
scripts/download_dataset.py --require-realobtains the pinned public Drebin-215 CSV and checks its SHA-256. If both pinned sources are unavailable or the bytes do not match, the workflow fails. It does not fall back to synthetic data. - Verify the contract. The dataset provenance must be
drebin215,is_synthetic: false, the feature names/order must match the frozen 215-feature schema, and both classes must be present. - Train and export a candidate.
scripts/train_model.py --require-realtrains on the canonical 215 columns. The converter and verifier check the float32[1,215] -> [1,1]Android tensor contract, checksums and schema. - Apply the baseline quality gate.
scripts/quality_gate.py --baselinechecks the fixed 1,451-row reference holdout and the existing unrounded 97.45% final TFLite accuracy floor.
A successful run uploads a short-lived drebin215-fallback-validation
artifact for audit. It does not allocate a version, run a release command,
or update the standard/latest release. The currently deployed model therefore
remains unchanged by this scheduled validation workflow.
Event-driven quality-gated releases
The separate .github/workflows/train-and-export.yml workflow receives
verified, pre-extracted 215-feature rows from the Main App through
repository_dispatch. It protects the same fixed Drebin holdout, requires
real baseline lineage and new usable feature rows, and enforces the existing
97.45% TFLite accuracy gate. Only that event-driven publisher path allocates
a new model version and publishes a standard/latest release. A rejected
candidate leaves the currently deployed release intact and pending rows
available for retry.
McNdroid and MH-1M do not enter either training lane. The 2013 McNdroid selected matrix is missing 100 canonical features; MH-1M has 70 absent and four ambiguous canonical features (74 unresolved). See DATASET_STRATEGY.md for the evidence and the future custom APK extractor proposal. The scheduled fallback is a historical Drebin-215 baseline validation, not a claim of modern-malware coverage.
Public dashboard and release statistics
The public dashboard is served from docs/index.html:
https://navyask911.github.io/safemobile-Antivirus-Trained-ML-Data-of-Android-malware/
Its data snapshot is docs/dashboard-data.json. The page shows the
app-managed TweetFeed CC0 hash feed flowing into the app's .hsb signature
database and the currently published ML model. TweetFeed publishes community
IOCs under CC0 (https://github.com/0xDanielLopez/TweetFeed). The app's
database generation and consumption remain app-side responsibilities.
The model card reports the current deployed version, model size, accuracy and last release/evaluation date. The scheduled Drebin fallback workflow creates a candidate-validation artifact only; it does not publish a candidate, update the latest release or rewrite the dashboard. Release metadata and dashboard statistics are updated through the event-driven publisher after its quality gate approves a candidate.
McNdroid's 100 unavailable and MH-1M's 74 unresolved canonical features are documented blockers to using those processed matrices as Android training inputs. LAMDA remains a separate research track. MH-1M's paper is CC BY 4.0, but the selected archive's asset-level redistribution rights have not been verified. EMBER 2018 data are MIT-licensed; its official upstream helper/source code is AGPL-3.0 (not Apache-2.0), and the data are used only for isolated Windows PE architecture validation.
No APKs, holdout vectors, raw matrices or dataset archives are exposed through the dashboard or model releases.