Constrained generation always picks the first `anyOf` variant
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- swift
調査の方向性
Start in StructuredGeneration.swift at generateNode(_:) and compare its anyOf handling with itemStartTokens(for:), which already masks array-item start tokens. Trace how sampled tokens identify a variant, including nullable unions and variants with the same initial structure; done means constrained generation can select each anyOf branch rather than always using the first.
索引モデルが issue の本文から書いたものです。
説明
Local models that use constrained generation (MLX, Core ML, and llama.cpp) always generate the first variant of an anyOf schema, because generateNode(_:) in StructuredGeneration.swift takes variants[0]. So a nullable union like anyOf: [person, .null] (#288) can never produce null, and a union of object types always produces the first one.
The model should choose the branch. One approach is to mask the next token to the start tokens of every variant, as itemStartTokens(for:) already does for array items, and continue with the variant whose start tokens include the sampled token. Variants that start the same way, like two object types, would need to look ahead to the first key.
- 主要言語
- Swift
- スター
- 948
- フォーク
- 99
- 平均マージ
- 19時間 57分
- マージ済み PR(30日)
- 50
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
huggingface/AnyLanguageModel のほかの issue
-
OpenAILanguageModel replays tool-call arguments as GeneratedContent's Codable form, not JSON対応中かも @gtokman が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
huggingface/AnyLanguageModel#324 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 18/100
huggingface/AnyLanguageModel#328 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
huggingface/AnyLanguageModel#327 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 50/100
huggingface/AnyLanguageModel#326 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Support the Gemini Interactions API in GeminiLanguageModel対応中かも @rizwankce が 7 日前に担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
huggingface/AnyLanguageModel#302 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
huggingface/AnyLanguageModel の issue をすべて見る
似ている issue
-
builtin-port enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
cmlarsen/writemorebetter#235 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
callstack/agent-device#3627 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
maziyarpanahi/openmed#4207 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
open-telemetry/opentelemetry-swift#1235 · リアクション 1 件 ·
メンテナーはふだん 4 日以内に返信