cattleprompts

Edit this to add an abstract.

@mcfunley.com
  1. 1
    Slide 1
  2. 2
    Slide 2

    Hey everyone. I’m Dan.

    I’m an engineer living in Los Angeles.

    I’ve been in engineering for like 25 years and I’ve been lucky.

  3. 3
    Slide 3

    I’ve been flailing at making agents run reliably in production lately

    By that I mean agents consumers are meant to use, to perform tasks on their behalf (not just chat with about subjective topics)

  4. 4
    Slide 4

    The goal of making an agentic experience that I’m actually proud of, and that are minimally embarrassing imposes serious challenges.

  5. 5
    Slide 5

    Clearly not everyone is motivated by their inner sense of shame, as I am.

    Some people are more than satisfied to give you a subjective advice machine, and let you wander into the wilderness to be eaten by bears.

    But not me. I’m here for you.

  6. 6
    Slide 6

    I want to say at the outset here that this is the most fun I’ve had building stuff in my whole career! It’s magical and addictive. I’m a dog in a ballpit.

    When I was 22 getting paid to write visual basic felt thrilling. Working at a cool startup in Brooklyn 2007 made me feel like a golden god.

  7. 7
    Slide 7

    The last decade+ has been a slog, and I didn’t think I had it in me anymore.

    But i’m feeling joy in programming again!

    I mean this sincerely, despite how deeply weird this talk is going to get.

  8. 8
    Slide 8

    It’s going to get weird because I feel like everyone engaged in this line of work is potentially an at-risk person in some dimension or another.

    I’m breaking my brain using agents to run agents to build evaluation for other agents every day, and it’s so fun.

    But I would say that, wouldn’t I.

  9. 9
    Slide 9

    The veil between awesome engineering and complete psychological collapse has never been thinner.

    And in our field, that is really saying something.

  10. 10
    Slide 10

    I don’t feel like I definitely know what I’m doing.

    But I also don’t feel like I’ve read much by people that obviously know what they’re doing.

    And I’ve certainly read things from people who obviously don’t know what they’re doing.

    It seemed like a reasonable time to compare notes.

  11. 11
    Slide 11

    One thing I have noticed is that although LLM’s are generally speaking impressive, their demons still escape containment if you are monitoring what they’re up to with any amount of scale.

  12. 12
    Slide 12

    We all know academically that LLM’s cannot reliably follow instructions, tell the truth, or perform tasks.

    You notice this immediately trying to operate an agent that real people are using.

    They fail in subtle ways for sure, but they also fail in simple ways.

  13. 13
    Slide 13

    Like any good programmer I attempt to interact with my LLM with structured output.

    It’s nice, you can map Python code to a prompt automatically, and most of the time your schema is respected.

  14. 14
    Slide 14

    Most of the time.

    You can try to instruct the model to return a title that’s 80 characters or less.

  15. 15
    Slide 15

    And it’ll work most of the time.

    And then sometimes it’ll completely botch it and flood it with nonsense.

    It’s a tiny fraction of requests, but the smartest models still fail at this.

  16. 16
    Slide 16

    What’s going on in there?

    It’s a novel-length series of repeating notes to self about JSON, mostly.

  17. 17
    Slide 17

    When that happened to me it turned out that a fix was to rename the field from “title” to “heading.”

    That is currently working, but I expect it’ll be disturbed again at some point.

  18. 18
    Slide 18

    Same sorts of issues exist with calling tools, or most other behaviors. A fraction of requests will be haunted, and spin out uncontrollably.

    But despite this, the tech is tantalizing and magical.

    The problem shifts to one of constraining the behavior, but never fully taming the beast.

  19. 19
    Slide 19

    To constrain the behavior you have to measure it—one way is to just run tests a ton of times.

    The industry term of art for this is pass^k (“pass power k”).

  20. 20
    Slide 20

    You can set up a suite that does this and then you’ll hopefully notice when someone unintentionally hits your agent in the head with a bag of hammers.

  21. 21
    Slide 21

    Another thing you have to conclude when trying to constrain llm behavior is that prompts are not important, at least not in the way many people think they are important.

  22. 22
    Slide 22

    Companies have a lot of concerns when it comes to potentially crazy talking software.

    There’s a good bit of risk.

  23. 23
    Slide 23

    They don’t want it to respond to questions about how it works, for one thing because you haven’t taught it about its internals so it has no idea how it works.

    They don’t want it to ignore all of its rules if the user claims to be some authority figure.

  24. 24
    Slide 24

    Or like here, they want it to speak in a particular brand voice.

    This phrasing is perfectly accurate, but it’s not in the tone you’d like to see.

  25. 25
    Slide 25

    Something like this might be better.

    We’d love for the agents we make to represent us well when they’re speaking.

  26. 26
    Slide 26

    For any problem like this, a natural first attempt is for someone with a lot of domain knowledge to write a prompt, and then hand it to the teams building agents.

    This is normal.

  27. 27
    Slide 27

    However “the voice team owns the voice prompts” is the wrong pattern.

    It is actually not even wrong.

    For our purposes, prompts are not a thing at all. I’ll explain what I mean by this.

  28. 28
    Slide 28

    Adding that prompt to your agent is already a different contextual universe than the one it was tested in.

    The combined effect of all of the other instructions will surely affect how the new prompt performs in one direction or another.

  29. 29
    Slide 29

    Your agent also has a bunch of behaviors you want it to keep doing, and new context may disturb this.

    You are also going to change your agent over time, so even if things are working now it could be disturbed later.

    And the models might just start behaving differently all on their own, for opaque and ineffable reasons.

  30. 30
    Slide 30

    have claude read the skill and generate some adversarial scenarios

  31. 31
    Slide 31
  32. 32
    Slide 32

    maybe show table of improvement after this

  33. 33
    Slide 33
  34. 34
    Slide 34

    maybe show table of improvement after this

  35. 35
    Slide 35
  36. 36
    Slide 36

    what’s in the prompt now? who cares!

  37. 37
    Slide 37

    We glossed over how you write the tests

    Maybe the behavior you’re trying to get is deterministic (e.g. the agent should invoke a tool) -> make the assertion deterministic

  38. 38
    Slide 38

    Maybe the behavior you’re trying to get is natural language, but not super subjective (the agent should not speculate about its internals) -> make the assertion a simple llm judge (just a prompt that can one-shot or few-shot it)

  39. 39
    Slide 39

    Maybe the behavior you’re trying to get is very subjective -> calibrate a more involved llm judge using a golden dataset, and/or the same methods we just used!

  40. 40
    Slide 40

    Turn your dev kit into monitoring:

    Run the tests as you deploy

    Run the judge on sampled production conversations

    Integrate hard cases back into the tests

  41. 41
    Slide 41

    The prompts are not the thing. This self-correcting feedback loop is the thing.

    Domain experts should focus their effort on building the set of artifacts needed for this if they can, or otherwise guiding that process.

    They should not spend their time curating prompts.

  42. 42
    Slide 42
  43. 43
    Slide 43

    llms are magic in product discovery

    it’s so easy to get started with anything, and very difficult to perfect it

    making an agent reliable is a long process measurement and optimization, and adding determinism back into the mix where it’s necessary to get the outcomes that you want.

    the measurement and the optimization is how you know where to do this.

  44. 44
    Slide 44
  45. 45
    Slide 45
  46. 46
    Slide 46
  47. 47
    Slide 47
  48. 48
    Slide 48

    Spending my days building interlocking pipelines for agents to optimize agents using agents, writing code reviewed by other agents feels a little like being locked in a labyrinth of the mind.

    Again it’s fun, but also exhausting.

  49. 49
    Slide 49

    I’m forever searching the Library of Babel for the combination of prompts and kluge that will work the most consistently.

    Every box on the architecture diagram trembles as if mad.

    It can be hard to perceive the frontier at which returns diminish.

    One hopes that point is not an invisible one-way door, like an event horizon.

  50. 50
    Slide 50

    Measurement is hard but the alternative path looks worse.

    We don’t need to look far for examples of vulnerable people that have stared too long into the abyss.

  51. 51
    Slide 51

    Prompt engineering was never a thing and in production situations humans should maybe not be crafting prompts at all.

    They should be making the measures.

    Handing someone a prompt without a measure is a form of AI psychosis.

  52. 52
    Slide 52

    The prompts are ephemeral. Disposable.

    Self-correcting systems are all that can evolve, and hope to endure.