Function Calling / Tool Use formatting issue: Model hallucinates `<tool_call>` XML tags instead of native JSON

#7
by Ats-F - opened

Model: LFM2-24B-A2B-Q6_K.gguf
Environment: Roo Code (VS Code Extension) -> LM Studio (OpenAI Compatible API) -> Lfm2
Architecture context from logs: general.architecture = lfm2moe

Description:
I am evaluating Lfm2-24B-a2b for use in an autonomous coding agent environment (Roo Code). While the model demonstrates excellent reasoning capabilities, it consistently fails to properly utilize the standard OpenAI-compatible function calling mechanism.

When the /v1/chat/completions endpoint is hit with a defined tools array, the model does not trigger a native tool_calls object. Instead, it responds with plain text and hallucinates custom XML-like tags to invoke tools.

Steps to Reproduce & Observed Behavior:

  1. Send a request to the model with a tools array containing JSON schemas for various tools (e.g., attempt_completion, list_files).
  2. Instruct the model to use a tool to complete the task.
  3. Expected: The API returns a tool_calls array with a valid JSON object.
  4. Actual: The API returns standard text content containing hallucinated tags like this:
<tool_call>
{"name": "attempt_completion", "arguments": {"result": β€œI have displayed the list of top-level folders. The task is complete.”}}
</tool_call>

This causes a continuous error loop with the agent (Roo Code), which strictly expects native tool calls and replies with: [ERROR] You did not use a tool in your previous response! Please retry with a tool use.

LM Studio Log Snippet (Request containing tools):

Received request: POST to /v1/chat/completions with body {
  "model": "liquid/lfm2-24b-a2b",
  "messages": [ ... ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "attempt_completion",
        "description": "After each tool use...",
        "parameters": { ... }
      }
    }
  ],
  "tool_choice": "auto"
}

Questions for the Team:

  1. Does Lfm2-24B-a2b require a specific Jinja prompt template or special tokens to correctly format JSON function calling?
  2. If this is a known limitation of the current instruction tuning, are there plans to align the tool-calling format with industry standards (e.g., Llama 3 or Qwen formats) in future updates?

Thank you for your hard work on this impressive model.

Sign up or log in to comment