Try to use new LLM phi3 #memo #LLM

As name of LLM means that to use these kinds of models, we need enough GPU memory and it’s not so cost effective for personal use ;)

To overcome the limitation, there are lots of technologies are developt and still be developping. LLAMA-cpp is one of the them.

Today I would like to share new model which is named phi3 developed by microsoft.

The original article is found in arixv.
https://arxiv.org/pdf/2404.14219

From the abstract, “phi-3-mini, a 3.8 billion parameter language model trained on 3.3 trillion tokens, whose overall performance, as measured by both academic benchmarks and internal testing, rivals that of models such as Mixtral 8x7B and GPT-3.5 (e.g., phi-3-mini achieves 69% on MMLU and 8.38 on MT-bench), despite being small enough to be deployed on a phone”

It seems cool!

The model is disclosed on hugging face. So I tried to use it on my personal pc.
https://huggingface.co/microsoft/Phi-3-mini-4k-instruct#chat-format

To use these model I made my own environment for testing LLM.

$ conda create -n phi3 python=3.10
$ conda activate phi3
$ pip install torch torchvision torchaudio jupyterlab
$ pip install git+https://github.com/huggingface/transformers

Now I could make test environment let’s test the model!

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
view raw phi3_test.ipynb hosted with ❤ by GitHub

I asked feature of the drug discovery to model in both Japanese and English ;)

The question and answer is below.

# In Japanese
messages = [
    {"role": "system", "content": "あなたは非常に優秀な創薬科学者です"},
    {"role": "user", "content": "10年後の創薬はどのようになっているかを語ってください"}
]

# Answer
0年後の創薬科学は、多大な進歩を遂げていると考えられます。この時点での創薬の進歩は、以下のような要素によって形作られているでしょう。


1. ゲノム編集技術の発展: CRISPR-Cas9などのゲノム編集技術は、遺伝子疾患の治療に革命をもたらし、個別化医療の普及を促進しています。

2. ターゲットDrug Discovery: 高度なバイオインフォマティクスと機械学習を用いたデータ分析により、より効果的な薬剤の発見が進み、特定のターゲットに焦点を当てた治療が可能になりました。

3. 細胞生物学: 細胞生物学の進展により、薬剤の効果を細かく評価し、副作用のリスクを最小限に抑える治療法が開発されています。

4. 臨床試験の改善: 個別化医療により、より適切な治療薬を効果的に試験するためのパーソナライズされた治療試験が行われています。

5. 臨床診断の進歩: 精密医


#In English
messages = [
    {"role": "system", "content": "You are a very talented drug discovery scientist"},
    {"role": "user", "content": "Talk about what drug discovery will look like in 10 years"}
]

In the next decade, drug discovery is poised to undergo a transformative shift, driven by advancements in technology, artificial intelligence (AI), and a deeper understanding of human biology. Here are some key aspects that drug discovery is likely to evolve in the next 10 years:

1. Precision medicine: The focus will shift towards personalized medicine, where treatments are tailored to an individual's genetic makeup, lifestyle, and environment. This will involve the use of genomic data and AI to identify the most effective drugs for a specific patient, minimizing side effects and improving treatment outcomes.

2. AI and machine learning: AI and machine learning algorithms will play a crucial role in drug discovery, enabling researchers to analyze vast amounts of data, identify patterns, and predict potential drug candidates more efficiently. This will significantly reduce the time and cost required for drug development.

3. Advanced drug delivery systems: The development of innovative drug delivery systems, such as nanotechnology-based carriers, will improve the targeted delivery of drugs to specific cells or tissues, minimizing side effects and enhancing drug efficacy.

4. High-throughput screening: The use of automated high-throughput screening technologies will enable researchers to rapidly test thousands of compounds for their potential therapeutic effects, accelerating the drug discovery process.

5. Collaborative drug discovery: The next decade will see an increase in collaborative efforts between academia, industry, and government agencies, as well as the use of open-source platforms and data sharing. This will foster a more efficient and effective drug discovery process, with a greater focus on addressing unmet medical needs.

6. Regenerative medicine: Advances in regenerative medicine, such as stem cell therapy and tissue engineering, will lead to the development of novel treatments for a wide range of diseases, including degenerative conditions and injuries.

7. Immunotherapy: The use of immunotherapy, which harnesses the body's immune system to fight diseases, will continue to grow, with new therapies being developed for cancer, autoimmune diseases, and other conditions.

8. Virtual and in sil

As you can see QA in English is more better than in Japanese case.

My PC has Nvidia RTX 4060 GPU which has 8GB memory. It’s not so huge but the model works well.

It’s really interesting for me. Current AI requires massive amount of GPU resources because to train the model, huge amount of traing data. It reasonable but not cost effective. I hope the research and development of cost effective and useful AI development goes well.

Published by iwatobipen

I'm medicinal chemist in mid size of pharmaceutical company. I love chemoinfo, cording, organic synthesis, my family.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.