Text Generation
Transformers
Safetensors
English
qwen3_5_text
code
codepin
code-localization
repository-search
software-engineering
supervised-fine-tuning
sft
qwen3.5
conversational
Eval Results (legacy)
Instructions to use LeeXugar/CodePin-SFT-Qwen3.5-0.8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LeeXugar/CodePin-SFT-Qwen3.5-0.8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LeeXugar/CodePin-SFT-Qwen3.5-0.8B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LeeXugar/CodePin-SFT-Qwen3.5-0.8B") model = AutoModelForCausalLM.from_pretrained("LeeXugar/CodePin-SFT-Qwen3.5-0.8B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LeeXugar/CodePin-SFT-Qwen3.5-0.8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LeeXugar/CodePin-SFT-Qwen3.5-0.8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LeeXugar/CodePin-SFT-Qwen3.5-0.8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LeeXugar/CodePin-SFT-Qwen3.5-0.8B
- SGLang
How to use LeeXugar/CodePin-SFT-Qwen3.5-0.8B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "LeeXugar/CodePin-SFT-Qwen3.5-0.8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LeeXugar/CodePin-SFT-Qwen3.5-0.8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "LeeXugar/CodePin-SFT-Qwen3.5-0.8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LeeXugar/CodePin-SFT-Qwen3.5-0.8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LeeXugar/CodePin-SFT-Qwen3.5-0.8B with Docker Model Runner:
docker model run hf.co/LeeXugar/CodePin-SFT-Qwen3.5-0.8B
| license: apache-2.0 | |
| license_link: https://huggingface.co/Qwen/Qwen3.5-0.8B/blob/main/LICENSE | |
| base_model: | |
| - Qwen/Qwen3.5-0.8B | |
| base_model_relation: finetune | |
| datasets: | |
| - LeeXugar/CodePin-SFT-Qwen3.5-35B-A3B | |
| language: | |
| - en | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: | |
| - code | |
| - codepin | |
| - code-localization | |
| - repository-search | |
| - software-engineering | |
| - supervised-fine-tuning | |
| - sft | |
| - qwen3.5 | |
| model-index: | |
| - name: CodePin-SFT-Qwen3.5-0.8B | |
| results: | |
| - task: | |
| type: text-generation | |
| name: Pure-text trajectory SFT | |
| dataset: | |
| name: CodePin-SFT-Qwen3.5-35B-A3B validation | |
| type: LeeXugar/CodePin-SFT-Qwen3.5-35B-A3B | |
| split: validation | |
| metrics: | |
| - type: loss | |
| value: 0.2157 | |
| name: Final evaluation loss | |
| # CodePin-SFT-Qwen3.5-0.8B | |
| `CodePin-SFT-Qwen3.5-0.8B` 是基于 [`Qwen/Qwen3.5-0.8B`](https://huggingface.co/Qwen/Qwen3.5-0.8B) 全参数微调的代码定位模型。它通过纯文本工具轨迹学习仓库搜索、文件阅读与证据归纳,面向大型代码仓库中的文件、类和函数定位。 | |
| [CodePin Collection](https://huggingface.co/collections/LeeXugar/codepin-6a8afa1064d9f83f9fce2982) · [SFT Dataset](https://huggingface.co/datasets/LeeXugar/CodePin-SFT-Qwen3.5-35B-A3B) · [SWE-smith Code Search](https://huggingface.co/datasets/LeeXugar/SWE-smith-code-search) | |
| ## Highlights | |
| - 5,676 条完整训练轨迹,最长 8,192 tokens;不使用会破坏工具调用闭环的硬截断。 | |
| - 4 × V100 32GB、FSDP FP16、全参数训练,共 710 optimizer steps / 20.49M 有效 tokens。 | |
| - 最终 train loss `0.1577`,validation loss `0.2157`;训练权重已通过 V100 加载、finite 检查和生成测试。 | |
| - 发布逐 step 指标、矢量图、训练配置与完整性验证,便于复核和二次分析。 | |
| ## Quick start | |
| 建议使用支持 Qwen3.5 的较新 `transformers` 版本。 | |
| ```python | |
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model_id = "LeeXugar/CodePin-SFT-Qwen3.5-0.8B" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| model_id, | |
| dtype=torch.float16, | |
| attn_implementation="sdpa", | |
| device_map="auto", | |
| ) | |
| messages = [{ | |
| "role": "user", | |
| "content": "Locate the files and functions that implement request authentication. Return concise evidence.", | |
| }] | |
| prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) | |
| inputs = tokenizer(prompt, return_tensors="pt").to(model.device) | |
| with torch.inference_mode(): | |
| output = model.generate(**inputs, max_new_tokens=512, do_sample=False) | |
| print(tokenizer.decode(output[0], skip_special_tokens=True)) | |
| ``` | |
| 模型训练目标包含工具语义,但权重本身不提供仓库访问能力。实际使用时需要接入与训练数据兼容的搜索、读取和结果提交工具,并对路径、权限与调用参数做隔离校验。 | |
| ## Training | |
| | Item | Configuration | | |
| |---|---| | |
| | Base model | `Qwen/Qwen3.5-0.8B` | | |
| | Dataset | `LeeXugar/CodePin-SFT-Qwen3.5-35B-A3B` | | |
| | Data | train 5,676 / 5,700;validation 294 / 300 | | |
| | Objective | 全部 assistant messages 的 causal LM loss | | |
| | Context | 最大 8,192 tokens,仅保留完整轨迹 | | |
| | Batch | microbatch 1/GPU,global batch 8 | | |
| | Optimizer | AdamW,peak LR `5e-5`,weight decay `0.01` | | |
| | Schedule | 71-step warmup + cosine decay | | |
| | Runtime | 4 × Tesla V100-PCIE-32GB,FSDP FP16 | | |
| | Training budget | 710 steps,20,487,244 effective tokens | | |
| 代码定位是多步行为任务:工具调用、返回结果和最终提交需要形成闭合轨迹,因此本次选择过滤超长样本,而不是在 8,192 tokens 处截断。对变长轨迹,样本数也不足以描述单步成本;本次 padded length 为 3,305–8,164,序列长度与 step time 的 Pearson `r=0.944`,说明训练预算与显存边界更适合用 token 数、最长序列和 padding efficiency 共同衡量。 | |
| 训练保留完整 Adam 状态和更新顺序;优化器状态的分层放置只改变张量驻留位置,不清空动量或二阶矩。导出时 token embedding 与 LM head 已物化为两组独立训练张量,因此配置明确使用 `tie_word_embeddings=false`,忠实保存最终训练状态。模型实际可加载参数量为 `1,006,672,704`。 | |
| ## Training dynamics | |
|  | |
| 710 个唯一成功 optimizer step 作为一条连续训练轨迹展示。前 50 步和后 50 步 loss 中位数分别为 `0.2919` 与 `0.1896`,下降 `35.0%`;gradient norm 在 warmup 初期达到峰值 `34.69`,后 50 步中位数稳定在 `1.31`。最终 train/eval loss 为 `0.1577/0.2157`,可支持“训练过程稳定且终点可用”的结论,但由于没有周期性 validation curve,不能据此断言最后一步是泛化最优 checkpoint。 | |
|  | |
| 本次 padded length 中位数为 `5,156`,共有 10 个 batch 达到或超过 7,500 tokens;每 GPU throughput 中位数为 `248.7 tokens/s`,non-padding ratio 中位数为 `68.7%`。长尾 batch 决定显存安全边界,而约 31% 的中位 padding 空间也表明下一轮最直接的优化是 length-aware bucketing 或动态 token-budget batching。这里的 loss 用于判断优化健康度;代码定位能力仍应在独立数据上报告 file/function Recall@k、工具调用成功率和轨迹完成率。 | |
| ## Artifacts | |
| | Path | Description | | |
| |---|---| | |
| | `model.safetensors` | 完整 HF 模型权重 | | |
| | `assets/*.png`, `assets/*.pdf` | 训练过程图及矢量版本 | | |
| | `training/sft_training_metrics.csv` | 710 steps 的逐步训练指标 | | |
| | `training/sft_training_summary.json` | 聚合统计与证据边界 | | |
| | `training/training_config.json` | 训练配置 | | |
| | `training/data_filter_summary.json` | 完整轨迹过滤结果 | | |
| | `training/final_hf_validation.json` | 权重加载与生成验证 | | |
| | `training/public_blob_validation.json` | 公开权重匿名回读验证 | | |
| | `scripts/gen_fig_sft_training_dynamics.py` | 图表与统计生成脚本 | | |
| ## Validation and integrity | |
| | File | Size | SHA-256 | | |
| |---|---:|---| | |
| | `model.safetensors` | 4,026,732,464 bytes | `d97009d9e41838a2eb8ce0e6275ac41cf80f1186915628f31662d3ba0b67e48e` | | |
| 最终模型在 Tesla V100 上以 FP16 加载,321 个 safetensors 张量全部为有限值,并通过 16-token greedy generation smoke test。发布后又在无 Hugging Face 凭据的条件下完整回读公开权重,重新计算的大小和 SHA-256 与上表一致。 | |
| ## Limitations | |
| - 数据由教师模型生成,可能继承其搜索偏好、冗余步骤与错误模式。 | |
| - 数据主要覆盖英文软件工程任务;其他语言和非代码领域不在目标分布内。 | |
| - 当前仅发布最终 validation loss,尚无独立下游代码定位 benchmark 结果。 | |
| - 输出不保证正确或可执行;真实仓库中的工具调用需要权限隔离与参数验证。 | |
| - 这是代码定位 SFT checkpoint,不是通用编程助手或自主代码修改系统。 | |
| ## License | |
| 模型权重继承 Qwen3.5 基座的 [Apache License 2.0](https://huggingface.co/Qwen/Qwen3.5-0.8B/blob/main/LICENSE)。训练数据和相关项目文件同时受各自来源的许可约束。 | |
| ## Acknowledgements | |
| [Qwen](https://huggingface.co/Qwen) · [Transformers](https://github.com/huggingface/transformers) · PyTorch FSDP · SkyRL | |