You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
복잡도 분석(complexity-analysis) 정확도 개선 필요 — 유저 주석 판별 오작동 #30
Activity
fix: 복잡도 분석의 주석 귀속/유효성 판정 정확도 개선
fix: SYSTEM_PROMPT에 원문 복사/인용 체크/matches 엄격 판정 보강
lkhoony commentedon May 1, 2026
해결 진행 상황
30-big-o브랜치에 책임 분리(plan v4) 방식으로 수정 완료. 커밋01a449a.핵심 변경 — 책임 분리
기존(v3
9bb73b3)은 LLM 단독 책임이었으나, 4개 실패 모드(actualTime 역조작 / 한국어 문장 침투 / matches 오판 / 환각)가 반복 재현됨. 이를 코드와 LLM의 책임을 명확히 분리하여 구조적으로 차단:bigOEquals정규화 동등성)신규 코드 모듈 (
handlers/complexity-analysis.js)stripComplexityComments— LLM 호출 직전에 사용자 복잡도 주석을 빈 줄로 치환 → actualTime이 user값에 오염될 길 차단extractUserAnnotations(content, headerLine)— 헤더 라인 위쪽 연속 주석 블록에서O(...)리터럴만 추출. 클래스 wrapper(class X:,public class Y {,impl Z {)는 투명 통과bigOEquals— 공백 제거, ²→^2, **→^ 정규화 후 결정적 비교cleanBigO— 모델이 끼워넣는 부연 설명 제거 (예:O(n) (최악)→O(n))composeSolution— 모델 응답 + 원본 소스 → 최종 솔루션 객체 합성LLM 응답 스키마 변경
10필드 → 7필드. user-* / matches 4필드 제거하고
headerLine1필드 추가. SYSTEM_PROMPT 11.7KB → 2.0KB (83% 감소).추가로 발견된 모델 글리치 흡수
problemNametruncation (longest-...→long-...): 정확 일치 실패 시 인덱스로 폴백actualTime부연 설명 끼워넣기:cleanBigO가 정리실 API 검증 (
gpt-4.1-nano, 4 PR)PR #2544 (JS), #2566 (Python), #2572 (Java), #2577 (Rust) 로 실측.
19개 풀이 중 16개 완전 정확 (84%), 0개 오류 (100% 비-오류). 나머지 3개는 사용자가 본문 docstring 안에 작성한 케이스로, 권장 안내 메시지(💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요) 자동 표시.
호환성
<!-- dalestudy-complexity-analysis -->마커: 변경 없음gpt-4.1-nano,temperature=0.2,max_tokens=4000): 변경 없음analyzeComplexity): 변경 없음테스트
bun test handlers/complexity-analysis.test.js— 64 pass / 0 fail