DEV Community

Marie Claire Uwiringiyimana
Marie Claire Uwiringiyimana

Posted on

Improving InkMind: Selecting an Open Large Language Model for AI-Powered Poetry Generation

Author: Marie Claire Uwiringiyimana
Project: InkMind — AI-Powered Poetry Generation
Field: Natural Language Processing (NLP)


1. Introduction

Natural Language Processing (NLP) is a branch of Artificial Intelligence that enables computers to process, understand, and generate human language. Recent developments in Large Language Models (LLMs) have significantly improved the ability of computers to produce meaningful text, answer questions, and support creative writing.

As part of my NLP learning journey, I worked on InkMind, a poetry generation project that transforms a simple word or idea into a complete poem. For example, a user can enter the word "Love," and the system generates a poem inspired by that theme.

Our current implementation uses GPT-2, a pretrained language model developed by OpenAI. Although GPT-2 provides a foundation for generating poems, we want to explore whether another modern language model can produce more coherent, creative, and relevant poetry.

To investigate this possibility, I reviewed the Botpress article The 10 Best Large Language Models (LLMs) in 2026 and examined the official documentation of several open-weight models. Based on this research, I selected Qwen3-4B-Instruct-2507 as the proposed alternative to GPT-2.

This blog explains the models considered, why Qwen3 is suitable for InkMind, and how we will compare the two models using the same prompts.


2. Understanding Large Language Models

Large Language Models are neural networks trained on large collections of text to learn patterns in human language. Many modern LLMs use the Transformer architecture and generate text by predicting the next token based on the preceding context.

A token may represent a complete word, part of a word, or another text unit. By repeatedly predicting and generating tokens, a language model can produce sentences, paragraphs, stories, and poems.

For example, InkMind receives the following input:

User prompt: Love

The model then generates a sequence of text inspired by that word, potentially producing several poetic lines and stanzas.

Different models may generate different poems from the same prompt because they differ in their training, architecture, parameter count, instruction-following capabilities, and generation settings.

According to Botpress, LLMs have different strengths, limitations, and deployment requirements. Therefore, selecting a model should depend on the intended application rather than simply choosing the largest or most popular model (Botpress, n.d.).

For InkMind, the most important requirements are creative text generation, relevance to the user's prompt, coherent poetry, accessible model weights, and manageable computing requirements.


3. Existing Model: GPT-2

GPT-2 is the model currently used in InkMind. Developed by OpenAI, it is a decoder-only Transformer language model pretrained on English text to predict the next token in a sequence.

The smallest GPT-2 model has approximately 124 million parameters. It can generate text from a prompt and can be further adapted to specific tasks through fine-tuning (OpenAI Community, n.d.).

Advantages and Limitations of GPT-2

✅ Advantages ⚠️ Limitations
It is relatively lightweight and suitable for experimentation on modest computing resources. It may generate repetitive or incoherent text.
Its pretrained weights are available for download. It does not consistently follow detailed instructions because the standard model is not instruction-tuned.
It can generate text without requiring a paid API for each generation. Its output may lose the original theme as a poem becomes longer.
It can be integrated into Python applications using libraries such as Hugging Face Transformers. Its original training does not guarantee good poetic structure, rhythm, or emotional depth.
It provides a useful baseline for evaluating alternative language models.

These limitations do not mean GPT-2 cannot generate good poems. Instead, they provide reasons to investigate whether a newer model can improve InkMind's output.

Official model documentation: GPT-2 on Hugging Face


4. Researching Alternative Large Language Models

Before selecting a replacement, I considered several models that offer different capabilities and deployment options.

4.1 GPT-4o

GPT-4o is a general-purpose model designed to support tasks such as writing, reasoning, and instruction following. It could generate poems from short prompts and follow additional instructions concerning tone, style, and structure.

For example, a user could enter "Love" and request a romantic poem containing four stanzas and vivid imagery.

However, using a hosted model through an API may involve usage charges and requires dependence on an external service. Its model weights are not available for ordinary local deployment.

Although GPT-4o could be useful for a future version of InkMind, I did not select it because our experiment prioritizes an open-weight model that we can download and run ourselves.

4.2 Gemma 3 (4B)

Gemma 3 is a family of language models developed by Google. Its four-billion-parameter version is a potential candidate for creative text generation and local experimentation.

It offers an alternative to GPT-2, but its resource requirements are higher. In addition, the applicable Gemma model terms must be reviewed before choosing it for deployment.

Gemma 3 remains a relevant candidate, but I selected Qwen3 because its specific model card documents open-ended text-generation improvements and its Apache 2.0 licence provides a clear basis for experimentation and adaptation.

4.3 Mistral Small 3.1

Mistral Small 3.1 is another model discussed in the Botpress comparison. It offers general-purpose language capabilities and open-weight deployment options.

It could be evaluated for creative writing, but its computing requirements may be more demanding than those of smaller models.

Since InkMind currently performs a focused task—generating poems from short prompts—we do not need to begin with a larger model unless our experiments demonstrate that its capabilities justify the additional resources.

4.4 Qwen3-4B-Instruct-2507

Qwen3-4B-Instruct-2507 is an instruction-tuned, four-billion-parameter language model in the Qwen3 family.

Its official model card describes improvements in instruction following, text comprehension, multilingual capabilities, and open-ended tasks. It is distributed under the Apache 2.0 licence, which permits use and modification subject to the licence's conditions (Qwen, n.d.).

These characteristics make Qwen3 a promising alternative for InkMind.

Unlike the standard GPT-2 model, which primarily continues a sequence of text, Qwen3-4B-Instruct has been adapted to respond to instructions. This may help it interpret a creative request and produce a poem that follows the requested theme and structure.

For example, the model can receive the following prompt:

Write a complete poem about love. Use four stanzas, emotional language, vivid imagery, and a hopeful ending.
Enter fullscreen mode Exit fullscreen mode

The model can then attempt to generate a poem that follows those requirements.

However, instruction tuning does not automatically guarantee superior poetry. We must evaluate the actual outputs produced by Qwen3 and GPT-2 using the same prompts and assessment criteria.

Official model card: Qwen3-4B-Instruct-2507 on Hugging Face


5. Comparing the Models for InkMind

The following table summarizes the models considered during my research.

Model Main strength Main limitation Suitability for InkMind
GPT-2 Lightweight text generation May struggle with coherence and detailed instructions Existing baseline
GPT-4o General-purpose generation and instruction following Hosted API dependency and potential usage costs Alternative requiring an external service
Gemma 3 (4B) Modern, relatively compact model Higher resource requirements than GPT-2 Potential local alternative
Mistral Small 3.1 General-purpose language generation More demanding deployment requirements Candidate for later evaluation
Qwen3-4B-Instruct-2507 Instruction following and open-ended generation Requires more computing resources than GPT-2 Selected alternative

The comparison is based on the models' documented characteristics, not on a completed benchmark of InkMind. Therefore, the table identifies promising candidates rather than claiming that one model has already won the poetry-generation experiment.


6. My Selected Model: Qwen3-4B-Instruct-2507

After considering the available alternatives, I selected Qwen3-4B-Instruct-2507 as the proposed replacement model for InkMind's GPT-2 implementation.

My choice is based on the following reasons.

6.1 Open-Weight Availability

Qwen3-4B-Instruct-2507 provides downloadable model weights. This allows us to experiment with the model in our own environment instead of depending entirely on a commercial text-generation API.

Its Apache 2.0 licence also permits broad use and adaptation, subject to the licence terms.

This is important because we want to understand how the model works, integrate it into our application, and evaluate its output directly.

6.2 Better Instruction Following

InkMind currently accepts a simple word as a prompt. In the future, we may want users to specify a poem's mood, length, style, or structure.

Qwen3-4B-Instruct is designed to follow instructions, making it a promising candidate for supporting both simple prompts and more detailed creative requests.

For example, users could generate a poem about love and then request a sad, romantic, inspirational, or humorous version.

6.3 Potential for Improved Creative Writing

The Qwen3 model card reports improvements in open-ended text generation and alignment with user preferences. These capabilities suggest that it is worth evaluating for poetry generation.

However, the model has not been specifically proven superior for InkMind's poetry task. We will determine whether it produces better results through our own experiment.

6.4 Flexibility for Future Development

Because Qwen3 can be run using supported local inference tools and adapted where appropriate, it gives us flexibility as InkMind develops.

We could later explore more advanced prompting, poetry-specific fine-tuning, or additional generation controls without necessarily changing the overall purpose of the application.

6.5 A Suitable Research Comparison

Comparing GPT-2 with Qwen3 will help us investigate how a lightweight pretrained language model differs from a newer instruction-tuned model.

The experiment will also help us understand the relationship between model size, instruction following, output quality, and computing requirements.

Although Qwen3 has substantially more parameters than GPT-2 small, a larger parameter count alone does not prove that it will generate better poems. The quality of the output and the cost of generating it must both be considered.


7. How We Will Compare GPT-2 and Qwen3

To determine whether Qwen3 improves InkMind, we will conduct a controlled comparison.

7.1 Experimental Procedure

Step 1: Prepare the prompts.

We will use the same five prompts for both models:

  1. Love
  2. Hope
  3. Nature
  4. Friendship
  5. Dreams

Step 2: Generate poems using GPT-2.

We will enter each prompt into the existing InkMind implementation and save the generated poems.

Step 3: Generate poems using Qwen3.

We will provide the same prompts to Qwen3 and save its generated poems.

Step 4: Keep the comparison fair.

We will use consistent output-length targets where possible, record the generation settings, and distinguish the effects of model choice from the effects of prompting.

Because GPT-2 is a base model and Qwen3 is instruction-tuned, the prompt formats may differ. We will document any formatting differences while keeping the requested poem topic and evaluation requirements equivalent.

Step 5: Evaluate the outputs.

We will compare the poems according to relevance, coherence, creativity, repetition, poetic structure, and generation time.

7.2 Evaluation Criteria

Criterion What we will evaluate
Prompt relevance Does the poem reflect the original word?
Coherence Do the lines communicate a consistent idea?
Creativity Does the poem use interesting language and imagery?
Repetition Does it repeat lines, phrases, or ideas unnecessarily?
Poetic structure Are the line breaks and stanzas appropriate?
Generation time How long does each model take to produce the poem?

We will use human evaluation to assess creative qualities that cannot be fully captured by automated metrics.

7.3 Results Table

The following table will be completed after running the experiment.

Prompt GPT-2 output Qwen3 output Preferred output
Love To be recorded To be recorded To be evaluated
Hope To be recorded To be recorded To be evaluated
Nature To be recorded To be recorded To be evaluated
Friendship To be recorded To be recorded To be evaluated
Dreams To be recorded To be recorded To be evaluated

This approach will allow us to make a decision based on observed results rather than assumptions.


8. Challenges and Limitations

Although Qwen3 is a promising choice, several limitations should be considered.

First, its four billion parameters make it considerably larger than GPT-2 small. Running the model locally requires more memory and computing resources, and actual performance will depend on the hardware and model precision used.

Second, instruction following does not guarantee that every generated poem will be coherent, original, or artistically meaningful. Human review remains necessary.

Third, both models can produce repetitive language or outputs that do not fully match the user's intended meaning.

Finally, the experiment will evaluate only a small set of prompts. A larger dataset and repeated evaluations would provide stronger evidence about overall performance.

These limitations will be documented so that the final model selection reflects both output quality and practical deployment considerations.


9. Conclusion

This research examined several Large Language Models that could potentially improve InkMind, an NLP project designed to generate complete poems from simple word prompts.

After considering GPT-2, GPT-4o, Gemma 3, Mistral Small 3.1, and Qwen3-4B-Instruct-2507, I selected Qwen3-4B-Instruct-2507 as the proposed alternative to our existing GPT-2 model.

The main reasons for this selection are its downloadable weights, Apache 2.0 licence, instruction-following capabilities, and documented improvements in open-ended text generation.

Our next step is to integrate Qwen3 into the experimental version of InkMind and compare its output directly with GPT-2. By using the same prompts and evaluation criteria, we can investigate whether the new model generates more relevant, coherent, creative, and varied poems.

The experiment will help us make an evidence-based decision about the best model for InkMind while strengthening our practical understanding of NLP and modern language models.


References

Top comments (0)