Monday, June 5, 2023

Coding with ChatGPT and related tools

 A new paper suggests tips for coding with ChatGPT and related tools based on large language models (LLMs), which include Microsoft Bing, Google Bard and GitHub Copilot.

Created with ChatGPT and Bing image creator

- Use it for:

    - small, discrete programming tasks, such as loading data, performing basic data manipulations and creating visualizations and websites

    - explaining, debugging and annotating code

    - translating code from one language to another


- Read it carefully and test it.

    - Be aware that ChatGPT can create “simple, stupid bugs”. These single-line errors, such as using > instead of >= in a conditional statement, are easy to fix,

    - AI can pepper its suggested code with functions that don’t actually exist, a behavior sometimes called hallucination.


- Think safety

    - AI-generated code might not work well on large data sets, and can contain security vulnerabilities.

    - Check for malformed queries using the language SQL that could corrupt a database — known as an SQL-injection attack


- Iterate

    - Chatbot-based coding is a conversation. Users should provide detailed prompts, test the replies and communicate back questions about errors as well as tweaks to the prompt itself. Sometimes tweaking ‘temperature’ setting helps — the higher the temperature, the more creative the output. 

- Anthropomorphize

    -  treat this AI as a summer intern, or direct it to assume a role

- Use new tools and plugins


REFERENCE

Perkel JM. Six tips for better coding with ChatGPT. Nature. 2023 Jun;618(7964):422-423. doi: 10.1038/d41586-023-01833-0. PMID: 37277596.



Shue E, Liu L, Li B, Feng Z, Li X, Hu G. Empowering beginners in bioinformatics with chatgpt. bioRxiv. 2023:2023-03.


No comments:

Post a Comment

AI and the Future of Housing Development

The role of AI and advanced algorithms in urban development is rapidly expanding, bringing transformative changes to how communities are pla...