[KongchangAI]
· 5 min read· 2,505 words

Getting Started with LLM Application Development: A Full-Stack Learning Path from Prompt to Agent

Getting Started with LLM Application Development: A Full-Stack Learning Path from Prompt to Agent

A systematic full-stack LLM learning map covering machine learning fundamentals, training stages, tokenization generation, and application scenarios.

Based on an introductory course, the article traces the conceptual evolution from AI, machine learning, and deep learning to generative AI and large models, introducing supervised, unsupervised, and reinforcement learning paradigms. It focuses on the three training stages—pre-training, SFT, and RLHF—and summarizes four major characteristics of large models: large scale, broad data, strong adaptability, and high compute requirements, along with the classification of language and multimodal models. It then explains tokenization, tokens, and autoregressive generation, and showcases applications through Tongyi Qianwen and its vertical products. Finally, it offers career transition advice emphasizing three main threads to lay a conceptual foundation for Prompt engineering and Agent development.

Getting Started with LLM Application Development: A Full-Stack Learning Path from Prompt to Agent

Large language models are reshaping the underlying logic of software development. For developers hoping to switch careers or expand their skill boundaries, understanding the core concepts, training pipelines, and application scenarios of LLMs has become an unavoidable fundamental skill. Based on a systematic introductory course, this article maps out the complete knowledge thread from machine learning fundamentals to large model applications, helping you build a clear full-stack LLM cognitive framework.

From AI to Large Models: Four Threads of Conceptual Evolution

To understand large models, you first need to understand the coordinate system they live in. Artificial intelligence is a broad interdisciplinary field covering computer science, statistics, linguistics, neuroscience, and even philosophy. Machine learning is the core subset of AI, and deep learning is a branch of machine learning that primarily relies on neural networks (input layer, hidden layer, output layer) to learn and represent data.

Generative AI is the fastest-growing subset within deep learning. It pre-trains deep models on large-scale unlabeled data, enabling machines to understand language and images and generate answers based on questions. Large models are the core vehicle of generative AI—in 2021, Stanford researchers published a paper proposing the concept of "Foundation Models," defined as pre-trained deep models with over a billion parameters that can be trained on broad data and adapted to a wide range of tasks.

In November 2022, OpenAI released ChatGPT, which achieved a major breakthrough in language understanding and generation capabilities and is regarded by the industry as a landmark event in AI industry development. Subsequently, major domestic Chinese tech companies followed suit: Baidu's Ernie Bot, Alibaba's Tongyi Qianwen, SenseTime, Huawei's Pangu, iFlytek, ByteDance, JD.com, Tencent, and others successively launched their own large models. Among them, Alibaba released the Tongyi Qianwen series of open-source large models in August 2023, offering versions at different scales such as 7B and 72B. It has now been upgraded to Tongyi Qianwen 2, featuring multimodal interaction capabilities including natural language processing, visual understanding, audio processing, and AI Agent.

The Transformer architecture is an unavoidable technical cornerstone for understanding today's large models. It was proposed by Google in the 2017 paper "Attention Is All You Need," with its core innovation being the Self-Attention mechanism, which allows the model to simultaneously attend to information at all other positions in a sequence when processing a given position, dynamically computing the association weights between them. Compared to the previously dominant RNNs and LSTMs, which must process data sequentially step by step, Transformers can process entire sequences in parallel, dramatically improving training efficiency. At the same time, the self-attention mechanism enables the model to capture long-distance semantic dependencies, solving the problem of RNNs easily "forgetting" early information in long texts. It is precisely this architecture that makes it possible to scale parameters to billions or even hundreds of billions, serving as the underlying skeleton for nearly all mainstream large models including GPT, BERT, and Tongyi Qianwen.

Parameters are the "memory capacity" of large models. They refer to the learnable weights and biases in a neural network. Each parameter is essentially a numerical value, and the model continuously adjusts these values during training to fit patterns in the data. The larger the parameter count, the more complex the patterns the model can store and express, but correspondingly more training data and compute are required. Billion-level parameters mean the model has a billion adjustable knobs internally—this is also the quantitative threshold for the "Foundation Model" concept.

Three Paradigms of Machine Learning: Supervised, Unsupervised, and Reinforcement Learning

The course uses the analogy of "teaching a child to recognize fruit" to explain machine learning, which is vivid and easy to understand.

Supervised learning is like holding up an apple and a banana and telling the child: this is an apple, it's round, red or green; this is a banana, it's elongated and yellow. After learning the correspondence between features and categories, the child can make judgments when facing new fruits. This requires manually providing labeled data categories.

Unsupervised learning is letting the child observe a pile of fruits without telling him the names, encouraging him to discover attributes like shape and color on his own and group them. The machine automatically classifies and clusters data objects without preset category labels.

Reinforcement learning is a guided form of learning. Each time a fruit is shown for the child to identify, if he gets it right he receives candy as a reward; if wrong, he doesn't. After repeated attempts and feedback, the child gradually finds the strategy that yields the most rewards. This reward mechanism is precisely the key means by which large models align with human preferences.

Deep Learning: Algorithm Architectures That Simulate the Brain

Deep learning simulates how the human brain's neural networks work, automatically extracting features and patterns through learning from large amounts of data, thereby accomplishing tasks such as image recognition, speech recognition, and natural language processing. Based on different network architectures, it can be categorized into Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), Transformers, and others.

The course similarly uses a fruit scenario as an analogy: taking a child to the supermarket without explaining the characteristics of each fruit—the child gradually learns to identify them through his own observation and comparison. At the model level, deep learning can automatically extract hierarchical features (roundness, elongation, color, smell) from complex visual, olfactory, and other information, and complete recognition tasks based on these features.

Deep learning network architecture diagram

Three Stages of Large Model Training: Pre-training, SFT, and RLHF

Large model training is divided into three core steps, and the course's analogy of "human growth" is very intuitive.

Pre-training: From Infant to College Graduate

In the pre-training stage, the model is like a person from birth to college graduation, learning language habits, knowledge systems, and various general content. For a large model, it learns massive corpora at this stage, mastering the statistical patterns of language and general knowledge. But the pre-trained model has only learned to "complete sentences" and hasn't truly grasped human intent—if you ask it "which country is the Eiffel Tower in," it might not answer "France," but instead output a seemingly plausible yet off-topic answer based on corpus patterns.

Supervised Fine-Tuning (SFT): Professional Training from High School to College

The SFT stage is similar to moving from high school to university and starting to learn professional knowledge in finance, law, and other fields. At this stage, the model learns human dialogue corpora and vertical domain knowledge, and after fine-tuning can answer professional questions according to human intent. Asking the same question about the Eiffel Tower's location, the SFT model will correctly answer "in France" rather than mechanically completing the corpus.

But SFT model responses sometimes still don't match human preferences and may involve inappropriate content such as violence or discrimination.

RLHF: Entering the Workplace and Adjusting Based on Feedback

RLHF (Reinforcement Learning from Human Feedback) is like a college student entering the workplace. The model generates multiple responses to the same question, humans score these responses, and the model learns to output the highest-scoring answers. This process is like employees adjusting their work approach based on praise or criticism from leaders and clients, striving for more positive feedback.

Reward mechanism in reinforcement learning

The core objective of pre-training is next-token prediction under self-supervised learning. The model does not need manually labeled data; instead, it automatically constructs training signals from massive text: taking the first half of a sentence as input, letting the model predict the next word, then comparing with the actual text to adjust parameters. This "self-supervised" approach means that books, web pages, code, and other unlabeled text on the internet can all become training material, greatly reducing data acquisition costs. After pre-training is complete, the model has acquired general language ability and world knowledge, but its behavioral pattern is still "text completion" rather than "answering questions," which is why subsequent SFT and RLHF are needed to align with human intent.

The reward model in RLHF is a key component connecting human preferences and model optimization. The specific process is: first have the SFT model generate multiple different responses to the same question, then have human annotators rank or score these responses by quality, and use this preference data to train an independent "Reward Model" to learn to predict how many points a human would give to a certain response. Subsequently, during the reinforcement learning process, the large model takes the reward model's score as its optimization target, continuously adjusting its policy to obtain higher rewards. This transforms difficult-to-optimize human subjective preferences into quantifiable mathematical objectives.

Four Major Characteristics and Two Classifications of Large Models

Four Core Characteristics

Large scale and parameter count: Hundreds of millions to hundreds of billions of parameters, capable of capturing complex data patterns and understanding and generating extremely complex information.

Extensive training data: Pre-trained on large amounts of diverse data, mastering broader knowledge and multilingual, multimodal features.

Strong adaptability and flexibility: Through fine-tuning, few-shot efficient learning can be achieved, with cross-domain capability, quickly becoming an "expert" in a certain field.

Adaptability and flexibility characteristics of large models

High computational resource requirements: Ordinary desktops or laptops cannot handle training tasks—large-scale compute, storage, and energy support are needed, with high hardware requirements.

Language Large Models and Multimodal Large Models

By application scenario, large models are roughly divided into two categories. Language Large Models (LLMs) focus on natural language processing, trained on large-scale text based on the Transformer architecture, capable of capturing grammar, context, and even cultural knowledge. Typical applications include text generation, question-answering systems, text classification, machine translation, and dialogue systems. Representative models include the GPT series, Google's BERT, and Alibaba Cloud's Tongyi Qianwen.

Multimodal large models can simultaneously process and understand information from different perceptual channels such as text, images, audio, and video, establishing associations and interactions between modalities to achieve cross-modal reasoning, generation, and understanding. Applications cover visual question answering, image generation, cross-modal retrieval, and multimedia content understanding. Common modality combinations include vision + text, audio + vision, and audio + text.

Large Model Workflow: Tokenization, Tokens, and Autoregressive Generation

Large models don't inherently understand Chinese characters—they need "tokenization" to split text into smaller units (tokens). This is like a codebook, where the model identifies human language based on a mapping table.

Tokenization has different granularities: word level is suitable for Western languages like English; character level is mainly for Chinese, splitting by individual characters; subword level breaks words into smaller units like roots and affixes, better handling new words and technical terminology—because the components of new words may already exist in the vocabulary.

Each token is pre-mapped to a Token ID, and a sentence is marked as a sequence of multiple tokens for computer processing.

When generating text, large language models predict the next token based on the previous one. Inference is not done in one step, but rather gradually predicts based on the existing token sequence, adds the prediction result to the sequence, then predicts the next token. This process is called autoregression, continuing until a special end token (such as EOS) is output or a length limit is reached. In each prediction step, the model takes the candidate word with the highest probability as the output for the next token.

Diagram of the relationship between tokenization and tokens

The choice of tokenizer directly affects model efficiency and performance. Word-level tokenization is more natural for English, but the vocabulary keeps growing as new words appear; character-level tokenization has a small vocabulary but overly long sequences and high computational costs; subword level falls in between, using algorithms like BPE (Byte Pair Encoding) to keep high-frequency words intact and split low-frequency words into subwords, controlling vocabulary size while handling unseen new words. In Chinese scenarios, a common approach is to mix character-level and subword-level tokenization—for example, Tongyi Qianwen's tokenizer is optimized for Chinese, so common phrases aren't split too finely, achieving a balance between expressiveness and computational efficiency.

Sampling strategies in autoregressive generation are also worth understanding. At each prediction step, the model outputs a probability distribution over every token in the vocabulary. If you always pick the highest-probability one (greedy strategy), the generated results tend to be repetitive and rigid; if you randomly sample according to probability, you may produce incoherent content. In practice, temperature parameters and Top-p sampling are commonly used for adjustment: higher temperature makes the distribution flatter and output more diverse; lower temperature makes the distribution sharper and output more deterministic. These strategies together determine the balance between creativity and stability in model-generated text.

Typical Application Scenarios of Tongyi Qianwen

Taking Alibaba's Tongyi Qianwen as an example, its applications already cover multiple vertical scenarios. Tongyi Lingma is aimed at developers and can be installed as a plugin in IDEs like PyCharm, helping optimize code, generate code, add comments, and write unit tests. Tongyi Tingwu is based on Tongyi Qianwen, implementing intelligent speech-to-text and content analysis, suitable for meeting notes, interview recordings, study note generation, video subtitles, and other scenarios. Tongyi Farui targets legal needs, integrating legal knowledge to assist with contract review, legal information location, document drafting, and legal consultation.

The basic Tongyi Qianwen large model itself also supports copywriting, code writing, question answering, real-time information queries (such as weather), and interpretation and analysis of complex charts.

Career Transition Learning Advice

This course content covers the complete knowledge chain from machine learning fundamentals to large model training principles, workflow, and product applications, suitable as an introductory map for career changers. When studying, it's recommended to focus on three main threads: first, understanding the differences and connections between the three machine learning paradigms; second, thoroughly grasping the logic of the three-stage training of pre-training, SFT, and RLHF; third, getting hands-on experience with mainstream large model products to map theoretical concepts to actual capabilities. Prompt engineering and Agent development are subsequent advanced directions, but a solid conceptual foundation will make subsequent learning twice as effective.

Prompt engineering is the first advanced direction encountered after getting started. It refers to the technique of guiding large models to produce desired outputs by designing input prompts, including techniques such as zero-shot prompting, few-shot examples, and Chain-of-Thought. Prompt engineering doesn't require modifying model parameters, is low-cost and quick to learn, but effectiveness is highly dependent on prompt quality.

Agents represent a higher-order application form. They enable large models not only to answer questions but also to autonomously plan tasks, call external tools (such as search engines, APIs, code executors), observe execution results, and iteratively adjust until completing a complex goal. Typical frameworks like ReAct (Reasoning + Acting) combine chain-of-thought with tool calling, enabling the model to dynamically decide whether the next step should be to "think" or to "do." From Prompt to Agent, the essence is moving from "making the model say the right things" to "making the model do the right things," which is also the most active frontier direction in current LLM application development.

#LLM application development#large language models#Prompt engineering#AI Agent#RLHF#Tongyi Qianwen#machine learning#Transformer#fine-tuning#career transition
Share:

Related articles