Devanagari Diffusion: Compositional Glyph Generation

A UNet-based Denoising Diffusion Probabilistic Model (DDPM) for generating Devanagari glyphs through compositional conditioning. The model learns to synthesize glyph images using independently parameterized base-character, matra, and font embeddings, enabling controlled generation of previously unseen character combinations.

Model Details

Model Description

This project explores diffusion-based generative modeling for Devanagari writing systems, with an emphasis on compositional character generation and controllability.

The model is built around a UNet-based DDPM trained on a synthetically generated dataset containing over 11,000 Devanagari glyph images across 384 glyph classes and 6 different fonts.

Unlike conventional class-conditioned generation, the proposed approach uses a compositional conditioning mechanism that independently represents:

  • Base Character Embeddings: Represent the underlying consonant or character.
  • Matra Embeddings: Represent vowel signs and associated diacritical components.
  • Font Embeddings: Encode font-specific stylistic characteristics.

These representations are combined to condition the diffusion process, allowing the model to generate glyphs based on individual character components and font specifications. This approach is designed to support the synthesis of previously unseen combinations of character components.

The project also investigates DDPM and DDIM sampling strategies to compare generation behavior and sampling efficiency.

  • Developed by: Mahir Shah
  • Model type: Conditional Denoising Diffusion Probabilistic Model (DDPM)
  • Architecture: UNet with compositional conditioning
  • Language(s): Devanagari (Hindi and Sanskrit script)
  • Framework: PyTorch
  • License: Not yet specified

Model Sources

Uses

Direct Use

The model is intended for research and experimentation in generative modeling of Devanagari glyphs.

Potential direct applications include:

  • Generating Devanagari glyph images conditioned on character components.
  • Exploring compositional representations in image generation.
  • Investigating font-conditioned glyph synthesis.
  • Studying diffusion-based generation for complex writing systems.

Downstream Use

The model can serve as a research foundation for:

  • Synthetic Devanagari character dataset generation.
  • Data augmentation for Indic script recognition systems.
  • Exploring generative approaches to low-resource script processing.
  • Font variation and character-style synthesis.
  • Compositional generation of characters not explicitly encountered as complete combinations during training.

These are potential downstream applications and have not necessarily been independently validated.

Out-of-Scope Use

The model is not intended for:

  • Production-grade document generation without additional validation.
  • Generating authoritative or linguistically verified Devanagari text.
  • Optical character recognition without a separately trained recognition system.
  • Generating scripts other than those represented in the training distribution without further adaptation.
  • Applications requiring guaranteed typographic or linguistic correctness.

Bias, Risks, and Limitations

The model has several limitations:

  • Synthetic Training Distribution: Training data consists of synthetically rendered glyph images. Generation quality may depend on how well the rendering process represents real-world typography.
  • Font Coverage: The training dataset covers six fonts, limiting the range of stylistic variations the model has encountered.
  • Character Coverage: The model was trained on 384 glyph classes and may not generalize to arbitrary Devanagari characters or combinations.
  • Compositional Generalization: Although the conditioning mechanism is designed to support unseen character combinations, generalization quality depends on the learned representations and requires further evaluation.
  • Visual Fidelity: Generated glyphs may contain distortions or structural inconsistencies, particularly for complex character combinations.

Recommendations

Users should visually inspect generated glyphs before using them in downstream applications. Generated samples should not be treated as linguistically or typographically verified without additional validation.

How to Get Started with the Model

The repository contains the trained model checkpoints, UNet components, conditioning encoder, and training-state artifacts.

Repository: https://huggingface.co/mahir123456/Devanagri-Diffusion

The model uses a custom UNet architecture and compositional conditioning mechanism. Loading the checkpoint requires the corresponding model architecture and conditioning implementation.

A standalone inference example will be provided once the model's inference interface and checkpoint-loading implementation are documented.

Training Details

Training Data

The model was trained on a synthetically generated dataset consisting of:

  • Total Images: 11,000+
  • Glyph Classes: 384
  • Fonts: 6
  • Script: Devanagari

The dataset contains rendered glyph images representing different character and matra combinations across multiple fonts.

Synthetic rendering provides controlled variation in character composition and font appearance, enabling systematic experimentation with compositional generative modeling.

Training Procedure

The model follows a Denoising Diffusion Probabilistic Model (DDPM) training framework.

During training, Gaussian noise is progressively introduced into the input glyph images according to a predefined noise schedule. The UNet learns to predict the added noise at different diffusion timesteps, enabling the reverse denoising process to reconstruct glyph images.

The conditioning mechanism incorporates independent embeddings for base characters, matras, and fonts to provide compositional control over the generation process.

Preprocessing

The training dataset was synthetically generated and organized across 384 glyph classes and six fonts.

Additional preprocessing and augmentation details are subject to the implementation used in the training pipeline.

Training Hyperparameters

  • Training Framework: PyTorch
  • Model Architecture: UNet
  • Generative Objective: Denoising Diffusion Probabilistic Modeling
  • Training Data: 11,000+ synthetic glyph images
  • Conditioning: Base character, matra, and font embeddings
  • Training Precision: Not specified
  • Optimizer: Refer to the training configuration

Speeds, Sizes, Times

Training duration, hardware utilization, and sampling throughput have not yet been documented.

Evaluation

Testing Data, Factors & Metrics

Testing Data

Evaluation is centered on the model's ability to generate Devanagari glyphs under compositional conditioning.

Relevant evaluation dimensions include:

  • Reconstruction and generation quality.
  • Generalization to previously unseen character combinations.
  • Consistency across different font conditions.
  • Differences between DDPM and DDIM sampling.

Factors

The model's generation behavior can be examined across:

  • Base character identity.
  • Matra combinations.
  • Font conditions.
  • Seen versus unseen character combinations.
  • Sampling strategy.

Metrics

Quantitative evaluation metrics should be reported once the corresponding experiments have been finalized.

Results

The project investigates compositional glyph generation using independently parameterized character, matra, and font representations.

DDPM and DDIM sampling strategies were implemented and compared as part of the generative modeling experiments.

Specific quantitative evaluation results are not reported in this model card.

Summary

The model demonstrates a compositional approach to diffusion-based Devanagari glyph synthesis, separating character identity, vowel-sign composition, and font style into distinct conditioning representations.

The central research objective is to investigate whether these independently learned representations can facilitate controlled generation of previously unseen glyph combinations.

Model Examination

The model's compositional conditioning mechanism provides an opportunity to investigate the influence of individual character components on generated glyphs.

Potential analyses include:

  • Varying the base-character embedding while keeping other conditions fixed.
  • Changing matra embeddings to examine compositional effects.
  • Switching font embeddings to study stylistic consistency.
  • Evaluating generation quality on unseen character combinations.

Environmental Impact

Carbon emissions have not been measured for this project.

  • Hardware Type: Not specified
  • Hours Used: Not specified
  • Cloud Provider: Not specified
  • Compute Region: Not specified
  • Carbon Emitted: Not measured

Technical Specifications

Model Architecture and Objective

The model uses a UNet-based diffusion architecture trained with a denoising objective.

The compositional conditioning mechanism independently embeds three components:

  1. Base character representation.
  2. Matra representation.
  3. Font representation.

These embeddings condition the denoising network, allowing the generation process to incorporate both character composition and font-specific information.

The model explores two sampling approaches:

  • DDPM: Iterative reverse diffusion using the learned denoising process.
  • DDIM: An alternative sampling approach for generating samples through a potentially reduced number of denoising steps.

Compute Infrastructure

Hardware

Not specified.

Software

  • Python
  • PyTorch
  • Hugging Face Hub
  • Diffusion model implementation using a custom UNet architecture

Citation

If you use this model in your research, please cite the repository:

@misc{shah2026devanagari_diffusion,
  author = {Shah, Mahir},
  title = {Devanagari Diffusion: Compositional Glyph Generation},
  year = {2026},
  publisher = {Hugging Face},
  url = {https://huggingface.co/mahir123456/Devanagri-Diffusion}
}

Model Card Authors

Mahir Shah

Model Card Contact

Please use the Hugging Face repository for questions, feedback, and research-related discussions.

Downloads last month

-

Downloads are not tracked for this model. How to track
Safetensors
Model size
77.4M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support