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.2.tar.gz (36.9 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.2-py3-none-any.whl (47.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cirilla-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d3e58546e8fcf30d88a1f99083ced83a5e0738926f7691c5d7d02800b3305735
MD5 d15d95bc65be14b81f040b9444426ff1
BLAKE2b-256 ce36787e52bd9d15e7cd839e1cdf7f46865eb428a7fc604d5596d070a88dc28b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for cirilla-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d2cacf94b53eb8d98cabc65329d121014b5e449c8bfc981af6e79a9668883199
MD5 3ca2e3c0d45824688aeab0cf03f0768e
BLAKE2b-256 a95e2fb65c8311bd7f6411c150172d49e76f775a9d771b1c6cc2f42030b56fb8

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