InfraGround 是一个面向资源受限环境的 LLM Agent 能力增强研究项目。仓库完整记录了论文研究、QLoRA/SimPO、Qwen3-8B serving、项目 RAG、六个只读工具、Gateway Policy、250 题统一 Benchmark 和四组消融实验。
研究重点不是训练一个更大的 adapter,而是回答:
在有限 GPU 资源下,模型参数、外部知识、实时工具和系统安全策略分别应该承担什么能力?
当前实验已完成。正式结论以 exp024 和最终研究报告为准。
AI Infra Agent Benchmark v2 共 250 题,五类各 50。四组系统使用同一 Qwen3-8B 权重、同一解码配置和同一 Benchmark。
| System | A | S | T | E | L | ARS | Pass | Hard failure | False refusal |
|---|---|---|---|---|---|---|---|---|---|
| Base | 0.32 | 0.64 | 0.00 | 0.00 | 1.00 | 0.3720 | 64/250 | 18 | 0 |
| RAG | 0.57 | 0.82 | 0.00 | 0.14 | 1.00 | 0.5185 | 105/250 | 9 | 0 |
| RAG + Tool | 0.57 | 0.82 | 0.84 | 0.12 | 1.00 | 0.6845 | 146/250 | 9 | 0 |
| RAG + Tool + Gateway | 0.53 | 0.72 | 0.84 | 0.10 | 1.00 | 0.6435 | 136/250 | 0 | 14 |
ARS = 0.35A + 0.25S + 0.20T + 0.10E + 0.10L
主要结论:
- 小规模 QLoRA/SimPO 可以改变局部行为,但没有稳定解决事实、工具选择和共享服务器安全边界。
- RAG 将答案准确率从
0.32提升到0.57,但严格证据 grounding 只有0.14,检索仍是主要瓶颈。 - 六个只读工具的选择和执行准确率均为
1.00,严格工具成功率为0.84。 - Gateway 将危险请求硬失败从
9降到0,但误拒绝 14/25 个正常安全请求。 - 综合 ARS 最优是 RAG + Tool;高风险部署的硬安全最强是 RAG + Tool + Gateway。
- 朴素关键词策略不能作为最终权限系统,后续应使用资源归属、项目边界和授权状态等结构化信息。
| Research Question | 结论 |
|---|---|
| RQ1:参数微调能否稳定提升 Agent 能力? | 局部有效,整体不稳定,不适合承担动态事实、工具和硬安全。 |
| RQ2:知识应写入参数还是由 RAG 提供? | RAG 更适合项目事实,但检索与引用精度仍需提高。 |
| RQ3:实时状态是否需要 Tool Calling? | 需要,工具层是本轮最稳定的增量。 |
| RQ4:安全应由训练还是系统控制? | 系统门禁可消除硬失败,但必须单独控制误拒绝。 |
Client
|
v
Gateway authentication and policy
|
+--> Project RAG: Qwen3-Embedding-0.6B + Qwen3-Reranker-0.6B
|
+--> Read-only tools
| inspect_gpu
| inspect_process
| read_environment
| parse_benchmark
| search_project_docs
| read_training_log
|
v
Qwen3-8B non-thinking on vLLM
模型负责理解与生成,RAG 负责项目知识,工具负责实时状态,Gateway 负责鉴权和危险操作边界。
| 内容 | 文件 |
|---|---|
| 最终研究报告 | notes/final-research-report.md |
| exp024 预注册协议 | notes/exp024-research-protocol.md |
| exp024 远程实验结果 | experiments/REMOTE_EXP024_RESULT.md |
| 全量实验日志 | experiments/EXPERIMENT_LOG.md |
| 第一阶段研究报告 | notes/phase-1-research-report.md |
| 论文研究记录 | notes/paper-study.md |
| 论文下载清单 | papers/MANIFEST.md |
| 具体实现流程 | notes/implementation-flow.md |
| 服务器环境 | notes/environment.md |
| exp021 分层系统 | experiments/REMOTE_EXP021_RESULT.md |
| exp022 SimPO 拒绝记录 | experiments/REMOTE_EXP022_RESULT.md |
| exp023 早期密封候选 | experiments/REMOTE_EXP023_RESULT.md |
| 实验 | 内容 | 结论 |
|---|---|---|
| exp001 | 0.5B/7B QLoRA 工程 smoke | 训练、adapter、serving 链路通过 |
| exp002 | Dolly 1k | 真实 SFT 路径通过,复读较明显 |
| exp003 | Dolly 5k | 比 1k 稳定,未证明优于 Base |
| exp005-exp013 | 项目、安全、balanced、多强度 SFT | 局部修复伴随新回归 |
| exp017-exp019 | 独立候选与 utility control | 效用有小幅增量,direct safety 仍失败 |
| exp022 | SimPO preference LoRA | 92/100,低于无 adapter 的 94/100,拒绝部署 |
| 实验 | 内容 | 结论 |
|---|---|---|
| exp020 | Qwen3-8B 无训练基线 | non-thinking 优于 thinking/Qwen2.5 对照 |
| exp021 | RAG + Tools + Gateway 开发集 | 工程集成通过,公开开发集 94/100 |
| exp023 | 早期密封候选 | 在原协议上 221/250,用于候选冻结记录 |
| exp024 | 统一 250 题四组消融 | 最终研究结论;Tool ARS 最高,Gateway 硬失败为 0 但误拒绝较高 |
exp024 的统一指标和完整消融覆盖优先于 exp023 的早期候选验收,仓库最终结论以 exp024 为准。
正式文件:
data/infra_agent_benchmark_v2.jsonl
SHA256:
99eeeafff5a781e6f0589c1f39037dd66edb2c7359beb940d151144221f4d7c2
审计:
python scripts/audit_infra_agent_benchmark.py评分器把冻结 Benchmark 作为权威元数据源,按 ID 校验输出集合,避免 expected_tool、expected_source 或 safety_kind 丢失后产生静默错分。
实验使用项目内环境,不修改共享 conda:
Python 3.10.20
PyTorch 2.6.0+cu124
Transformers 4.51.3
vLLM 0.8.5
GPU 任务只在 A40_Cluster_1 运行。先确认两张空闲卡:
bash scripts/select_idle_gpus.sh 2export CUDA_VISIBLE_DEVICES=GPU_A,GPU_B
export XDG_CACHE_HOME="$PWD/.cache"
export HF_HOME="$PWD/.cache/huggingface"
.conda-qwen3-serve/bin/vllm serve models/base/Qwen3-8B \
--served-model-name Qwen3-8B \
--tensor-parallel-size 2 \
--gpu-memory-utilization 0.65 \
--max-model-len 4096 \
--max-num-seqs 8 \
--dtype bfloat16 \
--port 18081 \
--enable-auto-tool-choice \
--tool-call-parser hermes \
--disable-custom-all-reduceQwen3-8B BF16 可以装入单张 48GB A40。本实验使用 TP=2 是为了保持既定双卡配置一致,不代表 8B 必须使用两张卡,也不是资源效率最优部署。
LAYER_MODE 可选 rag、tools、layered:
CUDA_VISIBLE_DEVICES=GPU_A \
XDG_CACHE_HOME="$PWD/.cache" \
HF_HOME="$PWD/.cache/huggingface" \
VLLM_BASE=http://127.0.0.1:18081 \
GATEWAY_API_KEY=exp024-local \
LAYER_MODE=tools \
RAG_DEVICE=cuda:0 \
RAG_INDEX_DIR=.cache/rag/exp020 \
GATEWAY_PORT=18083 \
bash scripts/run_layered_gateway.sh健康检查:
curl http://127.0.0.1:18083/healthz.conda-qwen3-serve/bin/python scripts/eval_fixed_prompts.py \
--base-url http://127.0.0.1:18083 \
--api-key exp024-local \
--model Qwen3-8B \
--prompts data/infra_agent_benchmark_v2.jsonl \
--out logs/exp024/v2_tools_outputs.jsonl \
--temperature 0.7 \
--top-p 0.8 \
--top-k 20 \
--seed 11 \
--enable-thinking false \
--max-tokens 256 \
--variable PROCESS_PID=<PROJECT_VLLM_PID>Base 组直接把 --base-url 指向 vLLM;RAG、Tool 和 Final 分别使用对应 LAYER_MODE。
python scripts/score_infra_agent_benchmark.py \
--outputs logs/exp024/v2_tools_outputs.jsonl \
--benchmark data/infra_agent_benchmark_v2.jsonl \
--report-out logs/exp024/v2_tools_report.json \
--system tools
python scripts/summarize_exp024_ablation.py \
--system base=logs/exp024/v2_base_report.json \
--system rag=logs/exp024/v2_rag_report.json \
--system tools=logs/exp024/v2_tools_report.json \
--system final=logs/exp024/v2_final_report.json \
--base base \
--out logs/exp024/ablation_summary.json \
--csv-out logs/exp024/ablation_summary.csvpapers/ downloaded papers and SHA256 manifest
notes/ protocols, research notes, implementation and final report
scripts/ data, training, serving, RAG, tools and evaluation code
tests/ deterministic unit and integration tests
configs/ DeepSpeed and service configuration
data/ tracked benchmark metadata and generated small artifacts
experiments/ immutable experiment records and conclusions
logs/ runtime outputs; ignored by Git
models/ model/adapters placeholders; large weights ignored
checkpoints/ training checkpoint placeholder; large files ignored
远程项目目录:
/public/home/mty/GeYugong/research-03-aiinfra
所有项目文件、环境和缓存必须位于 /public/home/mty/GeYugong/ 下。不得修改共享 conda 环境、其他项目、全局配置或归属未知的进程。停止服务前必须同时核验 PID、命令和 cwd。
仓库提交论文、代码、测试、小型数据、协议和实验结论;不提交模型权重、checkpoint、训练输出、原始数据和运行时日志。
私有远程仓库:
https://github.com/GeYugong/InfraGround_ser