Improving summarization of text

My task is to take content from a company’s home page and summarize its mission. I get very low-quality summarization responses using the Chat completion endpoint with model gpt-35-turbo. Do you have any suggestions on using better prompts?

Here is the code, and input/responses.

def generate_tagline(description):
    # Use OpenAI API to generate tagline
    response = client.chat.completions.create(
        model="gpt-3.5-turbo",
        messages=[
            {"role": "system", "content": "Your task is to summarize text that the user sends you that describes what an Artificial Intelligence technology company does. Words like 'training' refer to ML training. Do not start the response with any of these phrases: 'the company', 'the company is an AI technology company', 'the company is an AI tech company', 'Specializes in developing AI'. The response should be in the third person. This is the company's description:\n{description}.\n\n"},
            {"role": "user", "content": "Summarize the description to explain what the company does, in less than 30 words."}
        ],
        max_tokens=50,
        temperature=0.2
    )
    tagline = response.choices[0].message.content.strip()
    return tagline

These are the responses I get:

Company: Hugging Face

  • Input: “The platform where the machine learning community collaborates on models, datasets, and applications. AI filter for your portraits Create your own AI comic with a single prompt Track, rank and evaluate open LLMs and chatbots Create, discover and collaborate on ML better. Host and collaborate on unlimited models, datasets and applications. State-of-the-art diffusion models for image and audio generation in PyTorch. Parameter efficient finetuning methods for large models. Community library to run pretrained models from Transformers in your browser. State-of-the-art computer vision models, layers, optimizers, training/evaluation, and utilities. Train transformer language models with reinforcement learning. Easily train and use PyTorch models with multi-GPU, TPU, mixed-precision.”
  • Response: “The company offers AI solutions, including training models, developing algorithms, and providing data analysis services for various industries.”

Company: Iodine Software

  • Input: “Unlike other CDI solutions, AwareCDI — powered by CognitiveML — spots what is missing in patient documentation based on clinical evidence. With AwareCDI, healthcare organizations maximize documentation integrity and revenue capture like never before. Healthcare organizations have vast stores of data at their fingertips, but traditionally, technology’s ability to gather healthcare data has far surpassed its ability to make sense of it. Garnering clinical insights out of healthcare data is the final frontier. Iodine’s breakthrough AI engine processes raw clinical data at scale and surfaces actionable insights and predictions that enable the automation of clinical administrative tasks and complex workflows. With CognitiveML, Iodine is developing solutions that will enable healthcare organizations to improve care delivery, achieve financial stability, and more. Speak with an Iodine expert about solving your healthcare system’s biggest challenges with the industry’s most advanced AI engine.”
  • Response: “The company offers AI solutions for businesses, including training models, developing custom algorithms, and providing data analytics services.”

Company: Patented

  • Input: “We’ve built the world’s first patent and intellectual property service powered by AI to assist in high-stakes patent litigation and research. Featuring never-before-available capabilities: We’ve built the engine to fully understand every claim, claim element, and claim term published (in the US), including all utility, design, medical, and more. Purpose-built for maximum intellectual property leverage.”
  • Response: “Develops AI solutions for businesses, focusing on training models, natural language processing, computer vision, and deploying custom AI applications.”

As you can see, each response is almost identical, despite the 3 companies being in vastly different domains. Thank you, appreciate any help!

Welcome to the community!

that doesn’t look like an fstring to me, you’re literally sending

This is the company’s description:\n{description}.\n\n

to the model. :thinking:

1 Like

Thank you @Diet! That was the problem, that I was sending a literal string that was not evaluated. I added “f” to turn that into a runtime-interpreted f-string, and the results are beautiful.

1 Like