A Matter of Representation: Towards Graph-Based Abstract Code Generation
Iskandar, Bedri, Tsen
Most large language models (LLMs) today excel at generating raw, sequential code with minimal abstractions and custom structures. However, there has been little work on graph-based abstract code generation, where significant logic is encapsulated in predefined nodes and execution flow is determined by edges. This is relevant for visual programming languages, and in cases where raw source code is inaccessible to users and LLM training sets. In this work, we propose and evaluate JSON representations for graphs to enable high accuracy graph-based abstract code generation. We evaluate these representations on ScratchTest, a mini-benchmark based on our custom Python re-implementation of Scratch, which tests the LLM in code graph space. Our findings demonstrate that LLMs can indeed perform the aforementioned generation task in a single pass without relying on specialized or complex pipelines, given the correct graph representations. We also show that different representations induce significantly different accuracies, highlighting the instrumental role of representations in this generation task. All in all, this work establishes the first steps towards representation learning for graph-based abstract code generation.
현재 대부분의 대규모 언어 모델(LLMs)은 원시적이고 순차적인 코드 생성에 탁월하지만, 그래프 기반 추상 코드 생성 연구는 매우 부족하다. 그래프 기반 추상 코드는 중요한 로직을 사전 정의된 노드에 캡슐화하고, 엣지를 통해 실행 흐름을 결정한다. 이러한 코드 형식은 시각적 프로그래밍 언어에서 일반적이며, 원본 소스 코드에 사용자와 LLM 훈련 세트가 접근할 수 없는 경우에도 중요하다. 본 논문은 그래프의 JSON 표현 방법을 제안하고 평가하여 높은 정확도의 그래프 기반 추상 코드 생성을 실현한다. 저자들은 Scratch의 Python 재구현을 기반으로 한 소규모 벤치마크인 ScratchTest에서 이러한 표현 방법들을 평가한다. 연구 결과, 올바른 그래프 표현 하에서 LLMs는 전문화되거나 복잡한 파이프라인에 의존하지 않고 단일 생성으로 위 작업을 완료할 수 있음을 발견했다. 서로 다른 표현 방법은 현저히 다른 정확도를 초래하며, 이는 이 생성 작업에서 표현의 핵심적 역할을 강조한다.
논문은 54개의 관련 문헌을 인용하며, LLM 코드 생성, 그래프 신경망, 시각적 프로그래밍 언어 등 여러 분야의 중요한 연구를 포함하여 연구에 견고한 이론적 기초를 제공한다.
종합 평가: 이는 그래프 기반 추상 코드 생성 문제를 처음으로 체계적으로 해결한 개척적 연구이다. 평가 방법 및 이론적 분석 측면에서 개선의 여지가 있지만, 제안된 표현 방법이 단순하고 효과적이며 이 새로운 연구 방향의 중요한 기초를 마련했다. 본 연구는 강한 실용적 가치와 영감을 제공하며, 관련 분야의 추가 발전을 촉진할 것으로 예상된다.