How sparkzu/radiollm works
Project Type and Purpose
• RadioLLM is an ML research framework rather than a user-facing application. It integrates Hybrid Prompt and Token Reprogramming (HPTR) and a Frequency Attuned Fusion (FAF) module into large language models for cognitive radio signal processing tasks.
• Key use cases: pretraining on radio‐signal datasets, fine-tuning with expert prompts, and benchmarking on CRT (cognitive radio tasks).
Main Components
a. Data Layer
• dataset.py: orchestrates loading of benchmark datasets (e.g., from Hugging Face).
• utils/sig_utils.py & utils/signal_aug.py: domain‐specific signal processing and augmentation routines.
b. Model Layer
• model/embed.py: transforms raw or augmented signals into token embeddings suitable for LLM input.
• model/radiollm.py: core RadioLLM class implementing HPTR and FAF modules on top of a base Transformer.
• model/norm.py & model/utils.py: normalization layers and shared helper functions used by the model.
c. Training Pipelines
• pretrain.py: runs unsupervised or multi-task pretraining (configurable via script/multi_task_pretrain.yaml).
• finetune.py: script for supervised fine-tuning on downstream CRT tasks.
• script/multi_task_pretrain.yaml: YAML config defining datasets, hyperparameters, and task splits.
d. Deployment & Environment
• Dockerfile: containerizes Python 3.9 environment, PyTorch, Hugging Face Transformers & PEFT.
• README.md & docs/: documentation and assets (logo, high‐level usage).
Relationships and Data Flow
• Dataset inputs → (sig_utils + signal_aug) → dataset.py batches → embed module → core RadiollM model (HPTR + FAF) → loss computation → optimizer → updated model weights.
• pretrain.py and finetune.py drive above pipeline, loading the correct config, invoking dataset pipelines, instantiating the model, and logging metrics.
• External libraries (PyTorch, Transformers, PEFT) are dependencies used throughout model and training scripts.
Architectural Patterns & Principles
• Modular separation: data processing, model definition, and training logic kept in separate directories/files.
• Configuration-driven experiments: YAML file for hyperparameters & task definitions.
• Reusable utilities: common signal and model helpers in utils/ and model/utils.py.
• Containerization: Docker ensures reproducible environment.