Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/groq-performance-tuning

@0d57af8
Run it yourself

Optimize Groq API performance with model selection, caching, streaming, and parallel requests. Use when experiencing slow responses, implementing caching strategies, or optimizing request throughput for Groq integrations. Trigger with phrases like "groq performance", "optimize groq", "groq latency", "groq caching", "groq slow", "groq speed".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/groq-performance-tuning

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesexamples.md

≈679 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Groq Performance Tuning — Worked Examples

Each example maps a real scenario to the tuning levers from implementation.md. Assumes a shared new Groq() client plus the tieredCompletion, streamWithMetrics, cachedCompletion, and parallelCompletions helpers defined there.

Example 1: Latency-critical classification (cache + tiny max_tokens)

Sentiment classification on a hot path. Use the instant tier, a one-word prompt, max_tokens: 5, and the deterministic cache so repeat inputs return instantly.

const label = await cachedCompletion(
  [
    { role: "system", content: "Classify as positive/negative/neutral. One word only." },
    { role: "user", content: "This product exceeded every expectation." },
  ],
  "llama-3.1-8b-instant"
);
// => "positive"  (first call ~50ms TTFT; subsequent identical calls ~0ms from cache)

Example 2: Interactive chat (streaming for perceived speed)

A chat surface where the user watches tokens arrive. Stream with the balanced 70b model and surface live metrics.

const { content, ttftMs, tokPerSec } = await streamWithMetrics(
  [{ role: "user", content: "Explain LPU inference in two sentences." }],
  (token) => process.stdout.write(token)
);
console.log(`\n[TTFT ${ttftMs}ms | ${tokPerSec} tok/s]`);

Example 3: Bulk processing under rate limits (parallel + queue)

Classify 500 records without tripping the RPM/TPM ceiling. parallelCompletions wraps each call in a p-queue that caps concurrency and per-minute volume, and reuses the cache for duplicate rows.

const rows = await loadRecords();               // string[] of 500 items
const labels = await parallelCompletions(
  rows.map((r) => `Classify as positive/negative/neutral. One word only.\n${r}`),
  "llama-3.1-8b-instant"
);

Example 4: Picking a model empirically (benchmark then commit)

Before hardcoding a model, measure the three speed tiers against your real prompt shape and pick the fastest that meets your quality bar.

await benchmarkModels("Summarize this support ticket in one line: ...");
// llama-3.1-8b-instant     |  61ms avg | 548 tok/s avg
// llama-3.3-70b-versatile  | 148ms avg | 279 tok/s avg
// llama-3.3-70b-specdec    | 103ms avg | 401 tok/s avg

Reading the numbers

  • TTFT dominates perceived latency for short outputs — favor 8b-instant or 70b-specdec on interactive paths.
  • Throughput dominates total time for long generations — streaming hides TTFT but not total wall-clock.
  • Cache hit rate is the single biggest win for repeated deterministic prompts; normalize prompts so semantically-identical requests hash the same.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides legitimate performance optimization strategies for Groq API integrations, including model selection, caching, and parallelization. It follows security best practices by advising the use of environment variables for API keys and provides standard TypeScript implementation patterns.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 0d57af8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 months ago
What it can do
Reads files Edits files
version
1.11.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
[
  "saas",
  "groq",
  "api",
  "performance"
]
All 3 allowed tools
ReadWriteEdit
Other metadata
compatibility
Designed for Claude Code

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/groq-performance-tuning