diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2026-08-16 11:42:16 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2026-08-16 11:42:16 +0800 |
| commit | 01b9c204777c3f7e541241180bac0d3d93721af0 (patch) | |
| tree | f8b6898d41d6f94da7a29960b9a436c7562b4d96 | |
| parent | fe4e5958572a029c6f2d2831aa7cfd8a8671ce21 (diff) | |
| download | lex-01b9c204777c3f7e541241180bac0d3d93721af0.tar.gz | |
Optimize KV cache and compute buffers, bench results from Pi5.
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | bench/results_qwen2.5-3b-instruct-q4_k_m.gguf.pi5.1.txt | 43 | ||||
| -rw-r--r-- | bench/results_qwen2.5-3b-instruct-q4_k_m.gguf.pi5.2.txt | 101 | ||||
| -rw-r--r-- | llm.c | 344 | ||||
| -rw-r--r-- | llm.h | 10 | ||||
| -rw-r--r-- | main.c | 14 | ||||
| -rw-r--r-- | results_qwen2.5-3b-instruct-q4_k_m.gguf.txt | 175 |
7 files changed, 469 insertions, 220 deletions
@@ -80,7 +80,7 @@ deps/lib/libllama.a deps/lib/libggml.a deps/lib/libggml-cpu.a: rm -rf $(LLAMA_SRC_DIR) clean: - rm -f $(TARGET) + rm -f $(TARGET) $(OBJS) distclean: clean rm -rf deps diff --git a/bench/results_qwen2.5-3b-instruct-q4_k_m.gguf.pi5.1.txt b/bench/results_qwen2.5-3b-instruct-q4_k_m.gguf.pi5.1.txt new file mode 100644 index 0000000..220cce4 --- /dev/null +++ b/bench/results_qwen2.5-3b-instruct-q4_k_m.gguf.pi5.1.txt @@ -0,0 +1,43 @@ +PROMPT: Define imperious in 'an imperious necessity drove him forward on his quest' + +imperious (adj) — Formal + +DEFINITION: +Having a commanding or domineering character; asserting one's will with authority and arrogance. + +GENERAL TONE: +The necessity was so strong that it pushed him forward, regardless of his own wishes or the opinions of others. +SYNONYMS: +urgent, pressing, compelling. + +EXAMPLES: +1. The imperious necessity pushed him to finish his project ahead of schedule. +2. His imperious nature made it hard for others to disagree with him. + +METRICS: ELAPSED: 181.21s | MAX RSS: 2592.09 MB + +------------------------------------------------------------------------ + +PROMPT: Define despondency in 'he fell into a state of deep, uninterrupted despondency' + +despondency (noun) — Formal + +DEFINITION: +deep and persistent melancholy or hopelessness. + +GENERAL TONE: +The tone is somber, reflecting a profound sense of despair. + +SYNONYMS: +dejection, gloom, melancholy + +EXAMPLES: +1. He fell into a state of deep, uninterrupted despondency. +2. Her friends tried to lift her out of the long period of despondency. + +METRICS: ELAPSED: 192.09s | MAX RSS: 2592.90 MB + +------------------------------------------------------------------------ + +PROMPT: Define arduous in 'the long and arduous journey through the frozen mountains' + diff --git a/bench/results_qwen2.5-3b-instruct-q4_k_m.gguf.pi5.2.txt b/bench/results_qwen2.5-3b-instruct-q4_k_m.gguf.pi5.2.txt new file mode 100644 index 0000000..e511989 --- /dev/null +++ b/bench/results_qwen2.5-3b-instruct-q4_k_m.gguf.pi5.2.txt @@ -0,0 +1,101 @@ +PROMPT: Define imperious in 'an imperious necessity drove him forward on his quest' + +imperious (adj) — Formal + +DEFINITION: +Having a commanding or domineering character; asserting one's will with authority and arrogance. + +GENERAL TONE: +The necessity was so strong that it pushed him forward, regardless of his own wishes or the opinions of others. +SYNONYMS: +urgent, pressing, compelling. + +EXAMPLES: +1. The imperious necessity pushed him to finish his project ahead of schedule. +2. His imperious nature made it hard for others to disagree with him. + +METRICS: ELAPSED: 191.92s | DAEMON RSS: 5.14 MB + +------------------------------------------------------------------------ + +PROMPT: Define despondency in 'he fell into a state of deep, uninterrupted despondency' + +despondency (noun) — Formal + +DEFINITION: +deep and persistent melancholy or hopelessness. + +GENERAL TONE: +The tone is somber, reflecting a profound sense of despair. + +SYNONYMS: +dejection, gloom, melancholy + +EXAMPLES: +1. He fell into a state of deep, uninterrupted despondency. +2. Her friends tried to lift her out of the long period of despondency. + +METRICS: ELAPSED: 57.79s | DAEMON RSS: 2378.18 MB + +------------------------------------------------------------------------ + +PROMPT: Define arduous in 'the long and arduous journey through the frozen mountains' + +arduous (adjective) — Formal + +DEFINITION: +Challenging or difficult to endure, especially physically. + +GENERAL TONE: +The journey was tough and required a lot of effort. +SYNONYMS: +Difficult, strenuous, taxing, grueling + +EXAMPLES: +1. The expedition through the dense jungle was an arduous task. +2. Climbing Mount Everest is an arduous challenge for mountaineers. + +METRICS: ELAPSED: 55.04s | DAEMON RSS: 2364.88 MB + +------------------------------------------------------------------------ + +PROMPT: Define ephemeral in 'human history appeared as a brief and ephemeral flash in cosmic time' + +ephemeral (adj) — Formal + +DEFINITION: +lasting only a very short time; transient. + +GENERAL TONE: +The phrase suggests that human history is insignificant compared to the vastness of cosmic time. + +SYNONYMS: +transient, fleeting, momentary, brief. + +EXAMPLES: +1. The sunset was an ephemeral display in the sky. +2. His fame is just an ephemeral memory now. + +METRICS: ELAPSED: 53.64s | DAEMON RSS: 2364.31 MB + +------------------------------------------------------------------------ + +PROMPT: Define austere in 'they lived under the austere discipline of their new order' + +austere (adj) — Formal + +DEFINITION: +Strictly simple or plain; unadorned. + +GENERAL TONE: +The tone is formal and precise, emphasizing the starkness of their living conditions. + +SYNONYMS: +plain, simple, austonian, severe + +EXAMPLES: +1. They lived under the austere discipline of their new order. +2. The monastery was known for its austere lifestyle. + +METRICS: ELAPSED: 53.59s | DAEMON RSS: 2363.46 MB + @@ -1,15 +1,19 @@ +#include <stdio.h> #include <err.h> +#include <string.h> #include "llm.h" #include "mem.h" -#define MAX_TOKENS 300 +#define MAX_TOKENS 300 +#define N_CTX 1024 +#define N_THREADS 4 #define SYSTEM_PROMPT \ "You are a dictionary assistant. Define the target word in the context provided.\n" \ "DO NOT repeat target word in definition. Choose one or two of Formality levels.\n\n" \ "Output format:\n" \ - "<WORD> (<part of speech>) — <Formality: Conversational|Formal|Literary|Figurative|Archaic>\n\n" \ + "<WORD> (<part of speech>) - <Formality: Conversational|Formal|Literary|Figurative|Archaic>\n\n" \ "DEFINITION:\n" \ "<terse, highly accurate definition in context>\n\n" \ "GENERAL TONE:\n" \ @@ -20,181 +24,287 @@ "1. <example 1>\n" \ "2. <example 2>\n\n" -struct llama_model *llm_init(const char *model_path) -{ +struct llm_ctx { struct llama_model *model; + struct llama_context *ctx; + const struct llama_vocab *vocab; + struct llama_sampler *smpl; + + /* Token history of what is currently resident in ctx's KV + * cache for sequence 0, in order. Used to compute a + * longest-common-prefix against each new request so we only + * decode the tail that actually changed. */ + llama_token *cached_tokens; + int n_cached_tokens; + + /* Token count of the system prompt.Used as a sanity-check floor: + * if a later request's LCP against the cache falls below this, the + * system-prompt prefix itself failed to match, which would + * indicate template drift. */ + int n_system_tokens; +}; + +static void llm_log_cb(enum ggml_log_level level, const char *s, void *ud) +{ + (void)ud; + if (level < GGML_LOG_LEVEL_WARN) + return; + fputs(s, stderr); +} + +/* Tokenize `text` (already a fully rendered chat-template prompt) into + * a freshly malloc'd buffer. Returns token count via *out_n, or -1 on + * failure (*out is left untouched). Caller owns *out. */ +static int tokenize_prompt(const struct llama_vocab *vocab, + const char *text, int text_len, llama_token **out) +{ + int n; + + n = -llama_tokenize(vocab, text, text_len, NULL, 0, false, true); + if (n <= 0) + return -1; + + *out = MALLOC((size_t)n * sizeof(llama_token)); + + if (llama_tokenize(vocab, text, text_len, *out, n, false, true) < 0) { + free(*out); + return -1; + } + + return n; +} + +struct llm_ctx *llm_init(const char *model_path) +{ + char *sys_prompt; + int sys_prompt_len; + llama_token *sys_tokens; + + struct llm_ctx *llm; struct llama_model_params mparams; + struct llama_context_params cparams; + struct llama_sampler_chain_params sparams; + struct llama_chat_message sys_msg[1]; + llama_log_set(llm_log_cb, NULL); llama_backend_init(); mparams = llama_model_default_params(); - mparams.n_gpu_layers = 0; /* force all layers onto CPU */ - mparams.load_mode = LLAMA_LOAD_MODE_MMAP; + mparams.n_gpu_layers = 0; /* force all layers onto CPU */ + mparams.load_mode = LLAMA_LOAD_MODE_MLOCK; /* Force model to RAM, + * don't swap/compress */ + + llm = MALLOC(sizeof(*llm)); + llm->model = llama_model_load_from_file(model_path, mparams); + if (!llm->model) { + free(llm); + return NULL; + } + + if (!llama_model_chat_template(llm->model, NULL)) + fprintf(stderr, "WARN: model has no embedded chat template\n"); + + /* Creation of context allocates KV cache and compute buffers. + * Do this once in init, instead of per request. */ + cparams = llama_context_default_params(); + cparams.n_ctx = N_CTX; + cparams.n_threads = N_THREADS; + cparams.n_threads_batch = N_THREADS; + + llm->ctx = llama_init_from_model(llm->model, cparams); + if (!llm->ctx) { + llama_model_free(llm->model); + free(llm); + return NULL; + } - model = llama_model_load_from_file(model_path, mparams); - return model; + llm->vocab = llama_model_get_vocab(llm->model); + if (!llm->vocab) { + llama_free(llm->ctx); + llama_model_free(llm->model); + free(llm); + return NULL; + } + + /* Sampler chain, reuse across requests as well. */ + sparams = llama_sampler_chain_default_params(); + llm->smpl = llama_sampler_chain_init(sparams); + + llama_sampler_chain_add(llm->smpl, + llama_sampler_init_penalties( + 64, /* last_n: lookback window */ + 1.1f, /* repeat_penalty */ + 0.0f, /* frequency_penalty */ + 0.0f /* presence_penalty */ + ) + ); + + llama_sampler_chain_add(llm->smpl, llama_sampler_init_greedy()); + + llm->cached_tokens = MALLOC((size_t)N_CTX * sizeof(llama_token)); + llm->n_cached_tokens = 0; + + /* Measure system prompt's token count. Used to check template + * drift in llm_run(), not seed the KV cache. */ + sys_msg[0].role = "system"; + sys_msg[0].content = SYSTEM_PROMPT; + + sys_prompt_len = llama_chat_apply_template(NULL, sys_msg, 1, false, NULL, 0); + if (sys_prompt_len > 0) { + sys_prompt = MALLOC((size_t)sys_prompt_len + 1); + if (llama_chat_apply_template(NULL, sys_msg, 1, false, + sys_prompt, sys_prompt_len + 1) >= 0) { + llm->n_system_tokens = tokenize_prompt(llm->vocab, + sys_prompt, sys_prompt_len, &sys_tokens); + if (llm->n_system_tokens > 0) + free(sys_tokens); + else + llm->n_system_tokens = 0; + } else { + llm->n_system_tokens = 0; + } + free(sys_prompt); + } else { + llm->n_system_tokens = 0; + } + + return llm; } -void llm_free(struct llama_model *model) +void llm_free(struct llm_ctx *llm) { - llama_model_free(model); + if (!llm) + return; + llama_sampler_free(llm->smpl); + llama_free(llm->ctx); + llama_model_free(llm->model); llama_backend_free(); + free(llm->cached_tokens); + free(llm); } -void llm_process_request(struct llama_model *model, - const char *user_prompt, FILE *out) +void llm_run(struct llm_ctx *llm, const char *user_prompt, FILE *out) { - int n_prompt_tokens, i; + int i, n; char *prompt; int prompt_len; - - llama_token *prompt_tokens; + llama_token *new_tokens; + int n_new_tokens; + int n_common; llama_token new_token_id; - struct llama_batch batch; - struct llama_context *ctx; - struct llama_context_params cparams; - struct llama_sampler *smpl; - struct llama_sampler_chain_params sparams; struct llama_chat_message messages[] = { { "system", SYSTEM_PROMPT }, { "user", user_prompt } }; - const char *tmpl = llama_model_chat_template(model, NULL); - if (!tmpl) - fprintf(stderr, "Warning: model has no embedded chat template\n"); - + /* Retokenize full prompt. Let's expensive than decode; no + * assumptions about the model's internal chat structure. */ prompt_len = llama_chat_apply_template(NULL, messages, 2, true, NULL, 0); if (prompt_len <= 0) { - fprintf(stderr, "Error: failed to calculate chat template size\n"); + fprintf(stderr, "ERROR: Chat template size calculation failed\n"); return; } prompt = MALLOC((size_t)prompt_len + 1); - if (llama_chat_apply_template(NULL, messages, 2, true, prompt, prompt_len + 1) < 0) { - fprintf(stderr, "Error: failed to apply chat template\n"); + if (llama_chat_apply_template(NULL, messages, 2, true, prompt, + prompt_len + 1) < 0) { + fprintf(stderr, "ERROR: failed to apply chat template\n"); free(prompt); return; } - cparams = llama_context_default_params(); - cparams.n_ctx = 1024; /* context size in tokens */ - cparams.n_threads = 4; - cparams.n_threads_batch = 4; - - ctx = llama_init_from_model(model, cparams); - if (!ctx) { - fprintf(stderr, "Error: failed to create context\n"); - free(prompt); + n_new_tokens = tokenize_prompt(llm->vocab, prompt, prompt_len, &new_tokens); + free(prompt); + if (n_new_tokens <= 0) { + fprintf(stderr, "ERROR: tokenization failed\n"); return; } - const struct llama_vocab *vocab = llama_model_get_vocab(model); - if (!vocab) { - fprintf(stderr, "Error: failed to obtain model vocabulary\n"); - free(prompt); - llama_free(ctx); - return; - } - - n_prompt_tokens = -llama_tokenize(vocab, - prompt, prompt_len, NULL, 0, false, true); - - if (n_prompt_tokens <= 0) { - fprintf(stderr, "Error: tokenization sizing failed\n"); - free(prompt); - llama_free(ctx); + if (n_new_tokens + MAX_TOKENS > N_CTX) { + fprintf(stderr, "ERROR: token count exceeds context size\n"); + free(new_tokens); return; } - if (n_prompt_tokens + MAX_TOKENS > (int)cparams.n_ctx) { - fprintf(stderr, "Error: token count exceeds context size\n"); - free(prompt); - llama_free(ctx); - return; + /* llm->cached_tokens contain tokens from the previous request + * (system prompt + any tokens inserted by the model + previous + * user prompt + closing tokens inserted by the model). new_tokens + * should have a similar structure, except the new user prompt. We + * walk the two token sets to locate the first new token: presumably + * the start of the new user prompt. */ + n_common = 0; + while (n_common < llm->n_cached_tokens && n_common < n_new_tokens && + llm->cached_tokens[n_common] == new_tokens[n_common]) + n_common++; + + /* Sanity check */ + if (llm->n_cached_tokens > 0 && n_common < llm->n_system_tokens) { + fprintf(stderr, "WARN: Cached prefix is shorter than the " + "system prompt. Chat template may be rendering " + "inconsistently between requests."); } - prompt_tokens = MALLOC((size_t)n_prompt_tokens * sizeof(llama_token)); + /* Drop everything in the cache past the common prefix. */ + llama_memory_seq_rm(llama_get_memory(llm->ctx), + 0, /* sequence id: 0 - we only use one sequence */ + n_common, /* start at first differing token */ + -1 /* -1: clear to the end of sequence */ + ); + + if (n_common < n_new_tokens) { + /* Only decode the diff */ + batch = llama_batch_get_one(new_tokens + n_common, + n_new_tokens - n_common); + if (llama_decode(llm->ctx, batch) != 0) { + fprintf(stderr, "ERROR: prompt evaluation failed\n"); + free(new_tokens); + llm->n_cached_tokens = n_common; + return; + } - if (llama_tokenize(vocab, prompt, prompt_len, prompt_tokens, - n_prompt_tokens, false, true) < 0) { - fprintf(stderr, "Error: Tokenization failed\n"); - free(prompt); - free(prompt_tokens); - llama_free(ctx); - return; + /* Copy the newly tokens to the buffer */ + memcpy(llm->cached_tokens + n_common, new_tokens + n_common, + (size_t)(n_new_tokens - n_common) * sizeof(llama_token)); + llm->n_cached_tokens = n_new_tokens; } - free(prompt); /* Prompt buffer is fully tokenized and no longer needed */ - - /* Ingest prompt tokens in one batch (parallelizes matrix - * multiplications across tokens in the batch) */ - batch = llama_batch_get_one(prompt_tokens, n_prompt_tokens); + free(new_tokens); - if (llama_decode(ctx, batch) != 0) { - fprintf(stderr, "Error: Prompt evaluation failed\n"); - free(prompt_tokens); - llama_free(ctx); - return; - } - - free(prompt_tokens); + /* Sampler holds repetition-window state (from the penalties + * stage) across calls since we no longer rebuild it each + * request. Reset that state so one request's repeated words + * don't suppress an unrelated word in the next one. */ + llama_sampler_reset(llm->smpl); /* Generation loop */ - sparams = llama_sampler_chain_default_params(); - smpl = llama_sampler_chain_init(sparams); - - llama_sampler_chain_add(smpl, llama_sampler_init_penalties( - 64, /* last_n: lookback window (64 is standard) */ - 1.1f, /* repeat_penalty */ - 0.0f, /* frequency_penalty */ - 0.0f /* presence_penalty */ - )); - - /* Pick the top token */ - llama_sampler_chain_add(smpl, llama_sampler_init_greedy()); - - for (i = 0; i < MAX_TOKENS; i++) { - /* Model outputs next tokens for every token in the prompt. - * We need the one after the last token in the prompt */ - new_token_id = llama_sampler_sample(smpl, ctx, -1); - - /* Tell the sampler chain which token was chosen */ - llama_sampler_accept(smpl, new_token_id); - - /* Check for end-of-generation (EOG) tokens: - * EOS: end-of-sequence - * EOT: end-of-turn */ - if (llama_vocab_is_eog(vocab, new_token_id)) + for (i = 0; i < MAX_TOKENS; i++) { + new_token_id = llama_sampler_sample(llm->smpl, llm->ctx, -1); + llama_sampler_accept(llm->smpl, new_token_id); + + if (llama_vocab_is_eog(llm->vocab, new_token_id)) break; - /* Convert numeric token id to printable text */ char buf[128]; - int n = llama_token_to_piece(vocab, new_token_id, buf, - sizeof(buf), 0, false); - + n = llama_token_to_piece(llm->vocab, new_token_id, buf, + sizeof(buf), 0, false); if (n > 0) { fwrite(buf, 1, (size_t)n, out); fflush(out); } - - /* Create batch with 1 token for the next forward pass */ + batch = llama_batch_get_one(&new_token_id, 1); - - if (llama_decode(ctx, batch) != 0) { - fprintf(stderr, "llama_decode failed!\n"); + if (llama_decode(llm->ctx, batch) != 0) { + fprintf(stderr, "ERROR: llama_decode failed!\n"); break; } + + /* New token is now in KV cache. Record it for the next + * request's LCP check. */ + llm->cached_tokens[llm->n_cached_tokens++] = new_token_id; } fprintf(out, "\n\n"); fflush(out); - - //llama_perf_context_print(ctx); - - llama_sampler_free(smpl); - llama_free(ctx); } - @@ -3,11 +3,9 @@ #include "llama.h" -struct llama_model *llm_init(const char *model_path); - -void llm_process_request(struct llama_model *model, - const char *user_prompt, FILE *out); - -void llm_free(struct llama_model *model); +struct llm_ctx; +struct llm_ctx *llm_init(const char *model_path); +void llm_run(struct llm_ctx *ctx, const char *prompt, FILE *out); +void llm_free(struct llm_ctx *ctx); #endif /* LLM_H */ @@ -16,7 +16,7 @@ static void usage(const char *prog) errx(1, "usage: %s [-m model_path]", prog); } -static void loop(struct llama_model *model, int lsock) +static void loop(struct llm_ctx *llm, int lsock) { int csock, c; FILE *cfp; @@ -50,7 +50,7 @@ static void loop(struct llama_model *model, int lsock) line[len] = '\0'; if (line[0] != '\0') - llm_process_request(model, line, cfp); + llm_run(llm, line, cfp); } fclose(cfp); @@ -86,10 +86,7 @@ int main(int argc , char *argv[]) int sock, opt; const char *prog; const char *model_path; - struct llama_model *model; - - if (pledge("stdio rpath wpath cpath unix unveil", NULL) == -1) - err(1, "pledge failed"); + struct llm_ctx *llm; prog = argv[0]; model_path = MODEL_PATH; @@ -118,13 +115,14 @@ int main(int argc , char *argv[]) sock = sock_init(); - if (!(model = llm_init(model_path))) + if (!(llm = llm_init(model_path))) errx(1, "Failed to load model"); + /* llm_init() calls mlock, hence pledge() after that. */ if (pledge("stdio unix", NULL) == -1) err(1, "secondary pledge failed"); - loop(model, sock); /* doesn't return */ + loop(llm, sock); /* doesn't return */ return 0; } diff --git a/results_qwen2.5-3b-instruct-q4_k_m.gguf.txt b/results_qwen2.5-3b-instruct-q4_k_m.gguf.txt index d5b3043..45773b6 100644 --- a/results_qwen2.5-3b-instruct-q4_k_m.gguf.txt +++ b/results_qwen2.5-3b-instruct-q4_k_m.gguf.txt @@ -1,270 +1,269 @@ PROMPT: Define imperious in 'an imperious necessity drove him forward on his quest' -imperious (adj) — Formal +imperious (adj) - Formal DEFINITION: -Having a commanding or domineering attitude; asserting authority over others. +Having a commanding or domineering character; asserting one's will with authority and arrogance. GENERAL TONE: -The tone is formal, emphasizing the authoritative nature of imperious necessity. - +The necessity was so strong that it pushed him forward, leaving no room for resistance. SYNONYMS: -domineering, autocratic, bossy +urgent, pressing, compelling, urgent. EXAMPLES: -1. The manager's imperious attitude made the employees uncomfortable. -2. She felt an imperious necessity to finish her project before the deadline. +1. The imperious necessity compelled him to finish the project on time. +2. His imperious attitude made it hard for others to disagree with him. -METRICS: ELAPSED: 18.79s | DAEMON RSS: 467.86 MB +METRICS: ELAPSED: 19.96s | DAEMON RSS: 3.07 MB ------------------------------------------------------------------------ PROMPT: Define despondency in 'he fell into a state of deep, uninterrupted despondency' -despondency (noun) — Formality: Literary +despondency (noun) - Formal DEFINITION: a state of deep and persistent depression or hopelessness. GENERAL TONE: -The tone is somber, reflecting the heavy emotional state described in the sentence. +The tone is somber, reflecting the heavy emotional state described. SYNONYMS: melancholy, despair, gloom EXAMPLES: 1. He fell into a state of deep, uninterrupted despondency. -2. Her friends noticed she had been in a constant state of despondency lately. +2. Her friends noticed her mood had become increasingly despondent over the past few weeks. -METRICS: ELAPSED: 18.59s | DAEMON RSS: 3160.82 MB +METRICS: ELAPSED: 13.46s | DAEMON RSS: 3388.88 MB ------------------------------------------------------------------------ PROMPT: Define arduous in 'the long and arduous journey through the frozen mountains' -arduous (adjective) — Formality: Formal +arduous (adjective) - Formality: Literary DEFINITION: -Challenging or difficult to endure, especially physically. +Challenging or difficult, especially in a way that requires great effort and perseverance. GENERAL TONE: -The journey through the frozen mountains was a grueling and strenuous trek. +The journey through the frozen mountains was fraught with difficulties requiring immense determination to overcome. + SYNONYMS: -Difficult, taxing, trying, strenuous. +Challenging, difficult, strenuous, taxing EXAMPLES: -1. The expedition through the icy wilderness was an arduous journey. -2. Climbing up those steep mountains was an arduous task. +1. The expedition through the dense jungle was an arduous journey. +2. Climbing Mount Everest is an arduous undertaking for even the most experienced climbers. -METRICS: ELAPSED: 18.38s | DAEMON RSS: 3164.26 MB +METRICS: ELAPSED: 15.35s | DAEMON RSS: 3388.91 MB ------------------------------------------------------------------------ PROMPT: Define ephemeral in 'human history appeared as a brief and ephemeral flash in cosmic time' -ephemeral (adj) — Formality: Literary +ephemeral (adj) - Formal DEFINITION: -lasting only a very short time; transient. +lasting only a very short time; brief. GENERAL TONE: -The term evokes a sense of transience and impermanence, often used in philosophical or poetic contexts to describe fleeting moments or phenomena. +The concept of human history being fleeting in the vastness of cosmic time is often used to emphasize how insignificant our existence can seem from a cosmic perspective. SYNONYMS: transient, fleeting, momentary. EXAMPLES: -1. The sunset was an ephemeral display of colors. -2. Her smile was an ephemeral light in the room. +1. The success of the project was ephemeral; it didn't last long. +2. In the grand scheme of things, life is an ephemeral experience. -METRICS: ELAPSED: 18.78s | DAEMON RSS: 3164.46 MB +METRICS: ELAPSED: 15.77s | DAEMON RSS: 3388.91 MB ------------------------------------------------------------------------ PROMPT: Define austere in 'they lived under the austere discipline of their new order' -austere (adjective) — Formality: Formal +austere (adjective) - Formal DEFINITION: -Strictly simple or plain, often in a harsh or severe manner. +strict and plain in behavior or lifestyle; austere rules, regulations. GENERAL TONE: -The tone is formal and precise, suitable for historical contexts. +The tone is formal, emphasizing the strictness of the discipline imposed by the new order. SYNONYMS: -Spare, austonian, ascetic +rigid, severe, austonian EXAMPLES: -1. The monastery was known for its austere lifestyle. -2. His new regime imposed a strict austere regimen on the workers. +1. The monastery lived under austere rules. +2. His lifestyle was austere and simple. -METRICS: ELAPSED: 17.64s | DAEMON RSS: 3164.69 MB +METRICS: ELAPSED: 12.76s | DAEMON RSS: 3388.91 MB ------------------------------------------------------------------------ PROMPT: Define venerable in 'the venerable monuments of a long-forgotten civilization' -venerable (adjective) — Formality: Literary +venerable (adjective) - Formal DEFINITION: -Respected and revered due to age or historical significance. +Respected and held in high esteem due to age or historical significance. GENERAL TONE: -The tone is reverent, suggesting a sense of awe and respect for ancient structures. +The monuments are ancient structures that have stood the test of time, earning them respect from modern visitors. SYNONYMS: -Ancient, venerable, historic, esteemed +Ancient, revered, esteemed, venerable EXAMPLES: -1. The venerable monuments stood as silent witnesses to the past. -2. She felt a deep reverence for the ancient temples that were now ruins. +1. The venerable monuments of a long-forgotten civilization are now preserved as historical sites. +2. She felt a sense of reverence for the venerable old church in her hometown. -METRICS: ELAPSED: 18.57s | DAEMON RSS: 3166.86 MB +METRICS: ELAPSED: 15.89s | DAEMON RSS: 3388.91 MB ------------------------------------------------------------------------ PROMPT: Define tumultuous in 'the species endured a tumultuous period of war and renewal' -tumultuous (adj) — Formality: Literary +tumultuous (adj) - Formality: Literary DEFINITION: -Marked by violent disturbance or disorder; tumultuous events or conditions. +Marked by violent disturbance or disorder; stormy. GENERAL TONE: -The tone is formal, using precise language to describe a chaotic period of war and recovery. +The passage conveys a sense of chaos and upheaval during the period described. SYNONYMS: -chaotic, turbulent, stormy, agitated +Stormy, turbulent, chaotic, stormlike. EXAMPLES: -1. The city experienced a tumultuous period of unrest and rebuilding. -2. During the tumultuous years following the revolution, society underwent significant changes. +1. The tumultuous weather led to widespread power outages. +2. His life was marked by a tumultuous period of political upheaval. -METRICS: ELAPSED: 19.25s | DAEMON RSS: 3167.03 MB +METRICS: ELAPSED: 14.44s | DAEMON RSS: 3388.91 MB ------------------------------------------------------------------------ PROMPT: Define imperturbable in 'he maintained an imperturbable calm despite the surrounding chaos' -<imperturbable (adj)> — Formal +imperturbable (adjective) - Formal DEFINITION: -Unflappable; showing no sign of disturbance or emotion. +Unflappable; able to remain calm and composed under stress or in difficult circumstances. GENERAL TONE: -The tone is formal, emphasizing the unchanging nature of calmness in a chaotic situation. +The tone is formal, emphasizing the ability of someone to maintain composure even when faced with chaos. SYNONYMS: -Unflappable, composed, unruffled, steady. +Unflappable, composed, unruffled, steady EXAMPLES: -1. Despite the storm outside, he maintained an imperturbable calm. -2. Her imperturbable composure in the face of criticism was admirable. +1. Despite the stormy weather, he maintained an imperturbable calm. +2. The actor's performance was so imperturbable that it seemed scripted. -METRICS: ELAPSED: 19.17s | DAEMON RSS: 3167.21 MB +METRICS: ELAPSED: 16.26s | DAEMON RSS: 3388.91 MB ------------------------------------------------------------------------ PROMPT: Define singular in 'he was a man of a singular and unpredictable temperament' -(singular) — Formal +singular (adjective) - Formal DEFINITION: -Singular means unique or exceptional, not common. +single or unique in nature, not typical. GENERAL TONE: -The term conveys a sense of uniqueness and unpredictability in temperament. +The term suggests a person with an unusual and unpredictable personality. SYNONYMS: -Uncommon, distinctive, eccentric. +unusual, eccentric, peculiar, strange. EXAMPLES: -1. He was a man of singular and unpredictable temperament. -2. Her personality had a singular charm that attracted many admirers. +1. He was a man of a singular and unpredictable temperament. +2. Her approach to problem-solving is singularly innovative. -METRICS: ELAPSED: 16.05s | DAEMON RSS: 3167.36 MB +METRICS: ELAPSED: 11.76s | DAEMON RSS: 3388.91 MB ------------------------------------------------------------------------ PROMPT: Define enigmatic in 'he left behind an enigmatic smile and no further explanation' -enigmatic (adjective) — Formal +enigmatic (adjective) - Formal DEFINITION: Mysterious and difficult to understand or interpret. GENERAL TONE: -The tone is formal, precise, and somewhat mysterious as if the smile was a puzzle waiting to be solved. - +The smile was a puzzle, its meaning unclear. SYNONYMS: -mysterious, puzzling, enigmatic, elusive +mystifying, puzzling, enigmatical EXAMPLES: -1. The riddle left behind was an enigmatic smile. -2. His words were so enigmatic that they left everyone puzzled. +1. The riddle left me feeling enigmatic. +2. His smile was so enigmatic it made everyone curious. -METRICS: ELAPSED: 18.15s | DAEMON RSS: 3169.46 MB +METRICS: ELAPSED: 11.82s | DAEMON RSS: 3388.91 MB ------------------------------------------------------------------------ PROMPT: Define bestial in 'You submitted to be the slave of bestial men' -bestial (adj) — Formality: Literary +bestial (adj) - Formal DEFINITION: -Of or relating to animals; brutish, uncivilized. +Of or relating to animals; brutish. GENERAL TONE: -The tone is archaic and formal, evoking a sense of medieval literature. +The term suggests a brutal and uncivilized state of being, often associated with violence and degradation. SYNONYMS: -Savage, brutish, uncivilized. +brutal, savage, uncivilized EXAMPLES: -1. The bestial behavior of the animals in the zoo was shocking. -2. He felt like a bestial creature after being beaten by his captors. +1. You submitted to be the slave of bestial men. +2. The treatment of animals by these bestial owners was inhumane. -METRICS: ELAPSED: 18.51s | DAEMON RSS: 3169.58 MB +METRICS: ELAPSED: 14.01s | DAEMON RSS: 3388.91 MB ------------------------------------------------------------------------ PROMPT: Define flung in 'As if plunged in a stormy water, I was flung about wildly, and felt myself sinking.' -flung (verb) — Formality: Literary +flung (verb) - Formal DEFINITION: -To throw or toss violently; to hurl. +To throw or hurl with force. GENERAL TONE: -The tone is vividly descriptive, evoking a tumultuous scene. +The verb conveys a sense of sudden and violent action, often used in dramatic contexts. SYNONYMS: -Threw, tossed, hurled, tossed about. +Threw, tossed, hurled EXAMPLES: -1. As if plunged in a stormy water, I was flung about wildly. -2. The ball was flung across the field by the outfielder. +1. As if plunged in a stormy water, I was flung about wildly, and felt myself sinking. +2. The ball was flung across the field by the pitcher. -METRICS: ELAPSED: 18.36s | DAEMON RSS: 3169.75 MB +METRICS: ELAPSED: 14.77s | DAEMON RSS: 3388.91 MB ------------------------------------------------------------------------ PROMPT: Define hewers in 'You might by this time have made the Bags hewers of wood and drawers of water' -<hewers (noun)> — Formal +hewers (noun) - Formal DEFINITION: -People who cut wood or perform manual labor. +In the context of colonial America, hewers referred to those who cut wood. GENERAL TONE: -The sentence suggests a rustic, possibly colonial setting where physical work is common and valued. +The phrase suggests a laborious and manual work environment typical in early American settlements. SYNONYMS: -Laborers, woodcutters, cutters of timber. +Cutters, Sawyers, Woodcutters EXAMPLES: -1. The team of hewers were tasked with clearing the forest. -2. In the old days, men would often be seen as hewers of wood and drawers of water. +1. The hewers of wood were the backbone of the community. +2. By the time you mentioned, they had already become hewers and drawers of water. -METRICS: ELAPSED: 19.62s | DAEMON RSS: 3169.91 MB +METRICS: ELAPSED: 15.79s | DAEMON RSS: 3388.91 MB |
