ShortCoder: 지식 기반 구문 최적화를 통한 토큰 효율적인 코드 생성
ShortCoder: Knowledge-Augmented Syntax Optimization for Token-Efficient Code Generation
코드 생성 작업은 사용자의 요구사항을 실행 가능한 코드로 자동 변환하여 수동 개발 노력을 줄이고 소프트웨어 생산성을 향상시키는 것을 목표로 합니다. 대규모 언어 모델(LLM)의 등장으로 코드 생성 분야가 크게 발전했지만, 여전히 고유한 아키텍처 제약으로 인해 효율성이 제한됩니다. 각 토큰 생성을 위해서는 전체 추론 과정을 거쳐야 하며, 이는 문맥 정보를 메모리에 지속적으로 유지해야 하므로 자원 소비가 증가합니다. 기존 연구에서는 프롬프트 압축 및 모델 양자화와 같은 추론 단계 최적화에 집중하는 반면, 생성 단계는 상대적으로 덜 연구되었습니다. 이러한 문제점을 해결하기 위해, 우리는 의미적 동등성과 가독성을 유지하면서 코드 생성 효율성을 최적화하는 지식 기반 프레임워크인 ShortCoder를 제안합니다. 특히, 다음과 같은 내용을 제안합니다: (1) AST(Abstract Syntax Tree) 보존 변환에서 파생된 10가지 Python 구문 수준 단순화 규칙을 적용하여 기능적인 손실 없이 18.1%의 토큰 감소를 달성합니다; (2) 규칙 기반 재작성 및 LLM 기반 개선을 통합한 하이브리드 데이터 합성 파이프라인을 통해 원래 코드와 의미적으로 일관된 단순화된 코드 쌍으로 구성된 데이터셋 ShorterCodeBench를 생성합니다; (3) 기본 LLM에 간결성 인식을 주입하는 미세 조정 전략을 사용합니다. 광범위한 실험 결과는 ShortCoder가 HumanEval 데이터셋에서 최첨단 방법보다 일관되게 우수한 성능을 보이며, 이전 방법보다 18.1%에서 37.8%까지 생성 효율성이 향상되는 것을 보여줍니다.
Code generation tasks aim to automate the conversion of user requirements into executable code, significantly reducing manual development efforts and enhancing software productivity. The emergence of large language models (LLMs) has significantly advanced code generation, though their efficiency is still impacted by certain inherent architectural constraints. Each token generation necessitates a complete inference pass, requiring persistent retention of contextual information in memory and escalating resource consumption. While existing research prioritizes inference-phase optimizations such as prompt compression and model quantization, the generation phase remains underexplored. To tackle these challenges, we propose a knowledge-infused framework named ShortCoder, which optimizes code generation efficiency while preserving semantic equivalence and readability. In particular, we introduce: (1) ten syntax-level simplification rules for Python, derived from AST-preserving transformations, achieving 18.1% token reduction without functional compromise; (2) a hybrid data synthesis pipeline integrating rule-based rewriting with LLM-guided refinement, producing ShorterCodeBench, a corpus of validated tuples of original code and simplified code with semantic consistency; (3) a fine-tuning strategy that injects conciseness awareness into the base LLMs. Extensive experimental results demonstrate that ShortCoder consistently outperforms state-of-the-art methods on HumanEval, achieving an improvement of 18.1%-37.8% in generation efficiency over previous methods while ensuring the performance of code generation.
No Analysis Report Yet
This paper hasn't been analyzed by Gemini yet.
Log in to request an AI analysis.