Comparing Top AI Models on the Cyclomatic Complexity: Insights from ChatGPT 4o, Claude 3.5 Sonnet, Nemotron and More

Cristian Nedelcu
12 min readJun 22, 2024

I’m using top AI models according to lmsys.org, including ChatGPT, GPT-2, Gemini 1.5 Pro API, Claude 3.5 Sonnet, Claude 3 Opus, Yi Large Preview, LLaMA 3 70B Instruct, Reka Core, Qwen 2 72B Instruct, and Command R Plus, as well as others like Perplexity, PI AI, and Character AI. The prompt I’m using to compare their results is: “Explain what is Cyclomatic Complexity in simple terms”

https://chat.lmsys.org/?leaderboard

ChatGPT 4o

Cyclomatic complexity is a metric used in software development to measure the complexity of a program. Here’s a simple explanation:

1. **Basic Idea**: Cyclomatic complexity counts the number of different paths a program can take during its execution. The more paths, the more complex the program is.

2. **How It’s Calculated**: Imagine your program as a graph, where each point (node) is a line of code or a decision point (like an if-statement), and each arrow (edge) is the path that connects them. Cyclomatic complexity is calculated based on the number of nodes and edges in this graph. Specifically, it is:
\[
\text{Cyclomatic Complexity} = E — N + 2P
\]
where \( E \) is the number of edges, \( N \) is the number of nodes, and \( P \) is the number of connected components…

--

--