- Published on
What is NLP (and why context is everything)
In this blog post we will scratch the surface on what is NLP and how it is tie with context engineering.
What is NLP? 🤔
NLP, short for Natural Language Processing, is the field of AI of transforming unstructured text—like the things we speak—to structured, tokenized versions and vice-versa. The process of transforming unstructured to structured text is called NLU—Natural Language Understanding. The reverse process is called NLG—Natural Language Generation. Traditional a NLP focused on utilizing rule-based or statistical models to tokenization, named entity recognition, part-of-speech tagging, sentiment analysis, and so on. Applying deep learning and transformers brought NLP to the Gen AI era.
🔄 NLU vs. NLG
Aspect | NLU (Understanding) | NLG (Generation) |
---|---|---|
📌 Purpose | Interpret and extract meaning from text | Generate human-like text |
🧠 Core Capabilities | Entity recognition, intent detection, parsing | Text completion, summarization, translation |
🔍 Input | Unstructured natural language | Structured data or context + instructions |
🧾 Output | Structured data (entities, tags, vectors) | Natural language sentences or paragraphs |
🔧 Example Task | “Book me a flight” → intent: travel_booking | “Summarize this article” → full paragraph |
📚 Techniques | Tokenization, classification, embeddings | Language modeling, beam search, sampling |
Together, NLU and NLG form the two pillars of modern NLP systems — one to understand, the other to respond.
The role of context 🦾
Language is naturally ambiguous. In context engineering aims to bridge that gap by giving additional information as part of the prompt, improving results significantly. Its a way to refine the input thought instructions, commands, examples, and get better effectiveness without the need for fine tunning. Historically, we went from giving the NLP 2-3 sentences of context to entire documents.
How models use it? 🤖
LLMs like Chat GPT can handle big context windows like 8k-200k tokens fed via prompt. The LLM doesn't understand context, they pattern-match based on the training and the prompt.
Context engineering = intentionally crafting, selecting, or retrieving relevant text to guide an LLM.
Good context engineering is the difference between hallucination and a helpful answer. It includes chinking source docs, creating semantic embeddings, RAG, and formatting prompt templates to keep inputs aligned.
from langchain_core.prompts import PromptTemplate
template = "Translate the following text into {language}: {text}"
prompt_template = PromptTemplate.from_template(template)
Where it goes wrong 🗿
If you feed it garbage, it will output garbage. If you go over the context window limit, you will get half answer. If you create it with bias or missing domain-specifc vocabulary, you may get a deviated answer.
Conclusion
Context is the core challenge of NLP. If you want reliable, useful responses from an LLM, you have to engineer the context just as much as the code.