Working with LLMs: Learn abstractions

Working with LLMs: Learn abstractions

In the earlier article in the series on “skills needed to thrive in the era of AI”, https://www.dhirubhai.net/pulse/developer-skills-we-look-era-ai-ramarao-kanneganti-dtkgc/ , I presented “abstraction” as one of the key skills. Here, I am going to give you a personal take on what it means to me. Instead of making it dense, I presented the details in this article.?It may be a long article, but an easy read.

Abstraction

Stephen Wiltshire is an exceptional artist who can recreate entire cityscapes—high-rises, intricate streets, and all—from memory alone. Watching him work is astonishing. Yet this remarkable ability has drawbacks. Wiltshire is autistic, and while he can capture countless details with extraordinary precision, he struggles to discern broader patterns or integrate these details into a more abstract understanding. His gift for detail is both a blessing and a curse. It prompts the question: can he keep storing more and more details without ever building a higher-level understanding?

Now consider most of us. We don’t remember every detail. Instead, we pick and choose what’s relevant. This selection process—this filtering of what’s important—is a form of abstraction. Abstraction lets us handle a world overflowing with facts and data without getting lost. It allows us to see patterns, to ignore what’s not essential, and to extrapolate from what we do retain.

What is abstraction, really? When we learn something new—be it about technology, art, or science—we form a mental model. This model differs from person to person, yet abstraction helps shape it using four core techniques: simplification, transformation, generalization, and connections.

Abstraction: the core elements

An aside: What is a mental model? Next time, when you listen to something complex in your field, observe how you understand it. You have an idea or an image that may be unique to you that captures the idea. Different people may have different ways of understanding it.? Feynman, in his book “Surely you are joking, Mr. Feynman!” says the following, about how he creates a mental model:

“As they’re telling me the conditions of the theorem, I construct something which fits all the conditions. You know, you have a set (one ball)–disjoint (two halls). Then the balls turn colors, grow hairs, or whatever, in my head as they put more conditions on. Finally they state the theorem, which is some dumb thing about the ball which isn’t true for my hairy green ball thing, so I say, “False!” “

For him, the higher dimensional geometric visualizations capture the essence of the world. No wonder his way of capturing the world in Feynman’s diagrams was recognized in his Nobel prize!

Simplification

The primary goal of abstraction is to simplify complexity. Take a simple coding example. When you write console.log("Hello World"), you say the console prints a message. But under the hood, the program calls a library function, which talks to a device driver, which in turn manipulates digital signals, eventually lighting up pixels on a screen. There are countless intricate steps, but you don’t need them all. The abstraction “log the message” is enough to work with.?


Abstraction as simplification

Similarly, a movie summary on IMDb drastically condenses a complex film into a few lines, focusing on just enough detail to convey the main idea. In art, you might sketch a skyline focusing on the buildings, ignoring the tiny details of windows and rooftops.

We use such simplification in science as well. For example, no planet is a perfect sphere—yet in our physics calculations, we often treat it as one. In statistics, we often take an average to simplify studying a population. In art, simplified figures are standard, as in many medieval paintings. In literary criticism, analyzing a book might mean stripping away subplots or minor elements to focus on its central themes. Historians also create simplified narratives to cover complex eras like the Industrial Revolution.

Transformation

In abstractions, we don’t simply strip away details; we also adjust emphasis. Depending on our purpose, we highlight some aspects and downplay others. In fact, simplification is a kind of transformation.?

For example, if you’re an orthopedic surgeon studying a fracture, you zero in on the bone structure and omit other tissues. This selective image is not complete, yet, useful for you. In mathematics, we often transform the problem into a different domain to solve it. Representation of physical phenomenon in mathematics often transforms to focus on the aspects that we are interested in.

In art this is a standard age old technique. One of the first sculptures (23,000 BC), Venus of Willendorf, has exaggerated buttocks and breasts -- the sculptors want to focus on the elements of fertility. It is tailored to their mental model of what is important to depict and worship.

Venus of Willendorf

In programming, we use transformation as abstraction in many places. For example, materialized views is a transformation of underlying data that is suitable for the consumers. Data transformation to support different APIs, users etc is a common technique. This transformation of information in one form to another was the bulk of coding effort, historically.

Generalization

Abstraction encourages generalization. A well-formed abstraction can apply across multiple scenarios. Consider the movie Die Hard. Its core abstract formula—one hero against impossible odds in a confined space—reappears in many variations: Speed is essentially “Die Hard on a bus,” Under Siege is “Die Hard on a ship.” The original abstraction helps us identify a category and understand new stories through a familiar lens.

In many cases, abstractions are built from combinations and modifications of other known abstractions. In programming, most solutions follow this approach. We take known patterns (abstractions of specific problems and solutions), combine them, add some connecting logic, and voilà—we get a solution.? For example “Skyscraper” is a Die Hard in a skyscraper + disaster movie. There are several delightful examples in the “TV tropes” website.?

In programming, these generalizations often manifest in idioms, patterns, and frameworks. Frameworks combine different generalizations to create commonly useful foundations to base concrete solutions. Abstractions at work! Programming languages, of course, are the best examples of abstractions.

Connections

Finally, abstractions connect different subjects, making knowledge universally applicable. Just as athletes good at one sport often excel in others, people proficient in one subject can excel in others. History offers examples: communities that studied religious texts diligently often excelled in academics in subsequent generations.

Connections manifest in the way people understand new topics or explain them. This ability to link ideas and concepts across domains reflects abstraction’s power to unify knowledge.

Objections may arise: "I’m good at language but poor at mathematics. How does this square?" Perhaps the issue lies in how mathematics was taught or what "good" means in this context. Excellence in abstraction doesn’t always manifest identically across domains.

By combining simplification, transformation, and generalization, abstraction lets us build flexible mental models. We don’t need to memorize every detail of every system; instead, we construct frameworks that make sense of complexity, allowing us to see patterns and adapt to new situations. This is the power and purpose of abstraction.

Now, how do we go about building these abstractions?

Building abstractions

The funny thing is that all the training we get in the modern world is in making, using, and applying abstractions. Our systems -- education, arts, entertainment, language, conversations, and even jokes are geared towards it.

In a static world -- say for instance stone age civilizations -- there is no need for abstractions. What you need is a few concrete representations. There are no new situations, new people or even new ideas that require you to build from what you know. As we grew, the language grew with the ability to build from abstractions -- like similes, analogies, abstract ideas.?

How do we develop the ability to abstract? Usually, it is schooling, reading, listening to people from different domains, learning about new topics -- all these help with ability to deal with abstractions.


Abstract = Pure (as in opposite of applied). Math is applied philosophy.

For example, for me mathematics is a study of abstractions. We map the real world into a mathematical realm using numbers, symbols, equations, inequalities etc. We create structures and build more abstractions in that realm. Usually, these abstractions give better understanding of the world, help us come up with new facts that are not apparent in the real world, and also connect with different realms.

You want to study how planets move? Create an abstraction using calculus. Use the standard techniques that are proven to be correct in that model to predict the celestial motions. Want to understand how to model interactions between players with competing interests? Explore game theory, which maps real-world conflicts, negotiations, and strategies into mathematical abstractions that can reveal optimal actions or equilibrium points.

Moreover, mathematics gives the concepts and languages about relations, metrics, proofs and refutations, truth, probabilities, trust and many other concepts which we all think we know about.?

Consider physics. All the physical universe offers concepts about scientific approach, experiments, induction, deduction, classification and so many other aspects abstractions are enriched. Or, any science for that matter. I remember talking to a doctor, who translates any problem into biological systems and reasons about it.?

Philosophy, literature, and other disciplines outside science and technology teach you to distill ideas and see underlying patterns. For instance:

  • Philosophy encourages you to think critically about concepts like truth, knowledge, and existence, helping you refine abstract ideas.
  • Literature often deals with universal themes, such as love, conflict, or identity, enabling you to connect disparate ideas and recognize shared structures.
  • History provides case studies of human behavior and systemic evolution, helping you understand recurring patterns over time.
  • Literary criticism, in particular, uses these techniques effectively. They abstract complex stories, and generalize them to contextualize the ideas, and see patterns that a mere story cannot tell by itself.?

In short, any subject you study offers a chance to learn abstractions.


Standard ways we abstract from learning

?

Finally, computer science thrives on abstraction. It simplifies problems, generalizes algorithms, and connects real-world representations to computational solutions. Abstractions make it easier to understand and work with complex systems by focusing on the big picture.

  1. Representations are fundamental abstractions in computer science. For instance, images are represented as pixel arrays and text as binary-encoded characters, enabling computers to process them efficiently.
  2. Algorithms are another key area where abstraction shines. Sorting algorithms like quicksort focus on logical steps that work for various data types, from numbers to words, making them widely reusable.
  3. Stacks and layers organize systems through abstraction. The internet stack, for example, separates concerns like data transport (TCP/IP) and content delivery (HTTP), ensuring modularity and simplicity.
  4. High-level languages abstract machine-level details. For example, Python hides memory management, allowing developers to focus on solving problems instead of managing hardware.
  5. Operating systems abstract hardware, offering user-friendly interfaces for tasks like file management and program execution without requiring direct interaction with the machine.
  6. Databases simplify data handling by abstracting storage mechanisms. Developers use SQL to query and manipulate data without worrying about the underlying implementation.

Obviously, computer science is replete with these abstractions.?

Summary

In summary, abstraction serves as:

  • A language mechanism to communicate
  • A tool to understand and grasp essence
  • A means to relate new concepts to existing knowledge

If you want to excel in making abstractions:

  • Learn how to learn a new topic
  • Keep learning new topics
  • Whatever you learn, see how you can simplify, explain to others, and relate to what you know. And, hopefully apply what you learnt.


Srinivas Mullapudi

Product Leader at Highspot

1 个月

Beautiful! You touched so many fields to drive home what abstraction is. Am awestruck by your profound knowledge in so many fields and how well you connect them. ??

回复
Venkatesh Subramanian

Enterprise Architect, Technology Sustainability Innovations

2 个月

Love this Ramarao Kanneganti ! Clear thinking expressed here.

回复

Nicely written and explained. Brilliant as always!

回复
Ramanathan Sivasubramaniam

Country Head #SoftClouds #HCLTech #NTTF

2 个月

Very informative Ramarao Kanneganti thanks am sharing

回复
Satyanarayana Pamarty

CEO @ ATRITEX | Typesetting, eBook Conversion, Publishing Services

2 个月

I read your previous article and this one too. Your understanding of the subject is great. Right now, when we use AI to write code, we need to keep directing it to keep the course. It often abstracts a portion of what we say and forgets another portion of what's actually important from a previous prompt. We need to keep steering it to tell not to forget what was important in the previous prompts. As the AI systems have been evolving, this has improved. The day when it stops abstraction and focuses on details, that would be the day when they totally arrive. I dread the day when they (the AI systems) decide that they don't need to write code in languages understood by humans. When that happens, there would be no course correction or human steering possible. Then, we will feel as helpless in dealing with the scenario as present day historians find with the Indus valley civilisation. They will know civilization exists in broad daylight, but no Rosetta stone to decipher it or say what happens.

要查看或添加评论,请登录

Ramarao Kanneganti的更多文章

  • Developer skills we look for in the era of AI

    Developer skills we look for in the era of AI

    Recently, Google’s CEO mentioned that 25% of their code is written by AI. This highlights how AI is becoming an…

    12 条评论
  • Empathetic programming: a logical approach

    Empathetic programming: a logical approach

    I remember talking to a friend of mine who joined the professional programming world, while I was still toiling in the…

    2 条评论
  • Best Practices in Documentation: A guide to engineers

    Best Practices in Documentation: A guide to engineers

    This document provides an overview of the best practices in documentation: structure, format, content, style, and…

    11 条评论
  • Writing code as if people read it

    Writing code as if people read it

    Of late, working with younger programmers, I have observed the following: All of them write code that meets the…

    3 条评论
  • Learning in the time of Covid-19

    Learning in the time of Covid-19

    [I wrote this note for the parents who is asking about how their kids can spend their time wisely during the forced…

    3 条评论
  • A year in technology: 2019

    A year in technology: 2019

    Hello friends: This year, like every year taught me many new things: new methods, tools, and information about AI…

    6 条评论
  • My budget friendly PC

    My budget friendly PC

    The last time I built my desktop computer was 6 years back. I went all out and got 9TB disks and 64GB memory and two 27…

    3 条评论
  • Back in the saddle again

    Back in the saddle again

    My first desktop was Solaris. In fact, I had two Solaris monitors on my desktop, back when I was at Bell Labs.

    3 条评论
  • Standardization: What and why

    Standardization: What and why

    When I was a student at IIT Madras, my dream place to work was Bell Labs. Eventually, after a PhD, I ended up there.

    6 条评论
  • In the beginning, there was command line...

    In the beginning, there was command line...

    During the heydays of Linux, Neal Stephenson wrote an essay called “In the beginning, there was command line”, about…

    1 条评论

社区洞察

其他会员也浏览了