Production-Ready Music LLM Architecture: Edge-Cloud Hybrid, Agent Orchestration & Deliverable System Design

2026-11-30来源 dev.toEnglish
  1. 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: 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

  1. Model Architecture Selection (Clear Recommendation)

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).

Core Sub-modules

  1. Neural Audio Codec: DAC or hierarchical RVQ (8 layers, first layer semantic 16k codebook, remaining 7 acoustic layers 1k each), 44.1k/32k stereo, ~25~86 tokens/s.
  2. Global LLM (8B class): Takes lyrics + blueprint, predicts RVQ layer 1, manages long-range structure (Intro/Verse/Chorus/Bridge).
  3. Local LLM (0.6B class): Completes remaining RVQ layers, restoring pronunciation/instrument texture.
  4. Flow Matching + Flow-VAE Decoder: Latent fusion → continuous latent → waveform; cleaner vocals than pure token decoding.
  5. Vocal Branch: Text-based vocal description (reference audio cloning not enabled initially) or self-developed singing tokens, concatenated with accompaniment latents before mixing.

On-device Degradation

• 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."

  1. Service Architecture & Concurrency Design (Backend Deliverables)

Tech Stack: FastAPI (BFF) + Celery/Arq + Redis (queue/result backend) + K8s + Prometheus/Grafana.

Task State Machine

DRAFT → PLAN(LLM) → QUEUE → INFER(GPU Worker) → POST(loudness/watermark)
→ STORAGE → NOTIFY → DONE / FAILED / CANCELED

GPU Pooling

• 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

Key APIs

• 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

Latency Targets

• 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)

  1. Android App Architecture (App Deliverables)

• 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)

  1. Data & Training Pipeline

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.

  1. Compliance, Watermarking & Commercial Boundaries (Must be in PRD)

• 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)

  1. Milestones (Schedulable)

Phase Duration Deliverables

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

  1. Technology Selection Comparison & Clear Recommendation

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.

原文:https://www.a8q9.cn/en/article/production-ready-music-llm-architecture-edge-cloud-hybrid-agent-orchestration-de-ca93dd.html

相关文章