Fix parallel validation, remove ngram-mod

- Rewrite validation script with temp files for true parallel curl requests
- Both prompts now complete 1024 tokens each (was cutting first short)
- Remove ngram-mod from spec pipeline (was -1.2 tok/s regression)
- True parallel throughput: 15.68 tok/s across 2 streams
This commit is contained in:
Frank committed 2026-08-07 16:44:12 -07:00
1 parent 2426ca563a
commit 471e963350
3 files changed
+19 -13

No files matched your search

+17 -11
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Validation test for llama.cpp DFlash+MTP server
# Sends a simple prompt and measures generation speed (tokens/sec)
# Validation test for llama.cpp DFlash server
# Sends 2 parallel prompts and measures generation speed (tokens/sec)
set -euo pipefail
PORT="${LLAMA_PORT:-8080}"
@@ -31,7 +31,11 @@ echo ""
echo "Sending 2 parallel validation prompts..."
START_TIME=$(date +%s%N)
RESPONSE1=$(curl -s \
TMP1=$(mktemp)
TMP2=$(mktemp)
trap "rm -f $TMP1 $TMP2" EXIT
curl -s \
-X POST "http://${HOST}:${PORT}/v1/chat/completions" \
-H "Content-Type: application/json" \
-d "{
@@ -41,9 +45,10 @@ RESPONSE1=$(curl -s \
\"max_tokens\": ${MAX_TOKENS},
\"temperature\": 0.7,
\"top_p\": 0.95
}" &)
}" > "$TMP1" &
PID1=$!
RESPONSE2=$(curl -s \
curl -s \
-X POST "http://${HOST}:${PORT}/v1/chat/completions" \
-H "Content-Type: application/json" \
-d "{
@@ -53,22 +58,23 @@ RESPONSE2=$(curl -s \
\"max_tokens\": ${MAX_TOKENS},
\"temperature\": 0.7,
\"top_p\": 0.95
}" &)
}" > "$TMP2" &
PID2=$!
wait
wait $PID1 $PID2
END_TIME=$(date +%s%N)
# Extract token counts and timing from responses
COMPLETION_TOKENS1=$(echo "$RESPONSE1" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['usage']['completion_tokens'])" 2>/dev/null || echo "0")
COMPLETION_TOKENS2=$(echo "$RESPONSE2" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['usage']['completion_tokens'])" 2>/dev/null || echo "0")
COMPLETION_TOKENS1=$(python3 -c "import json; d=json.load(open('$TMP1')); print(d['usage']['completion_tokens'])" 2>/dev/null || echo "0")
COMPLETION_TOKENS2=$(python3 -c "import json; d=json.load(open('$TMP2')); print(d['usage']['completion_tokens'])" 2>/dev/null || echo "0")
TOTAL_TOKENS=$((COMPLETION_TOKENS1 + COMPLETION_TOKENS2))
TOTAL_TIME_MS=$(( (END_TIME - START_TIME) / 1000000 ))
if [ "$TOTAL_TOKENS" -eq 0 ]; then
echo "FAIL: No tokens generated or response parse error"
echo "Response1: $RESPONSE1"
echo "Response2: $RESPONSE2"
echo "Response1: $(cat $TMP1)"
echo "Response2: $(cat $TMP2)"
exit 1
fi