passdrill
AI & LLM Engineering · Prompt Engineering · Card 041/049 easy

A developer needs an LLM to classify 600 short product reviews as positive or negative, paying per input-and-output token through a hosted API. Sending each review as its own separate call means the same lengthy classification instructions and few-shot examples are repeated in every single request. Cheng et al. (2023), "Batch Prompting: Efficient Inference with Large Language Model APIs," propose an alternative. What does batch prompting do to cut this cost?

  1. It fine-tunes a smaller specialized model on the same classification examples so the large model is no longer needed once training completes
  2. It groups several independent input samples together into a single prompt, sharing one copy of the instructions and in-context examples across the whole group, and has the model return the answers for all of the grouped samples in one response instead of issuing a separate call per sample
  3. It reduces cost by having the model skip the few-shot examples entirely and rely purely on zero-shot instructions for every request
  4. It caches every previous request-response pair, so a later request only costs tokens if its text is not an exact character-for-character match to an earlier one
Next card → Shuffle