Skip to content

Misc. bug: QwQ 32B doesn't put the reasoning content in message.reasoning_content #12275

Closed
@henryclw

Description

@henryclw

Name and Version

ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
ggml_cuda_init: found 1 CUDA devices:
Device 0: NVIDIA GeForce RTX 3090, compute capability 8.6, VMM: yes
version: 4885 (b1026e0)
built with cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 for x86_64-linux-gnu

Operating systems

Linux

Which llama.cpp modules do you know to be affected?

llama-server

Command line

curl --location 'http://localhost:8080/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer no-key' \
--data '{
    "messages": [
        {
            "role": "user",
            "content": "What'\''s the biggest prime under 80?"
        }
    ],
    "n_predict": -1
}'

Problem description & steps to reproduce

When using the file QwQ-32B-Q4_K_M.gguf, response is

{
    "choices": [
        {
            "finish_reason": "stop",
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "<think>Okay, so I need to find the largest prime number that's less than 80. Hmm, primes are numbers greater than 1 that have no divisors other than 1 and themselves. Let me start by recalling the prime numbers I know. The primes under 100 are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, etc. Wait, so maybe 79 is a prime? Let me check that.\n\nFirst, let me confirm if 79 is prime. To do that, I need to see if any numbers less than its square root divide it evenly. The square root of 79 is approximately 8.888, so I only need to check divisibility by primes up to 8. The primes less than or equal to 8 are 2, 3, 5, and 7.\n\nTesting 79 divided by 2: 79 ÷ 2 = 39.5. Not an integer, so 2 is not a divisor.\n\n79 divided by 3: 79 ÷ 3 ≈ 26.333. Again, not an integer. 3 doesn't divide it.\n\n79 divided by 5: 79 ÷ 5 = 15.8. Nope, that's not an integer either.\n\n79 divided by 7: 79 ÷ 7 ≈ 11.2857. Still not an integer. So none of these primes divide 79, which means 79 is indeed a prime number. Since 79 is less than 80, that might be the answer. But just to be thorough, let me check the next number below 79, which is 78. But 78 is even, so it's divisible by 2. Not a prime. Then 77. 77 divided by 7 is 11, so 7×11=77, which means it's composite. 76 is even, 75 is divisible by 5, 74 is even, 73... Hmm, 73. Let me check if 73 is a prime too.\n\nSquare root of 73 is about 8.544, so again check primes up to 7. 73 divided by 2? 36.5, nope. 3? 73 ÷3 ≈24.333, no. 5? Ends with 3, so no. 7? 73 ÷7≈10.428, not an integer. So 73 is also a prime. But since 79 is higher than 73 and is still under 80, 79 is the bigger one. \n\nContinuing down, 72 is even, 71 is next. Let me check 71. Square root is about 8.43, so same primes. 71 divided by 2? 35.5, no. 3? 71/3 ≈23.666, nope. 5? No. 7? 71/7≈10.142, not integer. So 71 is also prime, but again, 79 is larger. \n\nSo moving down from 80, the numbers are 79, 78, 77, etc., and the first prime we hit is 79, which seems to be prime. Let me just confirm once more with another method. Maybe I can use the sieve of Eratosthenes in my head. Let's list numbers from 1 to 80 and cross out non-primes. But that might take too long. Alternatively, since I know primes up to 100, I can just recall the list. \n\nAlternatively, maybe I made a mistake in calculating the square root? Let me verify sqrt(79). 8 squared is 64, 9 squared is 81. So sqrt(79) is between 8 and 9, so yeah, 8.88. So primes up to 8, which are 2,3,5,7. So my check is sufficient. \n\nTherefore, the largest prime under 80 is 79. Wait, but hold on, is there a prime between 79 and 80? Well, 80 itself is not prime, so the next one below is 79. Therefore, I think that is the answer. Let me just check another number like 77, which I know is 7×11, so composite. 75 is 15×5, 70 is 7×10, so all those are composite. \n\nAlternatively, maybe I missed a prime between 70 and 80? Let's list them out:\n\n71, 73, 74 (no), 75 (no), 76 (no), 77 (no), 78 (no), 79. So between 70 and 80, primes are 71,73,79. So 79 is the largest. \n\nTherefore, I think 79 is the correct answer. \n\nWait, just to be absolutely sure, let me try dividing 79 by 7 again. 7*11 is 77, 7*12 is 84, so 7*11 is 77. So 79-77 is 2. So 7*11 +2=79, so no, 7 doesn't divide it. 5? 5*15 is 75, plus 4 is 79, so no. 3? 3*26=78, plus 1 is 79, so remainder 1. 2? It's odd, so no. \n\nYep, 79 is prime. Therefore, the biggest prime under 80 is 79.\n\n**Final Answer**\nThe biggest prime under 80 is \\boxed{79}.\n</think>\n\nTo find the largest prime number under 80, we start by checking the number 79. \n\n1. **Check divisibility by primes up to the square root of 79** (approximately 8.888):\n   - 79 is not divisible by 2 (79 ÷ 2 = 39.5)\n   - 79 is not divisible by 3 (79 ÷ 3 ≈ 26.333)\n   - 79 is not divisible by 5 (79 ÷ 5 = 15.8)\n   - 79 is not divisible by 7 (79 ÷ 7 ≈ 11.2857)\n\nSince 79 is not divisible by any of these primes, it is a prime number.\n\n2. **Check numbers below 79**:\n   - 78 is even (divisible by 2)\n   - 77 is divisible by 7 and 11\n   - 76 is even\n   - 75 is divisible by 5\n   - 74 is even\n   - 73 is a prime but less than 79\n   - 71 is a prime but less than 79\n\nThus, the largest prime number under 80 is confirmed to be 79.\n\n\\[\n\\boxed{79}\n\\]"
            }
        }
    ],
    "created": 1741471076,
    "model": "gpt-3.5-turbo",
    "system_fingerprint": "b4885-b1026e09",
    "object": "chat.completion",
    "usage": {
        "completion_tokens": 1686,
        "prompt_tokens": 20,
        "total_tokens": 1706
    },
    "id": "chatcmpl-cWwKnQVcsMhlvpCEeV4kEhWWaVlVQ4fY",
    "timings": {
        "prompt_n": 20,
        "prompt_ms": 549.747,
        "prompt_per_token_ms": 27.48735,
        "prompt_per_second": 36.38037133445022,
        "predicted_n": 1686,
        "predicted_ms": 92042.141,
        "predicted_per_token_ms": 54.5920172004745,
        "predicted_per_second": 18.3176964560179
    }
}

When using the file DeepSeek-R1-Distill-Qwen-32B-Q4_K_M.gguf, response is

{
    "choices": [
        {
            "finish_reason": "stop",
            "index": 0,
            "message": {
                "role": "assistant",
                "reasoning_content": "To find the biggest prime number under 80, I'll start by listing the numbers just below 80 and work my way down until I find a prime.\n\nFirst, I'll check 79. To determine if it's prime, I need to see if it has any divisors other than 1 and itself. I'll test divisibility by prime numbers less than its square root. The square root of 79 is approximately 8.89, so I'll check primes up to 7.\n\n79 divided by 2 is not an integer, so it's not divisible by 2. Similarly, dividing 79 by 3, 5, or 7 also doesn't result in an integer. Therefore, 79 is a prime number.\n\nSince 79 is prime and it's the first number I checked below 80, it is the largest prime number under 80.",
                "content": "To find the **biggest prime number under 80**, we can follow these steps:\n\n1. **List the numbers just below 80** and work our way down until we find a prime number.\n2. **Check each number** to see if it's a prime:\n   - A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.\n3. **Test divisibility** for each number by checking if it's divisible by any prime numbers less than or equal to its square root.\n\n**Let's apply this method:**\n\n- **79**:\n  - The square root of 79 is approximately **8.89**. We'll check divisibility by prime numbers up to 7.\n  - **79 ÷ 2 = 39.5** → Not divisible by 2.\n  - **79 ÷ 3 ≈ 26.33** → Not divisible by 3.\n  - **79 ÷ 5 = 15.8** → Not divisible by 5.\n  - **79 ÷ 7 ≈ 11.29** → Not divisible by 7.\n  - **Conclusion**: 79 is a prime number.\n\nSince **79** is the first number below 80 that we've confirmed as prime, it is the **largest prime number under 80**.\n\n\\[\n\\boxed{79}\n\\]"
            }
        }
    ],
    "created": 1741471225,
    "model": "gpt-3.5-turbo",
    "system_fingerprint": "b4885-b1026e09",
    "object": "chat.completion",
    "usage": {
        "completion_tokens": 506,
        "prompt_tokens": 13,
        "total_tokens": 519
    },
    "id": "chatcmpl-PFK22wjqVvubkpaFInf5MKRlnjr0Rhc2",
    "timings": {
        "prompt_n": 13,
        "prompt_ms": 250.423,
        "prompt_per_token_ms": 19.26330769230769,
        "prompt_per_second": 51.91216461746725,
        "predicted_n": 506,
        "predicted_ms": 25600.608,
        "predicted_per_token_ms": 50.59408695652174,
        "predicted_per_second": 19.765155577555035
    }
}

First Bad Commit

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions