Skip to content

Add opt-in request batching to the inference runtime - #6

Merged
ZhiningLiu1998 merged 2 commits into
SimpleJev:mainfrom
YennNing:feat/serve-request-batching
Oct 15, 2026
Merged

ZhiningLiu1998 merged 2 commits into
SimpleJev:mainfrom
YennNing:feat/serve-request-batching

Conversation

@YennNing

@YennNing YennNing commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Concurrent text requests can share a forward pass when max_batch_size is greater than 1. Requests are grouped within the batch-size and padded-token limits; an idle runtime adds no collection delay. Prefix-cache requests and multimodal checkpoints retain serial scoring.

The revision preserves current ContextLengthError responses and tokenizer/cache locking, and retries failed batches per request. Tests cover mixed Python/HTTP callers, packed and row backbones, batch and token limits, failure isolation, cache recovery, and multimodal fallback.

Validation: 85 offline checks passed; 7 CUDA cases skipped on the local CPU host. Both full CPU CI jobs and the website checks pass on the revised head. Original contributor commits are retained.

max_batch_size (--max-batch-size, JEVANY_MAX_BATCH_SIZE) lets concurrent
text requests share one forward pass. Batching is group commit: whichever
caller holds the model lock scores every queued request, so an idle server
still scores each request alone and adds no waiting time. A batch never
allocates more padded tokens than max_packed_tokens. Media and prefix-cache
requests run alone; a failed batch is retried per request so an error stays
with the request that caused it.

The default of 1 keeps the existing single-request path. On one H200 with
32 concurrent requests to a Qwen3.5-0.8B checkpoint, batching raised
throughput 2.3x in FP32 (max probability change 1.5e-5, no decision changed)
and 4.6x in BF16, where batch-shape rounding changed decisions on 2 of 32
requests; the docs recommend the default for reproducing metrics.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Human Review

  • API request failed (HTTP 404)

Human Review: see the findings and review evidence.

AI semantic review has not completed.

  • CI ci.yml: passed (run) — All expected jobs passed
  • CI pages.yml: passed (run) — All expected jobs passed

Reviewed head 2993289722238915819ebd5712126fc05ced52c0; base 64fd1f30b1cac984c3ccc3ca271c7f524c6914b9.
CPU CI does not verify production-model quality, CUDA or multi-GPU performance.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@ZhiningLiu1998

Copy link
Copy Markdown
Collaborator

This still conflicts in jevany/runtime.py, so I am leaving it open. Please integrate batching with the current request validation/error handling and rerun concurrent Python/HTTP, token-budget and per-request failure-isolation tests.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

Preserve context-length errors and tokenizer/cache locking while combining
queued text requests. Cover mixed Python/HTTP callers, batch and token
budgets, per-request failure recovery and multimodal fallback.

Co-authored-by: Xuying Ning <xuying@meta.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Human-Review. See the maintained PR review summary for evidence.

@ZhiningLiu1998 ZhiningLiu1998 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integrated batching with current context-length errors and cache/tokenizer locking. The 85 focused offline checks pass, including concurrent Python/HTTP parity and failure isolation; both full CPU CI jobs and site checks pass.

@ZhiningLiu1998
ZhiningLiu1998 merged commit fe9e087 into SimpleJev:main Oct 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants