How AI helps a programmer – and why this 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 its shortcomings, but nevertheless 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, in this matter, everything is not sweet yet. Reason: AI hallucinations

What are we even talking about?

Any AI output involves a risk of error, which is called “hallucination.” Just 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 things out.” For example, in its response, the neuron can refer to a non-existent scientific study, which at the same time looks like a real one: with all the initial data, names, design rules. It’s the same with the code. AI can write non-executable code and not even understand what is happening.

Then how to use AI in development?

If you think that the neuron will write the code for you, you are mistaken (but perhaps you have already tried and know this). So far, all AI programmer assistants are more like half-junes who can “bring ammo” (for example, help with syntax).

Neurons in development need to be used differently.

Plan infrastructure. Many developers find it difficult to tackle infrastructure, especially if there are problems with the abstraction layer. In this case, the AI ​​(for example, Autogen by Microsoft) will help provide the project with tools for collaboration and solving a single problem.

Select library. The latest version of ChatGPT is quite comfortable 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 do the research and clearly explain the differences. But I wouldn’t rely on her final choice.

In my experience, Chat GPT accurately “knows” PHP, Python, Java, Kotlin, Swift, C#, but can still produce something close to workable code from COBOL, Fortran, Forth, LISP, ALGOL. For fun, you can even run it in Assembler.

And here – 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 write code in it. It's all just a matter of the accumulated base.

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 problem into many small subtasks, each of which it tries to solve with a piece of existing code. It turns out well, but, of course, it’s a crutch on a crutch.

By the way, Microsoft also considers DeepCoder 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 already existing human parts.

What should you not do?

Offer to write code. Most likely, you will end up with buggy code that won't compile. In my experience, even a small plugin for WordPress or a simple one cannot be written using AI.

To write code using 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

Eg, Hugging Face bill themselves as a project that can turn natural language into code examples. But in this case, to obtain working code, a competent formulation of the problem in “human” language with a deep understanding of the operation of algorithms and data types is required.

Correct code. Neurons can practically debug the code on their own. For AI, the result of generation is a single entity that is very difficult to edit.

For a person, “rewriting the code” means fixing parts of it. For AI, rewriting code means creating something new that can achieve a result. As a result, the neuron is engaged in complicating the code base and is proud of the hooks.

How to help the neuron?

The most important thing you can do is to write as detailed a statement as possible. Rely on the Cornell University promt scale.

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

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

Error identification. To avoid accidentally using a result with an error, ask the AI ​​to cite the sources it relied on in its answer. She also knows how to ask clarifying questions, which will help the user adjust the procedure and get a more accurate result.

Improved tooltips. Sometimes the model refuses to answer. Then you can use different techniques to get around its limitations. For example, when asked to “specify the limitations of a microservice architecture,” she produces five main points. And when the user asks for clarification, 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 where you need to generate endless options according to a certain rule. In order not to insert a template every time, you can tell the model: “Generate answers for me without stopping according to a given rule.”

Context management. Useful when you need to exclude some sources from your answer. For example, you can ask that your answer be based only on data from official websites or indexed sources. This way, unnecessary context is cut off – and the model produces a result taking into account the data that is important to the user.

Sometimes you can find inconsistencies within an 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 mistakes.

By the way, what other problems could there be?

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

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

What next will be better?

Undoubtedly. I think our industry is facing some very big AI changes. Now the neural network cannot write good code, but it will definitely learn. And even earlier:

  • AI will be able to debug simple code.

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

  • The role of natural language in programming will continue to 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 remain unemployed.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *