【吴泳铭YYDS,开源o1-preview模型】Qwen QwQ 32B 预览版: 提升人工智能推理能力

549 阅读7分钟

简介

Qwen 团队最近发布了一个实验研究模型 QwQ 32B Preview,旨在提高人工智能的推理能力。尽管该模型仍处于预览阶段,但它展示了令人印象深刻的分析能力,同时也存在一些明显的局限性。

主要特点和局限性

  1. 语言混合和代码切换:QwQ 32B 预览版面临的挑战之一是它容易混合语言或在语言间意外切换,这可能会影响其响应的清晰度。
  2. 递归推理循环: 该模型有时可能会陷入循环推理模式,导致冗长的答案无法得出明确的结论。
  3. 安全和伦理考虑: 由于其实验性质,该模型需要额外的安全措施,以确保性能安全可靠。建议用户在部署时谨慎行事。
  4. 性能和基准测试: QwQ 32B Preview 在数学和编码任务方面表现出色,但在常识推理和细微语言理解等方面需要改进。

image.png

image.png

技术规格

  • 类型 因果语言模型
  • 训练阶段: 训练前和训练后
  • 架构 带有 RoPE、SwiGLU、RMSNorm 和注意 QKV 偏差的变换器
  • 参数数量 32.5B
  • 非嵌入参数数:31.0B 31.0B
  • 层数:64
  • 注意头数量 (GQA): Q 为 40,KV 为 8
  • 上下文长度 完整 32,768 个标记

开始使用

模型过大, 24GB太小了,只能用int4运行,不过速度快,而且质量在o1的推理加持下还挺高的。

from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
import torch
quantization_config = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16)

model_name = "Qwen/QwQ-32B-Preview"

model = AutoModelForCausalLM.from_pretrained(
    model_name,
    quantization_config=quantization_config,
    torch_dtype=torch.bfloat16
)
tokenizer = AutoTokenizer.from_pretrained(model_name)

prompt = "How many r in strawberry."
messages = [
    {"role": "system", "content": "You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step."},
    {"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

generated_ids = model.generate(
    **model_inputs,
    max_new_tokens=2048
)
generated_ids = [
    output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]

response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]

Let's see. I have this question: "How many r's in strawberry?" Hmm, it's a bit tricky because it's asking for the number of times the letter 'r' appears in the word "strawberry." Okay, so first, I need to look at the word "strawberry" and count how many 'r's are in it.

Let me write out the word: s-t-r-a-w-b-e-r-r-y. Now, I'll go through each letter and see which ones are 'r's.

Starting with s: not 'r'.

Then t: not 'r'.

Next is r: yes, that's one 'r'.

Then a: not 'r'.

W: not 'r'.

B: not 'r'.

E: not 'r'.

R: yes, that's another 'r'.

R: another 'r'.

Y: not 'r'.

So, I have one, two, three 'r's in "strawberry."

Wait a minute, but I remember that in some words, letters can be repeated, so I need to make sure I'm counting all the 'r's correctly.

Let me count again: s-t-r-a-w-b-e-r-r-y.

First 'r' is in the third position.

Second 'r' is before the last letter.

Third 'r' is right before the 'y'.

So, that's three 'r's.

But maybe I'm missing one. Let me check again.

S-t-r-a-w-b-e-r-r-y.

S is not 'r', t is not 'r', r is 'r', a is not 'r', w is not 'r', b is not 'r', e is not 'r', r is 'r', r is 'r', y is not 'r'.

So, indeed, there are three 'r's in "strawberry."

Wait, but I think sometimes people might think there are only two 'r's, maybe missing one.

Let me make sure.

Let me write it down again: s-t-r-a-w-b-e-r-r-y.

Okay, positions of 'r's:

Position 3: r

Position 9: r

Position 10: r

Yes, three 'r's.

So, the answer should be three.

But I've heard this question before, and I think the answer is two. Maybe I'm confusing it with another word.

Let me think about it.

Is "strawberry" spelled with two 'r's or three 'r's?

Let me recall the spelling: s-t-r-a-w-b-e-r-r-y.

That's how it's spelled, with three 'r's.

But maybe in British English or something, it's spelled differently.

Wait, no, I think "strawberry" is universally spelled with three 'r's.

So, the answer should be three.

But perhaps the question is tricky, and it's considering only the unique 'r's or something.

Wait, no, it's asking for the number of 'r's in the word, so it should be three.

Alternatively, maybe it's a trick question, and it's actually asking for the number of times the letter 'r' appears in the word "strawberry" in a specific context.

Wait, the question is "How many r's in strawberry," and it's spelled with three 'r's.

But maybe there's a trick here that I'm missing.

Let me think differently.

Is there a homophone or something that could be confusing?

Wait, "strawberry" is spelled with three 'r's, so unless there's some play on words, it should be three.

Alternatively, maybe the question is about the pronunciation, and in some dialects, they might pronounce it with fewer 'r's.

But in standard English, "strawberry" has three 'r's.

So, I think the answer is three.

But to be thorough, let me consider that maybe the question is written without apostrophes, and it's actually "straw berry," with two words.

Wait, but that's not standard.

"Strawberry" is one word.

So, in "strawberry," there are three 'r's.

Therefore, the answer is three.

But perhaps the question is written as "How many r's in strawberry," and it's considering only the 'r's before the 'berry' part.

Wait, that doesn't make sense.

Let me not overcomplicate this.

The word "strawberry" has three 'r's.

Therefore, the answer is three.

But to confirm, let me check a dictionary or something.

Wait, I don't have a dictionary handy, but I'm confident that "strawberry" is spelled with three 'r's.

So, the answer should be three.

However, I've heard this question before, and I think the expected answer is two.

Maybe it's a trick question where you have to consider only certain 'r's.

Wait, perhaps it's about the number of 'r's sounds in the pronunciation.

In that case, in some accents, like in Boston, they might not pronounce all the 'r's, so maybe only two are pronounced.

But in standard English, all three 'r's are pronounced.

So, perhaps the answer depends on the context or the accent.

But assuming standard English pronunciation, there are three 'r's in "strawberry."

Alternatively, maybe the question is about the number of times the letter 'r' appears in the word "strawberry" when written, which is three.

Unless specified otherwise, I think the answer is three.

But to be safe, I'll go with three.

Final Answer

[ \boxed{3} ]

Question: How many e in reinforence.

Let's see. I have this word: "reinforence". I need to find out how many times the letter 'e' appears in it. Okay, first, I should probably look at the word carefully. "Reinforecence". Hmm, spelling looks a bit off, but maybe it's a typo. I think the correct word is "reinforcement". Let me confirm that. Yes, "reinforcement" is the correct term, which means to make something stronger or more effective. So, probably, the word meant is "reinforcement".

Now, back to the task. I need to find how many 'e's are in "reinforence". Wait, but I think it's a misspelling of "reinforcement". Should I consider the misspelled word or the correct one? The question is about "reinforence", so I'll go with that.

Let's look at "reinforence". Let's spell it out: R-E-I-N-F-O-R-E-N-C-E. Now, I'll count the 'e's. Okay, first letter: R, not 'e'. Second: E, that's one 'e'. Third: I, not 'e'. Fourth: N, not 'e'. Fifth: F, not 'e'. Sixth: O, not 'e'. Seventh: R, not 'e'. Eighth: E, that's another 'e'. Ninth: N, not 'e'. Tenth: C, not 'e'. Eleventh: E, that's another 'e'. So, I've got three 'e's in "reinforence".

Wait a minute, when I spell it again: R-E-I-N-F-O-R-E-N-C-E, I see E's in positions 2, 8, and 11. That's three 'e's. But now I'm thinking maybe I missed one or miscounted. Let me count again. R (1), E (2), I (3), N (4), F (5), O (6), R (7), E (8), N (9), C (10), E (11). Yes, three 'e's.

But I recall that in the correct spelling, "reinforcement", there are two 'e's. Let me check that. "Reinforcement": R-E-I-N-F-O-R-M-E-N-T. Here, E's are in positions 2 and 10. So, two 'e's in "reinforcement".

So, in the misspelled word "reinforence", there are three 'e's, but in the correct spelling, there are two. Maybe the question is about the correct spelling?

Wait, the question is: "How many e in reinforence." So, it's probably about the misspelled word. Therefore, the answer is three.

But to be thorough, I should note that "reinforence" is not the standard spelling. The correct term is "reinforcement," with two 'e's. However, based on the word provided in the question, "reinforence," there are three 'e's.

Final Answer

[ \boxed{3} ]

有瑕疵,我拼错了reinforcement,他逻辑上没有质疑问题是否出错,但是准确的完成了任务。我在测试另一个开源o1模型发现的。

结论

QwQ 32B 预览版是人工智能研究领域一个令人兴奋的发展,它让我们看到了人工智能推理的未来。虽然它有一些局限性,但该模型在数学和编码方面的优势,以及其改进的潜力,使其成为该领域的一个宝贵贡献。别只开源PaddlePaddle,让大家多多学习嘛🤗🤗🤗

如需了解更多见解和最新信息,读者可参阅 Qwen 团队的博客,并在 GitHub 上探索 Qwen2.5 项目。