liveBook · Manning

Quadratic time complexity

As explained in How Large Language Models Work

Quadratic complexity is a computational growth rate proportional to the square of the input size, denoted O(n^2).

Quadratic growth means that work increases roughly with the square of input size: an input of n items has complexity O(n^2). Doubling the input can therefore require about four times the work. section 7.4

This growth becomes a practical limit as inputs expand. The treatment uses quadratic complexity to explain why an LLM cannot efficiently solve problems proven to require more than O(n^2) work precisely. section 7.4

Figure 7.7 A Venn diagram of computational complexities (assuming \(P \neq NP\), a minor point for the nerds) relate to each other. The top arrows give examples of the kind of problem that a new complexity class lets you solve. The bottom arrows show where LLMs land in terms of their complexity.
figure

Compare quadratic growth with other complexity classes and see where LLMs are placed in that hierarchy. section 7.4

How How Large Language Models Work covers it

How deep it goes
Defines O(n^2) and connects it to LLM limits, while stopping short of formal algorithms or graduate-level complexity theory.
Examples
Contrasts quadratic complexity with routing, resource allocation, and prime factorization problems listed at cubic or exponential complexity.
What you can do after
Evaluate whether a problem’s required complexity may exceed an LLM’s ability to solve it efficiently and precisely.
How it connects
Connects quadratic complexity with linear complexity, cubic complexity, exponential complexity, algorithmic complexity, and LLMs.

Also explained in

Compare how 4 books explain quadratic time complexity →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of How Large Language Models Work. The section links point to the parts of the book it draws on.