Reducing GPT-4 API Cost by using Prompt Decompression (2024)

Reducing GPT-4 API Cost by using Prompt Decompression (1)

  • Report this article

Martin Khristi Reducing GPT-4 API Cost by using Prompt Decompression (2)

Martin Khristi

"AI- og maskinlæringsfortaler | BI- og datavisualiseringsspecialist hos CA Karrierepartner og a-kasse | Microsoft Fabric-entusiast | Ingeniør & kurator af AI-indsigter | Python-programmering til AI og data science.

Published Mar 10, 2024

+ Follow

To reduce the size of a prompt, you can use compression techniques. One way to do this is by using GPT’s ability to compress and decompress tokens.

A recent tweet from @VictorTaelin suggests that GPT can be prompted to generate more tokens by compressing the original prompt. @VictorTaelin initially discovered GPT’s ability to compress and decompress tokens, as seen on his GitHub page.

Reducing GPT-4 API Cost by using Prompt Decompression (3)

Compression and Decompression Prompt

Here are the steps to create a compressed prompt:
Paste the text after the colon in the following prompt: “compress the following text in a way that fits in a tweet (ideally) and such that you (GPT-4) can reconstruct the intention of the human who wrote text as close as possible to the original intention. This is for yourself. It does not need to be human readable or understandable. Abuse of language mixing, abbreviations, symbols (unicode and emoji), or any other encodings or internal representations is all permissible, as long as it, if pasted in a new inference cycle, will yield near-identical results as the original text:”
Use trial and error to create a compressed version of the text. This may involve using abbreviations, symbols, or other encoding techniques to reduce the number of tokens.
If you are in a different session, or someone else wants to use the compression, provide the following text, with the compression after the colon: “this is compressed text, in your own language. you should be able to decompress it because it’s in your language. here’s what to decompress:”

The Results

I tried to summarize a newsletter prompt and reduce the token size, Here are the calculations:

Original Newsletter Prompt:

Original Token Size: 207

Recommended by LinkedIn

GPT-4o is a cool vision model ? Let's Take a Closer… Denis Smyslov 3 months ago
Why Infinite Context Is Still Not Enough? Giri Tatavarty 3 months ago
DBRX: A New State-of-the-Art Open LLM Sharad Gupta 5 months ago

Reduced Token Size: 75

75 Reduction: 37.5%

Reducing GPT-4 API Cost by using Prompt Decompression (7)

Conclusion

By using compression techniques, you can reduce the size of a prompt while still maintaining its meaning and intention. This can be particularly useful when working with large amounts of text or when memory constraints are an issue.

More Advanced Techniques:

Please take a look at Sparse Priming Representation (SPR)

In case of any queries, feel free to reach out to me

[email protected]

Like
Comment

1

To view or add a comment, sign in

More articles by this author

No more previous content

  • all about openai new model "OpenAI o1-preview," aka "Strawberry." Sep 13, 2024
  • what's new today in AI Insights Sep 12, 2024
  • Here's what's new today in the AI Insights Sep 10, 2024
  • 📚 Create Your Own Audiobook with Python: Let's Deep Dive into the Era of AI! 🚀 Sep 8, 2024
  • what's new today in AI Insights Sep 5, 2024
  • A Guide to P-Value in Data Science Aug 31, 2024
  • Here's what's new today in the AI Insights Aug 29, 2024
  • Here's what's new today in the AI Insights Aug 24, 2024
  • Major Power BI August 2024 Feature Summary Aug 23, 2024

No more next content

See all

Sign in

Stay updated on your professional world

Sign in

By clicking Continue to join or sign in, you agree to LinkedIn’s User Agreement, Privacy Policy, and Cookie Policy.

New to LinkedIn? Join now

Insights from the community

  • Machine Learning What do you do if logical reasoning in Machine Learning is evolving rapidly?
  • Computer Vision What are the current trends and future directions for VQA systems?
  • Contract Management What are the best practices for improving contract searchability with text analysis?
  • Artificial Neural Networks What are the benefits and challenges of fine-tuning BERT for text classification?
  • Generative AI How do you evaluate the quality and accuracy of the texts generated by transformers and GPT-3 models?
  • Search Engines How do you optimize the speed and scalability of self-attention models for search engines?
  • Artificial Intelligence How can self-attention improve question answering in AI?
  • Artificial Neural Networks What are the advantages and challenges of using GANs for text generation?
  • Statistics How can you handle class imbalance in text classification model selection and validation?
  • Data Mining How can you integrate expert systems with other technologies?

Others also viewed

  • DBRX: A New State-of-the-Art Open LLM Sharad Gupta 5mo
  • Transformer Architectures for Dummies - Part 2 (Decoder Only Architectures) Multicloud4U® Technologies 8mo
  • My Journey of Building the First Custom GPT for GPT Store Raj Kumar 4mo
  • How to Reduce Latency in Response Time When Making Requests to (OpenAI) Large Language Models? Mangalprada Malay 5mo
  • Research paper -Tiny Titans: Can Smaller Large Language Models Punch Above Their Weight in the Real World for Meeting Summarization? Srinivas Pradeep s 6mo
  • The Ultimate Hack for Perfecting Open-Source Language Models Dror Hilman 2mo
  • Explicit Reasoning: Why LLMs Must Write Down Their Thought Processes to Tackle Complex Challenges Pascal Soucy 4mo
  • Transformer Architectures for Dummies - Part 2 (Decoder Only Architectures) Bhaskar T, PhD 8mo
  • 🥇Top ML Papers of the Week DAIR.AI 3mo

Explore topics

  • Sales
  • Marketing
  • IT Services
  • Business Administration
  • HR Management
  • Engineering
  • Soft Skills
  • See All
Reducing GPT-4 API Cost by using Prompt Decompression (2024)
Top Articles
18 Financial Goals to Set and Achieve This Year
Best Strategies to Generate Retirement Income
417-990-0201
The UPS Store | Ship & Print Here > 400 West Broadway
Wisconsin Women's Volleyball Team Leaked Pictures
Insidious 5 Showtimes Near Cinemark Tinseltown 290 And Xd
Top Financial Advisors in the U.S.
Miles City Montana Craigslist
Trade Chart Dave Richard
Osrs But Damage
Evita Role Wsj Crossword Clue
Texas (TX) Powerball - Winning Numbers & Results
Hardly Antonyms
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Orlando Arrest and Public Records | Florida.StateRecords.org
South Bend Tribune Online
Oppenheimer Showtimes Near Cinemark Denton
Sports Clips Plant City
TS-Optics ToupTek Color Astro Camera 2600CP Sony IMX571 Sensor D=28.3 mm-TS2600CP
سریال رویای شیرین جوانی قسمت 338
A rough Sunday for some of the NFL's best teams in 2023 led to the three biggest upsets: Analysis - NFL
Magic Mike's Last Dance Showtimes Near Marcus Cedar Creek Cinema
Best Suv In 2010
House Of Budz Michigan
Extra Virgin Coconut Oil Walmart
Mychart Anmed Health Login
Little Caesars 92Nd And Pecos
Kirksey's Mortuary - Birmingham - Alabama - Funeral Homes | Tribute Archive
Rufus Benton "Bent" Moulds Jr. Obituary 2024 - Webb & Stephens Funeral Homes
Koninklijk Theater Tuschinski
Stephanie Bowe Downey Ca
United E Gift Card
Transformers Movie Wiki
Plato's Closet Mansfield Ohio
#scandalous stars | astrognossienne
Ark Unlock All Skins Command
Metro 72 Hour Extension 2022
Agematch Com Member Login
Etowah County Sheriff Dept
Today's Gas Price At Buc-Ee's
The disadvantages of patient portals
Restored Republic June 6 2023
Energy Management and Control System Expert (f/m/d) for Battery Storage Systems | StudySmarter - Talents
Sarahbustani Boobs
Walmart 24 Hrs Pharmacy
Dontrell Nelson - 2016 - Football - University of Memphis Athletics
Dyi Urban Dictionary
American Bully Puppies for Sale | Lancaster Puppies
Dragon Ball Super Card Game Announces Next Set: Realm Of The Gods
Subdomain Finer
Turning Obsidian into My Perfect Writing App – The Sweet Setup
Stone Eater Bike Park
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 6298

Rating: 4 / 5 (61 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.