Skip to content
This repository was archived by the owner on Jun 30, 2026. It is now read-only.
This repository was archived by the owner on Jun 30, 2026. It is now read-only.

JSON issues with hallucinations and query rewrite intrinsics #255

Description

@kndtran

I'm encountering the follow JSON issues for the two intrinsics below. All are invalid JSON errors that occurs during Pydantic model validation.

  1. Hallucinations
    1. Unterminated string starting at...
    2. Expecting ',' delimiter ...
  2. Query Rewrite
    1. Invalid escape at line...
    2. control character found ...
    3. Invalid \uXXXX escape ... (opened an earlier issue Bug: Hallucinations intrinsic sometimes produces invalid unicode escape characters #249)

Both intrinsics have guided decoding and guided decoding is enabled by default in vLLM:

  1. Hallucinations
    "extra_body": {"guided_json": _MODEL_OUTPUT_SCHEMA},
  2. Query rewrite
    self._extra_body = {"guided_regex": _JSON_FENCE_REGEX}

These errors are also difficult to replicate consistently and occur after a few dozen instances of a benchmark run (even with temperature=0). OpenAI has stated that structured outputs can still contain mistakes and there are many similar questions on Google.

Possible workarounds:

  1. Catch the exceptions and regenerate until there are no more exceptions.
  2. Add more specific instructions to the intrinsic prompts.
  3. Train the intrinsics with additional data and prompts that targets the errors above.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions