How AI helps a programmer – and why it doesn’t always happen

How AI helps a programmer – and why it doesn’t always happen

Neural networks have long ceased to be a toy and turned into a tool. Yes, it is not yet universal and not without flaws, but it is quite powerful and productive. AI is also used in development. Github proves: a neuron can become a “third hand” for a programmer: speeding up work and helping to complete tasks. However, all is not sweet in this case. The reason is II hallucinations

What is it all about?

In any result of the work of AI, there is a risk of error, which is called hallucination. As a person during a hallucination cannot distinguish reality from a distorted picture, so AI often cannot evaluate the result of its work.

Moreover, AI can “think”. For example, in its answer, the neuron of the method refers to a non-existent scientific study, which in its own way looks like a real one: with all the original data, surnames, rules of registration. The code is the same. AI can write code that doesn’t execute and not even understand what’s going on.

Then how to use AI in development?

If you think a neuron will write the code for you, you’re wrong (but maybe you’ve already tried and you know). So far, all the AI ​​assistants of the programmer are more like half-junes who can raise cartridges (for example, help with syntax).

Neurons in development need to be used differently.

Plan the infrastructure. Many developers find it difficult to tackle infrastructure, especially if there are problems with the level of abstraction. In this case II (for example, Autogen from Microsoft) will help provide the project with tools for collaboration and solving a single task.

Select a library. The latest version of ChatGPT is quite convenient to use as a super search engine. For example, with the help of AI, you can choose the appropriate library for your project: the neuron will search and clearly explain the differences. But I would not rely on her final choice.

In my experience, Chat GPT knows PHP, Python, Java, Kotlin, Swift, C# for sure, but can produce something close to workable code from COBOL, Fortran, Forth, LISP, ALGOL. For a joke, you can chase him even on Assembler.

But – funny examples of absurd codewho wrote Chat GPT.

In my opinion, the more popular a language is and the less dialectical changes occur in it, the better AI can code in it. It’s all about the accumulated database.

Simplify. For example, use DeepCoder for routine tasks. Unlike other “copilots”, DeepCoder does not try to write the code itself, but tries to break the task into many small subtasks, each of which it tries to solve with a piece of already existing code. It turns out not bad, but, of course, a crutch on a crutch.

By the way, Microsoft considers DeepCoder also a tool for learning programming. But it is difficult for me to imagine how doctors can be taught to heal by forcing them to sew a patient together from human parts.

And what should not be done?

Offer to write code. Chances are you’ll end up with buggy code that won’t compile. In my experience, even a small or simple plugin for WordPress cannot be written with the help of AI.

To write code with the help of AI, you need to be able to write it yourself – and almost always in this case it will be faster and easier to do everything yourself

Example, Hugging Face claims to be a project that can convert natural language into code examples. But in this case, to obtain a working code, a competent formulation of the task in “human” language with a deep understanding of the operation of algorithms and data types is required.

Fix the code. Neurons can practically debate the code on their own. For II, the generation result is the only entity that is very difficult to edit.

For a person, “rewriting the code” means correcting its parts. For AI, to rewrite the code is to create something new that can achieve a result. As a result, the neuron deals with the complexity of the codebase and makes the hooks proud.

How to help a neuron?

The most important thing you can do is to write as detailed a prompt as possible. Use the Cornell University prompts scale.

Input semantics. Set rules that AI remembers and takes into account for answers. This simplifies the syntax and saves time. An example of a request: “Remember this token, and when I ask to substitute it for the TOK variable, insert it from memory.”

Information output settings. Ask the AI ​​to output information based on a template. First, you need to load the rules into the neural network, and then specify in the request when to use them. For example: “Format the code according to the syntax requirements.”

Error identification. To avoid accidentally using the wrong result, ask the AI ​​to cite the answers of the source it relied on. And she also knows how to ask clarifying questions, they will help the user to adjust the prompt and get a more accurate result.

Improved tooltips. Sometimes the model refuses to answer. Then you can use different techniques to avoid its limitation. For example, on the request “specify the limitations of the microservice architecture”, it issues five main points. And when the user asks to clarify them, he says that there is no information. To break through this barrier, you should talk to the neural network and let it ask clarifying questions.

Interaction. This category may include tasks when it is necessary to generate infinite options according to a certain rule. In order not to insert the template every time, you can tell the model: “Generate me answers without stopping according to the given rule.”

Context management. It will be useful when you need to exclude some sources from the answer. For example, you can ask to rely only on data from official sites or indexed sources in the answer. In this way, unnecessary context is cut off – and the model produces a result taking into account the data that is important for the user.

Sometimes you can find inconsistencies inside the answer without fact-checking. Ask the model to show the algorithm for solving the problem step by step and describe the result at each stage, it will become clear at what point the AI ​​makes a mistake.

By the way, what problems can there be?

A non-obvious problem that a developer may face is that the generated AI code will not be considered the programmer’s intellectual property. I would not advise using AI assistants for the code base of an innovative startup: you can stay without a code base.

Fortunately, I can hardly imagine such a project – at least not until the hypothetical 2030s.

And what will be better next?

Definitely. I think our industry is in for some very big AI changes. A neural network can’t write good code right now, but it will definitely learn. And even earlier:

  • AI will be able to debate simple code.

  • Neurons will learn to bootstrap products in their entirety: from UX/UI to testing and marketing at the “corridor” level.

  • The role of natural language in programming will grow. In a world where you can describe a task in human language and get a working result with even a 50% probability, half of the programmers will be out of a job.

Related posts