Skip to main content
Back to Prompt Library
implementation

Build the application

Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.

Linked challenge: Build a Local Open-Weight Continuous Batching Sizing Calculator

Format
Code-aware
Lines
65
Sections
11
Linked challenge
Build a Local Open-Weight Continuous Batching Sizing Calculator

Prompt source

Original prompt text with formatting preserved for inspection.

65 lines
11 sections
No variables
1 code block
## Build
Evaluate memory headroom and PagedAttention KV-cache capacity across open-weight models on local servers. Synthesize safe concurrency limits and deployment guidance using hosted Claude.

## User
Inference Operations Engineer

## Workflow
1. Ingest open-weight model parameter counts, context lengths, and physical GPU memory specifications.
2. Calculate baseline model weight footprints and PagedAttention KV-cache block allocations using standard formulas.
3. Query hosted Claude via the Anthropic Python SDK to explain memory exhaustion risks and suggest concurrency thresholds.
4. Generate a structured capacity sizing report detailing maximum concurrent requests before out-of-memory preemption.

## Interface
CLI tool that accepts model memory parameters and emits an interactive console sizing report with simulated allocations.

## Data
Local synthetic JSON configurations defining open-weight model architectures (e.g., 7B and 70B parameters) and mock GPU hardware memory limits.
Starter examples below are synthetic. They are not downloaded records.

## Source
[vLLM open-model serving](https://raw.githubusercontent.com/vllm-project/vllm/main/README.md)
Applies vLLM PagedAttention KV-cache memory management concepts to compute per-token memory allocation limits for open weights.

## Tools
dspy, anthropic.
DSPy structures prompt signatures to ensure hosted Claude returns strictly typed capacity sizing rationales without schema drift.
Hosted a currently available hosted Claude model accessed via API key; local execution handles open-weight parameter calculations only.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Computes exact static parameter footprint and remaining memory for KV-cache blocks.
- Invokes hosted Claude using Anthropic SDK to explain continuous batching trade-offs.
- Emits structured capacity recommendations without simulating execution of proprietary weights.

## Starter Examples
```json
[
  {
    "input": {
      "model_name": "OpenLLaMA-7B",
      "parameter_count_billions": 7,
      "precision_bytes": 2,
      "gpu_vram_gb": 24,
      "context_len": 4096
    },
    "expected_output": {
      "model_weights_gb": 14,
      "available_kv_cache_gb": 10,
      "max_concurrent_sequences": 8,
      "concurrency_guidance": "Recommended maximum batch size is 8 to prevent KV-cache paging evictions under peak context lengths."
    }
  },
  {
    "input": {
      "model_name": "OpenLLaMA-70B",
      "parameter_count_billions": 70,
      "precision_bytes": 2,
      "gpu_vram_gb": 24,
      "context_len": 2048
    },
    "expected_output": {
      "model_weights_gb": 140,
      "available_kv_cache_gb": 0,
      "max_concurrent_sequences": 0,
      "concurrency_guidance": "Model weights exceed single-device capacity. Tensor parallelism or weight quantization is strictly required before sizing."
    }
  }
]
```

## Safety
Ensures purely simulated memory sizing without issuing live OS or cluster process controls.
Use mock external writes. Require human review before any real deployment.

Adaptation plan

Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.

Keep stable

Hold the task contract and output shape stable so generated implementations remain comparable.

Tune next

Update libraries, interfaces, and environment assumptions to match the stack you actually run.

Verify after

Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.