<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>NLP on Chen Kai Blog</title><link>https://www.chenk.top/en/tags/nlp/</link><description>Recent content in NLP on Chen Kai Blog</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 25 Nov 2025 09:00:00 +0000</lastBuildDate><atom:link href="https://www.chenk.top/en/tags/nlp/index.xml" rel="self" type="application/rss+xml"/><item><title>NLP (12): Frontiers and Practical Applications</title><link>https://www.chenk.top/en/nlp/frontiers-applications/</link><pubDate>Tue, 25 Nov 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/nlp/frontiers-applications/</guid><description>&lt;p>We have spent eleven chapters climbing from raw text to multimodal foundation models. This twelfth and final chapter sits at the frontier and at the runway. It is where research stops being a paper and starts being a service: an LLM that calls tools, writes and debugs code, reasons through hundred-step problems, ingests a 200K-token contract, and serves a thousand concurrent users behind a FastAPI endpoint with p95 latency under 300 ms.&lt;/p></description></item><item><title>NLP (11): Multimodal Large Language Models</title><link>https://www.chenk.top/en/nlp/multimodal-nlp/</link><pubDate>Thu, 20 Nov 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/nlp/multimodal-nlp/</guid><description>&lt;p>Humans never perceive the world in one channel at a time. We watch a chart while reading the caption, hear a tone of voice while reading a face, glance at a screenshot while debating a bug. Pure-text language models are deaf and blind to all of that. &lt;strong>Multimodal Large Language Models (MLLMs)&lt;/strong> close the gap by aligning images, audio, and video into the same representation space the language model already speaks.&lt;/p></description></item><item><title>NLP (10): RAG and Knowledge Enhancement Systems</title><link>https://www.chenk.top/en/nlp/rag-knowledge-enhancement/</link><pubDate>Sat, 15 Nov 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/nlp/rag-knowledge-enhancement/</guid><description>&lt;p>A frozen language model is a confident liar. It can&amp;rsquo;t read yesterday&amp;rsquo;s incident report, your company wiki, or the patch notes that shipped this morning, so when you ask, it confabulates an answer that is grammatically perfect but factually wrong. &lt;strong>Retrieval-Augmented Generation (RAG)&lt;/strong> breaks the deadlock by separating &lt;em>memory&lt;/em> from &lt;em>reasoning&lt;/em>: keep the LLM small and stable, and put the volatile knowledge in an external store that you can update anytime. Before generating, retrieve the relevant evidence and condition the model on it.&lt;/p></description></item><item><title>NLP (9): Deep Dive into LLM Architecture</title><link>https://www.chenk.top/en/nlp/llm-architecture-deep-dive/</link><pubDate>Mon, 10 Nov 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/nlp/llm-architecture-deep-dive/</guid><description>&lt;p>The 2017 Transformer paper drew one block. Every production LLM today still uses that diagram as a silhouette, but almost every internal piece has been replaced. Pre-norm replaced post-norm. RMSNorm replaced LayerNorm. SwiGLU replaced GELU. Rotary embeddings replaced sinusoids. Multi-head attention became grouped-query attention. The dense FFN sometimes became a sparse mixture of experts. And the inference loop is dominated by a data structure that doesn&amp;rsquo;t appear in the original paper at all: the KV cache.&lt;/p></description></item><item><title>NLP (8): Model Fine-tuning and PEFT</title><link>https://www.chenk.top/en/nlp/fine-tuning-peft/</link><pubDate>Wed, 05 Nov 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/nlp/fine-tuning-peft/</guid><description>&lt;p>In 2020, fine-tuning a 7-billion-parameter language model was a project budget item: eight A100s, several days, and an engineer who knew how to babysit gradient checkpointing. In 2024, a graduate student does it on a laptop. The distance between those two worlds is almost entirely covered by one paper — Hu et al.&amp;rsquo;s LoRA (ICLR 2022) — and one follow-up — Dettmers et al.&amp;rsquo;s QLoRA (NeurIPS 2023).&lt;/p>
&lt;p>The shift is not just engineering. Parameter-Efficient Fine-Tuning (PEFT) reframes what it means to &amp;ldquo;have a model.&amp;rdquo; Instead of one binary blob per task, you keep a single frozen base model and a directory of small adapter files, each a few tens of megabytes. Switching tasks becomes loading a new adapter; serving N domains becomes O(1) base + N · ε.&lt;/p></description></item><item><title>NLP (7): Prompt Engineering and In-Context Learning</title><link>https://www.chenk.top/en/nlp/prompt-engineering-icl/</link><pubDate>Fri, 31 Oct 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/nlp/prompt-engineering-icl/</guid><description>&lt;p>The same model can produce a sharp answer or a confident hallucination. The difference lies in the framing, not the weights. A vague request like &lt;em>&amp;ldquo;analyze this text&amp;rdquo;&lt;/em> yields a generic summary; a prompt with a role, two clear examples, and a strict output schema produces something a parser can use. &lt;strong>Prompt engineering turns that gap into a repeatable system, not just a lucky shot.&lt;/strong>&lt;/p>
&lt;p>In-Context Learning (ICL) is the mechanism that makes this work. When you include a few examples in the prompt, the model doesn&amp;rsquo;t retrain; it conditions its forward pass on those examples and effectively &lt;em>infers a task&lt;/em> from them. Understanding ICL&amp;rsquo;s capabilities and limitations separates a developer who struggles with the model from one who guides it.&lt;/p></description></item><item><title>NLP (6): GPT and Generative Language Models</title><link>https://www.chenk.top/en/nlp/gpt-generative-models/</link><pubDate>Sun, 26 Oct 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/nlp/gpt-generative-models/</guid><description>&lt;p>When you ask ChatGPT a question and a fluent multi-paragraph answer streams back token by token, you are watching a single deceptively simple loop: feed everything-so-far into a Transformer decoder, look at the probability distribution it produces over the vocabulary, pick one token, append it, repeat. That is &lt;em>all&lt;/em> an autoregressive language model does. The miracle is not the loop — it is what happens when you scale the network behind the loop to hundreds of billions of parameters and train it on most of the internet.&lt;/p></description></item><item><title>NLP (5): BERT and Pretrained Models</title><link>https://www.chenk.top/en/nlp/bert-pretrained-models/</link><pubDate>Tue, 21 Oct 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/nlp/bert-pretrained-models/</guid><description>&lt;p>In October 2018, Google released BERT and broke eleven NLP benchmarks at once. The recipe is almost embarrassingly simple: take a Transformer encoder, train it to predict words that have been randomly hidden using both left and right context, and then fine-tune the same pretrained model for whatever downstream task you have. Before BERT, every task came with its own from-scratch model. After BERT, &amp;ldquo;pretrain once, fine-tune everywhere&amp;rdquo; became the default mental model for the entire field.&lt;/p></description></item><item><title>NLP (4): Attention Mechanism and Transformer</title><link>https://www.chenk.top/en/nlp/attention-transformer/</link><pubDate>Thu, 16 Oct 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/nlp/attention-transformer/</guid><description>&lt;p>In June 2017, eight researchers at Google Brain and Google Research published a paper with a deliberately bold title: &lt;em>Attention Is All You Need&lt;/em>. The architecture it introduced, the &lt;strong>Transformer&lt;/strong>, threw away recurrence entirely. There were no LSTMs, no GRUs, no left-to-right scanning of a sentence. Instead, every token in a sequence could look at every other token directly through a single mathematical operation: scaled dot-product attention.&lt;/p>
&lt;p>That one design decision unlocked massive parallelism on GPUs, eliminated the long-range dependency problems that had plagued RNNs for decades, and became the substrate on which BERT, GPT, T5, LLaMA, Claude, and essentially every modern large language model is built. If you understand this article well, the rest of the series is mostly variations on a theme.&lt;/p></description></item><item><title>NLP (3): RNN and Sequence Modeling</title><link>https://www.chenk.top/en/nlp/rnn-sequence-modeling/</link><pubDate>Sat, 11 Oct 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/nlp/rnn-sequence-modeling/</guid><description>&lt;p>Open Google Translate, swipe-type a message, or dictate a memo to your phone — all these systems consume an ordered stream of tokens and produce another. A feed-forward network processes each input independently, but language is fundamentally &lt;strong>sequential&lt;/strong>: the meaning of &amp;ldquo;mat&amp;rdquo; in &lt;em>the cat sat on the mat&lt;/em> depends on every word that came before. Recurrent Neural Networks (RNNs) handle this by maintaining a &lt;strong>hidden state&lt;/strong> that evolves as they process each token. The hidden state is the network&amp;rsquo;s running summary of the past — its memory.&lt;/p></description></item><item><title>NLP (2): Word Embeddings and Language Models</title><link>https://www.chenk.top/en/nlp/word-embeddings-lm/</link><pubDate>Mon, 06 Oct 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/nlp/word-embeddings-lm/</guid><description>&lt;span class="math-block">$$\vec{\text{king}} - \vec{\text{man}} &amp;#43; \vec{\text{woman}} \approx \vec{\text{queen}}$$&lt;/span>
&lt;p>
The entire trajectory of NLP shifted toward representation learning. This article walks through that shift—from the failure of one-hot vectors, to Word2Vec&amp;rsquo;s shallow networks, to the global statistics that GloVe exploits, to the subword n-grams that let FastText handle unseen words—and finally connects embeddings to the language models that gave rise to them.&lt;/p></description></item><item><title>NLP (1): Introduction and Text Preprocessing</title><link>https://www.chenk.top/en/nlp/introduction-and-preprocessing/</link><pubDate>Wed, 01 Oct 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/nlp/introduction-and-preprocessing/</guid><description>&lt;p>Every time you ask Claude a question, autocomplete a sentence in Gmail, or read a Google Translate page, you&amp;rsquo;re using a stack that took seventy years to build. Natural Language Processing (NLP) is the field that taught machines to read, score, transform, and write human language. Surprisingly, much of the modern NLP stack still relies on preprocessing techniques from decades ago.&lt;/p>
&lt;p>This first article in the series does two things. First, it maps out the field&amp;rsquo;s history, current scope, and the reasons behind the tools we use. Second, it builds the foundational layer — cleaning, tokenization, normalization, and feature extraction — with code you can use directly in a project. By the end, you&amp;rsquo;ll have a reusable preprocessing pipeline and, more importantly, an understanding of when each step is helpful and when it can destroy signal.&lt;/p></description></item><item><title>Position Encoding Brief: From Sinusoidal to RoPE and ALiBi</title><link>https://www.chenk.top/en/standalone/position-encoding-brief/</link><pubDate>Fri, 30 Jun 2023 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/standalone/position-encoding-brief/</guid><description>&lt;p>Self-attention has a strange property that surprises most people the first time they compute it by hand: it does not know the order of its inputs. Permute the tokens and every attention score is permuted along with them — the function is exactly equivariant. So before we can do anything useful with a Transformer, we have to inject position information from the outside.&lt;/p>
&lt;p>That single design decision — &lt;em>how&lt;/em> to inject it — has spawned a remarkable amount of research. Sinusoidal, learned, relative, T5-style buckets, RoPE, ALiBi, NoPE, and more. This post is a practitioner&amp;rsquo;s brief: enough math to know why each scheme works, enough comparison to choose one, and a clear focus on the property that matters most in the LLM era — &lt;strong>length extrapolation&lt;/strong>, the ability to handle sequences longer than anything seen in training.&lt;/p></description></item><item><title>Multimodal LLMs and Downstream Tasks: A Practitioner's Guide</title><link>https://www.chenk.top/en/standalone/multimodal-llm-downstream-tasks/</link><pubDate>Sat, 09 Apr 2022 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/standalone/multimodal-llm-downstream-tasks/</guid><description>&lt;p>Stuffing pixels, audio, and video into a language model so it can &amp;ldquo;see,&amp;rdquo; &amp;ldquo;hear,&amp;rdquo; and reason — that was a research curiosity before CLIP landed in 2021. Today it&amp;rsquo;s table stakes for most consumer-facing AI products. But shipping a Multimodal LLM (MLLM) in production turns out to be hard in places people rarely talk about. Almost never the vision encoder. Almost always these four:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Alignment.&lt;/strong> How does the language model &amp;ldquo;understand&amp;rdquo; what the vision encoder produces? Is the projector a 2-layer MLP or a Q-Former? Which parameters thaw during training?&lt;/li>
&lt;li>&lt;strong>Task framing.&lt;/strong> The same MLLM has to do captioning, VQA, grounding, OCR. Each needs a prompt template that doesn&amp;rsquo;t quietly drop several points of accuracy.&lt;/li>
&lt;li>&lt;strong>Cost.&lt;/strong> A 1024x1024 image becomes hundreds of visual tokens. Prefill is brutal. Stretch that to video and the bill goes vertical. Token compression, KV cache reuse, and batching are not optional.&lt;/li>
&lt;li>&lt;strong>Evaluation.&lt;/strong> A model that scores 80 on MMBench can still hallucinate confidently on your customer&amp;rsquo;s invoice. Public benchmarks are the easy part.&lt;/li>
&lt;/ol>
&lt;p>This post follows the natural research arc — architecture, model families, downstream tasks, fine-tuning, evaluation, deployment — and tries to be specific enough at each stop that you can act on it. Less &amp;ldquo;what&amp;rsquo;s possible,&amp;rdquo; more &amp;ldquo;what to actually pick.&amp;rdquo;&lt;/p></description></item></channel></rss>