不依赖标注数据,用大模型内部信号自动生成代码
UCoder: Unsupervised Code Generation by Internal Probing of Large Language Models
- 通过探测模型内部状态提取代码质量信号
- 自一致性机制筛选可靠代码,训练出无监督代码生成器
- 适合资源受限场景下代码模型的高效训练
大型语言模型在代码生成任务中表现卓越,但其性能高度依赖于大量有标注(如问答对)或无标注数据(如代码片段),而这些数据往往难以大规模获取且成本高昂。为解决此问题,本文提出 IPC 框架——一种无需外部语料库(包括无标注代码片段)的无监督代码生成方法。通过引入问题空间探测、测试理解探测、解空间探测与知识强化整合,系统性地挖掘大模型内部的知识分布与置信度模式。进一步利用自一致性机制和基于表示的质量估计,筛选出可靠的代码候选,用于训练 UCoder(无监督学习的代码生成器)。在多个代码基准测试中验证表明,该方法在性能上可媲美有监督方法,同时显著降低对标注数据与计算资源的依赖。分析实验显示,模型内部状态蕴含丰富的代码质量与正确性信号,合理利用这些信号可实现高效的无监督代码生成,为资源受限场景下的代码大模型训练开辟新路径。
原文摘要 · Abstract (English)
Large language models (LLMs) have demonstrated remarkable capabilities in code generation tasks. However, their effectiveness heavily relies on supervised training with extensive labeled (e.g., question-answering pairs) or unlabeled datasets (e.g., code snippets), which are often expensive and difficult to obtain at scale. To address this limitation, this paper introduces a method IPC, an unsupervised framework that leverages Internal Probing of LLMs for Code generation without any external corpus, even unlabeled code snippets. We introduce the problem space probing, test understanding probing, solution space probing, and knowledge consolidation and reinforcement to probe the internal knowledge and confidence patterns existing in LLMs. Further, IPC identifies reliable code candidates through self-consistency mechanisms and representation-based quality estimation to train UCoder (coder with unsupervised learning). We validate the proposed approach across multiple code benchmarks, demonstrating that unsupervised methods can achieve competitive performance compared to supervised approaches while significantly reducing the dependency on labeled data and computational resources. Analytic experiments reveal that internal model states contain rich signals about code quality and correctness, and that properly harnessing these signals enables effective unsupervised learning for code generation tasks, opening new directions for training code LLMs in resource-constrained scenarios.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。