feat(hf): serve concurrent sessions with batched generation
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
- 35/100
Hướng nghiên cứu
Start with livekit/plugins/hf/llm.py and inspect _LoadedModel.generate_lock and the existing generation path. Compare the supported batching options in the installed transformers version with the proposed in-plugin scheduler. Done means concurrent sessions share generation work while LLMStream streaming, cancellation, and tool call behavior stay unchanged; the issue does not identify tests or a specific batching design.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Feature Type
Would make my life easier
Feature Description
livekit-plugins-hf (#7731) loads one copy of the model per process and shares it across sessions. Generation is serialized by a per-model lock, so sessions on the same worker take turns: each caller waits for every reply ahead of it to finish.
Measured on Qwen2.5-0.5B-Instruct, Apple M4 (MPS), temperature=0, 3 sessions sending the same request at the same time:
| time to first token | total | |
|---|---|---|
| one session alone | 99 ms | 481 ms |
| session 1 of 3 | 166 ms | 503 ms |
| session 2 of 3 | 603 ms | 1343 ms |
| session 3 of 3 | 1568 ms | 2448 ms |
Time to first token grows with every session queued ahead. In a voice agent, that is dead air on the line.
Proposal: batch concurrent requests into shared forward passes, so N sessions decode together instead of in sequence. Decoding is memory-bandwidth bound, so a small batch costs little more per step than a single sequence. Options:
transformerscontinuous batching (generate_batch/ the paged-attention cache) where the installed version supports it- a small in-plugin scheduler that pads and steps active requests together
The streaming, cancellation and tool call behaviour of LLMStream stays unchanged.
Workarounds / Alternatives
- One model per job process (the default process executor). This multiplies memory by the number of jobs, so a 1.5B to 7B model fits only a few sessions per GPU.
- Run vLLM or TGI as a separate server and use the
openaiplugin withbase_url. This works, but it adds a separate service, which the local plugin exists to avoid.
Additional Context
- Follow-up to #7731 (the plugin) and part of #5351 (local HF LLM, where KV cache compression is also proposed to raise sessions per GPU).
- The lock is in
livekit/plugins/hf/llm.py:_LoadedModel.generate_lock.
- Ngôn ngữ chính
- Python
- Star
- 14.6k
- Fork
- 3.9k
- Merge trung bình
- 3 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 171
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của livekit/agents
-
Assistant markup is stripped from chat history when expressive mode is offCó thể đã có người làm @ShivamSharma43 đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: openai.LLM vs openai.responses.LLM for HTTP OpenAI-compat hostsCó thể làm lại được @AbarnaaSree đã nhận 46 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
livekit/agents#7022 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
google: support Live Avatar video output for Gemini 3.8 Live (avatar_config, VIDEO modality)Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 22/100
livekit/agents#7843 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 40/100
Maintainer thường phản hồi trong vòng 1 ngày
-
StreamPacerWrapper.end_input() sets _input_ended before buffered sentences reach _sentences; last sentence(s) silently never sent to TTSCó thể đã có người làm @Hugo-DDT đã nhận 1 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của livekit/agents
Issue tương tự
-
fix formatting of the sample database page of the docsCó thể đã có người làm @Aaqibhafeezkhan đã nhận hôm nay. Đang mởdocumentation good first issue help wanted
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
chaoss/CollectOSS#544 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/plugin good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
kestra-io/plugin-soda#137 ·
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 62/100
ibm-granite/granite.build#504 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
`LazyFrameRemote` and `ExecuteRemote` sinks do not accept `Path`, like `LazyFrame` sinks do.Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày