Riyaz with a machine
The model keeps my riyaz journal after each session, and for a raag with a thin Wikipedia page it answers from its training.
I wanted something to talk to after riyaz, and the model on my computer put Bhimpalasi in the Khamaj thaat. Fixing that turned into a practice companion for surbahar and sitar that lives on a desktop at home and looks things up in 1,385 Wikipedia articles on raags, gharanas, talas and instruments before it answers, then tells me where the answer came from. Nothing leaves the house. It knows my two traditions, Dagarvani in dhrupad and Etawah in khayal.
Table of contents
- What I play
- The model that made things up
- Why the music has always been hard to digitise
- What I built
- The desktop
- Getting retrieval right
- The two guides
- Before and after
- Nobody had done this
- What it isn’t
- Source code
What I play
Surbahar and sitar are my two instruments, and the khayal and dhrupad essay says what each is like. My bani on the surbahar is Dagarvani. Khayal I learn in the Etawah gharana, which people also call the Imdadkhani gharana. My instrument, bani and gharana decide how I go at a raag. Bhimpalasi in the Dagarvani treatment has its own character and its own priorities.
The model that made things up
Earlier this year I tried a language model out as a riyaz journal. It was qwen3.6:27b. Once a session was done I wanted a place to note what I’d been working on, what worked and where it slipped, and something to think with that would remember the sessions before and ask me good questions.
Then I asked it to take me through Raag Bhimpalasi. I wanted the vadi and samvadi, the phrase structure, and how the Dagarvani approach treats komal Ni. It answered with full confidence and got most of it wrong. The aroha was some other raag’s, the vadi was wrong, and the advice on ornaments sounded believable and was wrong too. Marwa came out worse. Darbari Kanada came back garbled.
The model was hallucinating. If a model says Sa is the vadi when it’s really Ma and I believe it, I’m practising towards the wrong note, and that’s worse than having no model at all. So I set out to fix it.
Why the music has always been hard to digitise
Very little of this music has been digitised. A language model picks up whatever there’s plenty of in its training text. Western theory is everywhere, in blog posts by the million, forums, textbooks, Wikipedia, software manuals and YouTube transcripts. Hindustani music went from guru to shishya, face to face, for years and sometimes decades.
The theory does exist in books (Vishnu Narayan Bhatkhande’s Kramik Pustak Malika, the Sangit Ratnakar, and a good number of treatises in Urdu and Hindi), but most of it was never translated or digitised. What the model ends up with is a thin outline of the tradition, some well-known names, and the titles of a few raags. How those raags work is what I need once the instrument is in my lap.
A paper that came out in June 2026 was the first time anyone tested language models systematically on Hindustani theory. It put thirty-three models through 504 questions on raag grammar, thaat classification, tala systems and compositional reasoning. The big labs’ cloud models got eighty-five to ninety percent, whereas the smaller ones, the kind that runs on one machine like mine, did considerably worse. That was exactly what I’d run into, measured properly, with no fix offered. I only came across it once I was already building.
What I built
My fix was retrieval-augmented generation, where the model looks through a library before it answers. For the library I went with Wikipedia, which didn’t fill me with confidence at first. The big Hindustani raags do have articles, though, and a lot of those go into real detail (the vadi and samvadi, aroha and avaroha, the pakad, the thaat, the hour and the season, the ornaments that belong to the raag, and which raags it’s related to). For the main repertoire it’s all there and mostly right. Around the raags there are articles on melakarta and the thaats, on musicians one by one, gharanas, instruments and talas, so the model gets each raag along with how the raags connect to each other.
The script I wrote walks Wikipedia’s categories. It starts from root categories like Ragas, Ragas of Hindustani music, Melakarta ragas, Indian musical instruments, Gharanas, Hindustani singers, Carnatic music composers, and twelve others, then descends two levels below each one. Four fetchers ran in parallel, pulling each article as plain text through the API, throttled so I wasn’t hammering their servers. The total was 1,385 articles, roughly 650,000 words once cleaned.
The desktop
The machine is a desktop I put together for the job (Ryzen 7 9850X3D, 32GB of DDR5, and an RX 9070 XT with 16GB of VRAM). The 16GB decides everything else. Ollama puts the models on the card and serves them, and Open WebUI gives me the chat window.
I run two language models. qwen3.6:27b (27.8 billion parameters, four-bit quantisation, about 15.6GB on the card) is for when I want it to go slow and careful. qwen3:14b (14.8 billion parameters, about 8.6GB on the card) is for quick everyday questions. Whatever room is left on the card goes to the context window. The smaller model gets 32,768 tokens. The bigger one gets 24,576, and only because what it keeps of the conversation so far is stored in fewer bits to fit next to the model.
Embedding happens on the processor, so it doesn’t take card memory from either language model. The embedding model is BAAI/bge-m3, and it handles English, Devanagari and Sanskrit written in Roman letters alike. A question takes about two seconds to embed there, nothing next to the thirty the answer takes.
It’s all a few files, mostly config, and they’re at the bottom of this page. Nothing to install as such. If your own riyaz could use one of these, it’s there to take ideas from. Fair warning, the code doesn’t match this page any more, because the stack has moved on since this build in two ways. The models are from a newer generation now. The knowledge of raags comes to the model from its own small tool server, which runs a simple keyword search across the articles.
Getting retrieval right
The search is hybrid. Every question gets searched once by meaning, using the embeddings, and once with BM25. For this music the keyword half is needed. Vadi and samvadi sit close together in meaning, and anyone who’s played a raag knows they can’t be swapped.
Open WebUI splits each question into three shorter queries, each goes through the hybrid search, the results get merged, and the top five passages go to the model with the question. It works from those and numbers its citations.
During testing the same passages kept showing up twice, identical text under different database IDs, crowding out everything else in the context window. That one was my own doing. I’d loaded them in two goes, a first pass that half-filled the main collection, then a consolidation pass that copied in from staging collections without once checking for duplicates. Finding every chunk with the same source file and character offset and deleting the extras took out 5,482 of them, which left 7,078 unique chunks out of 12,560. The retrieval behaved after that.
The two guides
The chat window has two guides, each with its own settings and its own system prompt. The Dhrupad guide has been told about the Dagarvani bani and my surbahar. Its prompt sets out what that tradition cares about, the slow aalap that takes its time, how much weight the mandra saptak carries, and a patience and gravity that mark Dagar bani out from other dhrupad traditions. The surbahar matters for the practical side, because meend and gamak on a bass instrument don’t behave the way they do on a sitar.
The Khayal guide has the Etawah gharana and the gayaki ang that defines how that gharana plays khayal. Questions about working through a bandish, or about the Imdadkhani way of phrasing, go here.
Both guides have a deep version and a fast one. The deep one runs qwen3.6:27b with chain-of-thought switched on. That’s slower, and noticeably more accurate on questions that need musical reasoning over plain lookup. That one manages about 14 tokens a second, still faster than I read, and I use it when I want to think a raag through. The fast one switches reasoning off on qwen3:14b and does around 38 tokens a second, for the quick question I have mid-practice. The 14B also fits a 32,768-token context comfortably, roughly a third more than what the 27B holds safely, and on a long session that shows.
Before and after
Without the knowledge base, when I asked Bhimpalasi’s grammar straight out I got something like this.
Without the knowledge base
Raag Bhimpalasi belongs to the Khamaj thaat. Its vadi is Gandhar (Ga) and the samvadi is Nishad (Ni). The aroha follows: Sa Re Ga Ma Pa Dha Ni Sa'. The raga is characterised by its use of shuddha swaras throughout and is performed in the afternoon hours...The grammar in that is mostly wrong. Bhimpalasi is a Kafi thaat raag, its vadi is Madhyam, Re and Dha get skipped going up, and its Ni is komal.
When I ask the same thing now, the answer draws on Wikipedia’s Bhimpalasi article, with its sources cited so I can check them. This is an edited excerpt from a real session.
Session — June 2026
YouToday while practising aalap on surbahar on Bhimpalasi raag, I was noticing that I tend to repeat my phrases when I go back and forth between the octaves. While I understand that there are only a few phrases that can take me back or forward, how do I improvise such that it doesn't feel like direct repetition?
GuideIt is good to hear that you are spending time with Bhimpalasi. The observation about repetition during octave movement is a very common hurdle in developing vistar. In the Dagarvani tradition, the alap is not merely about playing notes, but about breathing into them — so that even the same swara feels different when approached with fresh intention.
In Bhimpalasi, whose vadi is Madhyam — Ma [1] — the challenge is that the melodic vocabulary can feel limited if one relies only on standard phrases. Repetition feels jarring because the listener expects an evolution of thought, not transposition.
Vary the gamak and meend application. Even if the swara sequence is identical — say, Ni Sa Ma — the physical execution on the surbahar can differ. A slow meend from Ni to Sa in one phrase can give way to a gamak-touched approach in the next. The note is the same; the texture is different. Shift the point of arrival. Instead of always returning to Sa as your resting point in the mandra saptak, try resting on Pa, or allow Ma to carry the phrase before ascending again...
Where the raags are covered, answers are dependably better with the library in. Darbari Kanada and Marwa are right now. For raags whose Wikipedia pages are thin or missing (Charukeshi, Kalavati, Nand, Hem Kalyan, and more besides) the model goes back to its training and we’re back where we started. When it has used the library the answer carries citations, so an answer with none is the one to be sceptical of.
Day to day, the journal is the part I use most. After a session I tell it what I worked on (the raag, the part of the aalap, where my phrasing kept falling apart, what felt different). It ties that to what I’ve told it in earlier sessions, asks me things, and gives me something specific to try next. The system prompt already knows my instrument, bani and gharana, so when it talks about aalap it means aalap the Dagarvani way. A lot of what I ask it has a factual side. Which way up to the upper octave suits this raag, what its typical phrases say about where the aalap should linger, what some musician of this tradition said about handling the weaker notes. With the knowledge base the model is accurate enough to ask those.
Nobody had done this
Once it was built I searched for prior work, fully expecting to find some. Other than the June 2026 paper, there was a December 2025 paper that built a Wikipedia-filtered music retrieval database spanning global music across 163 countries (3.2 million passages from 144,000 articles, deployed on cloud infrastructure). And Stanford’s WikiChat won the Wikimedia Research Award of the Year 2024 for grounding a model in Wikipedia to cut down hallucination (97.9% factual accuracy in testing with human users). Hindustani or Carnatic, with a Wikipedia library on a machine at home, set up for one instrument and one gharana and kept as a riyaz journal, I found nothing.
What it isn’t
All it gets from me is text. It can’t hear me play. It can’t correct my meend or tell I’ve been dodging upper Sa when the raag wants it, and for a practice companion that’s a big gap. It can’t show me sruti either. Both of those take a teacher.