#Introduction to LLM and Prompt.

1 messages Ā· Page 1 of 1 (latest)

marble tapir
#

A brief introduction to large language models and prompts.

#

What is Large Language Model (LLM)?

#

A large language model is a prediction engine that takes a sequence of words and tries to predict the most likely sequence to come after that sequence. It does this by assigning a probability to likely next sequences and then samples from those to choose one. The process repeats until some stopping criteria is met.

#

Large language models learn these probabilities by training on large corpuses of text. A consequence of this is that the models will cater to some use cases better than others (e.g. if it’s trained on GitHub data, it’ll understand the probabilities of sequences in source code really well). Another consequence is that the model may generate statements that seem plausible, but are actually just random without being grounded in reality.

#

What is prompt?

#

A prompt, sometimes referred to as context, is the text provided to a model before it begins generating output. It guides the model to explore a particular area of what it has learned so that the output is relevant to your goals. As an analogy, if you think of the language model as a source code interpreter, then a prompt is the source code to be interpreted. Somewhat amusingly, a language model will happily attempt to guess what source code will do:

#

itĀ almostĀ interprets the Python code perfectly!

#

Frequently, prompts will be an instruction or a question, like:

#

On the other hand, if you don’t specify a prompt, the model has no anchor to work from and it justĀ randomly samples from anything it has ever consumed

#

Why do we need prompt?

#

We used an analogy of prompts as the ā€œsource codeā€ that a language model ā€œinterpretsā€.Ā Prompt engineering is the art of writing prompts to get the language model to do what we want it to do – just like software engineering is the art of writing source code to get computers to do what we want them to do.

#

When writing good prompts, you have to account for the idiosyncrasies of the model(s) you’re working with. The strategies will vary with the complexity of the tasks. You’ll have to come up with mechanisms to constrain the model to achieve reliable results, incorporate dynamic data that the model can’t be trained on, account for limitations in the model’s training data, design around context limits, and many other dimensions.

#

There’s an old adage that computers will only do what you tell them to do.Ā Throw that advice out the window. Prompt engineering inverts this wisdom. It’s like programming in natural language against a non-deterministic computer that will do anything that you haven’t guided it away from doing.

chilly summit
#

~~I feel like I understand it. ~~Your analysis is very professional. Thank you for sharing!!

finite owl
#

Oh thank you! It was useful for me