Skip to content

perf(server): cap the batched-prefill transient memory (O(B*L^2) padded mask, unchunked forward) #715

Closed

Description

@inureyes

Problem / Background

Proposed direction

  • Cap the drained batched-prefill window by TOTAL tokens (not just row count), e.g. spill rows beyond a max_batch_prefill_tokens budget to the next tick, so B*L stays bounded.
  • Or chunk the batched prefill itself (respect prefill_chunk_size inside the padded cohort), which also removes the unchunked-forward memory cliff.
  • Consider a mask representation that avoids materializing [B, L, L] for the mixed-length case (per-row lengths / additive mask broadcast), if MLX supports it cheaply.

Acceptance criteria

References

Activity

  1. added
    status:backlogIn the backlog, not yet ready
    area:inferenceGeneration, sampling, decoding (incl. speculative, DRY)
    area:coremlxcel-core: MLX FFI, primitives, KV cache, layers
    and removed
    status:backlogIn the backlog, not yet ready
    on Jul 9, 2026
  2. self-assigned this
    on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:coremlxcel-core: MLX FFI, primitives, KV cache, layersarea:inferenceGeneration, sampling, decoding (incl. speculative, DRY)priority:mediumMedium prioritystatus:doneCompletedtype:performancePerformance improvements

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions