Improving Results Obtained from AI Assisted Development

Index of All Documentation » Wing Pro Reference Manual » AI Assisted Development »


In order to obtain quality results from AI assisted development, it helps to consider the size of the tasks you are asking the AI to perform, the clarity of your instructions to the AI, and whether or not you are providing enough context for it to be able to perform the requested task. If tasks are too large or poorly defined, or if you are providing the AI too little contextual information, then you will receive results that are either incorrect or require too much manual effort to work with.

For AI code suggestion, your request is essentially defined by what precedes the current editor insertion point. Adding a comment or the first part of the code you want helps the AI to understand what you expect it to write. Importing modules you expect the AI to use is another way to increase the chances that you will get what you are looking for.

Both the code in and around your selected transformation Target in the AI Coder tool (or Focus in AI Chat) and your written instructions are important. Be sure that your request is very specific and complete. The AI will understand more than you might expect. For example, you can ask it to "add documentation strings" but may get results closer to what you're looking for if you instead ask it to "add brief documentation strings but without documenting arguments" or "add documentation written in French".

However, asking the AI to transform, write, or otherwise process too much code at once tends to exceed the computational limits of generative AI, and won't produce good results. Focusing on a single function, method, or class tends to work well. Trying to rework a large file all at once often does not work well. You will need to experiment to get a sense for right-sizing your requests. What works is likely to change over time, as generative AI continues to advance.

You will also need to think about whether the AI might need additional context that is not found in the current editor file, as described in detail in AI Request Context.

AI assistants share many characteristics of human software developers: Given an overly large task with too little time to complete it, in the case of AI due to limits on computational complexity, they become overwhelmed and give up before coming up with a good result. A poorly specified task may cause them to go off on a tangent and do the wrong work. Too much irrelevant context can similarly confuse them, wasting their time and attention.

As also for humans, work created by an AI will vary somewhat with each invocation, even if the context and request are exactly the same. If you don't like the results that you've obtained, you may sometimes be able to get what you want just by invoking the same request again. In other cases, you may be better off asking the AI to correct specific mistakes or make further enhancements in subsequent requests, rather than expecting to write all the code with a single request.

Revision Control

We strongly recommend using a revision control system so that you can review and adjust code suggested by your AI provider, before it is accepted into your code base. Wing's AI code suggestion and the AI Coder tool will replace code in your files. If you save them to disk without a revision control system and quit Wing, then you will lose the ability to restore your code to the state it was in before your AI request was made.

If you are not using revision control and are concerned about the AI changing your code, you can use AI Chat to ask the AI to write code and then manually copy and paste results into your code base. AI Chat only outputs code to the chat area and never makes any changes to editors.

It may also help to ask Wing to start a diff/merge session after each result is applied, so you can review changes made and undo any that you don't want. This is done with Transform Starts Comparison in the AI Coder tool's Options menu.

Performance

AI supported development is compute intensive. Requests often take 5 or 10 seconds to complete, and sometimes much longer than that. However for well-designed requests, the amount of work being done by the AI is considerable, and it often produces results that would take much longer to implement manually.

Be sure to also read Managing Cost so that you understand the approximate costs involved with your AI assisted development.

Language Model

The best available language models for software development are constantly changing. Some of the older but still available models do not support a large enough context window to produce quality results in all but the smallest coding projects. As a general rule of thumb, models with context window of 128k tokens or greater seemn to work much better than those with smaller context windows.

Depending on your AI provider, you may need to need to prepay for API credits to a certain level in order to obtain access to better AI models and high enough rate limits for daily usage.