Inspiration

With the increasing adoption of large language models (LLMs) across industries, prompt engineering has become a critical yet untapped aspect of obtaining precise, contextual, and optimized outputs. However, most users struggle with crafting the optimal prompts to extract the best possible results from industry-leading models, thereby missing out on the optimal use of the capacity of tokens they can use in a ̄timeframe. This creates inefficiencies, inaccurate outputs, and a steep learning curve. This gap in prompt engineering and tokenization inspired us to develop Prompt-, an intuitive tool that optimizes LLM prompts and the tokens they utilize, enhancing the accuracy, relevance, and efficiency of responses for users across expertise levels. It enables users to bridge various contexts in novel LLM interactions, minimizing the tokens and time taken to carry over past data.

What it does

prompt- is an AI-powered prompt optimization platform designed to help developers, researchers, and LLM users easily craft and refine prompts for large language models (LLMs). Using advanced NLP techniques, our tool:

Optimizes Prompts: Provides real-time improvements for user-provided prompts to generate more relevant LLM responses using the least possible amount of tokens per query. Performs Task-Specific Optimization: Offers templates and optimization modes tailored to specific tasks, such as creative writing, technical queries, code generation, and summarization. Delivers Contextual Enhancements: Uses previous interactions and context to refine prompts dynamically, ensuring that the LLM maintains a coherent and relevant thread of conversation while minimizing time taken. Calculates Efficiency Metrics: Tracks metrics like model processing time, token usage, and response quality to help users understand the performance impact of their prompts.

How we built it

Architecture Model: (in our gallery) The text is first processed using traditional NPL techniques which lemmatizes and summarizes it, removing stop words, unnecessary content and punctuation, and is then passed through our custom model that optimizes the prompt while reducing token count further.

Languages: Python ∙ HTML ∙ CSS ∙ React ∙ JavaScript

Frameworks and Tools: React.js ∙ OpenAI ∙ SpaCy ∙ Firebase ∙ Figma ∙ Flask

  1. Input and prompt detection

User inputs the prompt into the chat GPT input that they want help with Our program fetches the input and uses NLP to detect the type of text: for now we have bifurcation for text that is either plain or code Once this text detection is completed, the program routes the input to its corresponding optimization strategy

  1. Prompt optimization

We mainly have two strategies for each text type: NLP for plain text: our program uses a variety of NLP techniques to reduce the token count of plain text some of them include Removing stop words Lemmatization Prioritizing some punctuation over others Custom GPT agent for code: our program uses langchain and custom GPT agents designed to do the following: Replacing tedious function implementations with concise Lambda Functions achieving “if-else” via ternary operators renaming variables

  1. Firebase and contextualisation functionality

Many times the AI chat lags due to too much information which might even be irrelevant with prompt- the user easy access to the user to a context summary produced by prompt- which can be resused on a new chat with the same of different agents. For every prompt we store the original prompt, and the prompt- our firebase real time database. (Disclaimer: this database is wiped out of all prompt data every time a GPT chat session ends / the dev server shuts down) This data is then fetched and fed into the contextualisation model which outputs a summery of the chat to the user in UI friendly form which can be copied to the clipboard and the user can then use this to start a new chat with the same or different AI assistants

  1. Frontend integration using flask

We used flask for integrating the chrome extension logic (javascript) and python(backend)

  1. Frontend dev stack and visualisation

The chrome extension frontend was planned to give the users a seamless and the most intuitive experience with the following design features: The prompt- button being right next to the enter button The context prompt having a copy to clipboard option The prompt- having a preview prompt option and replacing the current prompt on a double click

Challenges we ran into

Analyzing context from old conversations: We encountered difficulties in maintaining continuity and extracting relevant context from previous conversations, especially when the input history was long or complex. To combat this, we implemented a contextual memory system that selectively retains key elements from past interactions, allowing the model to reference relevant information while ignoring less important data, improving conversation continuity. Assessing kinds of input: It was challenging to design a system that could handle diverse input types, from simple queries to technical or creative prompts, and optimize each effectively without losing the user's intent. We developed a dynamic input classification system that identifies the type and complexity of the user's prompt, allowing our optimization engine to tailor suggestions based on the input's specific requirements. Making the experience seamless: Ensuring real-time prompt suggestions and feedback without slowing down the user's interaction with the LLM required optimizing both front-end and back-end processes for speed and efficiency. We optimized the system by parallelizing back-end processes and using efficient strategies, which reduced latency and enabled real-time feedback and prompt suggestions without interrupting the user experience.

Accomplishments that we're proud of

Significant Improvement in Response Accuracy: Our optimizations decreased token usage by 47% for text-based inputs and 35% for code/symbol-based inputs, especially in task-specific contexts like code generation and technical writing. User-Friendly Interface: We designed an intuitive user interface that makes token optimization and context extensibility accessible to users with varying levels of AI knowledge, from novices to experienced developers. Seamless Integration: prompt- can integrate with any LLM API, allowing developers to use it with their preferred models such as GPT, Claude, or LLaMA.

What we learned

Coming up with prompt- led us to realizing that effective prompt engineering requires balancing multiple factors: brevity, clarity, and contextual depth. We also learned the importance of making AI tools more approachable to non-expert users by abstracting the technical complexities of prompt creation.

What's next for prompt-

Expanding Task-Specific Templates: We plan to add more specialized templates and optimizations for fields like finance, healthcare, and education. Fine-tuning for Popular LLMs with Diverse Inputs: prompt-’s future versions will aim at refining our tool to work with a wider range of models and input formats, allowing more flexibility for users. Community-Driven Learning: We aim to introduce a community platform with documentation of prompt-’s features with novel version drops, where users can also collaborate on prompt engineering techniques, allowing for crowd-sourced improvement and insights. Multilingual Input Accessibility: We are looking into integrating multilingual input in languages beyond English to optimize the LLM experience and improve scalability. Multi-browser Extensibility: Future versions of prompt- will reflect it as an extension on other industry-leading browsers such as Safari, Firefox, and Opera.

Built With

Share this project:

Updates