프로필

설정

불러오는 중…

← 홈

도움말·문의

자주 묻는 질문

어떤 기능에 로그인이 필요한가요?

공개 논문의 해설과 논문 정보, 모델 구조, 관련 논문, 용어는 로그인 없이 볼 수 있습니다. 논문 올리기, 내 보관함, 읽기 기록, 논문 평가, 관심 분야 추천, 메일과 알림은 로그인해야 쓸 수 있습니다.

PDF 파일로도 올릴 수 있나요?

논문은 arXiv나 DOI 링크로 올리고, 해설은 모두에게 공개됩니다. 출처와 이용 조건이 확인되지 않아 해설을 공개할 수 없는 논문은 올릴 수 없습니다. PDF 파일 올리기와 나만 보기는 구독 회원만 쓸 수 있고, 파일로 올린 논문은 나만 보기로만 저장합니다. 제목으로 공식 정보를 찾는 검색은 버튼을 누를 때만 합니다.

그림과 AI 해설은 정확한가요?

그림은 논문 원본만 쓰고 이용 허락이 확인된 것만 보여 줍니다. 해설은 AI가 쓴 글이라 틀릴 수 있습니다. 중요한 주장과 수치, 그림의 맥락은 원문 근거로 확인해 주세요.

저작권 문제를 알리고 싶어요.

이용 조건과 원문 출처는 논문 정보 탭에 있습니다. 문제가 있으면 ‘문의하기’에서 ‘논문 내용·그림·저작권’을 골라 논문 링크와 문제가 되는 부분, 권리를 확인할 수 있는 근거를 보내 주세요. 접수만으로 권리가 확정되거나 바로 삭제되지는 않습니다. 검토 결과는 ‘내 문의’에서 볼 수 있습니다.

비밀번호를 잊었어요.

이메일로 가입했다면 로그인 창의 비밀번호 찾기에서 인증한 이메일로 다시 설정할 수 있습니다. Google, 네이버, 카카오로 가입했다면 그 서비스에서 비밀번호를 바꿔 주세요.

문의할 때 무엇을 적어야 하나요?

어느 화면에서 무엇을 하다 생긴 문제인지 논문 링크와 함께 적어 주세요. 비밀번호, API 키, 인증 코드, 전화번호 같은 개인정보는 적지 마세요. 문의와 답변은 Refivu에 저장되고 ‘내 문의’에서 볼 수 있습니다.

회원탈퇴는 어떻게 하나요?

설정의 내 계정에서 회원탈퇴를 누르세요. 지워지는 내용을 확인하고 본인 확인을 마치면 탈퇴됩니다. 다른 요청은 ‘문의하기’에서 ‘계정’을 골라 남겨 주세요.

논문 해설

Earley-Driven Dynamic Pruning for Efficient Structured Decoding

효율적인 구조화 디코딩을 위한 Earley 기반 동적 가지치기

  • 연구 문제 제약 디코딩에서 Earley 파서가 만드는 무효·중복 상태는 메모리와 캐시 효율을 떨어뜨립니다.
  • 연구 방법 ZapFormat은 의존성 그래프와 도달 가능성으로 활성 항목 집합을 계산하고, compact 연산으로 필요 없는 Earley 항목을 디코딩 중 실시간으로 제거합니다.
  • 주요 결과 Formatron은 표 1에서 Gemma의 JSON Schema 처리량을 XGrammar 1473.99보다 높은 7943.34 tokens/s로 보고하며, pruning 제거 변형은 여러 조건에서 처리량이 낮게 측정됩니다.

제약 디코딩의 메모리 부담

문맥 자유 문법으로 LLM 출력을 제한하는 제약 디코딩은 매 디코딩 단계마다 어휘 전체의 토큰이 문법에 맞는지 검사하고, 그 결과로 로짓 마스크를 만듭니다. 이때 파서는 여러 파싱 상태를 저장하고 갱신해야 합니다. 더 이상 유효한 파싱 경로에 기여하지 않는 상태가 쌓이면 메모리 사용과 캐시 미스가 늘고 디코딩이 느려집니다. 이 논문은 이런 상태를 실시간으로 찾아 제거하는 ZapFormat을 다루며, 이를 구현하고 기존 최적화를 통합한 제약 디코딩 엔진 Formatron을 함께 보고합니다. 연구 범위는 JSON 생성, JSON Schema 검증, 의미 파싱 과제에서 처리량과 메모리 사용량을 측정하는 것입니다.

Figure 2: Constrained decoding. Constrained decoding can be
achieved by masking the illegal tokens at the current step

Figure 2 . Constrained decoding. Constrained decoding can be achieved by masking the illegal tokens at the current step.

원문 · CC BY 4.0 · Xintong Sun, Chi Wei, Minghao Tian, Shiwen Ni · Earley-Driven Dynamic Pruning for Efficient Structured Decoding · 원문 그림 인용 · 원본 PDF 4쪽에서 그림 영역을 추출했습니다.

Earley 파싱과 상태 집합

Earley 알고리즘은 입력의 각 위치 i마다 상태 집합 S[i]를 만들고, 그 안에 Earley 항목을 담습니다. 항목은 규칙의 점 위치와 규칙이 시작된 위치 j를 함께 기록하며, 예측, 스캔, 완료의 세 연산으로 집합을 채웁니다. 예측은 점 뒤의 비단말 기호에 해당하는 규칙을 추가합니다. 스캔은 점 뒤의 단말 기호가 입력과 맞을 때 점을 넘긴 항목을 다음 집합에 넣습니다. 완료는 끝까지 파싱된 항목을 이용해 그 기호를 기다리던 상위 항목을 전진시킵니다. 완료 단계에서 역추적을 하려면 이전 집합을 대체로 보관해야 하므로, 더 이상 참조되지 않는 항목도 남기 쉽습니다.

Figure 1: Early parse. This diagram provides a detailed illustration
of the Earley parsing process for the input string ’a + d’ based on
the grammar S → A + B,…

Figure 1 . Early parse. This diagram provides a detailed illustration of the Earley parsing process for the input string ’a + d’ based on the grammar S → A + B, A→ a|c, B→ b|d. In the diagram, red arrows indicate Predict operations; yellow arrows represent Scan operations; and green arrows denote Complete operations.

원문 · CC BY 4.0 · Xintong Sun, Chi Wei, Minghao Tian, Shiwen Ni · Earley-Driven Dynamic Pruning for Efficient Structured Decoding · 원문 그림 인용 · 원본 PDF 3쪽에서 그림 영역을 추출했습니다.

의존성 그래프와 활성 항목 집합

ZapFormat은 Earley 항목을 (A → α • β, i, j) 형태로 확장해 규칙, 점 위치, 입력 구간을 함께 다룹니다. 예측, 스캔, 완료 각각에서 새로 만들어진 항목이 원래 항목에 의존하는 관계를 정의하고, 이를 정점과 간선으로 이루어진 방향 그래프에 기록합니다. 간선 (x, y)는 y가 x에 의존한다는 뜻입니다. 활성 항목 집합은 도달 가능한 항목들의 합집합으로 정의되며, 이 집합에 속하지 않는 항목은 더 이상 유효한 파싱에 기여하지 않는다고 판단됩니다. 원문은 도달 대상을 마지막 Earley 집합의 항목으로 설명하고, 활성 집합을 적는 식에서는 V의 항목 a에 대한 합집합으로 씁니다.

두 설명이 같은 대상을 가리키는지는 이 절에서 원문 표기 그대로 확인해야 합니다.

compact 연산과 실시간 가지치기

ZapFormat은 완료 단계 이후이고 다음 예측 단계 이전에 compact 연산을 넣습니다. 이 연산은 현재 집합의 각 항목이 활성 항목 집합에 속하는지 검사하고, 속하지 않는 항목을 제거합니다. 예측으로 새로 만든 항목은 직전 집합의 항목에만 의존하므로 이 순서에서는 불필요한 계산이 줄어듭니다. 활성 집합은 완료와 compact 뒤에 점진적으로 갱신되어 전체 항목 집합을 매번 다시 탐색하지 않습니다. 저자들은 이 방식이 파싱 정확성을 유지하면서 처리할 항목 수를 줄인다고 설명합니다. 다만 정확성 보장은 원문이 이론적 완전성으로 주장하는 내용이며, 본문에서 이를 뒷받침하는 형식적 증명은 제시되지 않습니다.

Figure 3: Dynamic pruning. Red parts indicate prunable nodes,
and green dashed lines represent Complete dependency paths.
First,already completed Earley items…

Figure 3 . Dynamic pruning. Red parts indicate prunable nodes, and green dashed lines represent Complete dependency paths. First,already completed Earley items only lead to modifications on their residing Earley set. Once their residing Earley set is fully processed, we can remove them. In addition, after one Earley set is fully processed, if an Earley set is not referenced by the union of reference chains of all items in the last Earley set, then it can be removed.

원문 · CC BY 4.0 · Xintong Sun, Chi Wei, Minghao Tian, Shiwen Ni · Earley-Driven Dynamic Pruning for Efficient Structured Decoding · 원문 그림 인용 · 원본 PDF 6쪽에서 그림 영역을 추출했습니다.

토큰 마스크 캐시와 거부 접두사

Formatron은 문맥 독립 토큰의 유효성을 터미널별로 미리 계산해 비트셋으로 저장하고, 실행 시에는 캐시에서 바로 가져옵니다. 이 방식은 XGrammar의 문맥 독립 토큰 마스크 캐시에서 영감을 받았지만, 불가능 토큰을 판정할 때 터미널의 가능한 접미사 문자열을 고려하지 않아 사전 계산 시간을 줄입니다. 한 상태에 후위 터미널이 여러 개 있으면 각 마스크를 하나의 최종 토큰 마스크로 합칩니다. 거부 접두사 최적화는 문법적으로 불가능한 최소 바이트 접두사를 집합으로 유지하며, 입력에서 이런 접두사가 나타나면 그 확장들을 상태 탐색 없이 버립니다. 저자들은 서로 다른 입력 토큰 시퀀스가 같은 가지치기 상태에 대응할 수 있어 상태 캐시의 적중률이 높아진다고 해석합니다.

처리량 비교와 과제별 결과

실험은 NVIDIA GeForce RTX 3090과 AMD EPYC 7452 환경에서 Gemma, Llama3, Mistral, Qwen 네 모델을 FP16으로 실행해 측정했습니다. 비교 기준은 lm-format-enforcer, Outlines, XGrammar이며, Outlines는 정규 제약 중심이어서 JSON Grammar 과제에는 적용되지 않습니다. 표 1에서 Gemma의 JSON Schema 처리량은 XGrammar 1473.99 tokens/s에 비해 Formatron 7943.34 tokens/s로 보고됩니다. 대부분의 과제에서 Formatron의 값이 높지만, 저자들은 Gemma의 geoquery와 Mistral의 Json s에서 XGrammar가 더 우세하다고 서술합니다.

그런데 표 1의 Mistral Json s 값은 XGrammar 8421.43, Formatron 10639.87이므로 본문 서술과 표 값이 엇갈립니다. 초록에 보고된 최대 2배 속도 향상은 이 비교 범위와 조건에서 읽어야 합니다.

Table 1: Comparative Throughput Performance of Different Meth-
ods in Constraint Parsing Tasks (tokens/s). Here, ‘-‘ indicates that
the method is not applicabl…

Table 1 . Comparative Throughput Performance of Different Meth- ods in Constraint Parsing Tasks (tokens/s). Here, ‘-‘ indicates that the method is not applicable to the task, and bold indicates the best result. All experimental results were obtained in the same local environment. lm-format represents lm-format-enforcer. Json s represents Json Scheam and Json g represents Json Grammar.

원문 · CC BY 4.0 · Xintong Sun, Chi Wei, Minghao Tian, Shiwen Ni · Earley-Driven Dynamic Pruning for Efficient Structured Decoding · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.

반복 실행과 제거 실험

Json Schema 과제에서는 1, 3, 5, 10회 실행 설정을 두었고, 데이터 증강에 LLM을 사용했습니다. 표 2에서 Gemma의 Formatron은 3회, 5회, 10회 실행에서 10609.08, 11323.63, 11993.89 tokens/s로 보고되며, 같은 조건의 XGrammar는 1500 tokens/s대 후반에 머뭅니다. 절제 실험에서 Formatron의 pruning을 제거한 변형은 Gemma에서 3회, 5회, 10회 실행 기준 6981.35, 6628.69, 7674.78 tokens/s로 낮게 측정됩니다. 본문은 pruning 제거 시 처리량이 30-50% 감소한다고 요약하지만, 이는 여러 모델과 실행 조건을 묶은 요약입니다.

모든 조건에서 확정된 수치로 읽으면 안 됩니다. Mistral의 3회 실행에서는 pruning 제거 변형이 9727.00 tokens/s로 Formatron 13522.77 tokens/s보다 낮습니다.

Table 2: Throughput Comparison of Different Models and Meth-
ods Across Multiple Runs. lm-format represents lm-format-
enforcer

Table 2 . Throughput Comparison of Different Models and Meth- ods Across Multiple Runs. lm-format represents lm-format- enforcer.

원문 · CC BY 4.0 · Xintong Sun, Chi Wei, Minghao Tian, Shiwen Ni · Earley-Driven Dynamic Pruning for Efficient Structured Decoding · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.

메모리 사용량과 출력 품질

최대 메모리 사용량 실험은 제약 디코딩 중 측정한 값이며 모델 전체의 메모리 크기가 아닙니다. Llama3에서 Formatron은 1635.92 MB, pruning을 제거한 변형은 1655.48 MB이고, Mistral에서는 각각 1519.09 MB와 1530.77 MB로 보고됩니다. 이 측정은 Llama3와 Mistral에만 있으며 Gemma와 Qwen의 메모리 값은 이 표에 없습니다. 출력 품질은 부록 B.2의 정확도 표로 따로 확인합니다. JSON schema 과제에서 Llama3의 baseline은 0.47이고 Formatron은 0.67입니다. Mistral의 baseline은 0.09이고 Formatron은 0.52입니다.

JSON grammar 과제에서는 Llama3의 Formatron 값이 0.48, Mistral의 Formatron 값이 0.11입니다. 이 결과는 처리량 실험과 별도 보조 실험에서 얻은 것입니다.

Table 4: Maximum memory usage comparison during constrained
decoding

Table 4 . Maximum memory usage comparison during constrained decoding.

원문 · CC BY 4.0 · Xintong Sun, Chi Wei, Minghao Tian, Shiwen Ni · Earley-Driven Dynamic Pruning for Efficient Structured Decoding · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.
Table 7: Accuracy comparison across different models and methods for JSON schema and grammar tasks

Table 7 . Accuracy comparison across different models and methods for JSON schema and grammar tasks

원문 · CC BY 4.0 · Xintong Sun, Chi Wei, Minghao Tian, Shiwen Ni · Earley-Driven Dynamic Pruning for Efficient Structured Decoding · 원문 그림 인용 · 원본 PDF 14쪽에서 그림 영역을 추출했습니다.

적용 범위와 남은 질문

주요 처리량 측정은 파싱과 마스크 생성 단계에 초점을 둔 결과입니다. 전체 파이프라인 처리량은 부록 B.1에서 JSON 객체 수 기준으로 따로 보고되며, 여기서 Gemma의 Formatron은 제약 없는 기준 18.16에 비해 18.02로 근접합니다. Outlines는 정규 문법 중심이며 문맥 자유 문법을 직접 지원하지 않는다고 원문이 밝힙니다. 메모리 절감은 Llama3와 Mistral에서만 측정되었고, 정확도 보조 실험도 제한된 모델과 과제에서 수행되었습니다. 따라서 이 결과를 모든 LLM 구조, 모든 문법, 모든 하드웨어로 넓히는 것은 근거가 부족합니다.

Table 6: Throughput comparison for parsing and masking stages across different models and methods (JSON objects per second)

Table 6 . Throughput comparison for parsing and masking stages across different models and methods (JSON objects per second)

원문 · CC BY 4.0 · Xintong Sun, Chi Wei, Minghao Tian, Shiwen Ni · Earley-Driven Dynamic Pruning for Efficient Structured Decoding · 원문 그림 인용 · 원본 PDF 14쪽에서 그림 영역을 추출했습니다.

논문 정보

저자
Xintong Sun, Chi Wei, Minghao Tian, Shiwen Ni
학회·저널
arXiv · 프리프린트
최초 공개일
2025년 6월 1일
등록일
2026년 10월 29일
수정일
2025년 6월 1일
버전
v1
arXiv
2506.01151
분류
cs.LG · cs.AI · cs.CL
원문 이용 조건
CC BY 4.0
제공 범위
논문 정보, 해설, 허용된 원문 그림

AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.

초록

Large Language Models (LLMs) have shown remarkable capabilities, yet ensuring their outputs conform to strict structural or grammatical constraints remains challenging, which is critical in function calls and domain-specific language (DSL) generation. Constrained decoding with context-free grammar is a flexible approach to guarantee LLMs' adherence to a specific format by dynamically building a token logits mask. However, creating this mask requires checking the validity of all tokens in the LLM vocabulary at every decoding step, which often incurs significant overheads in existing constrained decoding engines. To address this challenge, we propose $\textbf{ZapFormat}$, a novel $\textbf{dynamic pruning}$ strategy based on the Earley algorithm that identifies and eliminates invalid or redundant Earley states in real-time, significantly reducing memory occupation of the Earley algorithm's states. This further enables us to use a state cache to speed up structured generations on a large number of queries. We implemented ZapFormat in a new constrained decoding engine called Formatron which also incorporates existing optimizations. Through comprehensive experiments on structured generation tasks, including JSON generation, JSON Schema validation, and semantic parsing, we demonstrate that Formatron not only $\textbf{consistently maintains}$ high-precision compliant outputs but also achieves $\textbf{significant improvements}$ in inference speed up to 2x compared to state-of-the-art implementations. More importantly, Formatron is generally applicable across various LLM architectures. We release Formatron as open source at https://github.com/Dan-wanna-M/formatron.

원문 인용

Xintong Sun, Chi Wei, Minghao Tian, Shiwen Ni (2025). Earley-Driven Dynamic Pruning for Efficient Structured Decoding. arXiv:2506.01151v1. https://arxiv.org/abs/2506.01151v1

BibTeX
@misc{sun2025earley,
  title = {{Earley-Driven Dynamic Pruning for Efficient Structured Decoding}},
  author = {Xintong Sun and Chi Wei and Minghao Tian and Shiwen Ni},
  year = {2025},
  eprint = {2506.01151},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.01151v1}
}

관련 논문 보기다른 논문 둘러보기

논문 미리 보기
계정 보안

Google 계정 연결

Google 계정을 연결하면 그 계정으로도 로그인할 수 있습니다.

Refivu

회원탈퇴

Refivu
Refivu

회원가입