Skip to main content
Back

Gyan AI's Tiny Paramanu-Ayn Beats Gemini Pro on Legal Tasks at 97M Parameters

A 97M parameter model trained for 185 A100 hours on Indian Supreme Court documents beats 7B LLMs on legal judgment prediction and runs on a CPU.

Pro

Paper, Full Access
  • Paramanu-Ayn is a 97M parameter decoder pretrained from scratch on Indian Supreme Court documents in 185 A100 hours.
  • Beats LLaMa-2 7B and Gemini Pro on the PredEx legal judgment prediction task with 52% accuracy.
  • Runs at over 42 tokens per second on an 8-core AMD CPU with no GPU required for inference.
  • Uses a RoPE scaling trick to reach 8192 context length on a single A100-40GB.
  • Custom 15,575 token BPE tokenizer trained on the legal corpus rather than a generalist vocabulary.
  • Instruction-tuned on 10,763 legal tasks and scored 8+ on GPT-3.5 grading for Indian Supreme Court instructions.

A pair of researchers from Gyan AI Research and IIT Kanpur have taken the opposite bet from the frontier labs. Instead of adapting a general purpose large language model to legal work through continual pretraining or adapters, they pretrained a tiny 97 million parameter decoder from scratch on Indian Supreme Court documents and beat models 80 times larger on the tasks that actually matter for lawyers.

The model is called Paramanu-Ayn, and it took just 185 A100 hours on a single NVIDIA A100-PCIE-40GB GPU to train. The model can run effectively on standard CPUs, achieving an inference speed of over 42 tokens per second on an 8-core AMD processor. No GPU required at inference time.

Why not just fine-tune Llama?

The dominant recipe for domain adaptation is to grab an open-weight LLM and either continue pretraining it on domain data or bolt on LoRA adapters. Both approaches drag along the base model's generalist tokenizer, its Western-heavy pretraining biases, and its inference cost. Indian legal text has a distinctive syntax, procedural vocabulary, and citation style that a BPE vocabulary trained on Common Crawl handles inefficiently, wasting tokens and burning compute at every step of generation.

The authors argue that if you know your domain upfront, it is cheaper to build a small model that lives inside that domain than to keep dragging a large model toward it. Their training run emitted only 0.0196 tonnes of CO2 equivalent, which is a rounding error compared to continual pretraining a 7B model.

What is actually inside Paramanu-Ayn

The architecture is a fairly standard modern decoder stack, but the sizing is aggressive:

  • 97M parameters, hidden dimension 768, 12 layers, feedforward hidden dim 2048
  • Rotary position embeddings with a scaling trick to reach 8192 context on a single 40GB GPU
  • RMSNorm pre-normalization, SwiGLU activations, biases removed from dense layers
  • Grouped-query attention to shrink the KV cache at inference
  • Weight tying between the embedding and softmax layers
  • A custom BPE tokenizer with a 15,575 token vocabulary trained on the legal corpus

The clever bit is the RoPE scaling. If your GPU only fits a context of 256 tokens at your desired batch size, you divide every position_id by a shrinking factor (32 for the 8192 target) so that all rotations stay inside the physically feasible range. Token 4001 becomes position 125.03, keeping the rotary math well conditioned while training on sequences the hardware could not otherwise hold. This is what let them pretrain at 8192 context on a single card.

Pretraining data is small by modern standards: 38,222 Supreme Court of India cases from 1947 to 2023, the Constitution of India, and the Indian Penal Code, totaling about 142M whitespace-separated words. The model saw around 26 billion tokens over training and reached a Model FLOPs Utilization of 41.35, which is a solid number for a single-GPU BF16 setup.

Training perplexity dropping from ~9 to 1.7 over 25 billion tokens

The results that make this interesting

On the PredEx case judgment prediction with explanation task, Paramanu-Ayn hit 52.00% accuracy and a macro-F1 of 0.5037. LLaMa-2 7B managed 50.25% and 0.3772. Gemini Pro landed at 50.81% and 0.4908. A model 80 times smaller edging out both is unusual and points to how much the domain-specific tokenizer and pretraining corpus are doing.

Summarization is more of a mixed bag. Across ROUGE-1, ROUGE-L, BLEU, METEOR, and BERTScore against 100 Supreme Court test documents, Paramanu-Ayn wins clearly on BLEU (0.1529 vs 0.0171 for Gemini Pro and 0.0249 for Llama-3 8B) and METEOR, but loses to Mixtral 7B on ROUGE and to Llama-3 8B on BERTScore. Longer generations trade unigram overlap for semantic coverage, with the model peaking around a 2048 token summary length.

The surprise is on the general benchmarks. Despite seeing only case documents during pretraining, Paramanu-Ayn beats several much larger models on quantitative reasoning at zero-shot:

BenchmarkParamanu-Ayn 97MLlama-2 13BFalcon 40B
AGIEVAL-AQuA-RAT24.0221.718.5
AGIEVAL-SAT-Math27.2727.332.7
AGIEVAL-LSAT-AR22.6123.019.6
MMLU (raw)25.30--
TruthfulQA-mc251.81--

The Llama and Falcon numbers were reported from few-shot evaluations while Paramanu-Ayn was run zero-shot. On MMLU it beats the 25% random baseline, which the authors point out is better than what GPT-3 13B managed zero-shot in the original MMLU paper.

Scatter plot of model size versus average benchmark score, showing Paramanu-Ayn at 97M sitting on the pareto frontier

Instruction tuning and where it falls short

The team fine-tuned the base model on 10,763 legal instructions covering drafting, summarization, precedent identification, clause generation, and constitutional Q&A. GPT-3.5-Turbo scored the instruct model's Supreme Court responses at 8.00 on clarity, 8.88 on relevance, 8.22 on completeness, and 8.89 on legal reasoning out of 10. On contract drafting the scores drop to the mid-6s and 7s because the pretraining corpus never actually contained contracts.

The limitations are worth naming clearly. The authors admit they could not measure hallucination rates or perform legal expert human evaluation, and they generated with temperature 1.0 to keep outputs creative, which means the model will confidently invent citations and section numbers. There are no guardrails, no toxicity classifier, and the training documents were not anonymized. On general knowledge benchmarks like MMLU-Professional Law (23.66) and MMLU-International Law (19.83), the model performs near or below random, which is expected given it never saw non-Indian legal content.

Where it fits

Paramanu-Ayn is not a general legal assistant. It is a specialist for Indian Supreme Court material that happens to run at 42 tokens per second on a CPU and fits in a smartphone's memory budget. Good candidates for using something like it include:

  1. Case outcome prediction pipelines where you want to score thousands of proceedings without paying per token
  2. First-pass summarization of long Indian case documents before human review
  3. On-device legal search or drafting tools for jurisdictions with limited connectivity
  4. Research on whether small, corpus-specific pretraining beats adapter-based domain adaptation on your own legal, medical, or financial corpus

The broader point the paper makes is worth taking seriously even if you never touch Indian law. When you know your domain, when you have a clean corpus of a few hundred million words, and when you can afford one week on one A100, a from-scratch specialist model can beat a general 7B model on the tasks it was built for while costing an order of magnitude less to run.