Wednesday, August 27, 2025

Returning to Mamallapuram - the panels at Mahishasura Mardhini Cave Temple

 In the early days of this blog, I had written about Mamallapuram - popularly known as Mahabalipuram -  after a visit guided by a good friend of mine. This friend was then a budding Heritage expert, now a full-blown one. Fourteen years later, I had the occasion to visit Mamallapuram as part of a College Reunion. 

Another friend and I are currently on a pursuit to build a Heritage Tourism App with Mamallapuram as our first covered site. Over the last few months, the friend who is a Heritage Expert has been providing me with in-depth information about the various monuments at Mamallapuram to be included in this app. 

Armed with this knowledge, I took my college-mates on a guided tour of Arjuna's Penance (or Descent of Ganges depending on which interpretation of the sculpture you go by), the Varaha Cave Temple and the Shore Temple. The gang lapped it up; it was truly gratifying to be able to share the information and see their eyes light up. 

On that day, unfortunately we could not go to the Mahishasura Mardhini Cave Temple and see the famous relief panel there featuring a pivotal scene in the battle between Goddess Durga and the asura Mahisha. I have been recording some videos describing the sculptures and monuments of Mamallapuram and this post in an elaborate introduction to these two videos I just posted on Youtube:

  • Anantasayana Vishnu video describing the Anantasayana Vishnu that is on the left side wall and 
  • Durga-Mahisha battle video describing the Mahishasura Mardhini Sculptural panel on the opposite side. 

My friend revealed recently, the reason as to why these two seemingly unrelated stories, the first one, an episode on two asuras trying to attack Vishnu at his very abode in Vaikunta and the other about Goddess Durga and Mahisha in the same cave temple. It turns out that the ancient text Devi Mahatmyam, which describes the story of Durga vanquishing Mahisha also includes the story of Vishnu's encounter with Madhu and Kaitabha, the two asuras who came out of his ears and attacked him. It is uncanny - these connections - to note that the Pallava sculptors read the same texts that we now know about. 

R. Balaji    

P.S. Stay tuned for information on the Heritage App, coming to a Play/App Store near you. 


Friday, May 2, 2025

Another day in the office with AI

<Technical post, probably belongs in linkedin. Posting here regardless> 

It's a new world of coding with AI. I have been pair-programming with ChatGPT (and to a lesser extent Google Gemini) for a while now. My emotions run the full gamut and it is quite a roller-coaster :-). One minute I am full of awe and the next minute I am like "I can't believe you're that stupid". I will describe my experience with a couple of projects one big and one small. If you want to TLDR the project descriptions, move to the bottom to the Morals of the Story section.

Mobile App with Backend

I am starting on a project this year which is the first one where we are coding from scratch after the recent AI revolution. I wanted to provide the team that I am leading with some starter code for the backend (Python and the mobile app frontend (Flutter/Dart code).

  • Backend data model: I had written a document describing the entities and their fields and their relationship with other entities. I fed this document to ChatGPT and asked it to generate the model class definitions for a model-first Object-Relational-Mapping approach using Flask/SQLAlchemy ORM. This saved a lot time writing code for the classes. ChatGPT did 90% of the work and I could make adjustments to get it to 100%.
  • Backend data generation APIs: I gave detailed prompts asking ChatGPT to write code for a REST API to generate the data walking the object model to package all the nested objects in the object hierarchy and return the data as JSON. ChatGPT's code worked quite well here and again the 90%-10% split above worked out.
  • Client App code - I had mixed results here with LLMs:
    • I asked ChatGPT to write the Flutter/Dart code for the App to consume the JSON sent by the server API. I needed to persist the objects on the client on Hive local storage for offline availability. ChatGPT's first effort only persisted the top-level objects and not the objects embedded within it. When I pointed this out, ChatGPT added the additional code to persist embedded objects. But the code had one mistake that I was able to debug easily and fix. But I still ran into issues with Hive that I could not fix with additional prompts to ChatGPT. I ran into my session limit and ChatGPT asked me to come back after a few hours to continue.
    • I then moved to Gemini which did slightly better in some respects but worse than ChatGPT in others. It had some silly mistakes like a missed dependency in the project dependencies YAML file, which wasted some of my time. Gemini's advice to fix the issue was not useful, I ended giving up the advice to Gemini, which it graciously seemed to accept and promised not to make the mistake After these were fixed, somehow the Hive issue tht happened with Hive did not happen and I was able to finish the work. The generated code will essentially will serve as the Proof-of-concept of how our design would work with the backend date model, APIs for generating data in JSON, and client code to consume and persist in local cache.

Text-to-Speech

I was trying to integrate Google's text-to-speech converter to get to speak Indian/Sanskrit words and had to do some coding on top to get it to work. I needed to provide custom pronunciations for the Indian words that the text-to-speech would by default mispronounce. There was some gnarly handling required when the words with custom pronunciations are in possessive form with an aphostrope (say "Durga's") and Google TTS wasn't up to the task without additional coding. And I enlisted ChatGPT's help. V1 of the code didn't quite work. I had to do some debugging on my end and I realized what might be happening and gave ChatGPT a hint; it duly used the hint and tried to fix it with V2. Still didn't work. I now just said, nope, try again. Now it seemed to figure out itself what the problem might be and produced V3. That didn't work either. I gave up on this particular thread after V5 or so.

While I could not get that last thing (handling apostrophes gracefully) working, thanks to AI, I was still able to try out 3 different Text-to-speech solutions (AWS, Google, Elevenlabs) and came up with potentially a reasonable V1 approach figured out.

Morals of the story

  1. At the time of writing, LLMs like ChatGPT are good enough to generate a lot of the boiler plate code that needs to be written. This can save a lot of time.
  2. Often the 80-20 rule applies; you get 80% of the lines of code from the LLM and you finish the last 20; it is 90-10 if you are lucky. And if you are really lucky, the code would be bug-free. That gets us to the next point.
  3. A big caveat is that the code generated is very likely to have bugs and sometime serious gaffes and you need to be able to understand the logic completely so that you can fix the bugs to get it to work; at times, you can keep iterating (telling the AI that it is not working, try again) but you are better off finding the bugs, or at least do some partial troubleshooting so that you can frame your incremental prompts with helpful information to the AI. If you run into a situation where you are not able to figure out the fix, you may start losing the time-saving advantage of getting the boiler-plate code; but then again if you had written the code from scratch, your code may have the same (or higher) number of bugs.
  4. It is super important to invest in good English documentation (for e.g. the data model) of your high level design so that you can give detailed requirements in English in your prompts. That can server your entire project to generate both server and client code. This might finally be the forcing function to get your developers to write good documents. This is a bit worrisome because in my experience often developers (especially in India) hate to or are not good at (or both) documenting their designs, requirements and algorithms. But this is going to become more important in the new world.

R. Balaji

Thursday, January 30, 2025

Comic relief in Climate conversations (or more generally all left vs. right conversations)?

 We attended the Hyderabad Literary Fest which had a track on Climate Conversations and one of the best sessions was the one titled with this blog's title (not the part in parantheses). It was funny and thought provoking. 

The standup comic Raghava Mandava who specializes in bringing humor to the highly charged conversations of Climate Change talked about how he was a"nature lover" and not an "environmentalist". Because "environmentalist" has become associated with radical lefties whose cries of outrage (according to him) have only served to alienate the people who they want to convince. Or how imperfect sustainability solutions drive people away. Case in point, the turtle-killing plastic straw and its lame recent substitute, the paper straw which seems to dissolve in the drink you are sipping before you are half way done. I can relate to this personally. One of his lines was something like how a normal person who has nothing against turtles tries to drink using the paper straw and is driven to outrage ('**** the turtles'). 

The larger point is how climate change warriors perhaps should rethink how they communicate, how not come across as scolds etc. I do think the right suffers from a bit of persecution complex (e.g. the whole anti-woke thing); after all they are supposed to be the tough guys, are their feelings so delicate that they are hurt by bleeding heart liberals? Or do they have a point, has the radical left gone too far?

Another sentiment I heard in the session was how a single experience with nature can be more effective than 100 exhorting messages and lectures on how we should be reducing the carbon footprint. 

While the above was in the context of just one topic that is close to the heart of those on the left, the same arguments can be made for all hot-button cultural/political issues. After all, "the condescencion of  liberal elites" is a standard refrain you hear that mobilizes and even energizes the opposite side. 

Considing how the left got its collective backsides kicked in November (it was Inauguration week and the left is indeed licking its wounds, including yours truly), I am going to say, perhaps it is the latter. So time for some collective soul searching and how the messaging can be improved. Because while I continue to believe the left's heart is often in the right place, how they frame the conversation and the messaging is clearly due for some serious improvement.

R. Balaji

Thursday, January 16, 2025

Chola Temples of Darasuram/Kumbakonam

We recently visited the Airavatesvarar Temple at Darasuram (near Kumbakonam); it is one of the three Great Living Chola Temples (as anointed by UNESCO in its World Heritage citation), along with the Brihadisvara Temples at Thanjavur and Gangai Konda Cholapuram. The Airavatesvarar temple is not as big as the other two. While it lacks in size and majesty, it more than makes up for this in the quality and richness of its sculptures and mandapas/pillars with ornate carvings. 

Raja Raja Chola and Rajendra Chola are perhaps the greatest father/son duos to ever rule anywhere in India. They took the Chola kingdom to the peak of its 400 year rule in the south both in terms of territory expansion and cultural and architectural pursuits. They built the great Shiva temples at Thanjavur and Gangai Konda Cholapuram respectively. Rajendra Chola in a reverential nod to his father, made his vimanam (the tower on top of the sanctum santorum - garba griha) a bit shorter than his father's architectural magnum opus. It was during the reign of Raja Raja II who ruled almost 150 years later, that the Airavatesvarar temple was built. The vimanam is similar in style to the bigger Chola temples, but even shorter than the one in Gangai Konda Cholapuram.


The decline of the Chola empire is said to have started in Raja Raja II's  period. Nevertheless, he has added another jewel to the extensive list of Shaivite temples of the Chola era. Airavatam refers to Indra's mount, the white elephant that lost its complexion thanks to a curse from sage Durvasa. Airavatam is said to have sought redemption from Lord Shiva in this temple who duly got Airavatam back to its pearl-white splendour. 

The Mukhamandapa also known as the Rajagambhiran Mandapam  features ornate pillars and ceilings with a truly spectacular horse-ridden chariot motif featured on either side of the steps that go up to the great hall. 

The large wheel is reminiscent of the stone chariot in Hampi's Vitthala temple. While the chariot in Hampi is monolithic, what is remarkable about the horse and the wheel here is that they are pieced together like jigsaw puzzles by carving the  rectangular stones that make up the mandapa's plinth structure behind the wheel and the horse; i.e. the horse and the wheel are not separate from the super-structure of the temple, which in its ingenuity epitomizes the creativity and skill of the Chola artisans. 

The pillars on the mandapam all feature a gaja yaali at the bottom which is a hybrid of at least 5 animals, the eyes and mane of a lion, an elephant's trunk, goat's horns, a boar's ears and a bull's tail which you can see on the back side of the pillar. The way the tail curves on itself differs in each pillar. The yaalis' trunk is curved to point in the direction of the inner sanctum leading some people to speculate that it serves as a sign-post. 

The pillars on the mandapam have carvings of scenes from Shiva Purana and Skandha Purana. As a sample, the following shows the birth of Lord Muruga or Karthikeya as 6 babies before they get fused to a single 6-faced baby god by Parvathi. You can see Lord Shiva holding 3 of the babies, while Parvathi is nursing another child. Shiva and Parvathi are surrounded by the Krittikas who helped raise the baby Karthikeya. 

On one of the other balustrades, a running elephant is depicted, with great anatomic accuracy,  capturing the legs in running stride and a swinging bell indicating the motion. The jewelry and decorations on the elephant and the afore-mentioned horse are exquisitely carved. 

On the outer walls of the inner sanctum, you can see key moments from the lives of the 63 Shaivite Nayanmars carved as miniatures. You would really need a heritage expert or a very good guide to interpret each one of these. One of the panels shows Kannappar, a hunter  known for his innocent devotion to Lord Shiva. Like every one of his ardent devotees, Shiva tests Kannappar by showing a bleeding eye on the linga. Kannappa first removes one of his eyes and puts it on the lord; and then the other eye on the linga starts bleeding. Without hesitation, Kannappar offers his second eye, this time making sure to mark the spot of the lord's eye with his foot as he is scooping out his eye (!). 

And then there is the bull and the elephant panel called the rishabha gunjara, a double entendre in stone, if you will. The head in the middle can be either that of an elephant (body on the right) or of a bull (body on the left).  

We also visited Nageswaraswamy Temple at Kumbakonam, which is considered one of the earliest Chola temples. Early Chola temples are much smaller in size and grandeur than later day temples. However they have a sculptural innovation of their own, in the form of miniature relief panels depicting scenes from the Ramayana. These panels narrate the entire story in about 50 panels. I will talk about just one sample here where a bhootha is coming out of a yagna pyre bearing the amirtha (or payasam) which Dasaratha takes and distributes to his three wives which leads to the birth of Lord Rama and his brothers. The panel is half the size of  an A4 page and still the artist packs so much detail. Prof. Sivaramakrishnan's excellent talk (part of a series on Chola Art and Architecture organized by Tamil Heritage Trust) describes this panel in great detail wih all the intricacies; it is staggering to see the level of artistic thought, such as framing of the characters, where they are looking at (Dasaratha and his wives are all looking at the urn, while the 2 rishis are looking at each other with satisfaction after the success of the yagna), the curvature of the yagna flame in the middle and how Vashista's body is aligned with this curve. You have to listen to to the talk to know more, I can barely do justice.  

Each of these temples have so much to see and a short article like this can only be a teaser at best; the best way to experience them is in person with a well-informed guide. 

- R. Balaji


Returning to Mamallapuram - the panels at Mahishasura Mardhini Cave Temple

 In the early days of this blog, I had written about Mamallapuram - popularly known as Mahabalipuram -  after a visit guided by a good frie...