Code

Prompts for neural networks: rules for composing and query examples

Prompts for neural networks: rules for composing and query examples

Learn for free: "Neural Networks. A Practical Course"

Learn more

Neural networks, like a genie from a lamp, are capable of performing many tasks at our request: they create texts for social networks, translate articles and generate images in just a few seconds. However, to achieve the desired result, it's essential to formulate the query correctly. In this article, we'll explain how to effectively formulate queries for neural networks so they best meet your requirements.

Content is a crucial element of any text or document. It allows the reader to quickly navigate the structure of the material and find the sections they need. When creating content, it's important to consider keywords that will help improve the page's SEO ranking. This means that the content should not only be informative but also optimized for search engines. Including relevant terms and phrases in the content helps attract the target audience. Properly written content not only makes the text easier to read but also increases its visibility in search engines. It is important to ensure that the information reflected in the content is relevant and accurate to ensure a positive user experience.

  • What is a prompt
  • How to write a prompt correctly
  • Midjourney query - clear and to the point
  • Stable Diffusion queries follow the same rules as Midjourney queries
  • Add more details to Masterpiece queries
  • In Kandinsky queries, make references to Russian culture
  • In ChatGPT queries, be sure to describe the context
  • In GigaChat queries, ask for creativity
  • Where to look for inspiration
  • Prompt generation assistants

What is a prompt

A prompt is a task for a neural network, formulated on natural language. It's similar to how you assign a task to a human assistant: you don't need to know a programming language or complex algorithms. Simply describe clearly and in detail what exactly you expect from the assistant and provide the necessary input. A well-written prompt ensures effective interaction with the neural network, helping to achieve the desired results.

If we were planning to create this article using a neural network, the corresponding prompt might sound like this: "Act as an expert in the field of neural networks. Create a blog post on the topic: How to correctly formulate prompts for neural networks. Subtopics: Midjourney, ChatGPT. Writing style: descriptive. Tone of the text: informal."

Correctly worded prompts are a key aspect of successful interaction with neural networks. For Midjourney, it is important to consider visual elements and context to produce high-quality images. For example, when creating an image, you can specify the style, color scheme, and even the mood you want to see in the final result.

As for ChatGPT, it's important to emphasize the clarity and specificity of your request. The more precise your prompt, the more relevant and useful the answers you'll receive. It's important to remember that neural networks perform better with clear instructions and specific questions.

Thus, correctly setting up prompts for neural networks can significantly improve the quality of the results obtained and improve interaction with these powerful tools.

Let's pass this request to the ChatGPT bot in Telegram and look at the result. Screenshot: ChatGPT & Midjourney | AI bot / Telegram / Skillbox Media

The neural network successfully completed the task, but did not take into account that Midjourney and ChatGPT are different tools with unique features. Unfortunately, the article was not informative enough. There are several techniques that can help improve the quality of the results obtained when using these platforms. Proper use of the capabilities of each tool can significantly improve the quality of the content created.

How to write a prompt correctly

The basic principles of forming an effective request are key when interacting with generative machine learning models. Following these rules allows you to get more accurate and useful results. Proper request structure includes clarity, specificity, and completeness of information. Start with a clear statement of the problem, avoiding vague or overly general phrases. Clarify context when necessary and specify additional parameters to guide the model in the right direction. This approach will provide higher-quality answers and improve the efficiency of generative algorithms.

Decide what output you want from the neural network. When asking the model to generate images, specify whether you need a comic book or a photorealistic render. If you are using a language model, specify the format and genre of the text, for example, it could be a social media post, an article, a step-by-step guide, or a fictional story. The clearer your description, the more accurate and relevant the output will be.

Include the topic of the text and the characteristics of the target audience in the query so the language model can adapt the content to your requirements. If you are writing an article for beginners, be sure to specify this, otherwise the model may generate overly complex text. When generating an image, describe the main object in detail.

Neural networks are a key technology in the field of artificial intelligence, capable of solving a wide range of problems. These mathematical models, inspired by the human brain, are trained on large amounts of data, enabling them to recognize patterns and make predictions. Applications of neural networks span areas such as image processing, text analysis, process automation, and more.

One of the main advantages of neural networks is their ability to learn from examples. This allows the system to adapt and improve its results over time. For example, in the field of computer vision, neural networks provide high accuracy in recognizing objects in images, which finds application in various industries, including security and medicine.

There are several neural network architectures, each optimal for specific tasks. Convolutional neural networks (CNNs) are well suited for image processing, while recurrent neural networks (RNNs) are effective in analyzing sequential data, such as text or time series.

However, using neural networks also comes with certain challenges. The need for large volumes of training data and the complexity of tuning model parameters can be a barrier to their implementation. However, with advances in technology and the availability of cloud computing, neural networks are becoming increasingly accessible to businesses and scientific research. Ultimately, neural networks continue to revolutionize approaches to solving complex problems, opening new horizons for innovation and improving quality of life. Their use has already become part of everyday reality and continues to expand, allowing for impressive results in a wide variety of fields.

Screenshot: ChatGPT & Midjourney | AI bot / Telegram / Skillbox Media

Let's look at an example of image generation in the Kandinsky neural network. We'll use the prompt "Create an image of a cat programmer working late." This will allow us to obtain a unique visualization reflecting the image of a hard-working cat immersed in programming. The neural network will create an illustration demonstrating the atmosphere of night work, where the cat is surrounded by code and a computer, which emphasizes its professional activity.

Image: Yulia Gavrilova / Kandinsky

The image turned out unusual, but the neural network successfully reflected all aspects of the query. To achieve a more accurate result, it is necessary to pay more attention to the style selection. Optimizing parameters and carefully elaborating on query elements will help improve image quality and meet expectations.

The more detailed your query, the more accurately the text or image you receive will meet your expectations. When creating text, you can not only specify the topic and format but also list key points or define the structure of the article. Language models can also take into account other characteristics, such as writing style, tone, and target audience. This can significantly improve the quality and relevance of the generated content, which is an important aspect for successful SEO optimization. The more clearly you formulate your requirements, the more satisfactory the end result will be.

  • Mood: neutral, mystical, dramatic.
  • Style: scientific, journalistic, informal.
  • Target audience: schoolchildren, adults, IT specialists.
  • Text length: 100 words, 1000 characters.

Text topics can be varied, and it is important to adapt the content for different reader groups. For beginning readers, it is worth using simple, clear terms and explanations to make the material accessible. For example, you can start with a basic definition of the topic, gradually delving into the details. For a more experienced audience, you should use specialized vocabulary and assume basic knowledge, which will allow you to focus on complex aspects and in-depth analysis. In this way, you can create two texts, each of which will correspond to the level of preparation of its target audience, without losing the main essence and content.

  • "Write an article for a tech company's blog about neural networks. Explain why neural networks don't steal people's work, but create it. 1000 characters. The target audience is beginner programmers."
  • "Write a scientific article about neural networks. Explain why neural networks don't steal people's work, but create it. 1000 characters. The target audience is scientists."

When working with images, it's important to detail your query by specifying the size, color, shape, and location of objects. Instead of simply saying "cat," describe its characteristics (e.g., fat, orange, tabby), its location, and the objects surrounding it. For a better result, it is also recommended to set an image style.

Kandinsky created a unique image of a giant, fat, orange tabby cat programmer, working late at his computer in an 1980s-style setting. Immersed in the world of programming, this cat embodies the combination of creativity and technology. Its image seamlessly blends elements of oil painting, lending the painting a unique atmosphere and depth. The vibrant colors and textures typical of this style emphasize details, creating a sense of dynamism and tension typical of a programmer's nighttime work.

Image: Yulia Gavrilova / Kandinsky

Comparing the results of the first attempt at generating an image of a workaholic cat with the latest result, you can see a significant improvement in image quality. To achieve this effect, we used the same neural network, but this time we added more detail to the prompt, which allowed us to create a more realistic and expressive image.

Requests sent to different neural networks can produce significantly different results. For example, this is how the Stable Diffusion neural network depicted a cat.

Screenshot: Stable Diffusion Online / Skillbox Media

Neural networks can be used to create images in the style of famous artists. For example, Stable Diffusion generates paintings based on given queries. One example is the image "Cat at a Computer" in the style of Van Gogh's "Starry Night." Such technologies open up new horizons for art and allow everyone to feel like an artist, creating unique works inspired by classical styles.

Screenshot: Stable Diffusion Online / Skillbox Media

Here are some helpful tips to help you simplify your interaction with neural networks:

First, familiarize yourself with the basics of neural networks. Understanding how they work will help you better leverage their capabilities. Second, use high-quality datasets to train your models. The more diverse and complete the data, the more accurate the results will be. Third, remember about regularization. This will help avoid overfitting and improve the generalization ability of the model. Fourth, test and validate your models on different datasets to ensure their reliability and robustness.

It's also helpful to keep up with the latest trends in artificial intelligence. New algorithms and methods can significantly improve the efficiency of your projects. Don't forget about hyperparameter optimization, as the right settings can significantly impact the performance of your neural network. Finally, actively participating in communities and forums will allow you to share experiences and receive advice from industry professionals.

Following these recommendations, you can significantly simplify your work with neural networks and improve the efficiency of your decisions.

  • Use Telegram bots. Large foreign neural networks are currently unavailable in Russia, but chatbots based on them still work.
  • Many enthusiasts say that it's worth using queries in English—neural networks understand it better.
  • Avoid using abbreviations, colloquialisms, or slang in the prompt—language models don't understand them well.
  • Don't try to generate "forbidden" words. Neural networks have filters in place that won't let you do this.
  • Make sure your request details are consistent.

Midjourney requests should be clear and to the point.

Midjourney is a neural network platform designed to generate high-quality images. It creates four images upon request, giving the user a choice. Midjourney is accessible through a bot on the developers' official Discord server. It's important to note that there is no trial period, and subscriptions start at $8 per month. Payment is only available with international bank cards. Midjourney is suitable for both professionals and amateurs who want to create unique visual content using artificial intelligence.

Midjourney-based bots are available on Telegram, offering the opportunity to explore the neural network through a trial period. This period allows users to test the features and capabilities of Midjourney. However, after this period, you will need to purchase tokens to continue using the service.

When creating prompts for Midjourney, it is important to consider the order in which details are mentioned. The earlier you specify a specific element, the higher its priority in the final image. We recommend first describing the main subject, then the environment and background, and then moving on to style and color. Finally, specify the proportions and size of the image. It is also worth noting that it is more effective to formulate queries to Midjourney in English. This will help to obtain more accurate and high-quality results.

Here is an example of a prompt for image generation: "Depict a mural of a silver spaceship moving through pink, purple, and blue nebulae and galaxies. The ship is located in the center, and smaller spaceships, which are destroyed, are visible in the background. Genre: 80s science fiction."

We begin with a description of the subject of the mural—a spaceship. We then define the desired background, which includes nebulae and galaxies to add depth and atmosphere. It's also important to specify a style based on 80s science fiction, which will highlight the uniqueness and character of the work. We also refine the color palette for the objects and detail the arrangement of elements on the canvas to achieve harmony and expressiveness in the image.

Unique images were created using the Midjourney Telegram bot. This bot allows users to generate visual content using advanced AI algorithms, providing a variety of styles and themes. With Midjourney, you can create high-quality images that are ideal for use in a variety of projects. This tool is becoming increasingly popular among designers and creators looking to create original and engaging visual content.

Screenshot: ChatGPT4 | Midjourney / Telegram / Skillbox Media

To select the image you like, you need to click on one of the Un buttons, where n denotes the image number. Buttons with the V prefix create a new image based on your selection.

Screenshot: ChatGPT4 | Midjourney / Telegram / Skillbox Media

Images can be optimized using the built-in tools provided by the bot. These tools improve image quality by increasing clarity and brightness. Using the editing functions, you can adjust color balance, contrast, and saturation, which ultimately leads to a more appealing visual perception. Cropping and resizing options are also available, allowing you to adapt the image to different formats and platforms. Using these tools will improve the overall perception of the content and make it more appealing to users.

  • Upscale. Increases the image resolution. The Subtle and Creative parameters are responsible for the creativity of the upscaling. In the first case, the image will be identical to the original, and in the second, the neural network will add new details.
  • Vary. Generates variations of the same image. If you select a command with the Subtle parameter, the image will be more similar to the original version, if you select Strong, it will be smaller.
  • Zoom Out. Increases the viewable area of ​​the image by 1.5 or 2 times.

Specify the technical characteristics of the equipment used, such as the lens, camera, lighting, and other parameters. These aspects significantly affect the color gamut and overall perception of the image. For example, when using a film camera, photographs will have a slight graininess, which gives them a unique character. The correct selection of equipment and its settings will help achieve the desired visual effect and improve the quality of photographs.

Photography professionals can specify specific equipment settings in the Midjourney prompt. The neural network is capable of processing elements such as ISO, aperture, shutter speed, and white balance. These settings allow you to generate photorealistic images, which is especially important for professionals and amateurs striving for quality in their work. By using precise data, users can achieve the desired result and create unique visual projects.

Midjourney offers a variety of commands for creating detailed queries, allowing you to generate high-quality images. Using these commands significantly improves results. Let's look at some of the most popular and effective commands to help you create unique visuals.

  • —no. Excludes objects, styles, or colors from the result. For example, you can ask the neural network to create a picture of cucumbers and tomatoes in a summer kitchen, but do not use yellow:
Screenshot: ChatGPT4 | Midjourney / Telegram / Skillbox Media
  • —aspect or —ar. Allows you to set the aspect ratio. By default, the neural network generates images with a 1:1 ratio, but you can use other popular formats:
Image: Midjourney v7
  • —chaos or —с. This command controls how much the four generated variants differ from each other. The default value is zero. As it increases, the differences between the images will become greater:
Generations without the chaos parameter (left) and with the highest value (right) Image: Midjourney Documentation
  • —quality or —q. This parameter controls the processing and detail of the image. There are four possible values: 0.25, 0.5, 1, 2. The higher the detail, the more time it will take to generate. The default value is 1.
Image: Eugene Chekhov / X
  • —tile. This parameter tells the model to generate images in the form of a seamless pattern.

For more detailed information on how Midjourney processes queries, we recommend reading the official documentation. This will help you understand the basic principles of operation and the capabilities this tool offers.

Querying Stable Diffusion follows the same rules as querying Midjourney.

Stable Diffusion is an open-source model developed by Stability AI, which is actively used by third-party developers to create websites and applications based on this neural network. For those who want to test the model's capabilities, the Stable Diffusion Online service is available. It offers a trial plan that allows you to generate up to ten images for free, which is ideal for experimenting and familiarizing yourself with the neural network's functionality. Stable Diffusion is becoming an increasingly popular tool in the field of image generation, which opens up new horizons for creative projects and developments.

Screenshot: Stable Diffusion Online / Skillbox Media

The neural network does not offer commands for detailed configuration, as is implemented in Midjourney, but the basic principles of composing prompts remain unchanged. For example, Stable Diffusion created an image for the query "Beautiful retro comic-style image of a girl writing an article against the backdrop of a summer park on a bright sunny day."

Screenshot: Stable Diffusion Online / Skillbox Media

The Stable Diffusion Online service has a special field for specifying details that should not appear in the generated image. For example, if the request is "Angelic red apple on a cloud," you can add a condition to prevent the neural network from depicting angels. A menu for selecting a style is also located nearby. Select the "fantasy" style and analyze the result.

Screenshot: Stable Diffusion Online / Skillbox Media

Add more detail to your Shedevroom queries.

Shedevroom is a free neural network from Yandex designed for generating images and creating looping animations. To access this platform, you must install the app from Google Play or the App Store and log in. Using Shedevroom, users can create unique visual content, making it an excellent tool for designers and creatives.

All the query principles discussed earlier apply to Shedevroom as well. The app features a feed of the latest and most popular works, which can be used for inspiration and idea generation. Shedevroom's key advantage is its ability to effectively process requests in Russian.

Screenshot: Shedevroom / Skillbox Media

When searching for Kandinsky, we reference Russian culture.

Kandinsky by Sber AI is a neural network for generating images and short videos, released in 2021. The latest version has significantly improved context understanding and has extensive knowledge of Russian culture. If you need to create a character from a Russian or Soviet cartoon, such as Cheburashka, Kandinsky is the optimal choice for this task.

Access to the model is available through the ruDALL-E portal, Fusion Brain, as well as through a Telegram bot and the Salut app for Android.

The ruDALL-E website offers free use without registration. On the main page there is a field for entering a text query, as well as a menu that allows you to select the aspect ratio, resolution, and image style.

Screenshot: ruDALL-E / Skillbox Media

To access the Fusion Brain web app, you must complete the registration process. This app offers advanced content generation capabilities. Users can place multiple design options on a single canvas and select the most suitable one. Fusion Brain also provides tools for creating videos and animations, making it ideal for creative projects and visual presentations.

Kandinsky is currently only capable of creating short animations. The maximum animation length is 7 seconds, while videos can be up to 4 seconds. To create a video, you need to:

  • Select the "Video" tab in the editor.
Screenshot: Fusion Brain / Skillbox Media
  • In the "Model" section, select the content type: animation or video. In the "Size" menu, you can set the aspect ratio.
Screenshot: Fusion Brain / Skillbox Media
  • For generating animation You need to describe what's happening in each frame and choose the camera direction.
  • When creating a video, you can simply specify a prompt.

Examples of videos created using Kandinsky technology demonstrate the unique possibilities of generating visual content. Kandinsky provides tools for creating animations and videos that combine artificial intelligence and a creative approach. These videos are distinguished by an original style and can be used in a variety of fields, including advertising, art, and education. Thanks to powerful algorithms, Kandinsky allows users to bring their ideas to life, creating captivating video projects that attract viewers' attention.

Be sure to describe the context in your requests to ChatGPT.

ChatGPT is a chatbot based on the powerful GPT language model developed by OpenAI. It can create articles, generate ideas, develop content plans, and prepare publications for social media. Thanks to its advanced algorithms, ChatGPT efficiently processes requests and provides high-quality responses, making it a useful tool for marketers, authors, and content specialists.

The chatbot's official website is not available in Russia, but the company provides a public API. This API is actively used by third-party developers to create Telegram bots that integrate ChatGPT functionality. Thanks to this, users in Russia can access the chatbot's capabilities through alternative platforms, such as Telegram.

The neural network supports many languages, including Russian. To achieve predictable results, it is necessary to adhere to a clear structure when formulating queries. Correctly formulated queries allow you to maximize the capabilities of the neural network and receive high-quality answers.

  • Role. Start the prompt by describing the chatbot's role. For example, it could be an experienced marketer or a psychologist.
  • Task. Then tell ChatGPT what you want. To do this, use action descriptions: "write," "think up," or "analyze."
  • Context. Introduce ChatGPT to the task, convey the purpose of the request and the input data. If you want to generate a content plan, then talk about the end goal.
  • Format. Specify what format the response should be in: a table, email, script, or article.
  • Tone. If you are using a chatbot to generate an email for colleagues, then specify that the communication tone should be businesslike.

To successfully grow a blog in the education niche from 1,000 to 5,000 subscribers in three months, it is important to develop a detailed content plan. A sample monthly plan can include a variety of topics, formats, and promotion strategies. The main objectives are the creation of high-quality content, audience interaction, and search engine optimization.

The content plan may include:

1. Articles on modern teaching methods and their application.
2. Interviews with education experts.
3. Top 10 resources for self-improvement and professional development.
4. Video reviews of educational books and courses.
5. Collections of useful tools and applications for students.
6. Infographics on education trends.
7. Checklists for preparing for exams and tests.
8. Webinars with questions and answers on relevant topics.

It is important not only to publish content, but also to actively promote it through social networks, newsletters, and collaboration with other bloggers and educational platforms. It's also worth paying attention to the SEO optimization of each material, including keywords, meta tags, and internal links to improve visibility in search engines.

Screenshot: ChatGPT / Skillbox Media

Please be creative in your GigaChat queries.

GigaChat is a powerful language model developed by the Sber AI team. It is similar to ChatGPT, but with a focus on Russian-language content, which allows for higher-quality and more relevant responses for users. GigaChat can be accessed both through the official website and through a Telegram bot, making interaction with the model convenient and accessible. Optimized for the specifics of the Russian language, GigaChat offers a unique experience of communication and support on various issues.

The neural network has the ability to answer questions, create articles, and generate ideas. One of its main advantages is its high level of proficiency in Russian. However, it is worth noting that ChatGPT is initially oriented towards English, and quality issues sometimes arise when translating responses into Russian. This may impact the accuracy and depth of the information provided.

GigaChat is a powerful tool for working with Russian-language texts and generating creative content. The chatbot can create original jokes with puns, slogans, and even songs. Furthermore, the GigaChat Telegram bot makes it easy to design unique greeting cards for loved ones, allowing you to express your feelings and make every moment special. Use GigaChat to create high-quality content and boost creativity in your projects.

  • First, you need to send the "Create a postcard" command and answer a few clarifying questions.
Screenshot: GigaChat / Telegram / Skillbox Media
  • The neural network uses this data to compose a short poem:
Screenshot: GigaChat / Telegram / Skillbox Media

Where to Find Inspiration

Improving your prompt writing skills is possible with the help of specialized websites. On such platforms, users share successful queries and results that can be adapted to your own needs and goals. These resources provide valuable examples and inspiration for creating effective prompts.

  • Lexica. A large library of neuroarts with prompts that can be copied with one click.
Screenshot: Lexica / Skillbox Media
  • OpenArt. A gallery of user-generated images with requests and detailed parameter descriptions.
Screenshot: OpenArt / Skillbox Media
  • "Masterroom." The app feed displays users' work. They can be used to search for ideas.
Screenshot: "Shedevroom" / Skillbox Media
  • GigaChat. The Sber AI development team collects successful prompts in a knowledge base. They also publish example responses along with the queries.

Prompt Generation Assistants

There are specialized services designed to create effective queries for generative models. These tools help users formulate queries to obtain the most relevant and high-quality results. Using such services can significantly improve the accuracy and efficiency of interaction with generative models, making them indispensable for developers and researchers in the field of artificial intelligence.

  • Promptomania — a prompt builder for Midjourney. With it, you can quickly understand styles, camera settings, and create complex queries.
Screenshot: Promptomania / Skillbox Media
  • ChatGPT Prompt Generator is a service that helps you create a request with a detailed description of the chatbot's role. After processing such a request, the bot will respond as a regular expression specialist, writer, or software architect.
Screenshot: Aspose / Skillbox Media
  • Neural Writer is a prompt generator that supports 27 languages. The service receives the request and adapts it for ChatGPT.
Screenshot: Neural Writer / Skillbox Media
  • GPTprompt - helps to compose queries in Russian.
Screenshot: GPTprompt / Skillbox Media

Check out additional materials:

  • 30 powerful neural networks for any task
  • Neural networks are out of their minds: AI schizophrenics and mentally ill chatbots
  • TensorFlow library: writing a neural network and studying the principles of machine learning