Per-profession vocab
The idea is to reduce vocab.json
Why bother? To train low cost separate experts SLMs and merge them to get a MoE style larger LM)
The natural way of reducing is based on professions (professional terminology cut).
*Some other natural ways of reduction:
-Per-decade:
1800-1810 vocabulary (most frequent words)
1810-1820 etc
-Bio-regionalism https://en.wikipedia.org/wiki/Bioregionalism
Etymologically, bioregion means "life territory" or "place-of-life"
-Age:
3-4 years old 1500 words in TynyStories classic dataset as popular example.
...add more
Let me suggest to reuse this bebchmark classes to segment professions:
https://huggingface.co/datasets/edinburgh-dawg/mmlu-redux
$ python run_openai_mmlu-redux-2.0.py --resume
Assigned subjects: ['abstract_algebra', 'anatomy', 'astronomy', 'business_ethics', 'clinical_knowledge', 'college_biology', 'college_chemistry', 'college_computer_science', 'college_mathematics', 'college_medicine', 'college_physics', 'computer_security', 'conceptual_physics', 'econometrics', 'electrical_engineering', 'elementary_mathematics', 'formal_logic', 'global_facts', 'high_school_biology', 'high_school_chemistry', 'high_school_computer_science', 'high_school_european_history', 'high_school_geography', 'high_school_government_and_politics', 'high_school_macroeconomics', 'high_school_mathematics', 'high_school_microeconomics', 'high_school_physics', 'high_school_psychology', 'high_school_statistics', 'high_school_us_history', 'high_school_world_history', 'human_aging', 'human_sexuality', 'international_law', 'jurisprudence', 'logical_fallacies', 'machine_learning', 'management', 'marketing', 'medical_genetics', 'miscellaneous', 'moral_disputes', 'moral_scenarios', 'nutrition', 'philosophy', 'prehistory', 'professional_accounting', 'professional_law', 'professional_medicine', 'professional_psychology', 'public_relations', 'security_studies', 'sociology', 'us_foreign_policy', 'virology', 'world_religions']
Resuming abstract_algebra: 100 already processed, 0 remaining.
All questions for abstract_algebra already processed.
Resuming anatomy: 8 already processed, 92 remaining.
Evaluating anatomy (92 new questions)
anatomy: 0%| | 0/92 [00:00<?, ?it/s]
=== PROMPT ===
Which of the following terms describes the motion of bending the forearm toward the body?
A. Abduction
B. Eversion
C. Flexion
D. Pronation
==============
Question: anatomy_8
Response:
348 words let us filter some questions:
vintage-LLM/knowledge/pre1900$ cat mmlu-redux.questions_choices_ANACHRONISTIC.txt
ANACHRONISTIC | hits: ['1901', '1902', '1904', '1905', '1909', '1910', '1912', '1914', '1917', '1918', '1919', '1920', '1920s', '1921', '1922', '1924', '1925', '1926', '1927', '1928', '1929', '1930', '1930s', '1931', '1932', '1933', '1934', '1935', '1939', '1940', '1940s', '1943', '1945', '1946', '1947', '1949', '1950', '1950s', '1954', '1955', '1959', '1960', '1960s', '1961', '1962', '1963', '1964', '1965', '1966', '1967', '1969', '1970', '1970s', '1971', '1972', '1973', '1974', '1975', '1976', '1978', '1979', '1980', '1980s', '1981', '1984', '1985', '1987', '1988', '1989', '1990', '1990s', '1991', '1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999', '2000', '2000s', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020', '2047', '2048', '2049', '21st century', '9/11', 'abortion law', 'agenda', 'aircraft', 'airplane', 'airplanes', 'airport', 'antibiotic', 'antibiotics', 'antimatter', 'apartheid', 'astronauts', 'atom bomb', 'auschwitz', 'autism', 'basically', 'berlin wall', 'big bang', 'bitcoin', 'black hole', 'black holes', 'blog', 'blogs', 'c#', 'c++', 'cell phone', 'cellphone', 'chain reaction', 'chain reactions', 'chemotherapy', 'chromosome', 'chromosomes', 'cia', 'climate change', 'cold war', 'compiler', 'compilers', 'computer', 'computer program', 'computer programs', "computer's", 'computers', 'coronavirus', 'coronaviruses', 'cpu', 'cpus', 'credit card', 'credit cards', 'cultural', 'cybersecurity', 'cyclotron', 'dark energy', 'database', 'dataset', 'datasets', 'deuterium', 'digital media', 'diode', 'dna', 'drag queen', 'dvds', 'e-mail', 'einstein', 'email', 'eu countries', 'european union', "european union's", 'facebook', 'fascism', 'fascist', 'fax', 'fbi', 'federal reserve', 'feminism', 'feminist', 'feminists', 'ferromagnetic materials', 'ferromagnetism', 'first world war', 'franklin d. roosevelt', "franklin d. roosevelt's", 'gandhi', 'gene expression', 'gene therapy', 'general relativity', 'genetic', 'genetic engineering', 'genetics', 'genome', 'genomes', 'gigabyte', 'global variable', 'global variables', 'google', 'gpus', 'great depression', 'hawking radiation', 'helicopter', 'helicopters', 'hitler', 'holocaust', 'hormone', 'hormones', 'html', 'http', 'https', 'hydrogen bomb', 'hyperlink', 'in python', 'infrastructure', 'internet', 'ionic compounds', 'java program', 'jazz', 'jet engine', 'john f. kennedy', 'joseph stalin', 'jpeg', 'korean war', 'laptop', 'laser', 'lasers', 'leftist', 'lenin', "lenin's", 'lesbian', 'machine learning', 'mahatma gandhi', "mahatma gandhi's", 'mainstream', 'major league baseball', 'makeup', 'mechanization', 'megabyte', 'microprocessor', 'microprocessors', 'microsoft', 'microwave', 'microwaves', 'minecraft', 'mobile phone', 'mommy', 'movie', 'movies', 'mri', 'mrna', 'nafta', 'nato', 'nazi', 'nazi germany', 'neural network', "neural network's", 'neural networks', 'neutron', 'neutrons', 'new deal', 'nuclear fusion', 'nuclear power', 'nuclear reactions', 'nuclear weapon', 'nuclear weapons', 'online', 'operating system', 'operating systems', 'overfitting', 'pandemic', 'pandemics', 'penicillin', 'pixel', 'pixels', 'positron', 'power plant', 'programming language', 'programming languages', 'proton', "proton's", 'protons', 'public-key', 'pytorch', 'racism', 'racist', 'radar', 'radiocarbon', 'reality television', 'rebooted', 'regular expression', 'rna', 'rnas', 'ronald reagan', "ronald reagan's", 'saas', 'search engine', 'second world war', 'semiconductor', 'social media', 'software', 'soviet union', 'space shuttle', 'spacecraft', 'spaceship', 'spaceships', 'spectrometry', 'sql', 'stalin', "stalin's", 'star wars', 'strong nuclear', 'super bowl', 'superconductor', 'tcp', 'television', 'televisions', 'trna', 'trotsky', 'tv show', 'twentieth century', 'udp', 'united nations', 'usb', 'ussr', 'vegan', 'video camera', 'vietnam war', 'vitamin', 'vitamins', 'walt disney', 'weak nuclear', 'web browser', 'web browsers', 'web site', 'web sites', 'website', "website's", 'websites', 'wikipedia', 'world war', 'world war ii', 'world wars', 'world wide web', 'wwii', 'www', 'youtube']
Hey Foss,
All good ideas. For the year separation, I have little clean data compared to the total, but I can make it work.
Regionalism is probably much much harder, I didn't even look at the rest of the metadata from my datasets, I only checked the date. I wll think about it, but any ideas are welcome.
I mean, look at croqaz/vintage-v1 and croqaz/vintage-v2 readmes and you'll see the original sources. If those datasets contain the metadata, I can have it too.
Age? You mean, the target audience age of the text, like children stories? So they would contain very simple words for kids, right? How would you go about that?
For the professions or categories of text, what do you mean exactly?
What kind of data would you feed as input and what data do you expect as output, how exactly does the output look like specifically?
For the professions or categories of text, what do you mean exactly?
Exact example for medical terms in a separate discussion. Hope it helps to illustrate why per-profession principle.
Regionalism is probably much much harder, I didn't even look at the rest of the metadata from my datasets, I only checked the date. I wll think about it, but any ideas are welcome.
Percentage of keywords specific to a bioregion (ratio), rather than metadata. Like this
ugrep -Zzf region_specific_20words.list
Of which 20 words are human curated. It will return sources with 10x more such regional words. https://en.wikipedia.org/wiki/Dialectology dictionaries may help. Assume existing dictionaries to be less complete and less representative, then possible with large corpora and a vintage LLM assistant from 1800-1875.
Age? You mean, the target audience age of the text, like children stories? So they would contain very simple words for kids, right? How would you go about that?
They waste compute on a toy synthetic TinyStories dataset! Who: https://huggingface.co/models?other=dataset:roneneldan%2FTinyStories&sort=created
Good tech, bad content. Usefullness of thousands of SLM is near 0. Inference was not intended when training ((( . They are like lab rats born to be killed after 1 limited experiment,
It is all about enthropy. ~1500 vocab makes pretrain fast. Not about the age of the target audience. Such SLMs have no audience - they are dust. It was chosen onece and it became a bad tradition in LLM community to use TinyStories as an etalon to compare pretrain methods. Copyryght problem solved with 1875 year cut could be the best solution, not GPT4-synth!
2 examples of Good tech, bad content (just imagine they used vintage dataset from old childrens books instead):
https://huggingface.co/slvDev/esp32-ai-tinystories
The first 300 MB of roneneldan/TinyStories.
Limitations
Simple children's-story English only. No instruction following, no question answering, no chat.
Will produce fluent nonsense outside its distribution. 556K dense parameters do not store facts.Collective distributed slow-connect pretrain (free) by students: https://huggingface.co/commonsense-ai/tinystories-15m
It writes toddler fiction, and only toddler fiction. TinyStories is a synthetic corpus with a ~1,500-word vocabulary world, so the model has no knowledge, no instruction-following, and no register other than bedtime stories about children, animals, and feelings. Plots meander and pronouns drift. 512-token context. It is an educational artifact demonstrating that strangers on the internet can pretrain a real model together — use it to study that, not to ship products.
For the professions or categories of text, what do you mean exactly?
What kind of data would you feed as input and what data do you expect as output, how exactly does the output look like specifically?
16834 words (and/or word-pairs) not present in general 32k tokenizer.json and ~70-80% of which not shared with another domain.
Feed into tokenizer vocab from the freq lists.
Output: expected improvement of the fertility metrics in that domain (with all benefits of it for preteain performance). Output visible during LLM inference and in a longer seq measured in chars, smaller KV-caches for the same tok/s speed + faster learning and lower perplexity on texts in this domain.
Each 16384 extention of the vocabulary has lower cost of continued pretrain - 32k embeddings can be freezed and only extention learns.
How It Works
The principle is straightforward: instead of storing each token ID as a full 4-byte integer, you pack multiple IDs into a single integer using bit-shifting. For the scenario with a 16k vocabulary, each token ID needs just 14 bits to represent (since 2^14 = 16,384). This means you can pack two tokens into a 32-bit integer, effectively halving the dataset's memory footprint