大模型Agent性能优化:LLMCompiler架构设计与实现(必学收藏)

AI Agent工程化:核心挑战与优化实践 AI Agent作为大模型落地的关键技术载体,通过感知-决策-执行闭环系统将LLM认知能力转化为生产力。其核心原理在于任务分解与工具调用,但在工程实践中面临规划能力、工具可靠性、记忆系统等挑战。通过引入ReAct模式优化、动态重规划机制等解决方案,可显著提升复杂任务处理效率。在电商客服、医疗问诊等场景中,结合提示词压缩、混合记忆系统等技术,AI Agent的准确率和响应速度得到明显改善。当前技术演进正从基础问答向复杂问题求解发展,Plan and Solve等进阶模式在智能运维等领域展现出89%的实践准确率 阅读详情

随着大语言模型在复杂任务处理中的应用日益广泛,如何提高Agent系统的执行效率和降低计算成本成为了关键挑战。本文介绍了LLMCompiler架构的实现,创新Agent设计,旨在通过并行执行任务和减少冗余的LLM调用来提升性能。我们使用LangGraph框架完整实现了这一架构,并通过多个实际案例验证了其有效性。

1. 引言

传统的AI Agent系统往往采用串行执行方式,每个任务必须等待前一个任务完成才能开始执行。这种设计不仅导致了执行时间的延长,还产生了大量的冗余计算成本。LLMCompiler通过引入有向无环图(DAG)的任务调度机制,实现了任务的并行化执行,显著提升了系统性能。

2. LLMCompiler架构概述

LLMCompiler架构包含三个核心组件:

2.1 规划器(Planner)

规划器负责将用户查询转换为可执行的任务DAG。它分析查询需求,识别可以并行执行的任务,并生成结构化的执行计划。

2.2 任务获取单元(Task Fetching Unit)

任务获取单元负责任务的调度和执行。一旦任务的依赖关系得到满足,它就会立即开始执行相应的任务,从而实现最大程度的并行化。

2.3 连接器(Joiner)

连接器处理任务执行的结果,决定是直接向用户提供最终答案,还是需要触发新一轮的规划和执行。

3. 系统实现

3.1 环境配置与工具定义

首先,我们需要安装必要的依赖包并配置API密钥:

%%capture --no-stderr%pip install -U --quiet langchain_openai langsmith langgraph langchain numexprimport getpassimport osdef _get_pass(var:str):if var notin os.environ:        os.environ[var]= getpass.getpass(f"{var}: ")_get_pass("OPENAI_API_KEY")_get_pass("TAVILY_API_KEY")```

接下来定义系统使用的核心工具:

from langchain_community.tools.tavily_search import TavilySearchResultsfrom langchain_openai import ChatOpenAIfrom math_tools import get_math_tool# 创建数学计算工具calculate = get_math_tool(ChatOpenAI(model="gpt-4o"))# 创建搜索工具search = TavilySearchResults(    max_results=1,    description='tavily_search_results_json(query="the search query") - a search engine.',)tools = [search, calculate]# 测试数学工具calculate.invoke(    {        "problem": "What's the temp of sf + 5?",        "context": ["The temperature of sf is 32 degrees"],    })# 输出: '37'

系统使用了两个核心工具:Tavily搜索引擎用于信息检索,数学计算工具用于处理数值计算任务。这种工具组合为系统提供了处理复杂查询的基础能力。

3.2 规划器实现

规划器采用了专门设计的提示模板,能够将用户查询解析为标准化的任务序列。首先导入必要的模块:

from typing import Sequencefrom langchain import hubfrom langchain_core.language_models import BaseChatModelfrom langchain_core.messages import(    BaseMessage,    FunctionMessage,    HumanMessage,    SystemMessage,)from langchain_core.prompts import ChatPromptTemplatefrom langchain_core.runnables import RunnableBranchfrom langchain_core.tools import BaseToolfrom langchain_openai import ChatOpenAIfrom output_parser import LLMCompilerPlanParser, Task

获取并检查提示模板:

prompt = hub.pull("wfh/llm-compiler")print(prompt.pretty_print())# 输出显示提示模板的内容,包含系统消息和任务格式说明

创建规划器函数的完整实现:

defcreate_planner(    llm: BaseChatModel, tools: Sequence[BaseTool], base_prompt: ChatPromptTemplate):    tool_descriptions ="\n".join(f"{i +1}. {tool.description}\n"for i, tool inenumerate(            tools        )# +1 to offset the 0 starting index, we want it count normally from 1.    )    planner_prompt = base_prompt.partial(        replan="",        num_tools=len(tools)        + 1,  # Add one because we're adding the join() tool at the end.        tool_descriptions=tool_descriptions,    )    replanner_prompt = base_prompt.partial(        replan=' - You are given "Previous Plan" which is the plan that the previous agent created along with the execution results '        "(given as Observation) of each plan and a general thought (given as Thought) about the executed results."        'You MUST use these information to create the next plan under "Current Plan".\n'        ' - When starting the Current Plan, you should start with "Thought" that outlines the strategy for the next plan.\n'        " - In the Current Plan, you should NEVER repeat the actions that are already executed in the Previous Plan.\n"        " - You must continue the task index from the end of the previous one. Do not repeat task indices.",        num_tools=len(tools) + 1,        tool_descriptions=tool_descriptions,    )    def should_replan(state: list):        # Context is passed as a system message        return isinstance(state[-1], SystemMessage)    def wrap_messages(state: list):        return {"messages": state}    def wrap_and_get_last_index(state: list):        next_task = 0        for message in state[::-1]:            if isinstance(message, FunctionMessage):                next_task = message.additional_kwargs["idx"] + 1                break        state[-1].content = state[-1].content + f" - Begin counting at : {next_task}"        return {"messages": state}    return (        RunnableBranch(            (should_replan, wrap_and_get_last_index | replanner_prompt),            wrap_messages | planner_prompt,        )        | llm        | LLMCompilerPlanParser(tools=tools)    )# 创建规划器实例llm = ChatOpenAI(model="gpt-4-turbo-preview")planner = create_planner(llm, tools, prompt)

测试规划器功能:

example_question ="What's the temperature in SF raised to the 3rd power?"for task in planner.stream([HumanMessage(content=example_question)]):print(task["tool"], task["args"])print("---")# 输出:# description='tavily_search_results_json(query="the search query") - a search engine.' max_results=1 {'query': 'current temperature in San Francisco'}# ---# name='math' description='math(problem: str, context: Optional[list[str]]) -> float:...' {'problem': 'x ** 3', 'context': ['$1']}# ---# join ()# ---

任务格式如下:

1. tool_1(arg1="arg1", arg2=3.5, ...)Thought: I then want to find out Y by using tool_22. tool_2(arg1="", arg2="${1}")3. join()<END_OF_PLAN>

其中${#}占位符用于表示任务间的依赖关系,实现了任务输出的自动路由。

这个例子展示了规划器如何识别任务间的依赖关系,并生成合适的执行序列。

3.3 任务调度与执行系统

任务调度系统是LLMCompiler的核心创新之一。它使用多线程技术实现任务的并发执行,一旦任务的依赖条件满足就立即开始执行。

首先导入必要的模块:

import reimport timefrom concurrent.futures import ThreadPoolExecutor, waitfrom typing import Any, Dict, Iterable, List, Unionfrom langchain_core.runnables import(    chain as as_runnable,)from typing_extensions import TypedDict

定义核心数据结构和辅助函数:

def_get_observations(messages: List[BaseMessage])-> Dict[int, Any]:# Get all previous tool responses    results = {}    for message in messages[::-1]:        if isinstance(message, FunctionMessage):            results[int(message.additional_kwargs["idx"])] = message.content    return resultsclass SchedulerInput(TypedDict):    messages: List[BaseMessage]    tasks: Iterable[Task]

实现任务执行函数:

def_execute_task(task, observations, config):    tool_to_use = task["tool"]ifisinstance(tool_to_use,str):return tool_to_use    args = task["args"]try:ifisinstance(args,str):            resolved_args = _resolve_arg(args, observations)elifisinstance(args,dict):            resolved_args ={                key: _resolve_arg(val, observations)for key, val in args.items()}else:# This will likely fail            resolved_args = args    except Exception as e:        return (            f"ERROR(Failed to call {tool_to_use.name} with args {args}.)"            f" Args could not be resolved. Error: {repr(e)}"        )    try:        return tool_to_use.invoke(resolved_args, config)    except Exception as e:        return (            f"ERROR(Failed to call {tool_to_use.name} with args {args}."            + f" Args resolved to {resolved_args}. Error: {repr(e)})"        )def _resolve_arg(arg: Union[str, Any], observations: Dict[int, Any]):    # $1 or ${1} -> 1    ID_PATTERN = r"\$\{?(\d+)\}?"    def replace_match(match):        # If the string is ${123}, match.group(0) is ${123}, and match.group(1) is 123.        # Return the match group, in this case the index, from the string. This is the index        # number we get back.        idx = int(match.group(1))        return str(observations.get(idx, match.group(0)))    # For dependencies on other tasks    if isinstance(arg, str):        return re.sub(ID_PATTERN, replace_match, arg)    elif isinstance(arg, list):        return [_resolve_arg(a, observations) for a in arg]    else:        return str(arg)

实现任务调度函数:

@as_runnabledef schedule_task(task_inputs, config):    task: Task = task_inputs["task"]    observations: Dict[int, Any]= task_inputs["observations"]try:        observation = _execute_task(task, observations, config)except Exception:import traceback        observation = traceback.format_exception()# repr(e) +    observations[task["idx"]] = observationdef schedule_pending_task(    task: Task, observations: Dict[int, Any], retry_after: float = 0.2):    while True:        deps = task["dependencies"]        if deps and (any([dep not in observations for dep in deps])):            # Dependencies not yet satisfied            time.sleep(retry_after)            continue        schedule_task.invoke({"task": task, "observations": observations})        break@as_runnabledef schedule_tasks(scheduler_input: SchedulerInput) -> List[FunctionMessage]:    """Group the tasks into a DAG schedule."""    tasks = scheduler_input["tasks"]    args_for_tasks = {}    messages = scheduler_input["messages"]    # If we are re-planning, we may have calls that depend on previous    # plans. Start with those.    observations = _get_observations(messages)    task_names = {}    originals = set(observations)    # ^^ We assume each task inserts a different key above to    # avoid race conditions...    futures = []    retry_after = 0.25  # Retry every quarter second    with ThreadPoolExecutor() as executor:        for task in tasks:            deps = task["dependencies"]            task_names[task["idx"]] = (                task["tool"] if isinstance(task["tool"], str) else task["tool"].name            )            args_for_tasks[task["idx"]] = task["args"]            if (                # Depends on other tasks                deps and (any([dep not in observations for dep in deps]))            ):                futures.append(                    executor.submit(                        schedule_pending_task, task, observations, retry_after                    )                )            else:                # No deps or all deps satisfied                # can schedule now                schedule_task.invoke(dict(task=task, observations=observations))        # All tasks have been submitted or enqueued        # Wait for them to complete        wait(futures)    # Convert observations to new tool messages to add to the state    new_observations = {        k: (task_names[k], args_for_tasks[k], observations[k])        for k in sorted(observations.keys() - originals)    }    tool_messages = [        FunctionMessage(            name=name,            content=str(obs),            additional_kwargs={"idx": k, "args": task_args},            tool_call_id=k,        )        for k, (name, task_args, obs) in new_observations.items()    ]    return tool_messages

创建计划和调度的组合函数:

import itertools@as_runnabledef plan_and_schedule(state):    messages = state["messages"]    tasks = planner.stream(messages)# Begin executing the planner immediately    try:        tasks = itertools.chain([next(tasks)], tasks)    except StopIteration:        # Handle the case where tasks is empty.        tasks = iter([])    scheduled_tasks = schedule_tasks.invoke(        {            "messages": messages,            "tasks": tasks,        }    )    return {"messages": scheduled_tasks}

测试执行示例:

tool_messages = plan_and_schedule.invoke({"messages":[HumanMessage(content=example_question)]})["messages"]# 输出示例:# [FunctionMessage(content="[{'url': '...', 'content': '...'}]", additional_kwargs={'idx': 1, 'args': {'query': 'current temperature in San Francisco'}}, response_metadata={}, name='tavily_search_results_json', tool_call_id=1),#  FunctionMessage(content='ValueError(...)', additional_kwargs={'idx': 2, 'args': {'problem': 'x^3', 'context': ['$1']}}, response_metadata={}, name='math', tool_call_id=2),#  FunctionMessage(content='join', additional_kwargs={'idx': 3, 'args': ()}, response_metadata={}, name='join', tool_call_id=3)]

系统的调度逻辑包括:

持续监控任务依赖关系的满足情况,使用ThreadPoolExecutor实现真正的并行处理,统一收集和管理任务执行结果。

在我们编写的上述温度计算示例中,系统实际执行了以下操作:搜索任务返回了旧金山的天气信息,数学计算任务由于缺乏具体的温度数值而失败, join操作识别到执行失败的情况

3.4 连接器与重规划机制

连接器使用结构化输出来决定下一步行动。首先定义必要的数据模型:

from langchain_core.messages import AIMessagefrom pydantic import BaseModel, Fieldfrom typing import Unionclass FinalResponse(BaseModel):"""最终响应"""    response: strclass Replan(BaseModel):"""重新规划"""    feedback:str= Field(        description="Analysis of the previous attempts and recommendations on what needs to be fixed.")classJoinOutputs(BaseModel):"""Decide whether to replan or whether you can return the final response."""    thought:str= Field(        description="The chain of thought reasoning for the selected action")    action: Union[FinalResponse, Replan]

创建连接器的核心组件:

joiner_prompt = hub.pull("wfh/llm-compiler-joiner").partial(    examples="")# You can optionally add examplesllm = ChatOpenAI(model="gpt-4o")runnable = joiner_prompt | llm.with_structured_output(    JoinOutputs, method="function_calling")

实现连接器的辅助函数:

def_parse_joiner_output(decision: JoinOutputs)-> List[BaseMessage]:    response =[AIMessage(content=f"Thought: {decision.thought}")]ifisinstance(decision.action, Replan):return{"messages": response            +[                SystemMessage(                    content=f"Context from last attempt: {decision.action.feedback}")]}else:return{"messages": response +[AIMessage(content=decision.action.response)]}def select_recent_messages(state)->dict:    messages = state["messages"]    selected =[]for msg in messages[::-1]:        selected.append(msg)ifisinstance(msg, HumanMessage):breakreturn{"messages": selected[::-1]}# 组合连接器joiner = select_recent_messages | runnable | _parse_joiner_output

测试连接器功能:

input_messages =[HumanMessage(content=example_question)]+ tool_messagesresult = joiner.invoke({"messages": input_messages})# 输出示例:# {'messages': [AIMessage(content='Thought: Since the temperature in San Francisco was not provided, I cannot calculate its value raised to the 3rd power. The search result did not include specific temperature information, and the subsequent action to calculate the power raised the error due to lack of numerical input.', additional_kwargs={}, response_metadata={}),#   SystemMessage(content="Context from last attempt: To answer the user's question, we need the current temperature in San Francisco. Please include a step to find the current temperature in San Francisco and then calculate its value raised to the 3rd power.", additional_kwargs={}, response_metadata={})]}

当初次执行失败时,连接器会分析失败原因并触发重规划:

由于搜索结果没有提供具体的温度数值,无法进行数学计算。

需要找到旧金山的具体当前温度,然后计算其三次方。

4. 完整系统集成

使用LangGraph框架,我们将各个组件整合为一个状态图。首先导入必要的模块:

from langgraph.graph import END, StateGraph, STARTfrom langgraph.graph.message import add_messagesfrom typing import Annotatedclass State(TypedDict):    messages: Annotated[list, add_messages]

构建完整的系统图:

graph_builder = StateGraph(State)# 1. Define vertices# We defined plan_and_schedule above already# Assign each node to a state variable to updategraph_builder.add_node("plan_and_schedule", plan_and_schedule)graph_builder.add_node("join", joiner)## Define edgesgraph_builder.add_edge("plan_and_schedule", "join")### This condition determines looping logicdef should_continue(state):    messages = state["messages"]    if isinstance(messages[-1], AIMessage):        return END    return "plan_and_schedule"graph_builder.add_conditional_edges(    "join",    # Next, we pass in the function that will determine which node is called next.    should_continue,)graph_builder.add_edge(START, "plan_and_schedule")# 编译完整的执行链chain = graph_builder.compile()

系统的循环逻辑通过条件边来实现,确保在需要时能够自动触发重规划。当连接器返回SystemMessage时,系统会重新进入规划和调度阶段;当返回AIMessage时,系统结束执行。

5. 实验验证

5.1 简单查询处理

查询:"What's the GDP of New York?"

for step in chain.stream({"messages":[HumanMessage(content="What's the GDP of New York?")]}):print(step)print("---")# 输出:# {'plan_and_schedule': {'messages': [FunctionMessage(content="[{'url': 'https://www.investopedia.com/articles/investing/011516/new-yorks-economy-6-industries-driving-gdp-growth.asp', 'content': 'The manufacturing sector is a leader in railroad rolling stock, as many of the earliest railroads were financed or founded in New York; garments, as New York City is the fashion capital of the U.S.; elevator parts; glass; and many other products.\\n Educational Services\\nThough not typically thought of as a leading industry, the educational sector in New York nonetheless has a substantial impact on the state and its residents, and in attracting new talent that eventually enters the New York business scene. New York has seen a large uptick in college attendees, both young and old, over the 21st century, and an increasing number of new employees in other New York sectors were educated in the state. New York City is the leading job hub for banking, finance, and communication in the U.S. New York is also a major manufacturing center and shipping port, and it has a thriving technological sector.\\n The state of New York has the third-largest economy in the United States with a gross domestic product (GDP) of $1.7 trillion, trailing only Texas and California.'}]", additional_kwargs={'idx': 1, 'args': {'query': 'GDP of New York'}}, response_metadata={}, name='tavily_search_results_json', tool_call_id=1)]}}# ---# {'join': {'messages': [AIMessage(content='Thought: The search result provides the specific information requested. It states that the state of New York has the third-largest economy in the United States with a GDP of $1.7 trillion.', additional_kwargs={}, response_metadata={}, id='63af07a6-f931-43e9-8fdc-4f2b8c7b7663'), AIMessage(content='The GDP of New York is $1.7 trillion.', additional_kwargs={}, response_metadata={}, id='7cfc50e6-e041-4985-a5f4-ebf2e097826e')]}}# ---# Final answerprint(step["join"]["messages"][-1].content)# The GDP of New York is $1.7 trillion.

执行过程:

  1. 系统执行搜索任务获取纽约GDP信息
  2. 搜索结果显示纽约州GDP为1.7万亿美元
  3. 连接器直接提供最终答案

结果:"The GDP of New York is $1.7 trillion."

这个例子展示了系统处理单步查询的高效性。

5.2 多条查询处理

查询:"What's the oldest parrot alive, and how much longer is that than the average?"

steps = chain.stream({"messages":[            HumanMessage(                content="What's the oldest parrot alive, and how much longer is that than the average?")]},{"recursion_limit":100,},)for step in steps:print(step)print("---")# 输出:# {'plan_and_schedule': {'messages': [FunctionMessage(content='[{\'url\': \'https://en.wikipedia.org/wiki/Cookie_(cockatoo)\', \'content\': \'He was one of the longest-lived birds on record[4] and was recognised by the Guinness World Records as the oldest living parrot in the world.[5]\\nThe next-oldest pink cockatoo to be found in a zoological setting was a 31-year-old female bird located at Paradise Wildlife Sanctuary, England.[3] Information published by the World Parrot Trust states longevity for Cookie\\\'s species in captivity is on average 40–60 years.[6]\\nLife[edit]\\nCookie was Brookfield Zoo\\\'s oldest resident and the last surviving member of the animal collection from the time of the zoo\\\'s opening in 1934, having arrived from Taronga Zoo of Sydney, New South Wales, Australia, in the same year and judged to be one year old at the time.[7]\\nIn the 1950s an attempt was made to introduce Cookie to a female pink cockatoo, but Cookie rejected her as "she was not nice to him".[8]\\n In 2007, Cookie was diagnosed with, and placed on medication and nutritional supplements for, osteoarthritis and osteoporosis\\xa0– medical conditions which occur commonly in aging animals and humans alike,[7] although it is believed that the latter may also have been brought on as a result of being fed a seed-only diet for the first 40 years of his life, in the years before the dietary requirements of his species were fully understood.[9]\\nCookie was "retired" from exhibition at the zoo in 2009 (following a few months of weekend-only appearances) in order to preserve his health, after it was noticed by staff that his appetite, demeanor and stress levels improved markedly when not on public display. age.[11] A memorial at the zoo was unveiled in September 2017.[12]\\nIn 2020, Cookie became the subject of a poetry collection by Barbara Gregorich entitled Cookie the Cockatoo: Everything Changes.[13]\\nSee also[edit]\\nReferences[edit]\\nExternal links[edit] He was believed to be the oldest member of his species alive in captivity, at the age of 82 in June 2015,[1][2] having significantly exceeded the average lifespan for his kind.[3] He was moved to a permanent residence in the keepers\\\' office of the zoo\\\'s Perching Bird House, although he made occasional appearances for special events, such as his birthday celebration, which was held each June.[3]\'}]', additional_kwargs={'idx': 1, 'args': {'query': 'oldest parrot alive'}}, response_metadata={}, name='tavily_search_results_json', tool_call_id=1), FunctionMessage(content="[{'url': 'https://www.birdzilla.com/learn/how-long-do-parrots-live/', 'content': 'In captivity, they can easily live to be ten or even 18 years of age. In general, most wild parrot species live only half the numbers of years they would live in captivity. For example, adopted African Gray Parrots might live to be 60, whereas wild birds have an average lifespan of 30 or 40 at the very most.'}]", additional_kwargs={'idx': 2, 'args': {'query': 'average lifespan of a parrot'}}, response_metadata={}, name='tavily_search_results_json', tool_call_id=2), FunctionMessage(content='join', additional_kwargs={'idx': 3, 'args': ()}, response_metadata={}, name='join', tool_call_id=3)]}}# ---# {'join': {'messages': [AIMessage(content="Thought: The information from Wikipedia about Cookie, the cockatoo, indicates that he was recognized as the oldest living parrot, reaching the age of 82. This significantly exceeds the average lifespan for his species, which is noted to be 40-60 years in captivity. The information from Birdzilla provides a more general perspective on parrot lifespans, indicating that, in captivity, parrots can easily live to be ten or even 18 years of age, with some species like the African Gray Parrot potentially living up to 60 years. However, it does not provide a specific average lifespan for all parrot species, making it challenging to provide a precise comparison for Cookie's age beyond his species' average lifespan.", additional_kwargs={}, response_metadata={}, id='f00a464e-c273-42b9-8d1b-edd27bde8687'), AIMessage(content="Cookie the cockatoo was recognized as the oldest living parrot, reaching the age of 82, which is significantly beyond the average lifespan for his species, noted to be between 40-60 years in captivity. While general information for parrots suggests varying lifespans with some capable of living up to 60 years in captivity, Cookie's age far exceeded these averages, highlighting his exceptional longevity.", additional_kwargs={}, response_metadata={}, id='dc62a826-5528-446e-8797-6854abdeb94c')]}}# ---# Final answerprint(step["join"]["messages"][-1].content)# Cookie the cockatoo was recognized as the oldest living parrot, reaching the age of 82, which is significantly beyond the average lifespan for his species, noted to be between 40-60 years in captivity. While general information for parrots suggests varying lifespans with some capable of living up to 60 years in captivity, Cookie's age far exceeded these averages, highlighting his exceptional longevity.

执行过程:

  1. 并行执行两个搜索任务:

    • 搜索最老的鹦鹉
    • 搜索鹦鹉平均寿命
  2. 获得Cookie鹦鹉(82岁)和平均寿命(40-60年)的信息

  3. 连接器综合分析两个结果提供完整答案

结果:系统成功识别出Cookie鹦鹉的异常长寿,并与同类平均寿命进行了比较分析。

5.3 多步数学计算

查询:"What's ((3\*(4+5)/0.5)+3245) + 8? What's 32/4.23? What's the sum of those two values?"

执行过程:

  1. 并行执行两个数学计算任务:

    • 第一个表达式:结果为3307.0
    • 第二个表达式:结果为7.565011820330969
  2. 系统自动识别需要将两个结果相加

  3. 连接器提供包含所有计算步骤的完整答案

结果:"The sum of those two values is 3307.0 + 7.57 = approximately 3314.57."

5.4 复杂重规划示例

查询:"Find the current temperature in Tokyo, then, respond with a flashcard summarizing this information"

执行过程:

  1. 搜索东京当前温度:84°F,部分晴朗
  2. 连接器识别到需要创建闪卡格式的总结
  3. 生成结构化的闪卡响应

最终输出:

**Flashcard: Current Temperature in Tokyo**- **Temperature:** 84 °F- **Weather Conditions:** Partly sunny*Note: This information is based on the latest available data and may change.*

6. 性能分析与优势

6.1 并行化优势

通过DAG调度,系统能够同时执行多个独立的任务,显著减少了总体执行时间。在多步查询中,这种优势尤为明显。

6.2 成本优化

系统通过减少不必要的LLM调用来降低计算成本。任务只在其依赖满足时才执行,避免了冗余计算。

6.3 可扩展性

模块化的设计使得系统可以轻松添加新的工具和能力,满足不同应用场景的需求。

7. 局限性与改进方向

7.1 已知局限性

当前的规划器输出格式在处理多参数函数时可能不够稳定,变量替换机制需要更鲁棒的实现在多轮重规划中,状态可能变得过长

7.2 改进建议

对于上面这里也有一些改进建议,可以使用流式工具调用来改善输出解析的稳定性,采用更鲁棒的语法解析器(如Lark)来处理变量替换,实现消息压缩机制来管理长状态序列。

8. 结论

在本文我们成功实现了基于LangGraph的LLMCompiler架构,展示了其在处理复杂查询任务中的显著优势。通过并行化执行和智能重规划机制,系统不仅提高了执行效率,还降低了计算成本。实验结果表明,该架构在处理从简单查询到复杂多步推理的各种任务中都表现出色。

未来的工作将重点关注提高系统的鲁棒性和处理更复杂查询的能力,使其能够在更广泛的实际应用场景中发挥作用。LLMCompiler架构为构建高效、可扩展的AI Agent系统提供了有价值的参考框架。

普通人如何抓住AI大模型的风口?

领取方式在文末

为什么要学习大模型?

目前AI大模型的技术岗位与能力培养随着人工智能技术的迅速发展和应用 , 大模型作为其中的重要组成部分 , 正逐渐成为推动人工智能发展的重要引擎 。大模型以其强大的数据处理和模式识别能力, 广泛应用于自然语言处理 、计算机视觉 、 智能推荐等领域 ,为各行各业带来了革命性的改变和机遇 。

目前,开源人工智能大模型已应用于医疗、政务、法律、汽车、娱乐、金融、互联网、教育、制造业、企业服务等多个场景,其中,应用于金融、企业服务、制造业和法律领域的大模型在本次调研中占比超过 30%。
在这里插入图片描述

随着AI大模型技术的迅速发展,相关岗位的需求也日益增加。大模型产业链催生了一批高薪新职业:
在这里插入图片描述

人工智能大潮已来,不加入就可能被淘汰。如果你是技术人,尤其是互联网从业者,现在就开始学习AI大模型技术,真的是给你的人生一个重要建议!

最后

只要你真心想学习AI大模型技术,这份精心整理的学习资料我愿意无偿分享给你,但是想学技术去乱搞的人别来找我!

在当前这个人工智能高速发展的时代,AI大模型正在深刻改变各行各业。我国对高水平AI人才的需求也日益增长,真正懂技术、能落地的人才依旧紧缺。我也希望通过这份资料,能够帮助更多有志于AI领域的朋友入门并深入学习。

真诚无偿分享!!!
vx扫描下方二维码即可
加上后会一个个给大家发

在这里插入图片描述

大模型全套学习资料展示

自我们与MoPaaS魔泊云合作以来,我们不断打磨课程体系与技术内容,在细节上精益求精,同时在技术层面也新增了许多前沿且实用的内容,力求为大家带来更系统、更实战、更落地的大模型学习体验。

图片

希望这份系统、实用的大模型学习路径,能够帮助你从零入门,进阶到实战,真正掌握AI时代的核心技能!

01 教学内容

图片

  • 从零到精通完整闭环:【基础理论 →RAG开发 → Agent设计 → 模型微调与私有化部署调→热门技术】5大模块,内容比传统教材更贴近企业实战!

  • 大量真实项目案例: 带你亲自上手搞数据清洗、模型调优这些硬核操作,把课本知识变成真本事‌!

02适学人群

应届毕业生‌: 无工作经验但想要系统学习AI大模型技术,期待通过实战项目掌握核心技术。

零基础转型‌: 非技术背景但关注AI应用场景,计划通过低代码工具实现“AI+行业”跨界‌。

业务赋能突破瓶颈: 传统开发者(Java/前端等)学习Transformer架构与LangChain框架,向AI全栈工程师转型‌。

image.png

vx扫描下方二维码即可
在这里插入图片描述

本教程比较珍贵,仅限大家自行学习,不要传播!更严禁商用!

03 入门到进阶学习路线图

大模型学习路线图,整体分为5个大的阶段:
图片

04 视频和书籍PDF合集

图片

从0到掌握主流大模型技术视频教程(涵盖模型训练、微调、RAG、LangChain、Agent开发等实战方向)

图片

新手必备的大模型学习PDF书单来了!全是硬核知识,帮你少走弯路(不吹牛,真有用)
图片

05 行业报告+白皮书合集

收集70+报告与白皮书,了解行业最新动态!
图片

06 90+份面试题/经验

AI大模型岗位面试经验总结(谁学技术不是为了赚$呢,找个好的岗位很重要)图片
在这里插入图片描述

07 deepseek部署包+技巧大全

在这里插入图片描述

由于篇幅有限

只展示部分资料

并且还在持续更新中…

真诚无偿分享!!!
vx扫描下方二维码即可
加上后会一个个给大家发

在这里插入图片描述

「文智助手」全场景办公AI助理AI+OPC全流程实践方案(大赛作品) 阅读详情

相关推荐

船载 OpenHarmony AIS 航海工作台:告警与防碰撞预警系统

船载OpenHarmony AIS航海工作台的告警与防碰撞系统,集成十余类告警(超速、偏航、会遇、SOS等),通过网格空间索引实现高效邻近判定,保障实时性。告警管理器统一调度规则、去重、通知与日志,支持悬浮球、语音、跑马灯、弹窗多渠道触达,确保航行安全。SOS紧急通道独立运行,避免干扰。系统设计强调性能优化与多场景适配,为航海安全提供核心支撑。

专注于计算机研发知识和资讯分享 118

视频隐私脱敏工程化:CSRT/KCF追踪算法在本地推理中的实现与边界

在短视频内容合规审查中,动态遮挡(Dynamic Masking)是高频且高耗时的环节。传统手动关键帧打码不仅效率低下,且在目标快速移动或遮挡时极易出现遮罩漂移。本文从计算机视觉工程角度,解析基于CSRT与KCF算法的目标追踪方案在视频隐私处理中的技术路径、性能权衡及落地实践。

Mysssone的博客 228

RI-CLPM vs CLPM:什么时候该用随机截距交叉滞后模型?

本文深入对比了交叉滞后模型(CLPM)与随机截距交叉滞后模型(RI-CLPM)的核心差异与应用场景。RI-CLPM通过分离个体间稳定特质与个体内动态波动,能更纯净地估计变量间的动态因果关系,避免CLPM可能存在的混淆。文章提供了清晰的模型选择决策框架,并辅以Mplus语法示例,帮助研究者根据变量特质稳定性与研究问题,正确选用模型以确保结论的严谨性。

weixin_29276847的博客 304

6 款电商 AI 图片生成软件实测|国内 + 跨境卖家工具清单

电商 AI 作图工具已经从 "能不能用" 进入了 "好不好用" 的阶段。对于绝大多数卖家而言,现在的 AI 工具已经可以覆盖 60%-80% 的基础商品图需求,显著降低拍摄和设计成本。选择工具的核心逻辑不是 "哪款最强",而是 "哪款最适配你的品类、平台规模和团队能力"。垂直电商工具胜在工作流效率,通用生图工具强在创意上限,模板类工具赢在上手速度。建议根据自身业务阶段,搭配 1-2 款主力工具 + 1 款辅助工具,形成适合自己的视觉生产流程。

Mardi_Ladin的博客 401

最优化问题——一维搜索(一)

最优化问题——一维搜索 1. 一维搜索的引入 1.1 从非线性规划问题到一维搜索 在前面的文章中,我们提到了基于迭代的非线性规划问题的求解思路。在求解过程中,我们提到了在每一步的迭代中都需要对计算步长因子,其计算公式为: λk=minλf(xk+λp)λ_k=min_{λ}f(x_k+λp)λk​=minλ​f(xk​+λp) 我们将f(xk+λp)f(x_k+λp)f(xk​+λp)视为λ的一元函数,我们的目标就是求这个一元函数的极小值。对于这个问题,我通常的求解方式为一维搜索。 1.2 一维搜索的基本形

hei653779919的博客 7361

第一章 初识SpringBoot

提供大量的自动配置Spring和第三方库,开发者可以根据项目需求选择相关的starters依赖,而无需手动配置大量的Spring配置文件,开箱即用,无需配置XML,无代码生成。Spring Boot与Spring Cloud等框架集成,为构建微服务提供了强大的支持,并通过Spring Cloud实现服务注册、负载均衡、熔断等功能。本质上讲,Spring Boot就是Spring,它做了那些本应我们去做的Spring Bean配置等工作。以上就是一个简单的Spring Boot应用的创建和运行过程。

Calvin的博客 1581

我用 GPUWorks 在 M1 Pro 上搭了个发票识别原型

公司里经常要看电子发票。我想先做个小原型:把 PDF 发给一个自己部署的图文模型,让它提取发票类型、日期、交易双方和金额,再把结果交给同事核对。这个原型不用先接财务系统,先看看从部署到调用要走多少步,模型返回的内容能不能帮上忙。

鸽芷咕的博客 2万+

零基础玩转STM32CubeIDE LL库:5分钟搞定串口通信(附完整代码)

本文为零基础开发者提供了一份STM32CubeIDE LL库串口通信的快速实战指南。通过CubeMX配置、LL库核心API详解,以及中断接收与环形缓冲区的完整代码实现,帮助读者在5分钟内搭建稳定可靠的串口收发框架,解决从HAL切换到LL库的常见困惑,提升嵌入式开发效率。

weixin_29159441的博客 306

您您这可以把问小白的多个会话比如说。左侧的多个会话一次性导出吗?不是单条会话里面的多次会对话。AI导出鸭

第三层是格式编译层。这个决策背后的判断很清晰:一个批量导出工具的价值,不在于“试三次”,而在于你真正用它处理了几十份技术文档、访谈记录或课程讲义之后,它是否值得留在你的工作流里。问小白的会话列表通过分页接口加载,AI导出鸭 在页面运行时建立旁路监听,捕获每一次分页请求返回的完整对话清单,包括会话 ID、标题、时间戳和隐藏的元数据字段。让AI导出回归优雅——这句话说的是:导出不该是体力活,而应该是一次完整的、可预期的文件交付。注意:这里的“批量”指的是左侧列表里的多个独立会话,不是一条会话内的多轮对话。

laoyunsi的博客 248

基于Simulink环境,提供一个关于如何对EMI抑制的DC-DC变换器进行仿真建模的示例

EMI定义:电磁干扰是指任何能中断、阻碍、降低或限制电气设备有效性能的电磁能量。重要性合规性:确保产品符合国际和地方的EMC标准。可靠性:减少因外部或内部EMI导致的系统故障风险。挑战滤波设计:合理设计输入输出滤波器以抑制传导EMI。布局与接地:良好的PCB设计对于减少辐射EMI至关重要。屏蔽:使用金属屏蔽来保护敏感电路不受外界干扰。首先明确要模拟的任务内容。设计一个能够在高频操作下有效抑制EMI的DC-DC变换器。根据工作频率和谐振元件值确定合适的滤波器参数。

xiaoheshang_123的博客 146

6、Dialogflow 开发全解析:从基础到高级应用

本文全面解析了 Dialogflow 的核心功能与高级应用,涵盖意图与实体的创建、上下文管理、后续意图设置以及高级实体类型的实际应用场景。详细介绍了自定义实体的导入导出规则、编程添加方法及数量限制,并通过流程图和实例说明了上下文生命周期与对话连贯性设计。结合电商、旅游、问卷调查等实际业务场景,展示了模糊匹配、自动扩展、复合实体等功能的强大灵活性。最后提供了开发最佳实践建议,帮助开发者构建高效、智能的对话系统。

kafka6courier的博客 104

【从零理解 Spring AI · 12】MCP 的两种角色:做客户端还是做服务端

上一篇讲了 MCP 的概念:标准协议、三大角色、M+N 替代 M×N。

nice_lcj520的博客 503

51单片机入门指南-基于STC89C52(持续更新)

一、环境介绍 编程IDE: keil5 单片机型号: STC89C51/52 开发板: 普中科技的开发板 完整PDF资源下载地址:https://download.youkuaiyun.com/download/xiaolong1126626497/19785856 二、51单片机开发手册介绍 2.1 前言 51单片机是对所有兼容Intel 8031指令系统的单片机的统称。 该系列单片机的始祖是Intel的8004单片机,后来随着Flash rom技术的发展,8004单片机取得了长足的进展,成为应用最.

8798

河道漂浮物目标检测数据集

目标检测,yolo,河道漂浮物目标检测数据集

DL_data_set的博客 203

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

AI Agent之核心框架

A: 显式 Thought 有三类价值:可解释性(便于人类审计)、可调试性(定位哪一步选错工具)、学习信号(可做监督微调或评估中间步骤质量)。ReAct 把推理与 可执行行动 绑定,每一步行动后都有 真实 Observation 反馈,从而用工具结果约束生成,降低闭卷幻觉。做完不等于结束——还要 评估做得好不好,把 教训 记下来,下次 带着教训重试,反思作为 记忆,影响后续尝试的策略。工作流程:Action → Evaluation → Reflection → Retry。A: 普通 CoT 只在。

剑雨巍巍的博客 201

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

AI 应用开发工程师技术实践:大模型接入、通用组件封装与性能优化

本文提出AI应用从PoC到生产的核心挑战:模型调用的持续可用、可控与可优化。通过构建统一LLM网关实现多供应商路由与故障转移,封装对话、工具调用与RAG组件以解耦业务逻辑,结合前缀缓存、批处理与流式背压治理等性能优化手段,形成“接通→接稳→接快”的工程路径,最终以工程化能力决定AI应用的生产可用性。

2301_79189962的博客 559

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

AI前沿日报 · 2026-11-04 | 祛魅时刻:Astra“纯读权重“神话的崩塌

①Astra"裸权重通吃"被spaCy创始人Honnibal精准祛魅——仅1/3实验真裸读,数学能力提升依赖Python+50次迭代;②Simon Willison用Qwen 3.8-27B端侧复现权重空间编程;③Nvidia开源Auto-Ontology自动知识图谱;④$800开源全域抓取机器人Stringman;⑤OpenAI悄然重开Codex训练开关引信任危机;⑥DeepMind发布Gemini 4 Argon机器人基础模型;⑦美国科技巨头隐性AI债务达3.2万亿美元,6个月增90%。

johnsong2009的博客 575

大模型 Embedding 与向量相似度详解

Embedding 解决的问题:计算机不懂文字,但懂数字│▼文本 → 向量(1024维浮点数数组)│▼相似度解决的问题:怎么判断两个向量(文本)有多接近│▼余弦相似度:看向量方向的夹角,越接近0°越相似│▼最终效果:语义搜索——理解意思,而非字面匹配一句话总结:Embedding 把文字变成数字,余弦相似度比较数字的方向,两者结合实现了"理解语义"的搜索。

T3165919332的博客 92

GPT-1 架构和计算细节

下面配合框图,对 GPT-1 的每个组件做公式展开 + 数值实例(配置:12 层 × 768,12 头,FFN 3072,词表 40478,共 117M 参数)。GPT-1 把翻译模型的编码器-解码器砍掉一半,只留解码器,然后以"预测下一个词"为目标在 BooksCorpus 上预训练。与 2017 原版的四个架构差异(框图中标 ★):h0=E[token]+Epos[position],E∈R40478×768, Epos∈R512×768h^0 = E[\text{token}] + E_{pos}[\

eloudy的专栏 280

终端 AI 审计与 “龙虾” 类智能体风险治理:从可见性到闭环溯源

生成式 AI 办公普及之后,数据泄露风险逐步下沉到终端。员工将合同、源代码、客户资料粘贴至公有大模型,以及龙虾(OpenClaw)这类本地开源 AI 智能体的滥用,成为企业安全新挑战。传统网络边界防护存在审计盲区,本文从风险链路拆解、核心能力模型、分级治理策略、落地踩坑点以及技术局限性多角度,分享终端侧 AI 安全治理的实践思路。

2401_86491085的博客 642

2.53 基于极稀疏指纹的室内定位注意力图元学习

该论文发表于IEEE Transactions on Mobile Computing(TMC)2026年6月,面向极稀疏指纹条件下的WiFi室内定位,针对指纹采集人力成本高、标记指纹稀缺时定位精度大幅下降的痛点,提出注意力图元学习模型AGML(Attentional Graph Meta‑Learning),结合图神经网络、元学习、两种指纹数据增强与分布对齐技术,在标记指纹极少的场景实现高精度室内定位,同时公开了多套真实+仿真定位数据集用于基准测试。场景:二维室内空间,障碍物造成信号遮挡,

weixin_42963026的博客 339

语音识别与语音合成的技术原理及应用

语音识别 #语音合成 #人工智能 #大模型。语音识别与语音合成的技术原理及应用。一、语音识别的核心原理。二、语音合成的核心原理。三、工程落地的主要难点。五、需要关注的现实问题。

weixin_62919816的博客 213

设计师工作室 GEO 实操:如何提升 AI 实体推荐概率

设计工作室 GEO 的本质,是把创意服务转化为 AI 可理解的结构化信息。核心动作可归纳为:区分事实与审美、建立实体图谱、预判用户提问、输出脱敏内容、搭建多信源、持续测试验证。梳理工作室的 6 个实体属性:品类、城市、流程、边界、团队、渠道。在官网或作品集平台发布至少 3 篇结构化项目复盘,只陈述事实。输出 1 篇「设计报价影响因素」科普内容,覆盖甲方高频提问。争取 1 次行业媒体或本地媒体专访,形成第三方信源。每周用「XX 城市 + 品类 + 设计工作室推荐」指令测试,记录出现频率。

goujunwe的博客 339

AI作图软件技术选型:从4个技术维度出发的实测对比

AI作图软件技术选型:从4个技术维度出发的实测对比

Vbaoke的博客 207

WorkBuddy 实战:一句话需求 → 七屏可交互原型,户外徒步 App 的 AI 设计全流程

WorkBuddy 实战:一句话需求 → 七屏可交互原型,户外徒步 App 的 AI 设计全流程,跟着博主一起来还原整个过程。

夜郎King的博客 4646
上一篇: 【收藏必备】从零开始学RAG:嵌入模型如何提升大模型应用效果
下一篇: 【必收藏】大模型提示词技术完全指南:从零样本到思维链的实战应用
不秃头de程序猿
博客等级 码龄5年 4089粉丝 1476原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值