跳到正文
DEV Community· anne sonia·· 4 小時前AI 評分31

探索開源大語言模型:為 MiniChefGPT 選擇合適的模型

Exploring Open-Source Large Language Models: Choosing the Right Model for MiniChefGPT

AI 導讀

MiniChefGPT 項目選用 Qwen3-0.6B,為用戶根據輸入食材生成食譜;選擇考慮了學生可用的硬件及本地推理成本。文章比較 Qwen3-0.6B、SmolLM2-1.7B-Instruct 和 Phi-3.5-mini-instruct:三者分別有 0.6B、1.7B 和 3.8B 參數,均可下載並本地運行,無須支付 API 費用。

正文

Introduction

When I started learning about Large Language Models (LLMs), I thought they were mainly used for chatbots like ChatGPT. However, after studying Transformers, attention mechanisms, embeddings, and text generation, I realized that language models can solve many different problems.

In our MiniChefGPT project, we developed an AI application that generates cooking recipes from ingredients entered by a user. For example, someone can enter chicken, tomatoes, onions, and garlic, and the application attempts to generate a recipe with cooking instructions.

We built a small GPT-style Transformer from scratch using Python and PyTorch. This helped me understand how language models learn and predict the next token. However, our model still has limitations, especially when generating complete and accurate recipes.

For this research, I explored three open-weight language models: Qwen3-0.6B, SmolLM2-1.7B-Instruct, and Phi-3.5-mini-instruct. My goal was to find a model that could improve MiniChefGPT while remaining affordable and practical for students using Google Colab.

1. Understanding Open-Source LLMs

A Large Language Model is a neural network trained on large amounts of text to understand and generate human language.

Most modern generative LLMs use the Transformer architecture. Transformers contain important components such as token embeddings, attention mechanisms, feed-forward networks, and normalization layers.

One important thing I learned is that open-weight and open-source do not always mean the same thing. Open-weight models provide downloadable model parameters, while fully open-source development may also involve openly available code, training information, and permissive licenses.

For my project, I focused on models that provide downloadable weights and allow local inference without paying for a commercial API.

2. Qwen3-0.6B

Qwen is a language model family developed by Alibaba's Qwen team.

The Qwen3-0.6B model has approximately 0.6 billion parameters, as reported by its official model card. It supports a context window of 32,768 tokens and is distributed under the Apache 2.0 license.

Qwen3 supports instruction following, text generation, multilingual tasks, and reasoning. It also offers thinking and non-thinking modes.

What interests me most is its relatively small size. It can generate text without requiring the same computing resources as models with several billion parameters.

For MiniChefGPT, Qwen could receive a list of ingredients and generate a recipe in a specific format, including a title, ingredients, and numbered cooking steps.

Its Apache 2.0 license also makes it attractive for educational and future application development.

Reference: https://huggingface.co/Qwen/Qwen3-0.6B

3. SmolLM2-1.7B-Instruct

SmolLM2 is a family of compact language models developed by Hugging Face.

The version I researched has 1.7 billion parameters and supports a context window of 8,192 tokens. It uses the Apache 2.0 license.

SmolLM2 was designed to provide useful language capabilities while remaining relatively lightweight.

The instruction-tuned version is suitable for tasks such as answering questions, rewriting text, summarization, and following user instructions.

For our project, SmolLM2 could help generate cooking instructions in a clearer format. For example, we could ask it to return five cooking steps without adding unrelated explanations.

Its main disadvantage compared with Qwen3-0.6B is its larger memory requirement. Although it should fit on a Google Colab T4 for short-prompt inference, it needs more GPU memory.

Reference: https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct

4. Phi-3.5-mini-instruct

Phi-3.5-mini-instruct was developed by Microsoft.

It contains approximately 3.8 billion parameters and supports a context window of 128,000 tokens. The model is available under the MIT license.

Microsoft designed Phi models to provide useful language capabilities using relatively compact architectures and carefully selected training data.

Phi-3.5-mini-instruct is useful for instruction following, reasoning, and text generation.

For MiniChefGPT, it could help organize cooking instructions and respond to more complicated requests, such as generating a vegetarian recipe or adapting a recipe to specific preferences.

However, this model is considerably larger than Qwen3-0.6B. Running it on a free T4 GPU is possible with suitable settings, but it uses more memory and may require additional optimization for longer prompts.

Reference: https://huggingface.co/microsoft/Phi-3.5-mini-instruct

5. Comparison of the Three Models

Feature Qwen3-0.6B SmolLM2-1.7B Phi-3.5-mini
Developer Alibaba Qwen Hugging Face Microsoft
Parameters 0.6B 1.7B 3.8B
Context window 32,768 tokens 8,192 tokens 128,000 tokens
License Apache 2.0 Apache 2.0 MIT
Approx. FP16 weight memory 1.2 GB 3.4 GB 7.6 GB
Free T4 inference Yes Yes Yes, with care
Main strengths Lightweight, multilingual, instruction following Compact, instruction following Reasoning, long context
Main limitation Less capacity than larger models More memory than Qwen Higher memory and compute requirements

Note: Memory figures are approximate estimates for model weights at 16-bit precision. Actual GPU memory usage is higher because inference also requires memory for activations, attention caches, and other operations.

All three models can be downloaded and run locally without paying for an API key. Their public model repositories do not normally require accepting a special gated-access license, although downloading through Hugging Face may involve normal platform requirements.

6. The Model I Choose for MiniChefGPT

After comparing the three models, I choose Qwen3-0.6B for our MiniChefGPT project.

My decision is based on five reasons.

First, it fits our available hardware. As students, we cannot depend on expensive GPUs. Google Colab provides access to a T4 GPU with 16 GB of VRAM when available. Qwen3-0.6B has a relatively small memory footprint, making it practical for experimentation.

Second, it is free to use locally. We can download its public weights from Hugging Face and run inference without paying for an API key. The Apache 2.0 license is also suitable for developing applications.

Third, it supports instruction following. MiniChefGPT needs a model that can respond to specific requests and produce structured cooking instructions. We can prompt Qwen to generate a recipe title followed by numbered steps.

Fourth, its small size may make inference faster. Compared with larger models, Qwen3-0.6B generally requires fewer computations and less memory. However, I would need to benchmark generation time in Colab before claiming a specific speed.

Finally, it provides a practical upgrade path. Our original MiniChefGPT Transformer has about 1.05 million parameters and was trained from scratch using recipe data. Qwen has already learned general language patterns from much broader training.

I expect this pretrained knowledge to help with recipe generation, but I cannot claim it will automatically produce better recipes until we test it.

7. How Qwen Could Improve MiniChefGPT

Currently, our application accepts ingredients and generates a recipe using our custom Transformer.

Our testing showed that the model can produce recipe-like text, but sometimes omits requested ingredients, repeats phrases, or generates incorrect cooking instructions.

My proposed improvement is to keep our original model and integrate Qwen3-0.6B as an alternative generator.

For example, the user could enter:

Ingredients: Chicken, tomato, onion, garlic.

We would ask Qwen to produce a recipe title, the ingredients used, and clear numbered instructions.

To evaluate the improvement, we could give both models the same ingredient lists and compare ingredient coverage, instruction completeness, repeated text, generation time, and cooking safety.

We could also test whether Qwen follows a fixed output format. This would make it easier to display generated recipes in our Streamlit application.

One challenge is that even pretrained LLMs can invent ingredients or provide incorrect cooking advice. Therefore, generated recipes must still be checked before use.

8. Conclusion

Researching these models helped me understand that choosing an LLM is not only about selecting the largest or most powerful model.

We must also consider the available hardware, memory usage, licensing, cost, and the actual problem we want to solve.

Qwen3-0.6B, SmolLM2-1.7B-Instruct, and Phi-3.5-mini-instruct all offer useful capabilities, but they have different resource requirements.

For our MiniChefGPT project, I selected Qwen3-0.6B because it provides a practical balance between size, accessibility, and instruction-following capabilities.

My next step is to test Qwen alongside our original Transformer and measure whether it improves recipe quality.

Building MiniChefGPT from scratch helped me understand how Transformers work. Exploring pretrained LLMs is helping me understand how to turn that knowledge into more useful AI applications.

References

Qwen Team. Qwen3-0.6B Model Card. https://huggingface.co/Qwen/Qwen3-0.6B

Hugging Face. SmolLM2-1.7B-Instruct Model Card. https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct

Microsoft. Phi-3.5-mini-instruct Model Card. https://huggingface.co/microsoft/Phi-3.5-mini-instruct

Qwen Team. Qwen3 Technical Report. https://arxiv.org/abs/2505.09388

Hugging Face. SmolLM2: When Smol Goes Big. https://arxiv.org/abs/2502.02737

MiniChefGPT Project. https://minichefgpt.streamlit.app/

來源:DEV Community · dev.to