Production-Ready Music LLM Architecture: Edge-Cloud Hybrid, Agent Orchestration & Deliverable System Design
Architecture Overview (Text-based Diagram) [Android App] ├─ UI / Creation Mode: Prompts, lyrics, style, duration, A/B comparison, segment editing ├─ On-device Lightweight Layer: LiteRT/NCNN running 80M~300M small models (humming-to-token, rhythm tapping, 10s low-bitrate preview) ├─ Network Layer: R

[Android App] ├─ UI / Creation Mode: Prompts, lyrics, style, duration, A/B comparison, segment editing ├─ On-device Lightweight Layer: LiteRT/NCNN running 80M~300M small models (humming-to-token, rhythm tapping, 10s low-bitrate preview) ├─ Network Layer: Resumable uploads/downloads, task queue, offline drafts └─ Playback Layer: ExoPlayer + watermark verification + ID3 display
↑↓ HTTPS / WebSocket (task-based communication)
[API Gateway / BFF] ├─ Authentication, quotas, risk control, prompt safety filtering ├─ Task creation → Redis queue → Celery/K8s Job └─ Callback to App (progress, preview URL, final version URL)
[Creative Agent Layer] ├─ LLM Planner (Qwen3-8B class): One creative sentence → structured blueprint ([Verse][Chorus] BPM, key, instrumentation, vocal tone) ├─ Lyricist: Chinese/English lyrics generation + copyright rejection (blocking real-person lyrics / copyrighted lyrics) └─ Refiner: Maps "make it more intense" → target_bpm+=8 / add orchestral strings
[Generation Engine Layer (Pluggable)] ├─ Cloud Flagship: Hybrid-LM + RVQ Codec + Flow/DiT (MiniMax Music3-like, 32k/44.1k stereo, ≤5min) ├─ Cloud Economy: Latent Diffusion (Stable Audio / ACE-Step distilled 4~8 steps, 30s preview) ├─ On-device Fallback: INT8 quantized MusicGen-small / self-developed 200M AR (preview/loop only) └─ Vocal Track Branch: Vocals (VITS/DiffSinger-like) + Accompaniment (LM/DiT) joint or post-mixed separately
[Post-processing & Delivery] ├─ Loudness normalization (EBU R128), fade in/out, format conversion to MP3/WAV/OGG ├─ AudioSeal imperceptible watermark + SynthID-like identifier ├─ ID3 tags: AI declaration / model_ver / job_id / license_id └─ Object storage (S3/OSS/COS) + CDN signed URLs
[Data & Training Loop] ├─ Licensed music library (self-purchased/partnered/CC), humming logs (anonymized), A/B preferences ├─ Feature library: FAD, CLAP similarity, structural label consistency └─ Incremental fine-tuning (LoRA with frozen base) + reward model RLHF alignment
Recommendation: Hybrid Reasoning-Diffusion (LLM planning + Codec + DiT/Flow rendering) as the cloud flagship, with autoregressive models used only for on-device preview.
Rationale: • Pure AR (MusicGen-like) loses long-form song structure; the chorus cannot be recovered in a 5-minute track.
• Pure DiT delivers good quality but weak controllability and high latency.
• Hybrid delegates "structure" to the LLM and "texture" to DiT/Flow — the industry-converged solution for 2026 (Music3 / ACE-Step 1.5 both follow this path).
• Android: INT8 quantized 200M~500M AR or distilled DiT, LiteRT/NCNN for 10s loop preview, <100ms trigger latency.
• All heavy lifting goes to the cloud; on-device only provides "a quick feel."
Tech Stack: FastAPI (BFF) + Celery/Arq + Redis (queue/result backend) + K8s + Prometheus/Grafana.
DRAFT → PLAN(LLM) → QUEUE → INFER(GPU Worker) → POST(loudness/watermark) → STORAGE → NOTIFY → DONE / FAILED / CANCELED
• Flagship Pool: A100/H100, runs Hybrid 5min generation, batch=1, streaming chunk previews
• Economy Pool: L4/A10G, runs distilled DiT 30s preview, int8
• On-device fallback does not consume GPU
• POST /v1/jobs {prompt, lyrics, blueprint?, dur, ab:2, seed, model_tier}
• GET /v1/jobs/{id} Progress + segmented preview signed URL
• POST /v1/jobs/{id}/revise Structured feedback (bpm±, add strings, change to female vocal)
• GET /v1/assets/{id} Final version + watermark verification API
• 10s preview (on-device): <150ms first packet
• 30s cloud preview: 8~15s (distilled DiT)
• 3min flagship: 40~90s (A100, non-strict benchmark, adjust per actual measurement)
• Kotlin + Compose, playback via ExoPlayer, offline drafts stored in Room
• On-device inference: LiteRT (Gemma-class small LLM for prompt expansion) + NCNN running quantized MusicGen-small preview
• Dual-loop threading model (referencing DJemma pitfalls):
• Fast loop: Touch/humming → on-device beat marking → local audio synthesis (20ms-level)
• Slow loop: LLM modifies blueprint → cloud re-renders (1s-level, non-blocking UI)
• Poor network handling: Tasks persist locally, upload on WiFi; generation continues in background, WebSocket pushes progress
• Compliance UI: Generated content displays "AI-Generated" badge by default; sharing page includes license selection (personal/commercial requires subscription)
Licensed Audio → Loudness alignment / Denoising / DTW rhythm alignment → Codec encoding → (Lyrics ASR + Structure annotation + CLAP labels) → Segment 30s~5min → Pre-training (AR+DiT joint) → LoRA style fine-tuning (lofi / Chinese style / Kpop) → Reward Model (musicality / lyrics alignment / structure score) → RLHF/dpo → Distill on-device version
• Corpus baseline: Partner music library ≥ 50k licensed tracks; do not touch commercial vocals without this.
• Negative samples: Off-beat, key drift, mispronounced lyrics — specifically train the Refiner on these.
• Training data: Only licensed/CC/self-produced; retain license snapshots
• Generation blocking: Real-person voice cloning, copyrighted lyrics, celebrity names → reject or downgrade to instrumental-only
• Output enforcement: AudioSeal imperceptible watermark + ID3 AI-Generation: true + job_id traceability
• Subscription tiers: Free = non-commercial + watermark badge; Pro = commercial license + no visible badge (hidden watermark still applied)
• Evaluation: FAD (quality) + CLAP (text alignment) + structural label F1 + human A/B blind test (vs Suno v4.5 baseline)
M1 Cloud MVP 4 weeks FastAPI + open-source MusicGen/ACE-Step distilled, 30s instrumental, Web debug console
M2 Android Shell 4 weeks Kotlin client + task queue + preview + watermark, integrated with M1
M3 Hybrid Flagship 8 weeks Self-trained/fine-tuned Global+Local LLM+Flow-VAE, 5min with vocals, A/B
M4 On-device Preview 4 weeks INT8 small model on LiteRT, 10s loop offline
M5 Commercial Closure 4 weeks Licensed library integration, AudioSeal, subscription billing, audit logs
Direct conclusions on core engine and on-device solutions:
• Core Generation Engine: Abandon pure autoregressive (long-form structure collapse) and pure diffusion (weak control, high latency). Clearly recommend Hybrid Reasoning-Diffusion (LLM planning + Codec + DiT/Flow rendering). This is the current industry-converged solution that balances long-sequence structural consistency with high-fidelity audio quality.
• On-device Inference Solution: Abandon heavy quantized large models (uncontrollable memory and thermal issues). Clearly recommend an "on-device small model preview + cloud fallback" edge-cloud collaborative architecture. On-device only runs INT8 quantized lightweight AR or distilled DiT for 10s loops and beat marking; all heavy generation goes to the cloud, ensuring Android first-packet latency and smoothness.
Deployment advantages of this architecture: The Agent layer (Planner/Refiner) is natively compatible with LLM orchestration; the backend microservices facilitate horizontal scaling; edge-cloud separation balances experience and cost; and watermarking/licensing pipelines are embedded from day one, avoiding compliance blockers during app store submission.