#Introduction to LLM and Prompt.
1 messages Ā· Page 1 of 1 (latest)
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.
~~I feel like I understand it. ~~Your analysis is very professional. Thank you for sharing!!
Oh thank you! It was useful for me