Per-request LoRA adapters on the NPU (Qwen3.5), or a supported merged-model path?

Đang mở
#976 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp

Hướng nghiên cứu

The issue points to NPU kernels, flm serve, the converter, and model_list.json, but does not identify implementation files or tests. Start by reading the converter and model loading and request paths to determine whether adapter support or faster switching has an existing entry point. Done means maintainers clarify the supported LoRA and merged-model paths and whether multiple models can stay resident; the issue leaves these design choices open.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hi, and thanks for FastFlowLM. This follows up #219 (fine-tuned models, "on the roadmap") and #828 (the converter).

We'd like to run small LoRA adapters over qwen3.5:2b on XDNA 2: rank 32–64, F16, on the attention projections. We'd switch them per request, the way llama-server does it (--lora <file> at start, then a lora field in each request), so that one loaded model serves the base and several adapters.

What we tried, on a Ryzen AI 7 350 with FLM 1.0.10 and 1.0.12:

  • We found no adapter input: no request field, no CLI option, no model-folder file.

  • Merging the adapter into the weights works. We folded it into the BF16 GGUF, quantized to Q4_K, converted the result with ROCm/FLM_Q4NX_Converter (93b8398), and registered it as its own model in model_list.json. It loads on the NPU and runs at the base model's speed.

  • But each adapter is then a separate 1.34 GB model. Switching models in one flm serve takes 8–16 s (a full load), against about 1 s for the same model again.

  • The converter's output from the same BF16 doesn't match the shipped Qwen3.5-2B-NPU2 model.q4nx:

    • only about 57–66% of a projection's bytes are equal;
    • the shipped file has .bf16 copies of the linear-attention alpha/beta that the converter doesn't write;
    • its lm_head is int8.

    So we spliced only the adapted tensors into a copy of the shipped file. Even then, requantizing them adds rounding noise about twice the size of a small adapter's own change.

Questions:

  1. Are LoRA adapters planned for the NPU kernels, per request or at least per load? If so, roughly in what shape: file format, ranks, which projections (Qwen3.5's linear-attention qkv and out included?), F16 or quantized?
  2. If not soon, do you consider the merged-model route (the converter plus a model_list.json entry) supported across releases? Could the converter reproduce the shipped models' layout (the .bf16 copies, the int8 lm_head)? Or could the recipe for the shipped Qwen3.5 models be published? Either way, a merged model would then differ from the shipped one only by the adapter.
  3. Is there a faster way to switch between two models of the same architecture than a full load? For example, keeping both resident when the NPU's memory allows.

We're happy to test a pre-release. Thanks!

Ngôn ngữ chính
C++
Star
2.1k
Fork
184
Merge trung bình
12 giờ 22 phút
Pull request đã merge (30 ngày)
239

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ROCm/FastFlowLM

Tất cả issue của ROCm/FastFlowLM

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.