[논문 리뷰] Context2Name: A Deep Learning-Based Approach to Infer Natural Variable Names from Usage Contexts
Context2Name은 토큰 기반 정적 분석에 시퀀스 오토인코더와 RNN을 결합하여 최소화된 JavaScript의 사용 맥락으로부터 자연스러운 변수 이름을 예측하고, 상당한 정확도와 속도를 달성합니다. 이는 JSNice 및 JSNaughty와 비교해 우수한 성능을 보이며 고유한 예측을 추가로 제공합니다.
Most of the JavaScript code deployed in the wild has been minified, a process in which identifier names are replaced with short, arbitrary and meaningless names. Minified code occupies less space, but also makes the code extremely difficult to manually inspect and understand. This paper presents Context2Name, a deep learningbased technique that partially reverses the effect of minification by predicting natural identifier names for minified names. The core idea is to predict from the usage context of a variable a name that captures the meaning of the variable. The approach combines a lightweight, token-based static analysis with an auto-encoder neural network that summarizes usage contexts and a recurrent neural network that predict natural names for a given usage context. We evaluate Context2Name with a large corpus of real-world JavaScript code and show that it successfully predicts 47.5% of all minified identifiers while taking only 2.9 milliseconds on average to predict a name. A comparison with the state-of-the-art tools JSNice and JSNaughty shows that our approach performs comparably in terms of accuracy while improving in terms of efficiency. Moreover, Context2Name complements the state-of-the-art by predicting 5.3% additional identifiers that are missed by both existing tools.
연구 동기 및 목표
- 압축된 JavaScript 코드의 가독성 문제를 의미 있는 변수 이름 추론으로 촉진하고 해결합니다.
- 무거운 언어 특정 프로그램 분석 없이 사용 맥락으로부터 자연스러운 이름을 예측하는 딥러닝 프레임워크를 개발합니다.
- 대규모 실제 JavaScript 말뭉치에서 경험적 효과성과 효율성을 입증하고 최첨단 도구들과 비교합니다.
제안 방법
- 각 축소된 이름 주위의 토큰 시퀀스로 사용 맥락을 추출한다.
- 토큰의 원-핫 인코딩을 통해 사용 맥락을 희소 벡터로 변환한다.
- 시퀀스 오토인코더로 맥락을 조밀한 임베딩으로 압축한다.
- 순환 신경망으로 후보 이름의 순위 목록을 출력하여 이름을 예측한다.
- 최종 코드에서 의미 보존 제약을 보장하며 예측된 이름을 탐욕적으로 할당한다.
실험 결과
연구 질문
- RQ1RQ1: Context2Name은 실제 세계의 JavaScript에서 축소된 변수와 함수에 대해 자연스러운 이름을 얼마나 효과적으로 예측할 수 있는가?
- RQ2RQ2: 정확도와 효율성 면에서 Context2Name은 JSNice와 JSNaughty와 어떻게 비교되는가?
- RQ3RQ3: 이 접근법은 대형 프로그램에 대해 효율적이고 확장 가능한가?
주요 결과
| 지표 | Context2Name | JSNice | JSNaughty | JSNaughty ∞ | 베이스라인 |
|---|---|---|---|---|---|
| Local-Once | 47.5% | 48.3% | 39.4% | 55.3% | 0.0% |
| Local-Repeat | 49.8% | 55.3% | 41.3% | 59.2% | 0.0% |
| All-Once | 55.4% | 56.0% | 47.7% | 61.9% | 15.0% |
| All-Repeat | 58.1% | 62.6% | 49.3% | 65.8% | 16.4% |
- Context2Name은 데이터세트에서 축소된 로컬 이름의 정확히 47.5%를 재현한다.
- Context2Name은 이름당 평균 2.9 ms, 파일당 평균 110.7 ms로 로컬 예측한다.
- JSNice와 JSNaughty에 비해 Context2Name은 비슷한 정확도에 더 높은 효율성을 달성한다.
- Context2Name은 JSNice와 JSNaughty 모두에 의해 누락된 5.3%의 추가 식별자를 회수한다.
- 이 접근법은 파일을 빠르게 처리하며 무거운 언어 특화 프로그램 분석에 의존하지 않는다.
더 나은 연구,지금 바로 시작하세요
연구 설계부터 논문 작성까지, 연구 시간을 획기적으로 줄여보세요.
카드 등록 없음 · 무료 플랜 제공
이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.