Skip to content

armgit / sie

Public Imported from GitHub
0

Open-source inference server and production cluster for all the models your agent needs.

docs(examples): price the redact LLM arms at their Batch API rates (#463)

svonava201b1418e970
diff --git a/examples/redact/README.md b/examples/redact/README.md
index 95cd34b50..ae6cb7f14 100644
--- a/examples/redact/README.md
+++ b/examples/redact/README.md
@@ -45,8 +45,8 @@ spans it masks completely. The metric was fixed before the first request on
| Arm | Masked (of 1,792) | Coverage recall | 95% interval | States and countries excused | $ a month, 1M documents |
| --- | --- | --- | --- | --- | --- |
| SIE, two models composed | 1,591 | 88.8% | 86.7% to 90.9% | 90.5% | $32 |
-| Claude Haiku 4.5 | 1,490 | 83.1% | 80.8% to 85.2% | 92.6% | $1,450 |
-| GPT-6 Luna | 1,448 | 80.8% | 78.2% to 83.1% | 93.2% | $113 |
+| Claude Haiku 4.5 | 1,490 | 83.1% | 80.8% to 85.2% | 92.6% | $725 |
+| GPT-6 Luna | 1,448 | 80.8% | 78.2% to 83.1% | 93.2% | $57 |
| OpenAI Privacy Filter | 1,214 | 67.7% | 64.3% to 71.0% | 69.8% | $23 (self-hosted, L4) |
| Microsoft Presidio | 859 | 47.9% | 45.0% to 50.8% | 49.6% | $3 (self-hosted, CPU) |
| AWS Comprehend | not measured | | | | $351 |
@@ -107,9 +107,10 @@ For 1,000,000 documents a month like these, list prices read on 30 September
- **AWS Comprehend `DetectPiiEntities`:** $0.000025 per 100-character unit,
its cheapest tier, 3-unit minimum per request, units counted as characters
over 100 with no rounding up.
-- **LLMs:** the tokens each provider reported for the run, at $0.10 and $0.50
- (GPT-6 Luna) and $1 and $5 (Claude Haiku 4.5) per million input and output
- tokens.
+- **LLMs:** the tokens each provider reported for the run, at each vendor's
+ Batch API price, their cheapest: $0.05 and $0.25 (GPT-6 Luna) and $0.50 and
+ $2.50 (Claude Haiku 4.5) per million input and output tokens. At standard
+ prices they cost twice that: $113 and $1,450.
- **Presidio and Privacy Filter** are free to download, so their price is the
compute: Modal list price per second (L4 $0.000222, a core $0.0000131, a GiB
$0.00000222), divided by 75% utilisation and times 1.75 for region, at the
diff --git a/examples/redact/score.py b/examples/redact/score.py
index fffdaf295..35cc103ea 100755
--- a/examples/redact/score.py
+++ b/examples/redact/score.py
@@ -128,8 +128,11 @@ SIE_TOKENS = {FIRST_MODEL: 238_605, SECOND_MODEL: 227_727}
COMPREHEND_PER_UNIT = 0.000025
COMPREHEND_MIN_UNITS = 3
COMPREHEND_CHARS_PER_UNIT = 100
-# LLMs: $ per 1M input and output tokens, times the tokens each provider reported for the run.
-LLM_PRICES = {"llm:gpt-6-luna": (0.10, 0.50), "llm:claude-haiku-4-5": (1.00, 5.00)}
+# LLMs: $ per 1M input and output tokens, times the tokens each provider reported for the run, at each
+# vendor's Batch API price, half of list and its cheapest (list: GPT-6 Luna $0.10/$0.50, Claude Haiku 4.5 $1/$5).
+LLM_PRICES = {"llm:gpt-6-luna": (0.05, 0.25), "llm:claude-haiku-4-5": (0.50, 2.50)}
+# The standard prices the recorded results were costed at, checked against them below.
+LLM_LIST_PRICES = {"llm:gpt-6-luna": (0.10, 0.50), "llm:claude-haiku-4-5": (1.00, 5.00)}
# Self-hosted arms: Modal list price per second of the container, at the throughput measured in
# results/e2_results.json, divided by 75% utilisation and times 1.75 for region.
L4_PER_S = 0.000222
@@ -146,8 +149,8 @@ PUBLISHED_MONTHLY_USD = {
COMPOSITION: 32,
"presidio": 3,
"privacy-filter": 23,
- "llm:gpt-6-luna": 113,
- "llm:claude-haiku-4-5": 1450,
+ "llm:gpt-6-luna": 57,
+ "llm:claude-haiku-4-5": 725,
COMPREHEND: 351,
}
@@ -379,14 +382,17 @@ def bootstrap(per_arm: dict[str, list[dict[str, int]]]) -> dict[str, dict[str, l
def monthly_usd(
- documents: list[dict[str, Any]], rows: dict[str, dict[int, dict[str, Any]]], e2: dict[str, Any]
+ documents: list[dict[str, Any]],
+ rows: dict[str, dict[int, dict[str, Any]]],
+ e2: dict[str, Any],
+ llm_prices: dict[str, tuple[float, float]] = LLM_PRICES,
) -> dict[str, float]:
"""$ a month for MONTHLY_DOCUMENTS documents like the study's, per arm."""
n = len(documents)
per_document = {COMPOSITION: sum(SIE_TOKENS[m] * SIE_PRICE_PER_1M_TOKENS[m] / 1e6 for m in SIE_TOKENS) / n}
units = sum(max(COMPREHEND_MIN_UNITS, len(d["text"]) / COMPREHEND_CHARS_PER_UNIT) for d in documents)
per_document[COMPREHEND] = units * COMPREHEND_PER_UNIT / n
- for arm, (price_in, price_out) in LLM_PRICES.items():
+ for arm, (price_in, price_out) in llm_prices.items():
tokens_in = sum((r["output"] or {}).get("tokens_in", 0) for r in rows[arm].values())
tokens_out = sum((r["output"] or {}).get("tokens_out", 0) for r in rows[arm].values())
per_document[arm] = (tokens_in * price_in + tokens_out * price_out) / 1e6 / n
@@ -574,8 +580,11 @@ def main() -> int:
"presidio": e2["self_host"]["presidio"]["usd_per_1m_documents"],
"privacy-filter": e2["self_host"]["privacy-filter"]["usd_per_1m_documents"],
}
+ # The recording costs the LLMs at standard prices; the page and the table above use batch.
+ at_list = monthly_usd(documents, rows, e2, LLM_LIST_PRICES)
for arm, value in recorded_usd.items():
- check.equal(f"{arm} $ per 1M documents (recorded)", round(usd[arm], 6), round(value, 6))
+ got = at_list[arm] if arm in LLM_LIST_PRICES else usd[arm]
+ check.equal(f"{arm} $ per 1M documents (recorded)", round(got, 6), round(value, 6))
print()
if not replay: