Pr

PromptOptimizer – Minimize LLM token complexity to save cost

Hacker News

PromptOptimizer – Minimize LLM token complexity to save cost

For enterprises, OpenAI (and similar other) API Bills can be pretty high, any optimization per prompt could result in saving hundreds or even thousands of dollars over multiple calls. It is possible to reduce these costs by optimizing the number of tokens in the prompt. We call this "minimizing the token complexity". Informally speaking, token complexity is the estimated number of tokens required in input prompt to achieve a task. I understand more theory is required to formally describe token complexity and we are working on a paper for same. PromptOptimizer provides a set of optimizers ( https://promptoptimizer.readthedocs.io/en/latest/reference.h... ) and metrics to evaluate optimizations. As a framework, it is very easy to extend it by creating custom optimizers ( https://promptoptimizer.readthedocs.io/en/latest/extend/cust... ). There's a lot that can be done but for now we provide a set of preliminary optimizers and their performance evaluation here: https://github.com/vaibkumr/prompt-optimizer#evaluations There's a lot that can't be done because we don't assume access to model weights, logits or decoding process. We are trying to do the best with just optimizing the number of tokens in input prompts. My personal favorite is EntropyOptim: https://promptoptimizer.readthedocs.io/en/latest/reference.h... It uses a Masked Language Model to remove low entropy words (they can easily be inferred by good LLMs). Certainly, sometimes we would not want to lose important tokens for which we provide ignore tags in our framework. No free lunch: The reduction in cost often comes with a loss in LLM performance as can be observed here: https://github.com/vaibkumr/prompt-optimizer#cost-performanc... The eventual goal of this project is: 1. A one-stop solution for saving LLM API costs. Most of the existing works in this direction focus on vector stores and semantic cache. This project is perfectly compatible with those techniques and might include own implementations in future. 2. Extending "token complexity" theory formally. 3. Open leaderboard style evaluations in terms of minimizing prompt and continuation tokens for solving a task. 4. Be open to contributions and discussions for more diverse future directions. The project is inspired by Kevin from The Office TV Show. "Me think, why waste time say lot word, when few word do trick." what you think?

Share card

Actual performance

4points
2comments
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Strong signals: compatible · Missing: supports, reddit linkedin, podcasting
95%95% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Product HuntOn track for Day 1 leaderboard · Strong signals: model, openai, coding · Missing: mac, agents, macos
66%66% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: exist, lua, existing · Missing: https docs, excited, just released
61%61% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
TrustMRRFits verified-revenue profile · Strong signals: personal · Missing: mobile apps, ios, entrepreneurs
55%55% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Strong signals: calls · Missing: plus, platform, intuitive
39%39% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
11%11% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Incorrect prediction on native model

Similar products

EchoCache
EchoCache47%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Save Your LLM Cost By 80% !!

Indie Hackerscommitment-side-project
LLM Image Optimizer
LLM Image Optimizer68%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Save 80% on AI Token Cost when using images for context.

Indie Hackers1ai
Wo
Wordllama – Things you can do with the token embeddings of an LLM63%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Wordllama – Things you can do with the token embeddings of an LLM

Hacker News370
Save My Salary
Save My Salary38%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Track salary and expenses without complexity

Indie Hackerscommitment-side-project
LLM Token Counter
LLM Token Counter33%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Browser-only cost estimator for 18 LLM models — no login, no

Indie Hackerscommitment-side-project
Th
The SC4-HSM is now a FIDO U2F token46%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

The SC4-HSM is now a FIDO U2F token

Hacker News3
Jw
Jwt.show – show the payload of a jwt token46%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Jwt.show – show the payload of a jwt token

Hacker News1
Cr
CryptoTokens.wtf – Token Whitepapers from Highest Grossing ICOs42%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

CryptoTokens.wtf – Token Whitepapers from Highest Grossing ICOs

Hacker News1
To
Token Thermodynamics52%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Token Thermodynamics

Hacker News4
TokenDam
TokenDam57%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A linter for LLM token spend — that gates cost in CI

Product Hunt+2