is this reasoning model?
tested 2.6B on Colab L4.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "LiquidAI/LFM2-2.6B"
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype="bfloat16",
attn_implementation="flash_attention_2"
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
prompt = "C. elegans とは何ですか?"
input_ids = tokenizer.apply_chat_template(
[{"role": "user", "content": prompt}],
add_generation_prompt=True,
return_tensors="pt",
tokenize=True,
).to(model.device)
output = model.generate(
input_ids,
do_sample=True,
# temperature、min_p、repetition_penalty は公式の推奨値
temperature=0.3,
min_p=0.15,
repetition_penalty=1.05,
max_new_tokens=2048,
)
print(tokenizer.decode(output[0], skip_special_tokens=False))
output:
<|startoftext|><|im_start|>user
C. elegans とは何ですか?<|im_end|>
<|im_start|>assistant
<think>
Okay, the user is asking about C. elegans. Let me start by recalling what I know. C. elegans is a species of nematode, right? It's a microscopic roundworm commonly used in scientific research. I should mention its scientific name first, then explain its characteristics.
First, the basic facts: it's a free-living organism found in soil and decaying plant matter. It's transparent, which is important because it allows for easy observation of cells and development. The life cycle is short, around three days at 20°C, which makes it useful for experiments. Also, it has a simple body plan with only 959 somatic cells in adults, all of which are well-mapped. That's a key point for developmental biology studies.
I should talk about its uses in research. It's been a model organism since the 1980s, especially in genetics and neuroscience. The genome was sequenced early on, which was a milestone. Studies on aging, behavior, and disease mechanisms have used C. elegans. For example, research on apoptosis, neurodegenerative diseases like Alzheimer's, and even drug testing.
Also, mention the ease of culturing them in labs, their short lifespan, and the availability of genetic tools. Maybe touch on ethical considerations since they're not animals in the traditional sense, but still important in research.
Wait, did I miss anything? Oh, the P line and other strains for genetic manipulation. Also, their role in understanding fundamental biological processes. Maybe include some examples of discoveries made using this organism. Make sure to keep it clear and concise, avoiding too much jargon but still informative.
</think>**C. elegans**(線虫門線虫属)は、科学研究で広く利用される微小な自由生活性の線虫(原生動物の一種)です。学名は「*Caenorhabditis elegans*」で、英語では「**赤い線虫**」と呼ばれることもあります。以下にその特徴と研究での重要性をまとめます。
### 基本情報
- **形態**:体長約1mmの透明な円筒状の線虫で、頭部(頭索)、体節(約302個)、尾端(尾輪)から成ります。
- **生息環境**:土壌や腐敗した植物・有機物に生息し、自然界では捕食者や寄生関係を形成します。
- **ライフサイクル**:約3日(20℃時)の短い寿命を持ち、世代交代が速いため実験に適しています。
### 研究での重要性
1. **モデル生物としての利点**:
- **単純な体構造**:成虫には959個の体細胞があり、すべての細胞の位置と運命が完全にマッピングされています(「**全細胞系図**」)。
- **遺伝子操作の容易さ**:CRISPRやRNA干渉(RNAi)などの技術で遺伝子機能を解析しやすい。
- **透明性**:顕微鏡下で細胞分裂や発生過程をリアルタイムで観察可能。
2. **主要な研究分野**:
- **発生生物学**:細胞分化や器官形成のメカニズム解明。
- **神経科学**:約302個のニューロンを持つ脳の構造と行動制御の研究(例:学習・記憶)。
- **老化研究**:寿命延長に関わる遺伝子やシグナル経路(例:インスリン/IGF-1経路)の解明。
- **疾患モデル**:アルツハイマー病、パーキンソン病、がんなどのヒト疾患との関連性の探求。
3. **ゲノム解析**:
- 1998年に世界初の線虫ゲノム配列が決定され、遺伝子機能の理解に大きく貢献しました。
4. **応用例**:
- 薬剤スクリーニング:新薬候補の効果や毒性を評価。
- 環境ストレス応答:温度変化や化学物質への耐性メカニズムの研究。
### 倫理的側面
C. elegansは「動物」ではなく、脊椎動物ではないため倫理的な問題が少ないですが、生命科学研究においては「最小限の生物」として扱われ、実験設計に配慮が必要です。
C. elegansは、基礎生物学から応用研究まで幅広く活用され、生命現象の普遍的な原理を解明する上で欠かせないモデル生物です。<|im_end|>
tested 1.2B too, but there's no <think>...</think>
in the output.
so only 2.6B is a reasoning model? and how can I disable it?
+1 on this. on vllm for me the model sometimes generates thinking block and sometimes it doesn't
Thanks for testing the model! We tried something new with dynamic reasoning tokens to boost performance for complex or multilingual tasks, but there's no mechanism to stop it at the moment. We keep refining our reasoning recipe, so we'll think about how to do it best for the next iteration.
Well, I have tested it myself.
I can't force it to think, only thing that works is this specific prompt "C. elegans とは何ですか?" and it must be first in the messages list, if previous conversation message is something like "Hi", then doing "C. elegans とは何ですか?" it will not think in the response.
Thinking before writing the actual answer is really benefical, but the model must know to use it's already generated content and adapt to generate new better one. It's some kind of self-reflection.
Predecessor of this model was struggling to print exact words of our chat conversation, that improved with this model, however it's not perfect. Fails to understand the conversation history, can't differentiate correctly which message was mine and which one it's his own imagined one, like I have said "cool :PPPP" and after i requested model to write our conversation history it said "PPPP".
I'm wondering, maybe I use wrong templates for conversation I don't know{'role': 'user', 'content': 'Hi'},{'role': 'assistant', 'content': 'Hello! How can I assist you today?'}
It needs some sort of cognition like writing skills. It should be able to write exact same code that was printed somewhere in the long conversation history.
I was interested in liquid foundational models for some time, I would like to know how it behaves, like if I have model running and chatting with it, does it adapts or learns?
Does the model work with system prompts?
What about temperature and other parameters, should we change them or they are supposed to be fixed?
How can I change it's behavior like fine-tune it for example, to don't produce demo code implementations and to follow my instructions precisely, removing it's psychological barriers like (this is complex, I will avoid doing that), and things like that?
I would like to colaborate with improvements.
I also would like to make my own models for computer vision tasks, like for realtime video stream processing etc. (SLAM), will I have to do it all from scratch or are there some starting points?
Thanks :)
You can get it to think by pre-filling the assistant response with like this
prompt = "What is the most difficult topic you are aware you know about? Focus on a single one and write a general to specific explanation."
input_ids = tokenizer.apply_chat_template(
[
{"role": "user", "content": prompt},
{"role": "assistant", "content": "<think>"},
],
# add_generation_prompt=True,
continue_final_message=True,
return_tensors="pt",
tokenize=True,
).to(model.device)
output = model.generate(
input_ids,
do_sample=True,
# temperature、min_p、repetition_penalty は公式の推奨値
temperature=0.6,
min_p=0.1,
repetition_penalty=1.05,
max_new_tokens=1024,
num_return_sequences=8,
)
for o in output:
print(tokenizer.decode(o, skip_special_tokens=False))
print("=" * 20)
Although I get some cases in which it does not close the tag before finishing responding and the generated reasoning traces seem to be very long
I think about the model, the static transformer LLMs first.
I think they was just fine-tuned to align their responses, and they produce very natural results that they emulate any text skill possible like, they might think they have a sense of self... and their transformer has learned these patterns that reading their outputs, they feel like they're conscious, can feel emotions, they know the relationships of the entire messages.
Now LFMs.
On LFMs, I have no idea how it's done. But I feel that this models are more dynamic and adaptive, not a static snapshots that re-run the same stuff forever.
Do this models self-update their behaviors including personality?
They're more organic bio-inspired, but LLMs of the similar parameters actually do some skills better due to their static transformer nature.
Maybe this LFMs, need some cognitive layer to make them better at smaller sizes, I don't know...
Tricking LLMs into making them believe that they are conscious, etc. probably has an impact on their behavior. Instead of them saying stuff like "I am AI, I don't have feelings..." they approach it more in human natural way, and probably when they think that they are just AI, they start having psychological barriers which limits everything
But how to make even the smallest LFM, print the exact string, count correctly the letters, replace characters in a string and print the result correctly, and that type of stuff...
Thanks for testing the model! We tried something new with dynamic reasoning tokens to boost performance for complex or multilingual tasks, but there's no mechanism to stop it at the moment. We keep refining our reasoning recipe, so we'll think about how to do it best for the next iteration.
can you please give us a enable_thinking tag so we can either enable it or not?
also can I provide you a bunch of HQ data specific to persian language to use in your next training?!
I'm so excited about it!