ladderlore
  • S3 သို့မဟုတ် IAM လို service အမည်ကို ရိုက်ထည့်ပါ။

သဘောတရား

Reducing FM usage cost

Spend fewer tokens, send each token to the cheapest place that works, and avoid repeat calls.

ဒီသင်ခန်းစာကို မြန်မာဘာသာ မပြန်ရသေးလို့ အင်္ဂလိပ်လို ပြထားပါတယ်။

  • Long shared prefix on every call

    Prompt caching
  • Mixed easy and hard prompts

    Intelligent prompt routing
  • Large job, no one waiting

    Batch inference
  • Repeat or similar questions

    Answer cache in ElastiCache
  • Narrow task, huge model

    Distilled or smaller model
  • RAG prompts are huge

    Fewer, reranked chunks
Match the lever to the situation.

1 / 2

  • Long shared prefix on every call

    Prompt caching
  • Mixed easy and hard prompts

    Intelligent prompt routing
  • Large job, no one waiting

    Batch inference
  • Repeat or similar questions

    Answer cache in ElastiCache

2 / 2

  • Narrow task, huge model

    Distilled or smaller model
  • RAG prompts are huge

    Fewer, reranked chunks
Match the lever to the situation.
Question
Cache lookup
Cached answer
Model call
hitmissstore
A cache hit skips the model call.

ဘာလဲ

Prompt caching stores a long, repeated prefix, such as instructions or a document, so later requests read it from the cache instead of reprocessing it. Cached reads cost less and are faster, and they do not count toward your tokens-per-minute quota. You mark cache checkpoints in the request, put stable content first, and the cache lasts about 5 minutes by default (some models also offer 1 hour). Writes to the cache can cost more than normal input. Caching works on on-demand calls, not on batch inference.

ဘာလဲ

Intelligent prompt routing sends each prompt to one of two models in the same family, a stronger one or a cheaper one, based on the predicted quality of the answer. You use a default router or set your own routing criteria and fallback model. It is optimized for English prompts. Batch inference runs many prompts as an asynchronous job from S3 to S3, and for select models it costs 50 percent less than on-demand. Use it when no user is waiting.

ဘာလဲ

Trim the call itself. Write shorter prompts, set a maximum tokens limit so answers cannot run on, and send fewer and better RAG chunks: retrieve fewer results, rerank them and keep only what the answer needs. Cache whole answers in Amazon ElastiCache, keyed by the question text for exact repeats, or by an embedding match for similar questions (semantic caching). Set an expiry so cached answers do not go stale. Finally, use a smaller model: distill a large model into a small one for a narrow task, or choose a smaller tier.

မှတ်ထားရန်

  • Prompt caching: stable prefix first, cached reads cost less and skip the TPM quota. Not for batch.
  • Prompt routing: two models in one family, picked per prompt.
  • Batch inference: asynchronous, about 50 percent lower for select models.
  • Shorter prompts and a max tokens limit cut input and output.

မှတ်ထားရန်

  • Cache answers in ElastiCache: exact match, or semantic match by embedding.
  • Fewer, reranked RAG chunks. Smaller or distilled models.

စာမေးပွဲမှာ

  • “Same long document asked about again and again” points to prompt caching.
  • “Nobody waits for the results, cut cost” points to batch inference.
  • “Many users ask the same questions in different words” points to a semantic cache in ElastiCache.
  • “Easy prompts do not need the biggest model” points to intelligent prompt routing.