ProgrammingPro #22: Fine tuning GPT3.5, Superfast Python, and La la Llama
Bite-sized actionable content, practical tutorials, and resources for programmers.
Hi,
“Programmers should never be satisfied with languages which permit them to program everything, but to program nothing of interest easily.”
― Alan J. Perlis, First ACM Turing Lecture: The Synthesis of Algorithmic Systems
Welcome to this week’s issue of our programmer focused newsletter.
Let’s talk about fine tuning today. Early results show that fine-tuned GPT-3.5 Turbo can surpass the capabilities of GPT-4 in certain tasks. How many of you have tried fine-tuning already and what did you think about the results? Do let us know in this week’s survey.
For those still waiting to give it a try, we have found a comprehensive guide that will take you through the process of fine tuning GPT 3.5, which was made available to developers last week. And no, we haven’t forgotten to pick up something about using Code Llama. Also, IBM claims that GenAI can convert COBOL to Java!
We also look at Scalene, a Python profiler that is kicking up a storm and is probably going to make the language even more popular, if that is possible. In the meanwhile, IEEE’s Spectrum’s rankings published this week remind us of the importance of old languages like SQL in the job market despite the advent of AI.
For those of you who liked our touch on C++ last week, we have something interesting for you in our “Expert insights” section. But there’s even more to unpack, including some awesome tools, so dive right in!
What do you think of this issue and the usefulness of fine-tuning in your work as a programmer? Also, what tutorial would you like us to cover next week? Do let us know and we will try our best to get it for you. And as a bonus you can download a free PDF of the The C++ Workshop eBook upon completion.
Stay awesome!
Divya Anne Selvaraj
Editor-in-Chief
⚡ TechWave: News and Analysis
Computer scientists use AI to accelerate Python’s computing speed by thousands of times: The University of Massachusetts Amherst computer science team, led by Emery Berger, has introduced Scalene, a Python profiler that addresses Python's inherent slowness, which can be up to 60,000 times slower than other languages. Scalene precisely identifies Python code inefficiencies in CPU, GPU, and memory usage, and uniquely employs AI, similar to ChatGPT, to suggest optimizations for specific lines or code groups. This actionable dashboard helps programmers optimize their Python code for improved performance, which is critical as computer speed improvements increasingly depend on efficient programming. Scalene has gained widespread use with over 750,000 downloads since its GitHub release.
Poe’s new desktop app lets you use all the AI chatbots in one place: The AI chatbot platform from Quora, has unveiled significant updates, including a new Mac app and the ability to engage in multiple conversations with the same AI bot. Users can now access Meta's Llama 2 model, and Poe also plans to introduce an enterprise tier for company management. Poe aims to be the go-to browser for AI chatbots, envisioning a future where numerous AI bots co exist. It offers a subscription at $19.99 per month or $200 per year for unlimited access to all bots on its platform. Developers can now fine-tune prompts by adjusting the "temperature" for varied or consistent responses.
10X coders beware: Meta’s new AI model boosts coding and debugging for free: Code Llama is a game-changer for both research and commercial purposes, as it is proficient in generating and debugging code in various programming languages, including Python, Java, C++, PHP, TypeScript, C#, and Bash scripting. What sets Code Llama apart is its remarkable capacity to handle up to 100,000tokens, making it exceptionally adept at evaluating lengthy programs compared to its counterparts like ChatGPT. This extended context capability opens doors to more relevant code generation, particularly in debugging scenarios within extensive codebases. Whether you need code written from high-level instructions or corrections for problematic code, Code Llama is poised to boost software development efficiency and accessibility.
IBM says GenAI can convert that old COBOL code to Java for you: IBM claims that its GenAI has the potential to revolutionize software development by converting old code into modern software. However, questions about its effectiveness and the necessity of human oversight remain. GenAI, for now, seems to offer an intriguing tool for software modernization, with the ability to potentially reshape coding practices.
IEEE Spectrum’s10th annual rankings of The Top Programming Languages 2023: Employers are placing high value on SQL skills, putting it at the top of the job market rankings. While pure SQL programming roles are rare, employers appreciate candidates who combine SQL expertise with languages like Java or C++. With modern distributed architectures, vital business data often resides in SQL databases, making SQL proficiency crucial for accessing and utilizing this information. Python's dominance continues, particularly in AI and other domains, yet programming remains diverse. The IEEE Spectrum's Top Programming Languages ranking reflects the evolving needs of developers by combining multiple metrics of popularity to provide insights into language preferences.
✨ Tutorials and Guides
ChatGPT Functions - Full Tutorial for using OpenAI Functions: This video tutorial provides an introduction to ChatGPT Functions, explaining their purpose and how to integrate them into your applications. It covers the setup of OpenAI, API keys, and demonstrates basic examples of ChatGPT Function usage, including function initialization, syntax setup, and function calling, with practical examples like a "Time of day" function and an "Expert Function" for web scraping, along with a GitHub project for download.
GPT-3.5 Fine Tuning with NodeJS: A comprehensive guide: Fine-tuning offers benefits such as improved steerability, reliable output formatting, and aligning AI tone with brand voices. This tutorial in NodeJS provides a hands-on step-by-step approach to fine-tuning.
Fine-TuningGPT-3.5: A Practical Python Example: This guide provides a detailed, practical tutorial on how to utilize fine-tuning in OpenAI's models to achieve specific and cost-effective outputs for tasks like JSON formatting. It highlights the benefits of fine-tuning, such as better responses, increased training data, and shorter prompts for reduced costs and latency. The guide also offers a sample use case, demonstrating substantial cost savings compared to using LLMs. It outlines the steps to prepare synthetic training data, format it correctly, and fine-tune the model effectively.
How to Iterate Through a Dictionary in Python: This tutorial on iterating through Python dictionaries equips programmers with essential skills for efficient dictionary manipulation. It covers fundamental techniques like direct traversal, looping over dictionary items, and iterating through keys and values. The tutorial also explores advanced concepts such as comprehensions, sorting, and working with multiple dictionaries.
Mastering Node.js: The Ultimate Guide: This nifty guide will help you harness Node.js’ event-driven, asynchronous nature for efficient multitasking. Use this to master installation on different OSes, discover key modules, become familiar with the Node Package Manager (NPM), create an Express app, adopt a structured project layout for Node.js development, and more.
Get Started With Django: Build a Portfolio App: This tutorial introduces you to Django, and guides you through building a practical portfolio app. You'll gain insights into the advantages of using Django, understand its architecture, and learn to create models, views, and templates. Plus, you'll master the art of uploading images to your Django site.
Marketing for Developers: The Unconventional Guide: This is probably not something you would expect to see in this section, but we thought we would send this guide over to you anyway because we know you are always building awesome things that should be heard about. In the article, the author talks about the common pitfall of "building because we can" and emphasizes the importance of validating ideas before coding. The guide also distinguishes between marketing and sales, stressing the need for developers to excel in both. There is quite a bit more in there.
🧠 Expert insights from the Packt Community
An excerpt from Hands-On Design Patterns with C++ by Fedor G. Pikus
How to grant friendship in C++
Friend is a C++ concept that applies to classes and affects the access to class members…. Usually, public member functions and data members are accessible to anyone, and private ones are only accessible to other member functions of the class itself. The following code does not compile because the data member C:x_ is private:
class C {
int x_;
public:
C(int x) : x_(x) {}
};
C increase(C c, int dx) {return C(c.x_ + dx); }
// Does not compile
The easiest way to solve this particular problem is to make increase() a member function, but let's stay with this version for a moment. The other option is to relax access and make C::x_ public. That is a bad idea because it exposes x_— not just to increase(), but to any other code out there that wants to directly modify an object of type C. What we need is to make x_ public, or at least accessible, to increase() and to nobody else. This is done with a friend declaration:
class C {
int x_;
public:
C(int x) : x_(x) {}
friend C increase(C c, int dx);
};
C increase(C c, int dx) {return C(c.x_ + dx); }
// Now it compiles
The friend declaration does nothing more than give the specified function the same access as the class member functions get. There is also a form of friend declaration that grants friendship, not to a function, but to a class; this is just a way to grant friendship to all member functions of that class.
Hands-On Design Patterns with C++ by Fedor G. Pikus was released in July 2023. To get a more comprehensive preview of the book's contents, read the first chapter available for free here or signup for a 7-day free trial to access the complete Packt digital library. To explore more, click on the button below.
📚 Secret Knowledge: Learning Resources
Llama Code: How Meta AI LLM Can Help You Write Better Code: This article explains how to use Llama Code with Hugging Face, a NLP platform. It covers code generation, code completion, code debugging, and code documentation, demonstrating the LLM’s capabilities with practical examples.
OpenAI API Requests in JavaScript 2023: Are you ready to make the switch from OpenAI API v3 to v4? The transition involves syntax and breaking changes. This concise guide demonstrates how to create a request for the gpt-3.5-turbo model, by providing a practical example of generating, interestingly, a poem about the future of web development. Quite useful for developers looking to work with the OpenAI GPT API in JavaScript.
AI Wrangling For Devs 101: This guide emphasizes the importance of being specific when instructing AI, maintaining an active role in the AI-generated code refinement process, and not relying on AI to replace critical thinking. It highlights the need for clear instructions and an iterative feedback loop when working with AI. Overall, the article provides practical tips for developers considering the use of AI in their projects.
Programming embedded systems: event-driven programming: Dr. Miro Samek's video lesson delves into the concept, showcasing how event-driven programming revolutionized GUIs through dedicated event objects, asynchronous event delivery, and the event loop. He emphasizes Run-to-Completion (RTC), which guarantees orderly event processing, while highlighting the inversion of control principle—events drive the application.
Understanding Automatic Differentiation in 30 lines of Python: Automatic differentiation, is a crucial aspect of neural network training. This article starts by explaining the limitations of basic variable assignment in Python and then introduces a custom Tensor class that enables symbolic calculations. Through code examples, you will be able to see how this class can represent mathematical operations and build computation graphs. You will also see how features can be added to handle more complex formulas and derivatives.
Understanding how React handles input state: A deep dive: This article explores how React manages input states, focusing on controlled and uncontrolled components. It delves into the concept of input state, including input tags, checkboxes, radio buttons, and more. The article discusses controlled components, uncontrolled components, and how React leverages these concepts to enhance app performance and reduce re-rendering. Additionally, it covers how onFocus and onBlur events work with input elements and suggests using third-party libraries for handling input state in React.
🔍 HackerHub: Tools & Launches
CodeGlossary: a repository that provides clear explanations of programming terms, making complex coding concepts easily understandable, with features like a curated collection of coding jargon, open contributions, and a focus on simplifying programming terminology for all developers.
StringZilla: a library designed for rapid sorting, searching, splitting, and shuffling of strings, capable of efficiently handling extensive strings and multi-gigabyte files in both Python and C, to achieve exceptional speeds.
maccarone: a Python tool that delegates code sections to AI for automatic generation and updates, usable as a VS Code extension or via the command line, powered by OpenAI'sGPT-4.
OS.js: an open-source web desktop platform with window manager, application APIs, GUI toolkit, filesystem abstractions and more. You can use the OS.js base repository as a template to make your own distributions, installations and development environments.
netron: a versatile model viewer supporting various machine learning frameworks, including ONNX, TensorFlow Lite, Core ML, Keras, Caffe, Darknet, and more. It can be installed on macOS, Linux, and Windows, via a Python server, or as a browser version.
cdk-cost-limit: an Amazon Cloud Development Kit library that enables developers to deploy cost-aware, self-limiting resources on AWS, thus mitigating the risk of high cloud costs stemming from coding errors, pricing model misunderstandings, or malicious activities.
📢 If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want to advertise with us.
If you have any comments or feedback, take the survey!
Kind Regards,
Divya