Skip to main content

Crilla is a simple way to introduce optimized single-GPU training into your project

Project description

[!IMPORTANT]
For a much nicer README visit Cirilla

Ciri from The Witcher 4 trailer

Cirilla

Cirilla is an open source learning project aiming at implmenting various LLMs. It is focused mainly on showing how to make, train, infer and deploy a LLM from scratch using Pytorch and a budget friendly GPU (RTX 4060Ti 16GiB ~500$).

Who is Cirilla

Cirilla Fiona Elen Riannon, known as Ciri, is one of the central characters in The Witcher saga by Andrzej Sapkowski and its adaptations.
She is the princess of Cintra, granddaughter of Queen Calanthe, and the sole heir to a powerful lineage marked by the mysterious Elder Blood.

Ciri is defined by her destiny, adaptability, and potential. Unlike kings who wield authority by birthright, her strength comes from surviving chaos, learning from mentors like Geralt and Yennefer, and unlocking extraordinary powers.

Her unique abilities make her one of the most pivotal figures in the saga. Known as the Lady of Space and Time, the Lion Cub of Cintra, and the Child of the Elder Blood, she can manipulate space and time, travel between worlds, and influence the course of events in ways few can.

Fig.1 Ciri Gwent card by Bogna Gawrońska

Why name a LLM Cirilla

Unlike rulers who inherit authority, Cirilla embodies potential realized through learning, experience, and adaptability. She is resilient, capable of navigating complex and unpredictable worlds, and able to respond to challenges with skill and precision - qualities that mirror how an language model can shift between tasks, domains, and contexts.

Guided by mentors and shaped by hardships, Ciri develops her abilities quickly, mastering both strategy and instinct while remaining flexible in the face of unforeseen circumstances.

Her combination of innate talent, adaptability, and the capacity for growth makes her an fitting symbol for a language model designed to acquire knowledge, evolve over time, and connect information across domains.

Fig.2 Ciri Gwent card by Anna Podedworna

What is a LLM

On a high level: imagine a toddler with an huge amount of knowledge but still possessing a toddler-like way of reasoning and understanding.

On a lower level: an LLM is a neural network trained on so-called big data to recognize patterns, generate human-like responses, and predict the most likely next word in a given context. While it can process and recall information efficiently, it lacks true understanding, reasoning, or consciousness, relying only on statistical correlations rather than genuine comprehension. the reasoning of LLMs is being impoved in projects (most notably) like DeepSeek, which focus on enhancing the ability to understand context and simulating human-like reasoning.

Repo organization:

Cirilla - a LLM made on a budget/
    ├── BERT/                           # overview of BERT
     └── RAG/                        # overview of RAG
    ├── Cirilla_model/                  # implementation of Cirilla LLM
     ├── model.py
     ...
    ├── Decoder_only_architecture/      # overview of decoder only transformer architecture
     └── Llama2/                     # implementation of Llama 2 inference loop
     └── Mistral/                    # overview of the Mistral 7B architecture and inference tricks
    ├── LLM_pieces/                     # elements of decoder-only model you can use
     ├── SMoE.py                     # Sparse mixture of Experts
     ...
    ├── Synth_data/
     ├── multi_turn_vllm.py          # create multi turn instructions with VLLM
     ├── Ollama_create.py            # synthetic data creation with Ollama
     ├── reason_gym_synthetic.py     # create synthetic reasoning dataset with reasoning_gym
     ├── rm_duplicate_instruct.py    # remove duplicate instructions from Ollama
     └── witcher_mr_gather.py        # create multi turn instructions with Witcher
    ├── Training_optimizations/
     ├──FlexAttention/               # overview of Pytorch's FlexAttention
     └── HF_kernels/                 # overview of HF's kernel hub
    └── Transformer_from_scratch/       # transformer implementation
      ├── model.py                    # transformer model
      ├── dataset.py                  # dataset for MLM - masked language modelling
      ├── train.py                    # main transformer training loop
      └── LongNet.py                  # LongNet - crude dilated attention implementation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cirilla-0.1.0.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cirilla-0.1.0-py3-none-any.whl (48.4 kB view details)

Uploaded Python 3

File details

Details for the file cirilla-0.1.0.tar.gz.

File metadata

  • Download URL: cirilla-0.1.0.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.0

File hashes

Hashes for cirilla-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a40148ddf5a1c7ed207e539f361889ccbc996bb08309a67c2e70f946bc39bfaf
MD5 bc8b790413feda306b8ee81f523e208f
BLAKE2b-256 ca830a407fa93fc6595cab6eea3be3abb3a4670ba93e399cf160de4e09d12b4c

See more details on using hashes here.

File details

Details for the file cirilla-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cirilla-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 48.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.0

File hashes

Hashes for cirilla-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbb49f92a6efa6ca80a20a5185d9419aa54aa3a9fe4f7292d22660fe2fb61334
MD5 8ca8458b8d5a9800e93f4b538adc5487
BLAKE2b-256 7039bf5dfde66f5a5e9ff15f747fe86982a5ba0a383fec1a8860c59d9a30f1a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page