Text Generation
PEFT
Safetensors
Transformers
lora
research-prototype
failed-promotion
not-ready-for-deployment
Instructions to use minagayid/ELLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use minagayid/ELLM with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM2-135M-Instruct") model = PeftModel.from_pretrained(base_model, "minagayid/ELLM") - Transformers
How to use minagayid/ELLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="minagayid/ELLM")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("minagayid/ELLM", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use minagayid/ELLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "minagayid/ELLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "minagayid/ELLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/minagayid/ELLM
- SGLang
How to use minagayid/ELLM with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "minagayid/ELLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "minagayid/ELLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "minagayid/ELLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "minagayid/ELLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use minagayid/ELLM with Docker Model Runner:
docker model run hf.co/minagayid/ELLM
|
Download docs/nlp-platform.md from minagayid/ELLM: direct link, hf CLI and curl.
- Browser
- Download file 8.86 kB
-
https://huggingface.co/minagayid/ELLM/resolve/main/docs/nlp-platform.md
- Command line
-
hf download hf://minagayid/ELLM/docs/nlp-platform.md
-
curl -L -o nlp-platform.md https://huggingface.co/minagayid/ELLM/resolve/main/docs/nlp-platform.md
8.86 kB
| # ELLM NLP training platform | |
| This is a local, experimental training scaffold around the existing evidence-triage adapter. It supports corpus preparation, tokenizer experiments, continued or scratch pretraining, SFT, DPO, GRPO, and a frozen-set multilingual likelihood comparison. It does not train or upload anything until an operator explicitly runs a command with local data. | |
| The original `135M + LoRA` evidence-triage experiment remains separate and rejected. Nothing here changes its weights or evaluation result. The included model profiles are upstream SmolLM2 base checkpoints pinned to immutable revisions; they are starting points, not ELLM-trained foundation models. | |
| ## Install and workflow | |
| Python 3.10 or newer is required. Install the optional platform dependencies from the repository root: | |
| ```bash | |
| python -m pip install -e ".[nlp-training]" | |
| ``` | |
| Prepare each corpus for the purpose it will serve. The command reads only named local JSONL files, rejects records without the required rights/privacy attestations, assigns document-level splits, removes exact duplicate payloads, writes sharded JSONL, and records source hashes in a manifest. It does not fetch sources or verify the truth of attestations. | |
| ```bash | |
| python -m training.nlp.prepare_data --input /local/data/corpus.jsonl --purpose pretraining --output-dir /local/data/ellm-pretraining | |
| python -m training.nlp.prepare_data --input /local/data/tokenizer.jsonl --purpose tokenizer_training --output-dir /local/data/ellm-tokenizer-data | |
| ``` | |
| To train and inspect a tokenizer, with no tokenizer decision based on vocabulary size alone: | |
| ```bash | |
| python -m training.nlp.train_tokenizer --manifest /local/data/ellm-tokenizer-data/manifest.json --output-dir /local/models/ellm-bpe-64k --vocab-size 64000 | |
| ``` | |
| To start a small model from random weights with that tokenizer, use `pretraining-scratch.json` and pass `--tokenizer-dir /local/models/ellm-bpe-64k`. This is a genuine from-scratch initialization of the selected small architecture, but it is only as capable as its pretraining data and compute allow. Continued pretraining and instruction tuning can start from an earlier candidate with `--model-path /local/models/previous-candidate`; the saved tokenizer travels with the candidate. | |
| For continued pretraining from the pinned 135M base: | |
| ```bash | |
| python -m training.nlp.run_stage --config training/nlp/configs/pretraining.json --manifest /local/data/ellm-pretraining/manifest.json --output-dir /local/models/ellm-pretrain-candidate | |
| ``` | |
| The scratch-pretraining profile starts random weights with the architecture of the selected profile. Pair it with a custom tokenizer using `--tokenizer-dir`; do not substitute a newly trained tokenizer into pretrained weights because its token IDs do not correspond to the pretrained embeddings. | |
| Post-training examples are in `training/nlp/configs/sft.json`, `dpo.json`, and `grpo.json`. Prepare data with the matching purpose and pass the prior candidate using `--model-path`: | |
| ```bash | |
| python -m training.nlp.run_stage --config training/nlp/configs/sft.json --manifest /local/data/ellm-sft/manifest.json --model-path /local/models/ellm-pretrain-candidate --output-dir /local/models/ellm-sft-candidate | |
| ``` | |
| GRPO currently has one deliberately narrow built-in reward: normalized exact match for tasks with a single checkable reference answer. It is not a general reasoning reward. Each stage writes a `candidate-run.json`; the stage runner writes only to a new local candidate directory, never promotes a model, and never pushes to the Hub. Remote base checkpoints are downloaded from Hugging Face at the pinned revisions. There is no paid or hosted training fallback. | |
| ## Input record and provenance | |
| Every source row carries both the task data and explicit operator attestations. Example for an Arabic pretraining document: | |
| ```json | |
| { | |
| "text": "نص عربي راجعه مالك البيانات وسمح باستخدامه للتدريب.", | |
| "language": "ar", | |
| "domain": "general", | |
| "source_id": "publisher-001", | |
| "document_id": "document-001", | |
| "source_url": "https://example.org/document-001", | |
| "retrieved_at": "2026-09-29T10:00:00Z", | |
| "data_origin": "licensed", | |
| "license": "license identifier", | |
| "reuse_basis": "documented training permission", | |
| "rights_status": "approved", | |
| "terms_status": "allows_training", | |
| "terms_reviewed": true, | |
| "robots_status": "allowed", | |
| "robots_reviewed": true, | |
| "privacy_status": "not_present", | |
| "pii_reviewed": true, | |
| "allowed_uses": ["tokenizer_training", "pretraining"], | |
| "split": "train" | |
| } | |
| ``` | |
| The values above are structural examples, not claims that the named URL, license, or permissions exist. Only attest to a right or review after it actually occurred. External sources need a URL, retrieval time, reviewed terms explicitly allowing training, and an allowed crawler-policy review. For owner-created or synthetic material, `source_url` and crawler policy may be omitted, but source/document identifiers, license/reuse basis, terms status, privacy review, and allowed purpose remain required. The language tag is a simple BCP-47-style value such as `en`, `ar`, `ar-EG`, or `fr`. | |
| SFT accepts one of `text`, conversational `messages`, or `prompt` plus `completion`. Conversational SFT masks loss to assistant turns; prompt/completion SFT follows TRL's completion-only behavior. A plain role-based chat template is supplied at runtime if the model has no usable template. DPO accepts `prompt`, `chosen`, and `rejected`; GRPO accepts `prompt` and `answer`. Include the same provenance fields on every row. The Arabic evaluation directory contains the specification only; no Arabic benchmark examples are included. | |
| The tool places all records for a `document_id` in one split. Evaluation-purpose records must be explicitly in `test`. Training uses only `train`; validation and test are kept outside candidate fitting. Exact normalized-payload duplicates are removed and their provenance is retained in `duplicate-provenance.jsonl`. Near-duplicate detection, language quality classification, PII detection, toxicity filtering, malware/injection screening, and factual-quality scoring are not implemented. Operators must handle those before training. | |
| If preparation stops before `manifest.json` is written, treat that output directory as incomplete. Keep it for inspection and choose a new empty output path for a retry; no existing path is overwritten. | |
| ## Models, scale, and evaluation | |
| `training/nlp/configs/model_profiles.json` contains pinned `HuggingFaceTB/SmolLM2-135M` and `HuggingFaceTB/SmolLM2-1.7B` base profiles. The 135M profile is for pipeline experiments. The 1.7B profile uses substantially more memory and compute. No 7B/8B or MoE training configuration, validated distributed recipe, FSDP setup, or DeepSpeed setup is included. Config values are starting points and are not validated as optimal. | |
| For tokenizer training, the tool measures tokens per whitespace-delimited word on a sample for each language. This is a rough diagnostic; compare candidate tokenizers on the same clean multilingual text and also measure context use, throughput, memory, and downstream task quality. Byte-level coverage does not establish Arabic or multilingual competence. | |
| Prepare a separately authorized, frozen evaluation corpus with `--purpose evaluation`, then compare the candidate with a pinned baseline: | |
| ```bash | |
| python -m training.nlp.prepare_data --input /local/eval/frozen.jsonl --purpose evaluation --output-dir /local/eval/ellm-frozen | |
| python evaluation/compare_language_models.py --manifest /local/eval/ellm-frozen/manifest.json --candidate /local/models/ellm-sft-candidate --baseline-id HuggingFaceTB/SmolLM2-135M --baseline-revision 93efa2f097d58c2a74874c7e644dbc9b0cee75a2 --output /local/eval/ellm-report.json | |
| python evaluation/promotion_gate.py --report /local/eval/ellm-report.json | |
| ``` | |
| The evaluator compares bits per UTF-8 byte by language. The initial gate requires at least 1,000 examples for English and Arabic language families and rejects more than a 0.02 bits-per-byte regression in either. Arabic subtags such as `ar-EG` are aggregated for this volume/regression check. A passing report means only `eligible_for_human_review`; it is not a model promotion decision. The current repository has no such multilingual test corpus, so it cannot pass the Arabic gate until independently reviewed data is supplied. Likelihood scores alone do not establish capability, factuality, reasoning, safety, robustness, or generation quality. | |
| The larger pasted roadmap also describes dynamic data mixing, preference/reasoning reward design, independent task suites, adversarial evaluation, canaries, rollback, tool-using agents, and model evolution. Those remain future work. Existing evidence retrieval and deterministic release gating stay separate from these training tools. | |