HarmonyFidelisHarmonyFidelis
登录
AI 基础LLM 原理LLM 技能评估术语表构建器
Aura 学院

第 3 节 · 构建

LLM 应用的核心技能

可靠性来自架构、边界与评估。每种技术解决的故障类型不同。

中级30 分钟

学完后你可以

  • Choose between prompting, retrieval, tool use and model adaptation.
  • Explain RAG, function calling, MCP and agent loops.
  • Design a bounded workflow with validation and fallback.

五种工程能力

01

Prompt contracts and structured output

State the task, relevant context, constraints and success criteria. A schema makes output machine-readable, but validation is still required and structure does not prove truth.

02

Retrieval-augmented generation

RAG retrieves external passages and places them in context. It can improve freshness and traceability, but depends on indexing, retrieval quality and faithful use of evidence.

03

Tools and MCP

Function calling lets a model propose structured tool arguments. The host validates, authorizes and executes. MCP standardizes how applications expose contextual resources, prompts and tools.

04

Agents and orchestration

An agent loop observes, plans, calls tools and updates state. Limit steps, cost, permissions and side effects; keep deterministic code in control of important invariants.

05

Adaptation and deployment

Fine-tuning or LoRA can shape repeated behavior; quantization reduces resource needs. Neither replaces missing knowledge, permissions, evaluation or a sound data pipeline.

Choose the smallest effective intervention

  1. 01

    Clarify prompt

  2. 02

    Add relevant context

  3. 03

    Call a trusted tool

  4. 04

    Adapt model if repeated

  5. 05

    Optimize runtime last

Use prompting for instruction gaps, RAG for accessible knowledge, tools for external actions or exact computation, and fine-tuning for stable repeated behavior patterns.

常见混淆

  • RAG does not eliminate hallucinations: retrieval can fail and the model can misread or ignore evidence.
  • The model may propose a tool call, but the application—not the model—must authorize and validate it.
  • A multi-agent design can multiply latency, cost and error propagation without improving the task.

Practice: design a grounded assistant

Sketch a support assistant that answers from a controlled knowledge base.

  • Define retrieval inputs, source metadata and an abstention rule when evidence is weak.
  • Define one read-only tool with a strict schema and server-side authorization.
  • Record the prompt, model, retrieved passages, tool outcome and final evaluation without logging secrets.

Quick check

When is RAG more appropriate than fine-tuning?

When the problem is supplying current, private or traceable knowledge that can be retrieved at request time.

Who must authorize a tool call?

The host application must validate arguments, user permissions and policy before execution.

Does valid JSON guarantee a correct answer?

No. It guarantees only that the output matches a syntax or schema; facts and business rules still need checks.

关键词

  • prompt
  • schema
  • grounding
  • RAG
  • embedding search
  • function calling
  • MCP
  • agent
  • LoRA
  • quantization

规范与一手研究

Retrieval-Augmented GenerationPrimary paper combining parametric generation with retrieved external memory.OpenAI function calling guideCurrent provider documentation for defining tools and handling structured calls.Model Context Protocol specificationNormative specification for interoperable AI context and tool connections.ReActPrimary paper on interleaving reasoning-oriented traces and actions in language models.LoRAPrimary paper on low-rank adaptation for efficient model fine-tuning.
上一节: LLM 如何工作下一节: 评估与安全