Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Applied NLP in the Age of Generative AI

Applied NLP in the Age of Generative AI

Large Language Models (LLMs) and in-context learning have introduced a new paradigm for developing natural language understanding systems: prompts are all you need! Prototyping has never been easier, but not all prototypes give a smooth path to production. In this talk, I'll share the most important lessons we've learned from solving real-world information extraction problems in industry, and show you a new approach and mindset for designing robust and modular NLP pipelines in the age of Generative AI.

Breaking down larger business problems into actionable machine learning tasks is one of the central challenges of applied natural language processing. I will walk you through example applications and practical solutions, and show you how to use LLMs to their fullest potential, how and where to integrate your custom business logic and how to maximize efficiency, transparency and data privacy.

Ines Montani

August 09, 2024
Tweet

Resources

A practical guide to human-in-the-loop distillation

https://explosion.ai/blog/human-in-the-loop-distillation

This blog post presents practical solutions for using the latest state-of-the-art models in real-world applications and distilling their knowledge into smaller and faster components that you can run and maintain in-house.

How S&P Global is making markets more transparent with NLP, spaCy and Prodigy

https://explosion.ai/blog/sp-global-commodities

A case study on S&P Global’s efficient information extraction pipelines for real-time commodities trading insights in a high-security environment using human-in-the-loop distillation.

Applied NLP Thinking: How to Translate Problems into Solutions

https://explosion.ai/blog/applied-nlp-thinking

This blog post discusses some of the biggest challenges for applied NLP and translating business problems into machine learning solutions, including the distinction between utility and accuracy.

The Window-Knocking Machine Test

https://ines.io/blog/window-knocking-machine-test/

How will technology shape our world going forward? And what tools and products should we build? When imagining what the future could look like, it helps to look back in time and compare past visions to our reality today.

Practical Tips for Bootstrapping Information Extraction Pipelines

https://speakerdeck.com/honnibal/practical-tips-for-bootstrapping-information-extraction-pipelines

Matt's presentation on approaches for bootstrapping NLP pipelines and retrieval via information extraction, building on top of this talk.

More Decks by Ines Montani

Other Decks in Programming

Transcript

  1. 250m+ 250m+ spaC y ChatGPT can write spaCy code! Open-source

    library for industrial- strength natural language processing spacy.io downloads
  2. 900+ 10k+ Prodi g y Modern scriptable annotation tool for

    machine learning developers prodigy.ai 900+ companies 10k+ users
  3. 900+ 10k+ Prodi g y Modern scriptable annotation tool for

    machine learning developers prodigy.ai Alex Smith Developer Kim Miller Analyst GPT-4 API 900+ companies 10k+ users
  4. B ack to our r oots! explosion.ai/blog/back-to-our-roots We’re back to

    running Explosion as a smaller, independent-minded and self-su ff icient company.
  5. B ack to our r oots! explosion.ai/blog/back-to-our-roots We’re back to

    running Explosion as a smaller, independent-minded and self-su ff icient company. Consulting open source developer tools
  6. Falcon MIXTRAL GPT-4 good contextual results ⚠ transparency ⚠ e

    iciency easy to use & configure fast prototyping LLM
  7. Falcon MIXTRAL GPT-4 good contextual results ⚠ data privacy ⚠

    transparency ⚠ e iciency easy to use & configure fast prototyping LLM
  8. rules or instructions ✍ programming & rules machine learning examples

    📝 supervised learning E volution de fi nition s
  9. rules or instructions ✍ programming & rules machine learning examples

    📝 supervised learning in-context learning rules or instructions ✍ LLM prompt engineering E volution de fi nition s
  10. rules or instructions ✍ programming & rules machine learning examples

    📝 supervised learning in-context learning rules or instructions ✍ LLM prompt engineering instructions: human-shaped, easy for non-experts, risk of data drift ✍ E volution de fi nition s
  11. rules or instructions ✍ programming & rules machine learning examples

    📝 supervised learning in-context learning rules or instructions ✍ LLM prompt engineering instructions: human-shaped, easy for non-experts, risk of data drift ✍ 📝 examples: nuanced and intuitive behaviors, specific to use case, labor-intensive E volution de fi nition s
  12. rules or instructions ✍ programming & rules machine learning examples

    📝 supervised learning in-context learning rules or instructions ✍ LLM prompt engineering ? ? LLM instructions: human-shaped, easy for non-experts, risk of data drift ✍ 📝 examples: nuanced and intuitive behaviors, specific to use case, labor-intensive E volution de fi nition s
  13. P rototype task-specific output 💬 prompt 📖 text LLM prompt

    model & transform output to structured data github.com/explosion/spacy-llm GPT-4 API
  14. 📖 text task-specific output P roduction P rototype task-specific output

    💬 prompt 📖 text LLM prompt model & transform output to structured data github.com/explosion/spacy-llm GPT-4 API
  15. 📖 text task-specific output P roduction P rototype task-specific output

    💬 prompt 📖 text LLM distilled task-specific components prompt model & transform output to structured data github.com/explosion/spacy-llm GPT-4 API
  16. 📖 text task-specific output P roduction P rototype task-specific output

    💬 prompt 📖 text LLM distilled task-specific components prompt model & transform output to structured data github.com/explosion/spacy-llm ✅ modular GPT-4 API
  17. 📖 text task-specific output P roduction P rototype task-specific output

    💬 prompt 📖 text LLM distilled task-specific components prompt model & transform output to structured data github.com/explosion/spacy-llm ✅ small & fast ✅ modular GPT-4 API
  18. 📖 text task-specific output P roduction P rototype task-specific output

    💬 prompt 📖 text LLM distilled task-specific components prompt model & transform output to structured data github.com/explosion/spacy-llm ✅ data-private ✅ small & fast ✅ modular GPT-4 API
  19. 99% 99% Case Stud y : S&P Global • real-time

    commodities trading insights by extracting structured attributes 6mb 6mb model size 16k+ 16k+ words/second F-score explosion.ai/blog/sp-global-commodities
  20. 99% 99% Case Stud y : S&P Global • real-time

    commodities trading insights by extracting structured attributes • high-security environment 6mb 6mb model size 16k+ 16k+ words/second F-score explosion.ai/blog/sp-global-commodities
  21. 99% 99% Case Stud y : S&P Global • real-time

    commodities trading insights by extracting structured attributes • high-security environment • used LLM during annotation 6mb 6mb model size 16k+ 16k+ words/second F-score explosion.ai/blog/sp-global-commodities
  22. 99% 99% Case Stud y : S&P Global • real-time

    commodities trading insights by extracting structured attributes • high-security environment • used LLM during annotation • 10× data development speedup with humans and model in the loop 6mb 6mb model size 16k+ 16k+ words/second F-score explosion.ai/blog/sp-global-commodities
  23. 99% 99% Case Stud y : S&P Global • real-time

    commodities trading insights by extracting structured attributes • high-security environment • used LLM during annotation • 10× data development speedup with humans and model in the loop • 8 market pipelines in production 6mb 6mb model size 16k+ 16k+ words/second F-score explosion.ai/blog/sp-global-commodities
  24. 99% 99% Case Stud y : S&P Global • real-time

    commodities trading insights by extracting structured attributes • high-security environment • used LLM during annotation • 10× data development speedup with humans and model in the loop • 8 market pipelines in production 6mb 6mb model size 16k+ 16k+ words/second F-score explosion.ai/blog/sp-global-commodities
  25. Software 1.0 Software 1.0 📄 code 💾 program compiler Software

    2.0 Software 2.0 📊 data 🔮 model algorithm
  26. Software 1.0 Software 1.0 📄 code 💾 program compiler Software

    2.0 Software 2.0 📊 data 🔮 model algorithm ✅ tests 📈 evaluation
  27. Software 1.0 Software 1.0 📄 code 💾 program compiler Software

    2.0 Software 2.0 📊 data 🔮 model algorithm ✅ tests 📈 evaluation refactoring refactoring
  28. Software 1.0 Software 1.0 📄 code 💾 program compiler Software

    2.0 Software 2.0 📊 data 🔮 model algorithm ✅ tests 📈 evaluation refactoring refactoring iteration iteration
  29. I lo v e cats. SIMILAR OR NOT? I ha

    t e cats. Your application context always matters!
  30. Serve with a cold beer and a small bowl of

    Cheetos on the side. spacy.fyi/pydata-nyc Mix the Cheetos with the breadcrumbs and crush them with a rolling pin. INGREDIENT DISH EQUIPMENT WHICH LABEL?
  31. Serve with a cold beer and a small bowl of

    Cheetos on the side. spacy.fyi/pydata-nyc Mix the Cheetos with the breadcrumbs and crush them with a rolling pin. INGREDIENT DISH EQUIPMENT WHICH LABEL? We beat few-shot GPT baseline with 20× speedup!
  32. Serve with a cold beer and a small bowl of

    Cheetos on the side. spacy.fyi/pydata-nyc Mix the Cheetos with the breadcrumbs and crush them with a rolling pin. INGREDIENT DISH EQUIPMENT WHICH LABEL? We beat few-shot GPT baseline with 20× speedup!
  33. Serve with a cold beer and a small bowl of

    Cheetos on the side. spacy.fyi/pydata-nyc Mix the Cheetos with the breadcrumbs and crush them with a rolling pin. INGREDIENT DISH EQUIPMENT WHICH LABEL? Serve with a cold beer and a small bowl of Cheetos on the side. Mix the Cheetos with the breadcrumbs and crush them with a rolling pin. EQUIPMENT We beat few-shot GPT baseline with 20× speedup!
  34. Serve with a cold beer and a small bowl of

    Cheetos on the side. spacy.fyi/pydata-nyc Mix the Cheetos with the breadcrumbs and crush them with a rolling pin. INGREDIENT DISH EQUIPMENT WHICH LABEL? Serve with a cold beer and a small bowl of Cheetos on the side. Mix the Cheetos with the breadcrumbs and crush them with a rolling pin. EQUIPMENT ADJ NOUN We beat few-shot GPT baseline with 20× speedup!
  35. F actor out busi n ess logic result = business_logic(classification(text))

    MODEL words, grammar, syntax information in the text
  36. F actor out busi n ess logic result = business_logic(classification(text))

    MODEL external knowledge facts that can change over time words, grammar, syntax information in the text
  37. F actor out busi n ess logic result = business_logic(classification(text))

    P ro tip: Try to think about the text from the model’s point of view! MODEL external knowledge facts that can change over time words, grammar, syntax information in the text
  38. Re d uce operational complexit y STEP 1 STEP 2

    STEP 3 business problem Structured Data {}
  39. Re d uce operational complexit y STEP 1 STEP 2

    STEP 3 business problem Structured Data {} explosion.ai/blog/applied-nlp-thinking This is the hard part!
  40. Re d uce operational complexit y STEP 1 STEP 2

    STEP 3 business problem Structured Data {} explosion.ai/blog/applied-nlp-thinking This is the hard part! Is it generative or predictive?
  41. Re d uce operational complexit y Can it be a

    simpler classifier? STEP 1 STEP 2 STEP 3 business problem Structured Data {} explosion.ai/blog/applied-nlp-thinking This is the hard part! Is it generative or predictive?
  42. Re d uce operational complexit y Can it be a

    simpler classifier? STEP 1 STEP 2 STEP 3 business problem Structured Data {} explosion.ai/blog/applied-nlp-thinking This is the hard part! What can we do deterministically? Is it generative or predictive?
  43. Re d uce operational complexit y Can it be a

    simpler classifier? STEP 1 STEP 2 STEP 3 business problem Structured Data {} explosion.ai/blog/applied-nlp-thinking This is the hard part! What can we do deterministically? Is it generative or predictive? What’s needed for the application? APP
  44. The Window K nocking Machine Tes t ines.io/blog/window-knocking-machine-test Are you

    designing a window-knocking machine or an alarm clock? “knocker-uppers”
  45. Hello, I ’ m Toni ’ s virtual assistant and

    I help schedule appointments. Do you have time at 1pm on Monday? No, but Tuesday would work for me. Okay, please confirm: Tuesday at 1pm? 1pm is unideal but 3pm would work. Toni doesn ’ t have availability at 3pm but I could offer a slot at 4pm or 5 : 30pm. Which time zone is this by the way? I ’ m in CET. ines.io/blog/window-knocking-machine-test
  46. Hello, I ’ m Toni ’ s virtual assistant and

    I help schedule appointments. Do you have time at 1pm on Monday? No, but Tuesday would work for me. Okay, please confirm: Tuesday at 1pm? 1pm is unideal but 3pm would work. Toni doesn ’ t have availability at 3pm but I could offer a slot at 4pm or 5 : 30pm. Which time zone is this by the way? I ’ m in CET. Calendly ines.io/blog/window-knocking-machine-test
  47. Hello, I ’ m Toni ’ s virtual assistant and

    I help schedule appointments. Do you have time at 1pm on Monday? No, but Tuesday would work for me. Okay, please confirm: Tuesday at 1pm? 1pm is unideal but 3pm would work. Toni doesn ’ t have availability at 3pm but I could offer a slot at 4pm or 5 : 30pm. Which time zone is this by the way? I ’ m in CET. Calendly “window-knocking machine” “alarm clock” ines.io/blog/window-knocking-machine-test
  48. What ’ s the total services revenue from 2023? $2,923,531

    How many clients is that in total? 29 ⏺ ⏺ ⏺ ines.io/blog/window-knocking-machine-test
  49. What ’ s the total services revenue from 2023? $2,923,531

    How many clients is that in total? 29 ⏺ ⏺ ⏺ 🔮 LLM 📚 database 🤖 agents ⚙ query Retrieval-Augmented Generation ines.io/blog/window-knocking-machine-test
  50. 2023 Year Services Type ACME Inc. FooBar GmbH NLPCorp XKCD

    Ltd. Python AG 432,032 82,000 1,500 193,000 91,320 $ 2,625,032 Clients (28) Revenue What ’ s the total services revenue from 2023? $2,923,531 How many clients is that in total? 29 ⏺ ⏺ ⏺ 🔮 LLM 📚 database 🤖 agents ⚙ query Retrieval-Augmented Generation ines.io/blog/window-knocking-machine-test
  51. 2023 Year Services Type ACME Inc. FooBar GmbH NLPCorp XKCD

    Ltd. Python AG 432,032 82,000 1,500 193,000 91,320 $ 2,625,032 Clients (28) Revenue A I still needs produc t decisions! Kim Miller Analyst What ’ s the total services revenue from 2023? $2,923,531 How many clients is that in total? 29 ⏺ ⏺ ⏺ 🔮 LLM 📚 database 🤖 agents ⚙ query Retrieval-Augmented Generation ines.io/blog/window-knocking-machine-test
  52. Reason and refactor. The key to success lies in your

    data and may surprise you! Summar y APPLIED NLP & GEN AI APPLIED NLP & GEN AI
  53. Reason and refactor. The key to success lies in your

    data and may surprise you! Summar y APPLIED NLP & GEN AI APPLIED NLP & GEN AI Think beyond chat bots. You don’t want to build a “window-knocking machine”.
  54. Reason and refactor. The key to success lies in your

    data and may surprise you! LLM Stay ambitious. Don’t compromise on best practices, e iciency and privacy. Summar y APPLIED NLP & GEN AI APPLIED NLP & GEN AI Think beyond chat bots. You don’t want to build a “window-knocking machine”.